/* ── BA-ATC Design Tokens ──────────────────────────────────────────────
   Mirrors docs/prototype/ba-atc-demo/styles.css tokens exactly.
   If you change this file, also update docs/prototype/ba-atc-demo/styles.css.
   Design spec source: docs/design/design.md
*/

:root {
  /* Brand */
  --brand-blue: #005bb5;
  --brand-blue-light: rgba(0, 91, 181, 0.08);
  --brand-blue-border: rgba(0, 91, 181, 0.22);
  --accent-hover: #0077ed;
  --brand-green: #047857;
  --brand-green-light: #a7f3c5;
  --brand-green-bg: rgba(4, 120, 87, 0.08);

  /* Text */
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --text-inverse: #ffffff;

  /* Backgrounds & Surfaces */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-tertiary: #fbfbfd;
  --bg-surface: linear-gradient(180deg, #e9f0f5 0%, #f6f8fb 34%, #eef3f0 100%);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-bg-thin: rgba(255, 255, 255, 0.35);
  --surface-nav: rgb(255 255 255 / 58%);
  --surface-raised: rgb(255 255 255 / 88%);
  --surface-overlay: rgb(255 255 255 / 94%);

  /* Borders & Separators */
  --glass-border: rgba(15, 23, 42, 0.08);

  /* Interactive */
  --bg-hover: rgba(0, 91, 181, 0.04);
  --bg-active: rgba(0, 91, 181, 0.08);
  --glass-blur: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  --shadow-brand: 0 3px 10px rgba(0, 91, 181, 0.18);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Spacing (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Typography — clamp() responsive */
  --font-size-xs: clamp(11px, 0.6875rem, 12px);
  --font-size-sm: clamp(13px, 0.8125rem, 14px);
  --font-size-base: clamp(15px, 0.9375rem, 17px);
  --font-size-lg: clamp(17px, 1.0625rem, 19px);
  --font-size-xl: clamp(20px, 1.25rem, 22px);
  --font-size-2xl: clamp(24px, 1.5rem, 28px);
  --font-size-3xl: clamp(28px, 1.75rem, 32px);
  --font-size-4xl: clamp(32px, 2rem, 40px);
  --font-size-5xl: clamp(40px, 2.5rem, 48px);
  --font-sans: "Source Han Sans SC", "Noto Sans SC", "Noto Sans CJK SC", "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, "DejaVu Sans", sans-serif;

  /* Layout */
  --container-desktop: 1200px;
  --touch-target-min: 44px;
}

/* ── Reset & Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.625;
  letter-spacing: -0.011em;
  background: var(--bg-surface);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--brand-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

/* ── Layout ─────────────────────────────────────────────────────────── */

.content-shell {
  width: min(calc(100% - 64px), var(--container-desktop));
  margin: 0 auto;
}

/* ── App Bar (sticky nav) ───────────────────────────────────────────── */

.app-bar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 64px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--surface-nav);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.app-bar .brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--brand-blue);
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand-product {
  padding-left: var(--space-3);
  border-left: 1px solid var(--glass-border);
  color: var(--brand-blue);
  font-size: var(--font-size-lg);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.brand-subtitle {
  padding-left: var(--space-3);
  margin-left: var(--space-1);
  border-left: 1px solid var(--glass-border);
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  font-weight: 400;
  white-space: nowrap;
}

.app-bar .nav-links {
  display: flex;
  gap: var(--space-2);
}

.app-bar .nav-link {
  padding: 9px var(--space-4);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: color 160ms ease, background 160ms ease;
}
.app-bar .nav-link:hover {
  color: var(--brand-blue);
  background: var(--brand-blue-light);
  text-decoration: none;
}

/* ── Glass Card ─────────────────────────────────────────────────────── */

.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.glass-card.card-flat {
  background: var(--bg-primary);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ── Buttons ────────────────────────────────────────────────────────── */

.btn {
  min-height: var(--touch-target-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px var(--space-5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 72%);
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled {
  color: var(--text-tertiary);
  background: rgba(233, 236, 239, 0.72);
  border-color: var(--glass-border);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary {
  color: var(--text-inverse);
  border-color: var(--brand-blue);
  background: var(--brand-blue);
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  color: var(--brand-blue);
  border-color: var(--brand-blue-border);
  background: rgb(255 255 255 / 68%);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-ghost {
  color: var(--text-secondary);
  background: transparent;
  border-color: transparent;
  backdrop-filter: none;
}
.btn-ghost:hover { color: var(--brand-blue); background: var(--brand-blue-light); }

.btn-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target-min);
  padding: 0;
  border: none;
  background: transparent;
  color: var(--brand-blue);
  font-weight: 600;
  text-underline-offset: 4px;
  cursor: pointer;
  backdrop-filter: none;
}

.btn-sm {
  min-height: 36px;
  padding: 6px var(--space-4);
}

.btn-large {
  min-height: 50px;
  padding-inline: var(--space-6);
}

/* ── Forms & Inputs ─────────────────────────────────────────────────── */

.form-group {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.form-group label {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.input-field {
  width: 100%;
  min-height: 48px;
  padding: 12px var(--space-4);
  color: var(--text-primary);
  background: rgb(255 255 255 / 60%);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  outline: none;
  backdrop-filter: blur(10px);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.input-field:focus {
  background: var(--bg-primary);
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px var(--brand-blue-light);
}
.input-field:disabled {
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  border-color: var(--glass-border);
  cursor: not-allowed;
}

textarea.input-field { resize: vertical; min-height: 100px; }

select.input-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236e6e73' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* ── Status Badges ──────────────────────────────────────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px var(--space-3);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.status-blue  { color: var(--brand-blue);  background: var(--brand-blue-light); }
.status-green { color: var(--brand-green); background: var(--brand-green-bg); }
.status-gray  { color: var(--text-tertiary); background: rgba(15, 23, 42, 0.06); }

/* Per-row result codes (ok / dropped / over-corrected) */
.code-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.code-ok {
  color: var(--brand-green);
  background: rgba(16, 185, 129, 0.10);
}
.code-dropped {
  color: #991b1b;
  background: rgba(153, 27, 27, 0.08);
}
.code-overcorrected {
  color: #92400e;
  background: rgba(146, 64, 14, 0.08);
}

/* ── Upload progress bar ──────────────────────────────────────────── */
.upload-progress {
  margin-top: var(--space-4);
}
.upload-progress-track {
  height: 8px;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--brand-blue);
  border-radius: var(--radius-full);
  transition: width 120ms linear;
}
.upload-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  margin-top: var(--space-2);
  font-size: var(--font-size-sm);
}
.upload-progress-meta strong {
  color: var(--brand-blue);
  font-weight: 600;
}
.upload-progress-meta span {
  color: var(--text-secondary);
}

/* ── Tables ─────────────────────────────────────────────────────────── */

.table-card {
  overflow: hidden;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

table.data-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--glass-border);
}

table.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--glass-border);
}

table.data-table tr:hover td {
  background: var(--bg-hover);
}

/* ── Messages / Alerts ──────────────────────────────────────────────── */

.message {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: var(--font-size-sm);
}

.message-success { color: #166534; background: #dcfce7; border: 1px solid #bbf7d0; }
.message-error   { color: #991b1b; background: #fee2e2; border: 1px solid #fecaca; }
.message-warning { color: #92400e; background: #fef3c7; border: 1px solid #fde68a; }
.message-info    { color: var(--brand-blue); background: var(--brand-blue-light); border: 1px solid rgba(0, 91, 181, 0.14); }

/* ── Height Grid (for select_heights) ───────────────────────────────── */

.height-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--space-3);
  margin: var(--space-4) 0;
}

.height-option {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.56);
  cursor: pointer;
  font-weight: 600;
  transition: border 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.height-option:hover {
  border-color: var(--brand-blue-border);
  background: var(--bg-hover);
}
.height-option.selected {
  color: var(--brand-blue);
  background: var(--brand-blue-light);
  border-color: rgba(0, 91, 181, 0.32);
  box-shadow: 0 0 0 2px rgba(0, 91, 181, 0.06);
}
.height-option:disabled {
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  cursor: not-allowed;
}
.height-option input { display: none; }

/* ── File Upload Zone ───────────────────────────────────────────────── */

.upload-zone {
  display: grid;
  justify-items: center;
  padding: var(--space-12) var(--space-8);
  text-align: center;
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}
.upload-zone:hover {
  background: var(--brand-blue-light);
  border-color: var(--brand-blue-border);
}

.upload-zone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ── Progress ───────────────────────────────────────────────────────── */

.progress-track {
  height: 8px;
  margin: var(--space-4) 0;
  overflow: hidden;
  background: var(--brand-blue-light);
  border-radius: var(--radius-full);
}
.progress-track span {
  display: block;
  height: 100%;
  background: var(--brand-blue);
  border-radius: inherit;
  transition: width 650ms ease;
}

/* ── Charts ─────────────────────────────────────────────────────────── */

.chart-card {
  margin-top: var(--space-5);
  padding: var(--space-8);
}

.chart-container {
  position: relative;
  min-height: 330px;
  margin-top: var(--space-5);
}

/* ── Result Delivery Page ───────────────────────────────────────────── */

.result-page {
  padding: var(--space-8) 0 96px;
}

.result-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}

.result-status-line {
  margin-bottom: var(--space-2);
}

.result-title {
  margin: 0;
  font-size: var(--font-size-4xl);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.result-task-number {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.result-task-number code {
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

.result-meta {
  display: grid;
  grid-template-columns: 0.8fr 1.4fr 1fr 1fr;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-md);
}

.result-meta > div,
.metric-card {
  display: grid;
  align-content: start;
  gap: var(--space-1);
}

.result-meta span,
.metric-card span {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.result-meta strong {
  line-height: 1.5;
}

.metric-grid {
  display: grid;
  gap: var(--space-4);
  margin: var(--space-5) 0;
}

.result-metric-grid {
  grid-template-columns: repeat(4, 1fr);
}

/* round-4 web sync: donut share charts (inclusion + dropped reasons) */
.pie-section {
  padding: var(--space-8);
}
.pie-section .pie-row {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-2);
}
.pie-card {
  flex: 1;
  height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}
.pie-card canvas {
  width: 290px;
  height: 290px;
}
.exception-pct {
  color: var(--text-tertiary);
  font-size: 0.9em;
  font-weight: 500;
  margin-left: 2px;
}

.metric-card {
  min-height: 112px;
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-md);
}

.metric-card strong {
  font-size: var(--font-size-2xl);
  line-height: 1.25;
}

.metric-card small {
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
}

.metric-card .metric-note {
  margin-top: var(--space-1);
  line-height: 1.5;
}

.metric-card-primary {
  background: var(--surface-raised);
  border-color: var(--brand-blue-border);
  box-shadow: 0 0 0 2px var(--brand-blue-light), var(--shadow-sm);
}

.metric-card-primary strong {
  color: var(--brand-blue);
}

.result-chart-card {
  margin-top: 0;
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
}

.chart-header h2,
.result-section-heading h2,
.exception-card h2,
.traceability-card h2 {
  margin: 0;
  font-size: var(--font-size-xl);
  line-height: 1.375;
}

.chart-legend {
  display: flex;
  gap: var(--space-5);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.chart-legend b {
  font-weight: 500;
}

.chart-legend i {
  width: 20px;
  height: 0;
}

.legend-before { border-top: 2px solid #9ca3af; }
.legend-after { border-top: 2.5px solid var(--brand-blue); }

.chart-container-compact {
  height: 330px; /* fixed height: Chart.js responsive needs a definite container size */
  min-height: 330px; /* override .chart-container min-height:330px */
}

.chart-subtitle {
  margin: var(--space-6) 0 var(--space-3);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
}


.height-tabs {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

.height-tab {
  min-height: 40px;
  padding: 6px var(--space-4);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.height-tab:hover {
  color: var(--brand-blue);
  background: var(--bg-hover);
}

.height-tab[aria-selected="true"] {
  color: var(--brand-blue);
  background: var(--brand-blue-light);
  border-color: var(--brand-blue-border);
  font-weight: 600;
}

.chart-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  pointer-events: none;
}

.chart-state[hidden] { display: none; }

.result-height-summary {
  margin-top: var(--space-5);
  padding: var(--space-6) var(--space-8);
  border-radius: var(--radius-md);
}

.result-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-8);
  margin-bottom: var(--space-5);
}

.result-section-heading > p {
  max-width: 460px;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  text-align: right;
}

.table-scroll { overflow-x: auto; }

.result-stats-table th:first-child,
.result-stats-table td:first-child {
  padding-left: 0;
}

.result-stats-table th:last-child,
.result-stats-table td:last-child {
  padding-right: 0;
}

.result-stats-table tbody tr:last-child td {
  border-bottom: 0;
}

.result-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  margin-top: var(--space-5);
}

.exception-card,
.traceability-card {
  padding: var(--space-6) var(--space-8);
  border-radius: var(--radius-md);
}

.exception-list,
.traceability-list {
  display: grid;
  gap: 0;
  margin-top: var(--space-5);
  padding: 0;
  list-style: none;
}

.exception-list li,
.traceability-list > div {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--glass-border);
}

.exception-list li:last-child,
.traceability-list > div:last-child {
  border-bottom: 0;
}

.exception-list span,
.traceability-list dt {
  color: var(--text-secondary);
}

.exception-list .code-badge {
  flex: none;
}

.exception-list .exception-label {
  flex: 1;
}

.exception-list strong {
  min-width: 40px;
  text-align: right;
}

.traceability-list dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.result-empty-note {
  margin-top: var(--space-5);
  color: var(--text-secondary);
}

.result-safety-note {
  margin-top: var(--space-5);
  margin-bottom: 0;
}

.result-boundary {
  margin-top: var(--space-5);
  padding: var(--space-6);
  border-radius: var(--radius-md);
}

.result-boundary h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-lg);
}

