:root {
  --bg: #f5f7fa;
  --bg-soft: #eef2f6;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-line: rgba(15, 23, 42, 0.08);
  --surface-line-strong: rgba(15, 23, 42, 0.14);
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-faint: #64748b;
  --accent: #0f172a;
  --accent-soft: #e2e8f0;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.04);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-sans: "Avenir Next", "Segoe UI Variable", "Helvetica Neue", "Noto Sans", sans-serif;
  --font-display: "Avenir Next", "Segoe UI Variable", "Helvetica Neue", "Noto Sans", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-sans);
  background:
    radial-gradient(1200px 420px at 0% 0%, rgba(148, 163, 184, 0.08) 0%, transparent 58%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

body.login-body,
body.blocked-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

body.blocked-body {
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
}

img {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

/* ── App layout: sidebar + main ─────────────────────────────── */
:root {
  --sidebar-w: 240px;
  --sidebar-bg: #0f172a;
  --sidebar-ink: rgba(255,255,255,0.85);
  --sidebar-ink-soft: rgba(255,255,255,0.45);
  --sidebar-active-bg: rgba(255,255,255,0.10);
  --sidebar-hover-bg: rgba(255,255,255,0.06);
  --sidebar-border: rgba(255,255,255,0.08);
}

body.has-sidebar {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: width 0.22s ease;
}

body.sidebar-collapsed .sidebar {
  width: 56px;
  min-width: 56px;
}

body.sidebar-collapsed .sidebar__label,
body.sidebar-collapsed .sidebar__project-name,
body.sidebar-collapsed .sidebar__section-label,
body.sidebar-collapsed .sidebar__brand-name,
body.sidebar-collapsed .sidebar__badge,
body.sidebar-collapsed .sidebar__jobs,
body.sidebar-collapsed .sidebar__project-link {
  display: none;
}

body.sidebar-collapsed .sidebar__chevron-btn {
  width: 100%;
  justify-content: center;
  padding: 8px;
}

.main-wrap {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  transition: margin-left 0.22s ease;
}

body.sidebar-collapsed .main-wrap {
  margin-left: 56px;
}

.shell {
  width: min(1100px, calc(100% - 32px));
  margin: 24px auto 40px;
}

/* ── Sidebar: logo ──────────────────────────────────────────── */
.sidebar__logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
  overflow: hidden;
}

.sidebar__brand-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1;
}

.sidebar__brand-name {
  white-space: nowrap;
}

.sidebar__collapse-btn {
  background: transparent;
  border: none;
  color: var(--sidebar-ink-soft);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.sidebar__collapse-btn:hover {
  color: var(--sidebar-ink);
  background: var(--sidebar-hover-bg);
}

/* ── Sidebar: nav ───────────────────────────────────────────── */
.sidebar__nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 8px 0 16px;
  gap: 0;
}

.sidebar__section {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 8px;
}

.sidebar__section--bottom {
  margin-top: auto;
  border-top: 1px solid var(--sidebar-border);
  padding-top: 12px;
}

.sidebar__section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sidebar-ink-soft);
  padding: 4px 8px 2px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--sidebar-ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  overflow: hidden;
}

.sidebar__link:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

.sidebar__link--active {
  background: var(--sidebar-active-bg);
  color: #fff;
}

.sidebar__link--danger {
  color: rgba(248,113,113,0.8);
}

.sidebar__link--danger:hover {
  background: rgba(248,113,113,0.12);
  color: #f87171;
}

.sidebar__icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.sidebar__label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sidebar: project accordion ─────────────────────────────── */
.sidebar__project {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
}

.sidebar__project--archived {
  opacity: 0.55;
}

.sidebar__project-toggle {
  display: none; /* hidden, we use the link directly */
}

.sidebar__project-row {
  display: flex;
  align-items: center;
  border-radius: 8px;
  overflow: hidden;
}

.sidebar__project-row:hover {
  background: var(--sidebar-hover-bg);
}

.sidebar__project--active > .sidebar__project-row {
  background: var(--sidebar-active-bg);
}

.sidebar__chevron-btn {
  background: transparent;
  border: none;
  color: var(--sidebar-ink-soft);
  cursor: pointer;
  padding: 8px 4px 8px 8px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.12s;
}

.sidebar__chevron-btn:hover {
  color: var(--sidebar-ink);
}

