/* SSR shell adapters; presentation rules come from the original Vue components. */
.site-container > main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 0;
}
.site-container > main.workspace-main {
  padding: 2rem;
}
.catalog-results {
  flex: 1;
  min-width: 0;
  padding: 1rem;
}
.nav details {
  margin-top: 0;
}
.nav ul {
  list-style: none;
}
.login-link,
.account-logout {
  font: inherit;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: none;
  border: 0;
  cursor: pointer;
}
.account-logout {
  padding: 0.4rem 0.75rem;
}
.detail-nav {
  background: none;
  border: none;
}
.pagination:empty {
  display: none;
}
@media (max-width: 700px) {
  .site-container > main.workspace-main {
    padding: 1rem;
  }
}
.workspace-main .toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.workspace-main .panel {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}
.package-file {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.package-file code {
  overflow-wrap: anywhere;
  min-width: 0;
}
@media (max-width: 700px) {
  .workspace-main .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Workspace pages: login, upload, projects, review, device, account. */
.muted {
  color: var(--text-secondary);
  font-size: 0.875rem;
}
.empty {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}
.empty h1,
.empty h2 {
  color: var(--text-primary);
  font-size: 1.15rem;
}
.page {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}
.page--narrow {
  max-width: 560px;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-header h1 {
  font-size: 1.5rem;
}
.page-header p {
  margin-top: 0.35rem;
}
.page-header-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.actions--end {
  justify-content: flex-end;
}
.btn-sm {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
}
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 120, 120, 0.4);
  background: rgba(255, 90, 90, 0.12);
  color: #ffb4b4;
  cursor: pointer;
  white-space: nowrap;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(255, 90, 90, 0.2);
}
.link-button {
  font: inherit;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
}
.link-button:hover {
  color: var(--accent);
  text-decoration: underline;
}
button:disabled,
.btn-primary:disabled,
.btn-secondary:disabled {
  cursor: not-allowed;
}
.btn-primary.is-busy,
.btn-secondary.is-busy {
  cursor: progress;
}
.field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.field-error {
  font-size: 0.8rem;
  color: #ff9696;
}
.field-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}
input[aria-invalid='true'],
textarea[aria-invalid='true'] {
  border-color: rgba(255, 120, 120, 0.6);
}
input:disabled,
select:disabled {
  opacity: 0.6;
}
.notice {
  display: grid;
  gap: 0.35rem;
  background: var(--bg-surface);
}
.notice.error {
  border-color: rgba(255, 120, 120, 0.35);
  background: rgba(255, 90, 90, 0.06);
}
.notice.success {
  border-color: rgba(104, 211, 145, 0.35);
  background: var(--green-dim);
}
.notice.info {
  color: var(--text-secondary);
  border-color: rgba(246, 173, 85, 0.3);
  background: rgba(246, 173, 85, 0.06);
}
.notice-title {
  font-weight: 600;
  color: var(--text-primary);
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid currentColor;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge--draft {
  color: #9aa0b0;
}
.badge--processing {
  color: #63b3ed;
}
.badge--processing::before {
  animation: pulse 1.2s ease-in-out infinite;
}
.badge--pending {
  color: var(--orange);
}
.badge--published {
  color: var(--green);
}
.badge--rejected,
.badge--failed {
  color: #ff8a8a;
}
.badge--withdrawn {
  color: var(--text-muted);
}
@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

/* Account menu */
.account-menu > summary {
  gap: 0.5rem;
}
.avatar {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.avatar--lg {
  width: 3.25rem;
  height: 3.25rem;
  font-size: 1.3rem;
}
.lang-menu .menu-label {
  padding: 0.45rem 0.9rem 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.lang-menu .menu-divider {
  height: 1px;
  margin: 0.3rem 0;
  background: var(--border);
}
.account-logout {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}
.account-logout:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}
.mobile-panel .mobile-divider {
  height: 1px;
  margin: 0.2rem 0;
  background: var(--border);
}
.mobile-panel .mobile-label {
  padding: 0 0.9rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.mobile-panel button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2.75rem;
  padding: 0 0.9rem;
  font: inherit;
  color: var(--text-secondary);
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.mobile-panel button:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* Login */
.auth-card {
  display: grid;
  gap: 1.25rem;
  margin-top: 2rem;
  padding: 2rem !important;
}
.auth-card h1 {
  font-size: 1.5rem;
}
.auth-benefits {
  display: grid;
  gap: 0.5rem;
  list-style: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.auth-benefits li::before {
  content: '✓';
  margin-right: 0.6rem;
  color: var(--green);
}
.auth-card .btn-primary {
  justify-content: center;
  width: 100%;
  padding: 0.75rem 1.4rem;
}

/* Stepper */
.stepper {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  list-style: none;
  counter-reset: step;
}
.stepper li {
  flex: 1;
  counter-increment: step;
}
.stepper button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-top: 2px solid var(--border);
  text-align: left;
  cursor: default;
}
.stepper button::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-size: 0.75rem;
}
.stepper .is-done button {
  color: var(--text-secondary);
  border-top-color: rgba(232, 54, 45, 0.5);
  cursor: pointer;
}
.stepper .is-done button::before {
  content: '✓';
  color: var(--accent);
  border-color: rgba(232, 54, 45, 0.5);
}
.stepper .is-current button {
  color: var(--text-primary);
  font-weight: 600;
  border-top-color: var(--accent);
}
.stepper .is-current button::before {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.stepper button:disabled {
  opacity: 1;
}

/* Choice cards */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.choice-card {
  position: relative;
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.choice-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}
.choice-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.choice-card:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.6;
}
.choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice-card strong {
  color: var(--text-primary);
  font-size: 0.95rem;
}
.choice-card small {
  font-size: 0.8rem;
}
.segmented {
  display: inline-flex;
  padding: 0.2rem;
  gap: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}
.segmented button {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.9rem;
  color: var(--text-secondary);
  background: none;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.segmented button[aria-pressed='true'] {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}
.segmented button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

/* Dropzone */
.dropzone {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  padding: 2.5rem 1.5rem;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  text-align: center;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.dropzone.is-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.dropzone-icon {
  color: var(--text-muted);
}
.dropzone-title {
  font-weight: 600;
  color: var(--text-primary);
}
.dropzone input[type='file'] {
  display: none;
}
.source-summary {
  display: grid;
  gap: 0.9rem;
}
.checklist {
  display: grid;
  gap: 0.4rem;
  list-style: none;
  font-size: 0.875rem;
}
.checklist li {
  display: flex;
  gap: 0.6rem;
  color: var(--text-secondary);
}
.checklist li::before {
  content: '✓';
  color: var(--green);
  font-weight: 700;
}
.checklist li.is-bad {
  color: #ff9696;
}
.checklist li.is-bad::before {
  content: '✕';
  color: #ff8a8a;
}
.meter {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: inherit;
  transition: width 0.2s;
}
.meter.is-warn > span {
  background: var(--orange);
}
.meter.is-bad > span {
  background: #ff8a8a;
}
.file-list {
  max-height: 260px;
  overflow: auto;
  margin-top: 0.5rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}
.wizard-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.wizard-footer .spacer {
  flex: 1;
}

/* Upload progress */
.phases {
  display: grid;
  gap: 0.9rem;
  list-style: none;
}
.phases li {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: 0.25rem 0.75rem;
  align-items: center;
  color: var(--text-muted);
}
.phases li::before {
  content: '';
  width: 0.9rem;
  height: 0.9rem;
  margin: auto;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.phases li.is-active {
  color: var(--text-primary);
}
.phases li.is-active::before {
  border-color: var(--accent);
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}
.phases li.is-done {
  color: var(--text-secondary);
}
.phases li.is-done::before {
  content: '✓';
  border: 0;
  color: var(--green);
  font-weight: 700;
  width: auto;
  height: auto;
}
.phases .meter {
  grid-column: 2;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Project list */
.project-group {
  padding: 0 !important;
  overflow: hidden;
}
.project-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.project-head h2 {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}
.project-head .kind {
  margin-right: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}
.project-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.version-row {
  display: grid;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
}
.version-row + .version-row {
  border-top: 1px solid var(--border);
}
.version-row .actions {
  margin-top: 0.25rem;
}
.version-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.version-title strong {
  font-family: 'IBM Plex Mono', monospace;
}
.reason-card {
  padding: 0.6rem 0.8rem;
  border-left: 3px solid #ff8a8a;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(255, 90, 90, 0.06);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.reason-card strong {
  display: block;
  margin-bottom: 0.15rem;
  color: #ffb4b4;
  font-size: 0.8rem;
}
.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
  max-width: 720px;
  margin: 0.5rem 0;
  text-align: left;
}
.guide-grid ul {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.tabs button {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  margin-bottom: -1px;
  color: var(--text-secondary);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tabs button[aria-selected='true'] {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tabs .count {
  margin-left: 0.4rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
}

/* Review */
.review-card {
  display: grid;
  gap: 0.9rem;
}
.review-card details {
  margin-top: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}
.review-card details[open] summary {
  margin-bottom: 0.75rem;
}
.review-card table td,
.review-card table th {
  padding: 0.5rem 0.6rem;
}
.diff-add {
  color: var(--green);
}
.diff-mod {
  color: var(--orange);
}
.diff-del {
  color: #ff8a8a;
}
.diff-del .link-button {
  text-decoration: line-through;
  color: var(--text-muted);
  cursor: default;
}
.diff-same {
  color: var(--text-muted);
}
.toggle {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}
.toggle input {
  width: auto;
}

/* Modal */
.modal {
  width: min(560px, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
  margin: auto;
  padding: 0;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.modal--wide {
  width: min(960px, calc(100vw - 2rem));
}
.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}
.modal-body {
  display: grid;
  gap: 0.75rem;
  padding: 1.5rem;
}
.modal-title {
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.modal pre {
  max-height: 65vh;
  overflow: auto;
  padding: 1rem;
  font-size: 0.8rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}

/* Toast */
.toast-host {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1000;
  display: grid;
  gap: 0.5rem;
  max-width: min(380px, calc(100vw - 2.5rem));
}
.toast {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.2s ease-out;
  transition:
    opacity 0.25s,
    transform 0.25s;
}
.toast--error {
  border-left-color: #ff8a8a;
}
.toast--leaving {
  opacity: 0;
  transform: translateY(6px);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* Device & account */
.code-input {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.4rem;
  letter-spacing: 0.25em;
  text-align: center;
  text-transform: uppercase;
}
.device-card {
  display: grid;
  gap: 0.75rem;
}
.device-label {
  font-size: 1.1rem;
  font-weight: 600;
}
.perm-list {
  display: grid;
  gap: 0.35rem;
  padding-left: 1.1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.result-state {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
  text-align: center;
}
.result-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--green-dim);
  color: var(--green);
}
.result-icon--bad {
  background: rgba(255, 90, 90, 0.12);
  color: #ff8a8a;
}
.profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.token-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0;
}
.token-row + .token-row {
  border-top: 1px solid var(--border);
}
.cmd {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.4rem 0.7rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
}
.owner-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.empty-state .actions {
  justify-content: center;
}
.empty-state {
  flex-direction: column;
  gap: 0.5rem;
}

@media (max-width: 700px) {
  .page-header {
    flex-direction: column;
  }
  .choice-grid,
  .guide-grid {
    grid-template-columns: 1fr;
  }
  .stepper span {
    display: none;
  }
  .stepper .is-current span {
    display: inline;
  }
  .project-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .token-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