.result-boundary p {
  font-size: var(--font-size-sm);
}

.result-footer {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  margin-top: var(--space-5);
}

.result-footer p {
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  text-align: right;
}

/* ── Footer ─────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.32);
}

.footer-shell {
  width: min(calc(100% - 64px), var(--container-desktop));
  margin: 0 auto;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
}

.footer-version {
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  letter-spacing: 0.01em;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  line-height: 1.45;
}

.footer-brand .brand-name {
  color: var(--brand-blue);
  font-weight: 700;
  font-size: var(--font-size-base);
  letter-spacing: -0.025em;
}

.footer-brand .brand-tagline {
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  white-space: nowrap;
}

.footer-shell nav {
  display: flex;
  gap: var(--space-6);
}

.footer-shell a {
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  text-decoration: none;
}

.footer-shell a:hover {
  color: var(--brand-blue);
}

/* ── Utility ────────────────────────────────────────────────────────── */

.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.p-8   { padding: var(--space-8); }
.text-center  { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }

/* ── Continuous Task Workflow ──────────────────────────────────────── */

.workflow-page {
  min-height: calc(100vh - 64px);
  padding: var(--space-8) 0 96px;
}

.workflow-topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}

.workflow-topbar-end { justify-content: flex-end; }
.result-workflow-topbar { margin-bottom: var(--space-6); }