.sidebar__chevron {
  transition: transform 0.18s ease;
}

.sidebar__project--open > .sidebar__project-row .sidebar__chevron {
  transform: rotate(90deg);
}

.sidebar__project-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 2px;
  flex: 1;
  min-width: 0;
  color: var(--sidebar-ink);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: color 0.15s;
}

.sidebar__project-link:hover,
.sidebar__project--active > .sidebar__project-row .sidebar__project-link {
  color: #fff;
}

.sidebar__project-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar__badge--active {
  background: rgba(59,130,246,0.35);
  color: #93c5fd;
}

/* ── Sidebar: jobs list ─────────────────────────────────────── */
.sidebar__jobs {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0 4px 18px;
}

.sidebar__project--open > .sidebar__jobs {
  display: flex;
}

.sidebar__job {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--sidebar-ink-soft);
  text-decoration: none;
  font-size: 12.5px;
  overflow: hidden;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.sidebar__job:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-ink);
}

.sidebar__job-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.sidebar__job--queued .sidebar__job-dot,
.sidebar__job--running .sidebar__job-dot { background: #3b82f6; }
.sidebar__job--stopping .sidebar__job-dot { background: #f59e0b; }
.sidebar__job--done .sidebar__job-dot { background: #22c55e; }
.sidebar__job--failed .sidebar__job-dot,
.sidebar__job--stopped .sidebar__job-dot { background: #ef4444; }

.sidebar__job-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__job-id {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.6;
}

.sidebar__job-empty {
  font-size: 12px;
  color: var(--sidebar-ink-soft);
  padding: 4px 8px;
}

/* ── Page header (replaces topbar on sidebar pages) ──────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--surface-line);
}

.page-header__title-block {
  flex: 1;
  min-width: 0;
}

.page-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.page-kicker {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

/* ── Sidebar chevron used in toggle button ──────────────────── */
.sidebar__chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  :root { --sidebar-w: 200px; }
}

@media (max-width: 640px) {
  .sidebar {
    width: 56px;
    min-width: 56px;
  }
  .sidebar__label, .sidebar__project-name, .sidebar__section-label,
  .sidebar__brand-name, .sidebar__badge, .sidebar__jobs { display: none; }
  .main-wrap { margin-left: 56px; }
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.topbar--compact {
  margin-bottom: 16px;
}

.brandblock {
  display: grid;
  gap: 8px;
}

.brand-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 4.2vw, 42px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.page-subtitle {
  margin: 0;
  max-width: 760px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.navline,
.button-row,
.inline-actions,
.filter-row,
.metric-row,
.toolbar-meta,
.history-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.navline {
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible,
.file-input:focus-visible,
.modal-close:focus-visible,
.toggle:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.18);
  outline-offset: 2px;
}

.button--primary {
  background: var(--ink);
  color: #fff;
}

.button--secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--surface-line-strong);
}

.button--ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--surface-line);
}

.button--warn {
  background: #fff7ed;
  color: var(--warn);
  border-color: rgba(180, 83, 9, 0.16);
}

.button--danger {
  background: #fef2f2;
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.16);
}

.button--success {
  background: #f0fdf4;
  color: var(--ok);
  border-color: rgba(21, 128, 61, 0.16);
}

.button--block {
  width: 100%;
}

.button--small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid;
  font-size: 14px;
}

.flash--success {
  color: #166534;
  background: #f0fdf4;
  border-color: rgba(22, 101, 52, 0.12);
}

.flash--error {
  color: #991b1b;
  background: #fef2f2;
  border-color: rgba(153, 27, 27, 0.12);
}

.hero,
.card,
.panel,
.metric,
.project-card,
.login-card,
.blocked-card,
.viewer-card,
.info-card,
.empty-state,
.modal-card,
.table-shell,
.surface,
.upload-zone {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.hero,
.card,
.panel,
.viewer-card,
.info-card,
.table-shell,
.surface,
.upload-zone {
  padding: 20px;
}

.metric,
.project-card {
  padding: 18px;
}

.hero {
  padding: 22px;
}

.hero-grid,
.panel-grid,
.stats-grid,
.dual-grid,
.form-grid,
.option-grid,
.meta-grid,
.scan-grid,
.viewer-summary,
.viewer-controls,
.viewer-toolbar,
.login-fields,
.project-list,
.viewer-layout,
.viewer-results {
  display: grid;
  gap: 16px;
}

.panel-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.95fr);
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dual-grid,
.form-grid,
.option-grid,
.meta-grid,
.viewer-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.scan-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.scan-card--full {
  grid-column: 1 / -1;
}