.back-link {
  min-height: var(--touch-target-min);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.back-link:hover { color: var(--brand-blue); text-decoration: none; }

.workflow-progress { min-width: 650px; }
.workflow-progress ol {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto 1fr auto;
  align-items: start;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-progress li:not(.workflow-connector) {
  min-width: 86px;
  display: grid;
  justify-items: center;
  gap: var(--space-1);
  color: var(--text-tertiary);
}

.workflow-marker {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: rgb(255 255 255 / 55%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.workflow-step-label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  white-space: nowrap;
}

.workflow-progress li.is-current { color: var(--brand-blue); }
.workflow-progress li.is-current .workflow-marker {
  color: var(--text-inverse);
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  box-shadow: var(--shadow-brand);
}

.workflow-progress li.is-current .workflow-step-label { font-weight: 700; }
.workflow-progress li.is-done { color: var(--brand-green); }
.workflow-progress li.is-done .workflow-marker {
  background: var(--brand-green-bg);
  border-color: var(--brand-green-bg);
}

.workflow-connector {
  height: 1px;
  align-self: start;
  margin-top: 15px;
  background: var(--glass-border);
}

.workflow-connector.is-done { background: var(--brand-green-light); }

.workflow-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: var(--space-8);
}

.workflow-title {
  margin: var(--space-2) 0 var(--space-3);
  font-size: var(--font-size-4xl);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.workflow-lead {
  max-width: 720px;
  margin: 0 0 var(--space-8);
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
}

.stack-form { display: grid; gap: var(--space-6); }
.field-section { margin: 0; padding: 0; border: 0; }
.field-section legend,
.field-group > span {
  margin-bottom: var(--space-3);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.field-group { display: grid; }
.textarea-field { resize: vertical; min-height: 100px; }
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.select-card {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.select-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.select-card input { position: absolute; opacity: 0; pointer-events: none; }
.select-card span { display: grid; gap: var(--space-1); }
.select-card strong { font-size: var(--font-size-lg); }
.select-card small { color: var(--text-secondary); font-size: var(--font-size-sm); }
.select-card i {
  width: 24px;
  height: 24px;
  display: none;
  place-items: center;
  color: var(--text-inverse);
  background: var(--brand-blue);
  border-radius: var(--radius-full);
  font-style: normal;
  font-size: var(--font-size-sm);
}

.select-card.card-selected,
.select-card:has(input:checked) {
  border-color: var(--brand-blue-border);
  box-shadow: 0 0 0 3px var(--brand-blue-light), var(--shadow-sm);
}

.select-card.card-selected i,
.select-card:has(input:checked) i { display: grid; }
.select-card:has(input:focus-visible) {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

.select-card.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
  background: rgba(15, 23, 42, 0.04);
}
.select-card.is-disabled:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}
.select-card.is-disabled small {
  color: var(--text-tertiary);
}

.context-card {
  position: sticky;
  top: 96px;
  padding: var(--space-8);
}

.context-card h2 { margin: 0 0 var(--space-5); font-size: var(--font-size-xl); }
.numbered-notes { display: grid; gap: var(--space-5); margin: 0; padding: 0; list-style: none; }
.numbered-notes li { display: grid; grid-template-columns: 30px 1fr; gap: var(--space-3); }
.numbered-notes li > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--brand-blue);
  background: var(--brand-blue-light);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 700;
}
.numbered-notes p { margin: 1px 0 0; color: var(--text-secondary); font-size: var(--font-size-sm); }

.task-summary-strip {
  display: grid;
  grid-template-columns: 1.45fr 0.8fr 0.55fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-md);
}
.task-summary-strip div { min-width: 0; display: grid; gap: var(--space-1); }
.task-summary-strip span { color: var(--text-secondary); font-size: var(--font-size-sm); }
.task-summary-strip code { overflow-wrap: anywhere; }

.upload-card { overflow: hidden; }
.upload-zone {
  position: relative;
  display: grid;
  justify-items: center;
  margin: var(--space-4);
  padding: var(--space-10) var(--space-8);
  text-align: center;
  background: var(--glass-bg-thin);
  border: 1px dashed var(--brand-blue-border);
  border-radius: var(--radius-md);
}
.upload-zone.is-dragging { background: var(--brand-blue-light); border-color: var(--brand-blue); }
.upload-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-bottom: var(--space-4);
  color: var(--brand-blue);
  background: var(--brand-blue-light);
  border-radius: var(--radius-md);
}
.upload-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.upload-zone h2 { margin: 0 0 var(--space-2); font-size: var(--font-size-xl); }
.upload-zone p { margin: 0 0 var(--space-4); color: var(--text-secondary); }
.format-hint {
  margin-bottom: var(--space-4);
  padding: var(--space-1) var(--space-3);
  color: var(--brand-blue);
  background: var(--brand-blue-light);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
}
.file-list-panel { padding: var(--space-5) var(--space-6); border-top: 1px solid var(--glass-border); }
.file-list-header { display: flex; justify-content: space-between; margin-bottom: var(--space-3); font-size: var(--font-size-sm); }
.file-list-header span { color: var(--text-secondary); }
.file-list { display: grid; gap: var(--space-2); max-height: 220px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.file-list li {
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 32px;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-3);
  background: rgb(255 255 255 / 52%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
}
.file-list li:has(.file-state) { grid-template-columns: minmax(0, 1fr) auto auto 32px; }
.file-list small { color: var(--text-tertiary); }
.file-state { color: var(--brand-blue) !important; }
.file-remove {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}
.file-remove:hover { color: var(--text-primary); background: var(--bg-hover); }
.form-message { min-height: 24px; margin: 0; color: var(--brand-blue); font-size: var(--font-size-sm); }
.form-message.is-error { color: var(--text-primary); }

.single-column-shell { width: 900px; margin: 0 auto; }
.height-card { margin-top: var(--space-8); padding: var(--space-8); }
.height-summary {
  display: grid;
  grid-template-columns: 0.8fr 1.5fr 0.7fr;
  gap: var(--space-4);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--glass-border);
}
.height-summary div { display: grid; gap: var(--space-1); }
.height-summary span { color: var(--text-secondary); font-size: var(--font-size-sm); }
.height-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--space-8) 0 var(--space-4);
}
.height-selector-header h2 { margin: 0; font-size: var(--font-size-xl); }
.selection-count { color: var(--text-secondary); }
.selection-count b { color: var(--brand-blue); }
.height-card .height-grid { grid-template-columns: repeat(5, 1fr); }
.height-card .height-option { position: relative; }
.height-card .height-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.height-card .height-option:has(input:focus-visible) {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}
.split-actions { justify-content: space-between; margin-top: var(--space-5); }
.split-actions p { margin: 0; color: var(--text-secondary); font-size: var(--font-size-sm); }

.status-layout { width: 760px; margin: var(--space-8) auto 0; }
.processing-card { padding: var(--space-12); text-align: center; }
.processing-card h1 { margin: var(--space-3) 0; font-size: var(--font-size-3xl); }
.processing-card > p:not(.section-kicker):not(.processing-state) { color: var(--text-secondary); }
.processing-orbit {
  position: relative;
  width: 76px;
  height: 76px;
  display: block;
  margin: 0 auto var(--space-6);
  border: 1px solid var(--brand-blue-border);
  border-radius: var(--radius-full);
}
.processing-orbit i {
  position: absolute;
  inset: 12px;
  border: 2px solid var(--brand-blue-light);
  border-top-color: var(--brand-blue);
  border-radius: var(--radius-full);
  animation: processing-spin 1.2s linear infinite;
}
.processing-orbit b {
  position: absolute;
  inset: 29px;
  background: var(--brand-blue);
  border-radius: var(--radius-full);
  box-shadow: 0 0 0 6px var(--brand-blue-light);
}
.task-progress-track { margin-top: var(--space-8); }
.progress-security_check { width: 20%; }
.progress-format_check, .progress-parsing { width: 45%; }
.progress-queued { width: 24%; }
.progress-processing { width: 72%; }
.progress-generating_report { width: 94%; }
.processing-state { color: var(--brand-blue); font-size: var(--font-size-sm); font-weight: 600; }
.status-detail-card {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin-top: var(--space-5);
  padding: var(--space-5) var(--space-8);
  border-radius: var(--radius-md);
}
.task-meta-row {
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-right: var(--space-8);
}
.task-meta-row:nth-child(even) { padding-right: 0; padding-left: var(--space-8); border-left: 1px solid var(--glass-border); }
.task-meta-row > span:first-child { color: var(--text-secondary); font-size: var(--font-size-sm); }
.task-meta-row code { max-width: 220px; overflow-wrap: anywhere; text-align: right; }
.processing-note {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}
.processing-note p { margin: 0; }
.processing-note-icon { width: 22px; height: 22px; color: var(--brand-blue); }
.processing-note-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.processing-secondary-action { display: flex; justify-content: center; margin-top: var(--space-3); }