.field,
.stack,
.form-fields,
.section-stack {
  display: grid;
  gap: 8px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.section-lead,
.helper,
.field-note,
.helper-list {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.helper-list {
  margin: 0;
  padding-left: 18px;
}

.field-label,
.metric__eyebrow,
.kv__key {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric__value {
  margin: 6px 0 0;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.metric__caption {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.metric--accent {
  background: var(--ink);
  color: #fff;
  border-color: rgba(15, 23, 42, 0.08);
}

.metric--accent .metric__eyebrow,
.metric--accent .metric__caption {
  color: rgba(255, 255, 255, 0.72);
}

.metric--soft {
  background: var(--surface);
}

.badge,
.status,
.tag,
.note-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge.soft,
.tag {
  color: var(--ink-soft);
  background: var(--surface-muted);
  border-color: var(--surface-line);
}

.badge.ok,
.status.done {
  background: #f0fdf4;
  color: #166534;
  border-color: rgba(22, 101, 52, 0.1);
}

.badge.warn,
.status.stopping {
  background: #fff7ed;
  color: #9a3412;
  border-color: rgba(154, 52, 18, 0.1);
}

.badge.danger,
.status.failed,
.status.stopped {
  background: #fef2f2;
  color: #991b1b;
  border-color: rgba(153, 27, 27, 0.1);
}

.status.running,
.status.queued {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: rgba(29, 78, 216, 0.1);
}

.input,
.select,
.textarea,
.file-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--surface-line-strong);
  background: #fff;
  color: var(--ink);
}

.textarea {
  min-height: 140px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus,
.file-input:focus {
  outline: none;
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.14);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
}

.toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--ink);
}

.inline-checks,
.preset-row,
.viewer-chipbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.scan-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--surface-line);
  background: var(--surface-muted);
}

.table-shell {
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.table-scroll,
.viewer-table-wrap {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--surface-line);
}

.table,
.viewer-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.table--compact {
  table-layout: auto;
}

.table th,
.table td,
.viewer-table th,
.viewer-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--surface-line);
  text-align: left;
  vertical-align: middle;
}