@keyframes processing-spin { to { transform: rotate(360deg); } }

/* ── Reduced Motion ─────────────────────────────────────────────────── */

/* ── Responsive ─────────────────────────────────────────────────────── */

/* Header brand subtitle is long; hide on tablet/mobile to avoid overflow */
@media (max-width: 1023px) {
  .app-bar .brand-subtitle {
    display: none;
  }
}

/* Footer tagline: keep on tablet, hide on narrow phones */
@media (max-width: 600px) {
  .footer-brand .brand-tagline {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Hero Section ─────────────────────────────────────────────────── */
.hero-shell {
  position: relative;
  isolation: isolate;
  width: min(calc(100% - 64px), var(--container-desktop));
  min-height: 700px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.04fr 0.96fr;
  align-items: center;
  gap: var(--space-16);
  padding: var(--space-16) 0;
}

.hero-shell::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0 auto 0 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: url("/static/img/onshore-wind-farm.jpg") center 46% / cover no-repeat;
  filter: saturate(0.9) contrast(0.98);
}

.hero-shell::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 auto 0 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(239,245,249,.96) 0%, rgba(242,247,250,.88) 28%, rgba(240,246,249,.56) 54%, rgba(237,244,247,.16) 77%, rgba(237,244,247,.32) 100%),
              linear-gradient(180deg, rgba(233,240,245,.12), rgba(238,243,240,.52));
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--brand-blue);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.hero-eyebrow-dot {
  width: 8px;
  height: 8px;
  background: var(--brand-blue);
  border-radius: var(--radius-full);
  box-shadow: 0 0 0 5px var(--brand-blue-light);
}

.hero-copy {
  padding-bottom: var(--space-6);
}

.hero-copy h1 {
  max-width: 650px;
  margin: var(--space-5) 0 var(--space-6);
  font-size: var(--font-size-5xl);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.hero-lead {
  max-width: 650px;
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
  line-height: 1.625;
}

.hero-panel {
  background: rgba(255, 255, 255, 0.84);
  padding: var(--space-8);
}

.hero-validation {
  max-width: 650px;
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding: var(--space-4);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hero-validation p { margin: 0; }

.validation-label {
  color: var(--brand-blue);
  font-size: var(--font-size-sm);
  font-weight: 700;
}

.validation-context {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.validation-metrics {
  display: grid;
  gap: var(--space-2);
}

.validation-metric {
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: start;
  gap: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--glass-border);
}

.validation-term {
  display: inline-flex;
  justify-content: center;
  padding: 3px var(--space-2);
  color: var(--brand-blue);
  background: var(--brand-blue-light);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 700;
  white-space: nowrap;
}

.validation-metric p {
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  line-height: 1.55;
}

.validation-metric strong {
  color: var(--brand-blue);
  font-weight: 700;
  white-space: nowrap;
}

.validation-boundary {
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-top: var(--space-6);
}

.btn-large svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  transition: transform 160ms ease;
}

.btn-large:hover svg {
  transform: translateX(4px);
}

.home-sections {
  display: grid;
  gap: 96px;
  padding: 96px 0 112px;
}

/* ── Nav Layout ───────────────────────────────────────────────────── */
.nav-shell {
  width: min(calc(100% - 64px), var(--container-desktop));
  margin: 0 auto;
  height: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-8);
}

/* ── Panel Header ─────────────────────────────────────────────────── */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--glass-border);
}

.panel-kicker {
  margin: 0 0 var(--space-2);
  color: var(--brand-blue);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.panel-title {
  margin: 0;
  font-size: var(--font-size-xl);
  line-height: 1.375;
  letter-spacing: -0.022em;
}

/* ── Section Kicker ───────────────────────────────────────────────── */
.section-kicker {
  margin: 0 0 var(--space-2);
  color: var(--brand-blue);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

/* ── Principle / Support Cards ────────────────────────────────────── */
.principle-grid, .support-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.principle-card, .support-card {
  padding: var(--space-8);
}

.principle-card h3, .support-card h3 {
  margin: var(--space-5) 0 var(--space-2);
  font-size: var(--font-size-xl);
}

.principle-card p, .support-card p {
  margin: 0;
  color: var(--text-secondary);
}

/* ── Line Icon ────────────────────────────────────────────────────── */
.line-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--brand-blue);
  background: var(--brand-blue-light);
  border-radius: var(--radius-md);
}

.line-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Support Card ─────────────────────────────────────────────────── */
.support-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.support-card-top h3 { margin-top: 0; }

.file-chip {
  display: inline-flex;
  margin-top: var(--space-6);
  padding: 5px var(--space-3);
  color: var(--brand-blue);
  background: var(--brand-blue-light);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

/* ── Inline Heading (support section) ─────────────────────────────── */
.inline-heading {
  max-width: none;
  display: grid;
  grid-template-columns: 1fr 470px;
  align-items: end;
  gap: var(--space-12);
}

/* ── Section Block ────────────────────────────────────────────────── */
.section-block {
  scroll-margin-top: 96px;
}

.section-heading {
  max-width: 760px;
  margin-bottom: var(--space-10);
}

.section-heading h2 {
  margin: 0 0 var(--space-4);
  font-size: var(--font-size-4xl);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.section-heading p:last-child {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
}

/* ── Boundary Card ────────────────────────────────────────────────── */
.boundary-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: var(--space-6);
  padding: var(--space-8);
}

.boundary-card h2 {
  margin: 0 0 var(--space-4);
  font-size: var(--font-size-4xl);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.boundary-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
}

.boundary-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--brand-blue);
  background: var(--brand-blue-light);
  border: 1px solid rgba(0,91,181,.14);
  border-radius: var(--radius-full);
  font-family: Georgia, serif;
  font-size: var(--font-size-xl);
  font-weight: 700;
}

/* ── Workflow List (Steps) ────────────────────────────────────────── */
.workflow-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: var(--space-2) 0 0;
  list-style: none;
}

.workflow-list li {
  position: relative;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: var(--space-4);
  padding: var(--space-5) 0;
}

.workflow-list li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 58px;
  bottom: -7px;
  width: 1px;
  background: var(--glass-border);
}

.step-number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--brand-blue);
  background: var(--brand-blue-light);
  border: 1px solid rgba(0, 91, 181, 0.12);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 700;
}

.workflow-list strong {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--font-size-lg);
}

.workflow-list p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

/* ── Contact Link ─────────────────────────────────────────────────── */
.contact-link {
  margin-top: var(--space-5);
}

/* ── Preprocessor download page (v0.5) ─────────────────────────────── */
.card-title {
  margin: 0 0 var(--space-4);
  font-size: var(--font-size-2xl);
  font-weight: 600;
  color: var(--text-primary);
}

.meta-list {
  display: grid;
  gap: var(--space-3);
  margin: 0 0 var(--space-5);
}

.meta-list > div {
  display: flex;
  gap: var(--space-4);
  align-items: baseline;
}