.table th,
.viewer-table th {
  background: #f8fafc;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table tr:last-child td,
.viewer-table tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover,
.viewer-row:hover {
  background: #f8fafc;
}

.table tbody tr.is-hidden {
  display: none;
}

.job-row {
  cursor: pointer;
}

.job-row td:nth-child(1) {
  width: 38%;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-row td:nth-child(2) {
  width: 18%;
}

.job-row td:nth-child(3) {
  width: 24%;
  color: var(--ink-soft);
  white-space: nowrap;
}

.job-row td:nth-child(4) {
  width: 20%;
}

.inline-actions {
  justify-content: flex-end;
}

.inline-actions form,
.navline form {
  margin: 0;
}

.job-link,
.project-link,
.file-link {
  color: var(--ink);
  text-decoration: none;
}

.job-link:hover,
.project-link:hover,
.file-link:hover {
  color: var(--ink-soft);
}

.kv {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--surface-line);
  background: var(--surface-muted);
}

.kv__value {
  word-break: break-word;
  line-height: 1.55;
}

.command {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.command code,
.code,
.mono,
.logbox {
  font-family: var(--font-mono);
}

.command code,
.code {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--surface-muted);
  border: 1px solid var(--surface-line);
  font-size: 12px;
}

.logbox {
  min-height: 200px;
  max-height: 560px;
  overflow: auto;
  padding: 18px;
  border-radius: 16px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.55;
}

.logbox .ansi-bold { font-weight: 700; }
.logbox .ansi-c30 { color: #94a3b8; }
.logbox .ansi-c31 { color: #fca5a5; }
.logbox .ansi-c32 { color: #86efac; }
.logbox .ansi-c33 { color: #fde68a; }
.logbox .ansi-c34 { color: #93c5fd; }
.logbox .ansi-c35 { color: #f0abfc; }
.logbox .ansi-c36 { color: #67e8f9; }
.logbox .ansi-c37 { color: #f8fafc; }
.logbox .ansi-c90 { color: #cbd5e1; }
.logbox .ansi-c91 { color: #fecaca; }
.logbox .ansi-c92 { color: #bbf7d0; }
.logbox .ansi-c93 { color: #fef3c7; }
.logbox .ansi-c94 { color: #bfdbfe; }
.logbox .ansi-c95 { color: #f5d0fe; }
.logbox .ansi-c96 { color: #a5f3fc; }
.logbox .ansi-c97 { color: #ffffff; }

.empty-state {
  display: grid;
  gap: 10px;
  padding: 24px;
}

.empty-state__title {
  margin: 0;
  font-size: 20px;
}

.empty-state__text {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.login-card,
.blocked-card,
.modal-card {
  width: min(520px, 100%);
  padding: 24px;
}

.blocked-card {
  width: min(960px, 100%);
  text-align: center;
}

.blocked-copy {
  margin-top: 18px;
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.28);
  z-index: 100;
}

.modal.is-open {
  display: flex;
}

.modal-card {
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--surface-line);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}

.modal-grid,
.viewer-kv {
  display: grid;
  gap: 10px;
}

.project-list {
  grid-template-columns: 1fr;
}

.project-card__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.project-card--compact {
  padding: 14px;
}

.project-card--clickable {
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.project-card--clickable:hover {
  background: #f8fafc;
  border-color: var(--surface-line-strong);
  transform: translateY(-1px);
}

.project-card__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.project-card__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.project-card__sub {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.session-table .mono,
.mono {
  font-size: 12px;
  word-break: break-all;
}

.center-note {
  text-align: center;
}

@media (max-width: 1100px) {
  .panel-grid,
  .stats-grid,
  .dual-grid,
  .form-grid,
  .option-grid,
  .meta-grid,
  .scan-grid,
  .viewer-summary,
  .viewer-controls,
  .viewer-toolbar {
    grid-template-columns: 1fr;
  }

  .job-row td:nth-child(1),
  .job-row td:nth-child(2),
  .job-row td:nth-child(3),
  .job-row td:nth-child(4) {
    width: auto;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100%, calc(100% - 20px));
    margin-top: 16px;
  }

  .topbar,
  .section-head,
  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .navline,
  .inline-actions,
  .button-row {
    justify-content: stretch;
  }

  .button,
  .navline form,
  .inline-actions form {
    width: 100%;
  }

  .navline form .button,
  .inline-actions form .button {
    width: 100%;
  }

  .hero,
  .card,
  .panel,
  .table-shell,
  .surface,
  .upload-zone,
  .metric,
  .project-card,
  .login-card,
  .blocked-card,
  .modal-card {
    padding: 16px;
    border-radius: 16px;
  }

  .table-scroll {
    overflow: auto;
  }

  .table,
  .viewer-table {
    font-size: 13px;
  }

  .page-title {
    font-size: clamp(26px, 9vw, 34px);
  }
}

/* ── Scan Project Cards ─────────────────────────────────────── */
.scan-project-card {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  cursor: pointer;
  transition: box-shadow 0.18s, border-color 0.18s, opacity 0.18s;
  box-shadow: var(--shadow-soft);
}

.scan-project-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--surface-line-strong);
}

.scan-project-card--archived {
  opacity: 0.65;
}

.scan-project-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.scan-project-card__info {
  flex: 1;
  min-width: 0;
}

.scan-project-card__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.scan-project-card__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.scan-project-card__desc {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scan-project-card__stats {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 12px 0 10px;
  border-top: 1px solid var(--surface-line);
  border-bottom: 1px solid var(--surface-line);
}

.scan-project-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.scan-project-stat--wide {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.scan-project-stat__val {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

.scan-project-stat__val--done {
  color: var(--ok);
}

.scan-project-stat__val--active {
  color: #1d4ed8;
}

.scan-project-stat__val--failed {
  color: var(--danger);
}

.scan-project-stat__val--date {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.scan-project-stat__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.scan-project-card__footer {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-faint);
}

.badge--active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: rgba(29, 78, 216, 0.15);
}

/* ── Breadcrumb link ────────────────────────────────────────── */
.breadcrumb-link {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ── Job ID + name in table ─────────────────────────────────── */
.job-id-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.job-id-mono {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
}

.job-name-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