.meta-list dt {
  flex: 0 0 88px;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.meta-list dd {
  flex: 1;
  min-width: 0; /* flex item must be allowed to shrink so long values wrap */
  margin: 0;
  color: var(--text-primary);
  font-size: var(--font-size-base);
  word-break: break-all;
}

/* Keep technical values (version / SHA-256) visually consistent with the
   plain-text rows: same font family, size and weight as the <dd> base. */
.meta-list code {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.code-break {
  display: inline-block;
  max-width: 100%;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.notice-banner {
  padding: var(--space-4) var(--space-5);
  border: 1px solid rgba(0, 91, 181, 0.16);
  border-radius: var(--radius-md);
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  font-size: var(--font-size-base);
}

.field-hint {
  margin: var(--space-3) 0 0;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

/* ── Home preprocessor section (v0.5) ──────────────────────────────── */
.preprocessor-card {
  padding: var(--space-6);
  max-width: var(--container-desktop, 1200px);
}

.preprocessor-card .meta-list > div {
  display: flex;
  gap: var(--space-4);
  align-items: baseline;
}

.preprocessor-card .meta-list dt {
  flex: 0 0 88px;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.preprocessor-card .meta-list dd {
  flex: 1;
  min-width: 0; /* allow long hashes/values to wrap inside the card */
  margin: 0;
  font-size: var(--font-size-base);
  word-break: break-all;
}

.pre-note {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  margin: 0 0 var(--space-5);
}

/* ── Tool info card (preprocessor download page, v0.5) ─────────────────
   .upload-card is designed for the upload zone (overflow hidden, no
   padding); the tool card needs its own comfortable inner padding so
   the action button does not hug the card edge. */
.tool-card {
  padding: var(--space-6);
}

.tool-card .form-actions {
  margin-top: var(--space-2);
}

/* ── Internal backoffice shell ─────────────────────────────────────── */
.backoffice-page { padding: var(--space-8) 0 96px; }
.backoffice-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}
.backoffice-heading h1 { margin: 0 0 var(--space-2); font-size: var(--font-size-4xl); line-height: 1.2; }
.backoffice-heading p:last-child { margin: 0; color: var(--text-secondary); font-size: var(--font-size-lg); }
.backoffice-nav { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); padding: var(--space-2); border-radius: var(--radius-md); }
.backoffice-nav-item { min-height: var(--touch-target-min); display: inline-flex; align-items: center; padding: 0 var(--space-4); color: var(--text-secondary); border-radius: var(--radius-sm); font-size: var(--font-size-sm); font-weight: 600; text-decoration: none; }
.backoffice-nav-item:hover { color: var(--brand-blue); background: var(--bg-hover); text-decoration: none; }
.backoffice-nav-item.is-active { color: var(--brand-blue); background: var(--brand-blue-light); }
.backoffice-empty { padding: var(--space-8); border-radius: var(--radius-md); }
.backoffice-empty h2 { margin: 0 0 var(--space-2); font-size: var(--font-size-xl); }
.backoffice-empty p { margin: 0; color: var(--text-secondary); }

/* ── Backoffice lead workspace (desktop scope) ─────────────────────── */
.lead-filter-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding: var(--space-5);
  border-radius: var(--radius-md);
}
.lead-filter-field { display: grid; gap: var(--space-2); color: var(--text-secondary); font-size: var(--font-size-sm); font-weight: 500; }
.lead-filter-panel .btn { align-self: end; }
.lead-workspace-grid { display: grid; grid-template-columns: minmax(320px, .72fr) minmax(0, 1.5fr); align-items: start; gap: var(--space-6); }
.lead-list-panel { overflow: hidden; border-radius: var(--radius-md); }
.lead-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--glass-border); }
.lead-panel-heading h2, .lead-contact-card h2 { margin: 0; font-size: var(--font-size-xl); line-height: 1.375; }
.lead-panel-heading .section-kicker { margin-bottom: var(--space-1); }
.lead-count { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 28px; padding: var(--space-1) var(--space-2); color: var(--brand-blue); background: var(--brand-blue-light); border-radius: var(--radius-full); font-size: var(--font-size-sm); font-weight: 700; }
.lead-list { display: grid; max-height: 720px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.lead-list-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 78px; padding: var(--space-4) var(--space-6); color: var(--text-primary); border-bottom: 1px solid var(--glass-border); text-decoration: none; transition: background 160ms ease; }
.lead-list-row:hover { background: var(--bg-hover); text-decoration: none; }
.lead-list-row.is-selected { background: var(--brand-blue-light); box-shadow: inset 3px 0 0 var(--brand-blue); }
.lead-list-main, .lead-list-meta { display: grid; gap: var(--space-1); min-width: 0; }
.lead-list-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-size-base); }
.lead-list-main small, .lead-list-meta small { color: var(--text-secondary); font-size: var(--font-size-xs); }
.lead-list-meta { justify-items: end; text-align: right; }
.lead-empty-state { padding: var(--space-8) var(--space-6); }
.lead-empty-state h3 { margin: 0 0 var(--space-2); font-size: var(--font-size-lg); }
.lead-empty-state p, .lead-empty-copy { margin: 0; color: var(--text-secondary); font-size: var(--font-size-sm); }
.lead-detail-stack { display: grid; gap: var(--space-5); }
.lead-contact-card, .lead-editor-card, .lead-tasks-card, .lead-timeline-card { padding: var(--space-6); border-radius: var(--radius-md); }
.lead-contact-card { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); align-items: end; gap: var(--space-6); }
.lead-contact-card .section-kicker { margin-bottom: var(--space-1); }
.lead-contact-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); margin: 0; }
.lead-contact-meta div { display: grid; gap: var(--space-1); }
.lead-contact-meta dt { color: var(--text-secondary); font-size: var(--font-size-xs); }
.lead-contact-meta dd { margin: 0; overflow-wrap: anywhere; font-size: var(--font-size-sm); font-weight: 600; }
.lead-editor-card, .lead-tasks-card, .lead-timeline-card { padding: 0; overflow: hidden; }
.lead-editor-form { display: grid; gap: var(--space-5); padding: var(--space-6); }
.lead-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.lead-editor-form .field-group { margin: 0; }
.lead-outcome-panel { display: grid; gap: var(--space-3); padding: var(--space-5); background: var(--glass-bg-thin); border: 1px solid var(--glass-border); border-radius: var(--radius-md); }
.lead-outcome-panel > p { margin: 0; color: var(--text-primary); font-size: var(--font-size-base); font-weight: 600; }
.lead-outcome-panel > small { color: var(--text-secondary); font-size: var(--font-size-xs); }
.lead-outcome-panel .check-row { margin: 0; }
.lead-editor-actions { display: flex; justify-content: flex-end; }
.lead-tasks-card .table-scroll { padding: 0 var(--space-6) var(--space-2); }
.lead-task-table tbody tr:last-child td { border-bottom: 0; }
.lead-timeline { display: grid; gap: var(--space-5); margin: 0; padding: var(--space-6); list-style: none; }
.lead-timeline li { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: var(--space-3); }
.lead-timeline li:not(:last-child)::after { content: ""; position: absolute; left: 5px; top: 18px; bottom: calc(var(--space-5) * -1); width: 1px; background: var(--glass-border); }
.lead-timeline-dot { width: 10px; height: 10px; margin-top: var(--space-1); background: var(--brand-blue); border-radius: var(--radius-full); box-shadow: 0 0 0 4px var(--brand-blue-light); }
.lead-timeline p { margin: 0; }
.lead-timeline-values { display: flex; align-items: baseline; gap: var(--space-2); margin-top: var(--space-1) !important; color: var(--text-secondary); font-size: var(--font-size-sm); overflow-wrap: anywhere; }
.lead-timeline-values span:last-child { color: var(--text-primary); }
.lead-timeline small { display: block; margin-top: var(--space-1); color: var(--text-tertiary); font-size: var(--font-size-xs); }
.lead-timeline-card .lead-empty-copy, .lead-tasks-card .lead-empty-copy { padding: var(--space-6); }

/* ── Result feedback card (v0.6 §8.4) ──────────────────────────────── */
.feedback-card { margin-top: var(--space-5); padding: var(--space-8); border-radius: var(--radius-md); }
.feedback-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-6); margin-bottom: var(--space-6); }
.feedback-card-head h2 { margin: 0 0 var(--space-2); font-size: var(--font-size-xl); line-height: 1.375; }
.feedback-card-head p { margin: 0; color: var(--text-secondary); font-size: var(--font-size-sm); }
.feedback-form { display: grid; gap: var(--space-6); }
.feedback-scale { margin: 0; padding: 0; border: 0; }
.feedback-scale legend { margin-bottom: var(--space-3); color: var(--text-secondary); font-size: var(--font-size-sm); font-weight: 500; }
.feedback-scale-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-3); max-width: 420px; }
.feedback-scale-option { min-height: 48px; display: grid; place-items: center; cursor: pointer; }
.feedback-scale-option input { position: absolute; opacity: 0; pointer-events: none; }
.feedback-scale-option span { width: 100%; min-height: 48px; display: grid; place-items: center; color: var(--text-secondary); background: rgba(255,255,255,.6); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); font-size: var(--font-size-lg); font-weight: 600; transition: border 160ms ease, background 160ms ease, color 160ms ease; }
.feedback-scale-option:hover span { border-color: var(--brand-blue-border); background: var(--bg-hover); }
.feedback-scale-option input:checked + span { color: var(--brand-blue); background: var(--brand-blue-light); border-color: rgba(0,91,181,.32); }
.feedback-scale-option input:focus-visible + span { outline: 2px solid var(--brand-blue); outline-offset: 2px; }
.feedback-scale-labels { display: flex; justify-content: space-between; max-width: 420px; margin: var(--space-2) 0 0; color: var(--text-tertiary); font-size: var(--font-size-xs); }
.feedback-intent select { max-width: 420px; }
.feedback-actions { display: flex; justify-content: flex-end; }

/* ── Backoffice operational queues (§8.2) ───────────────────────────── */
.ops-queue-stack { display: grid; gap: var(--space-5); }
.ops-queue-card { padding: 0; overflow: hidden; border-radius: var(--radius-md); }
.ops-queue-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--glass-border); }
.ops-queue-head h2 { margin: 0 0 var(--space-1); font-size: var(--font-size-xl); line-height: 1.375; }
.ops-queue-head p { margin: 0; color: var(--text-secondary); font-size: var(--font-size-sm); }
.ops-queue-list { display: grid; margin: 0; padding: 0; list-style: none; }
.ops-queue-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 72px; padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--glass-border); }
.ops-queue-list li:last-child { border-bottom: 0; }
.ops-item-main { display: grid; gap: var(--space-1); min-width: 0; }
.ops-item-main strong { font-size: var(--font-size-base); }
.ops-item-main small { color: var(--text-secondary); font-size: var(--font-size-sm); }
.ops-item-meta { display: flex; align-items: center; gap: var(--space-4); flex: none; }
.ops-overdue { display: inline-flex; align-items: center; justify-content: center; min-width: 64px; padding: 3px var(--space-2); color: #92400e; background: rgba(146, 64, 14, 0.08); border-radius: var(--radius-full); font-size: var(--font-size-xs); font-weight: 600; }
.ops-queue-card .lead-empty-copy { padding: var(--space-6); }

/* ── Backoffice decision dashboard (§8.3) ───────────────────────────── */
.dashboard-note { margin: 0 0 var(--space-5); color: var(--text-tertiary); font-size: var(--font-size-sm); }
.dashboard-metric-grid { grid-template-columns: repeat(4, 1fr); }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); margin-top: var(--space-5); }
.dashboard-table-pad { padding: var(--space-4) var(--space-6) var(--space-2); }
.dashboard-table-pad table td:last-child { white-space: nowrap; }
.dashboard-table-pad .data-table tbody tr:last-child td { border-bottom: 0; }
.cohort-rate { display: block; margin-top: var(--space-1); color: var(--text-tertiary); }

/* ── Backoffice support console / system settings (§8.4) ────────────── */
.support-filter-panel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; align-items: end; gap: var(--space-4); padding: var(--space-5) var(--space-6); }
.support-filter-panel .btn { align-self: end; }
.support-table-pad { padding: 0 var(--space-6) var(--space-4); }
.support-table-pad .table-scroll { margin-top: var(--space-4); }
.inline-form { display: inline; }
.btn-sm { min-height: 36px; padding: 6px var(--space-3); font-size: var(--font-size-sm); }

/* ── System mode panel (§Spec 7.1/7.2) ──────────────────────────────── */
.mode-panel { display: grid; gap: var(--space-6); padding: var(--space-6); }
.mode-block { display: grid; gap: var(--space-3); padding: var(--space-5); background: var(--glass-bg-thin); border: 1px solid var(--glass-border); border-radius: var(--radius-md); }
.mode-block-title { margin: 0; color: var(--text-primary); font-size: var(--font-size-base); font-weight: 600; }
.mode-actions { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-4); }
.mode-actions .check-row { margin: 0; }
