/* ==========================================================================
   StockSense AI — application styles
   Layout, header/footer, nav, cards, buttons, tables. All values reference
   tokens.css. No brand colours are hard-coded here.
   ========================================================================== */

/* --- Reset / base --------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--athera-off-white);
  color: var(--athera-charcoal);
  font-family: var(--athera-sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--athera-display);
  font-weight: 300;
  color: var(--athera-charcoal);
  margin: 0;
}

p { margin: 0 0 var(--space-2); }

a {
  color: var(--athera-blue-deep);
  text-decoration: none;
  transition: color var(--ease);
}
a:hover { color: var(--athera-charcoal); }

:focus-visible {
  outline: 2px solid var(--athera-blue-deep);
  outline-offset: 2px;
}

/* --- Layout primitives ---------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding-left: var(--page-pad);
  padding-right: var(--page-pad);
}

.section-pad { padding-top: var(--space-7); padding-bottom: var(--space-7); }

.blue-rule {
  width: 48px;
  height: 1px;
  background: var(--athera-blue);
  border: 0;
  margin: var(--space-3) 0;
}

.stack > * + * { margin-top: var(--space-3); }

.grid { display: grid; gap: var(--space-3); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.muted { color: var(--athera-grey); }

/* --- Header --------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(248, 247, 244, 0.9);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--athera-line);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 76px;
  flex-wrap: wrap;
}

.brand-lockup {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}
.product-name {
  font-family: var(--athera-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--athera-charcoal);
}
.product-kicker {
  display: block;
  margin-top: 2px;
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--athera-grey);
}

/* Inline A!thera wordmark */
.athera-wordmark {
  font-family: var(--athera-display);
  font-size: 20px;
  font-weight: 300;
  color: var(--athera-charcoal);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.athera-wordmark .mark { color: var(--athera-blue); }
.athera-wordmark-partners {
  font-family: var(--athera-sans);
  font-size: 0.5em;
  font-weight: 400;
  color: var(--athera-grey);
  letter-spacing: 0.08em;
  margin-left: 4px;
  vertical-align: super;
}

/* --- Nav ------------------------------------------------------------------ */
.site-nav {
  border-bottom: 1px solid var(--athera-line);
  background: var(--athera-off-white);
}
.site-nav .container {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  overflow-x: auto;
}
.nav-link {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 16px 14px;
  cursor: pointer;
  color: var(--athera-grey);
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color var(--ease), border-color var(--ease);
}
.nav-link:hover { color: var(--athera-charcoal); }
.nav-link .nav-index {
  font-family: var(--athera-mono);
  font-size: 10px;
  color: var(--athera-grey-light);
  margin-right: 6px;
}
.nav-link.is-active {
  color: var(--athera-charcoal);
  border-bottom-color: var(--athera-blue);
}
.nav-link.is-active .nav-index { color: var(--athera-blue-deep); }

/* --- Main / screens ------------------------------------------------------- */
main { flex: 1 0 auto; }

.screen { display: none; }
.screen.is-active {
  display: block;
  animation: fade-in 0.3s ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .screen.is-active { animation: none; }
  * { transition: none !important; }
}

/* Screen header block */
.screen-head { max-width: 720px; margin-bottom: var(--space-5); }
.screen-head h2 { margin-top: var(--space-1); }
.screen-head .lead { margin-top: var(--space-3); }

/* --- Cards ---------------------------------------------------------------- */
.athera-card {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  padding: var(--space-4);
}
.athera-card-dark {
  background: var(--athera-navy);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--athera-line-dark);
  border-radius: 4px;
  padding: var(--space-4);
}

.card-number {
  font-family: var(--athera-mono);
  font-size: 11px;
  color: var(--athera-grey-light);
}

/* Placeholder ("coming together") block for stubbed screens */
.placeholder {
  border: 1px dashed var(--athera-line);
  border-radius: 4px;
  background: var(--athera-white);
  padding: var(--space-6) var(--space-5);
  text-align: left;
}
.placeholder .placeholder-tag {
  display: inline-block;
  margin-bottom: var(--space-2);
}
.placeholder h3 { margin-bottom: var(--space-2); }

/* --- Buttons -------------------------------------------------------------- */
.athera-button-primary {
  display: inline-block;
  padding: 12px 24px;
  background: var(--athera-blue);
  color: var(--athera-navy);
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background var(--ease);
}
.athera-button-primary:hover { background: var(--athera-blue-deep); color: var(--athera-navy); }

.athera-button-secondary {
  display: inline-block;
  padding: 12px 24px;
  background: transparent;
  color: var(--athera-charcoal);
  border: 1px solid var(--athera-line);
  border-radius: 2px;
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}
.athera-button-secondary:hover { background: var(--athera-off-white); border-color: var(--athera-grey-light); }

.button-row { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-4); }

/* --- Tables --------------------------------------------------------------- */
.athera-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--athera-sans);
  font-size: 13px;
}
.athera-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--athera-grey-light);
  border-bottom: 1px solid var(--athera-line);
}
.athera-table td {
  padding: 12px 16px;
  color: var(--athera-charcoal);
  border-bottom: 1px solid var(--athera-line-light);
}
.table-scroll { overflow-x: auto; }

/* --- Hero (Home) ---------------------------------------------------------- */
.hero { padding-top: var(--space-8); padding-bottom: var(--space-7); }
.hero .eyebrow { margin-bottom: var(--space-3); }
.hero h1 { max-width: 14ch; }
.hero .lead { max-width: 60ch; margin-top: var(--space-4); }

.feature-grid { margin-top: var(--space-6); }
.feature h3 { font-size: 22px; margin-bottom: var(--space-1); }

.guardrails {
  margin-top: var(--space-6);
  padding: var(--space-5);
  background: var(--athera-surface);
  border-radius: 4px;
}
.guardrails ul { margin: var(--space-2) 0 0; padding-left: 1.1em; }
.guardrails li { margin-bottom: var(--space-1); color: var(--athera-charcoal-light); }

/* --- Disclaimer note ------------------------------------------------------ */
.review-note {
  border-left: 2px solid var(--athera-blue);
  padding: var(--space-1) 0 var(--space-1) var(--space-3);
  color: var(--athera-charcoal-light);
  font-size: 14px;
}

/* --- Footer --------------------------------------------------------------- */
.site-footer {
  flex-shrink: 0;
  margin-top: var(--space-8);
  background: var(--athera-navy);
  color: rgba(255, 255, 255, 0.7);
}
.site-footer .container {
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.site-footer .athera-wordmark { color: #fff; }
.site-footer .footer-disclaimer {
  max-width: 68ch;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.6);
}
.site-footer .footer-meta {
  font-family: var(--athera-mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  border-top: 1px solid var(--athera-line-dark);
  padding-top: var(--space-3);
}

.hero-note {
  margin-top: var(--space-3);
  max-width: 56ch;
  color: var(--athera-grey);
}

/* --- Skeletons (calm loading) --------------------------------------------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--athera-surface);
  border-radius: 4px;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: skeleton-sweep 1.4s ease infinite;
}
@keyframes skeleton-sweep { to { transform: translateX(100%); } }
.skeleton-line { height: 14px; margin-bottom: var(--space-3); }
.skeleton-block { height: 120px; margin-bottom: var(--space-4); }
.skeleton-w-24 { width: 24%; }
.skeleton-w-30 { width: 30%; }
.scope-skeleton, .data-skeleton { padding: var(--space-4) 0; }

@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; }
}

/* --- Generic state message (error / empty) -------------------------------- */
.state-message {
  border: 1px dashed var(--athera-line);
  border-radius: 4px;
  background: var(--athera-white);
  padding: var(--space-5);
}
.state-message h3 { margin-bottom: var(--space-2); }
.state-message .athera-button-secondary { margin-top: var(--space-3); }

/* ==========================================================================
   Screen 2 — Planning Scope form
   ========================================================================== */
.scope-form { max-width: 960px; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5) var(--space-5);
}
.field { min-width: 0; margin: 0; border: 0; padding: 0; }
.field-wide { grid-column: 1 / -1; }

.field-label {
  display: block;
  font-family: var(--athera-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--athera-charcoal);
  padding: 0;
}
legend.field-label { margin-bottom: 0; }
.field-hint {
  margin: 6px 0 var(--space-2);
  font-family: var(--athera-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--athera-grey);
}

/* Segmented control (radios) */
.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--athera-surface);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  flex-wrap: wrap;
}
.seg-option { position: relative; margin: 0; }
.seg-option input {
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  top: 0; left: 0;
  margin: 0;
  cursor: pointer;
}
.seg-option span {
  display: block;
  padding: 9px 18px;
  border-radius: 2px;
  font-family: var(--athera-sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--athera-grey);
  transition: background var(--ease), color var(--ease);
  white-space: nowrap;
}
.seg-option:hover span { color: var(--athera-charcoal); }
.seg-option input:checked + span {
  background: var(--athera-navy);
  color: #fff;
}
.seg-option input:focus-visible + span {
  outline: 2px solid var(--athera-blue-deep);
  outline-offset: 2px;
}

/* Selects */
.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--athera-grey);
  border-bottom: 1.5px solid var(--athera-grey);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.scope-form select,
.upload-panel select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  padding: 13px 40px 13px 16px;
  font-family: var(--athera-sans);
  font-size: 15px;
  color: var(--athera-charcoal);
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color var(--ease);
}
.scope-form select:hover,
.upload-panel select:hover { border-color: var(--athera-grey-light); }
.scope-form select:focus-visible,
.upload-panel select:focus-visible {
  outline: 2px solid var(--athera-blue-deep);
  outline-offset: 2px;
  border-color: var(--athera-blue-deep);
}

/* Number input */
.number-wrap { position: relative; display: inline-flex; align-items: center; }
.scope-form input[type="number"] {
  width: 140px;
  padding: 13px 56px 13px 16px;
  font-family: var(--athera-sans);
  font-size: 15px;
  color: var(--athera-charcoal);
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 3px;
  transition: border-color var(--ease);
}
.scope-form input[type="number"]:focus-visible {
  outline: 2px solid var(--athera-blue-deep);
  outline-offset: 2px;
  border-color: var(--athera-blue-deep);
}
.number-suffix {
  position: absolute;
  right: 16px;
  font-family: var(--athera-mono);
  font-size: 12px;
  color: var(--athera-grey);
  pointer-events: none;
}

/* Switch (promotion toggle) */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  margin-top: 4px;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  display: inline-block;
  width: 44px; height: 24px;
  background: var(--athera-grey-light);
  border-radius: 999px;
  transition: background var(--ease);
  flex-shrink: 0;
}
.switch-thumb {
  display: block;
  width: 18px; height: 18px;
  margin: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--ease);
}
.switch input:checked + .switch-track { background: var(--athera-blue-deep); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--athera-blue-deep);
  outline-offset: 2px;
}
.switch-text {
  font-family: var(--athera-sans);
  font-size: 14px;
  color: var(--athera-charcoal);
}

/* Scope actions */
.scope-actions { margin-top: var(--space-2); }
.scope-actions-row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.scope-status { margin-top: var(--space-3); color: var(--athera-grey); min-height: 1em; }
.scope-status.is-error { color: var(--athera-amber); }

/* ==========================================================================
   Screen 3 — Data Overview
   ========================================================================== */
.data-scopebar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--athera-line);
  margin-bottom: var(--space-5);
}
.data-scopebar-value { margin: 6px 0 0; color: var(--athera-charcoal); font-size: 16px; }
.data-scopebar-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.data-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--athera-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--athera-grey);
}
.data-chip-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--athera-blue);
  flex-shrink: 0;
}

/* Stat row */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.stat-card {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  padding: var(--space-3) var(--space-4);
}
.stat-card .stat-label {
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--athera-grey);
}
.stat-card .stat-value {
  font-family: var(--athera-display);
  font-size: 34px;
  font-weight: 300;
  line-height: 1.1;
  color: var(--athera-charcoal);
  margin-top: var(--space-1);
}
.stat-card .stat-sub {
  font-family: var(--athera-mono);
  font-size: 11px;
  color: var(--athera-grey-light);
  margin-top: 4px;
}

/* Data sections */
.data-section { margin-bottom: var(--space-6); }
.data-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}
.data-section-head h3 {
  font-family: var(--athera-display);
  font-size: 24px;
  font-weight: 400;
  color: var(--athera-charcoal);
}
.data-section-head .section-count {
  font-family: var(--athera-mono);
  font-size: 11px;
  color: var(--athera-grey);
}
.data-section-desc {
  font-family: var(--athera-sans);
  font-size: 13px;
  color: var(--athera-grey);
  margin: 0 0 var(--space-3);
  max-width: 68ch;
}
.table-card {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
}
.table-card .table-scroll { border-radius: 4px; }
.athera-table tbody tr:last-child td { border-bottom: 0; }
.athera-table td.num, .athera-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.athera-table td.mono { font-family: var(--athera-mono); font-size: 12px; color: var(--athera-charcoal-light); }
.athera-table tbody tr { transition: background var(--ease); }
.athera-table tbody tr:hover { background: var(--athera-off-white); }
.cell-strong { color: var(--athera-charcoal); font-weight: 500; }

/* Status tag (never colour-only: shape marker + word) */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--athera-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--athera-line);
  color: var(--athera-charcoal-light);
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 2px;
  background: var(--athera-grey-light);
}
.tag-promo { color: var(--athera-blue-deep); border-color: rgba(42, 143, 176, 0.35); }
.tag-promo::before { background: var(--athera-blue); border-radius: 50%; }
.tag-upcoming::before { background: var(--athera-amber); transform: rotate(45deg); border-radius: 1px; }

.data-empty {
  padding: var(--space-4);
  color: var(--athera-grey);
  font-size: 14px;
  border: 1px dashed var(--athera-line);
  border-radius: 4px;
  background: var(--athera-white);
}

/* ==========================================================================
   CSV upload panel (secondary)
   ========================================================================== */
.upload-panel {
  margin-top: var(--space-7);
  padding: var(--space-5);
  background: var(--athera-surface);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
}
.upload-head { max-width: 68ch; margin-bottom: var(--space-4); }
.upload-head h3 { margin: var(--space-1) 0 var(--space-2); }
.download-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-2);
  color: var(--athera-blue-deep);
  font-weight: 500;
}
.download-link:hover { color: var(--athera-charcoal); }
.download-icon {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 12px;
}

.upload-form { border-top: 1px solid var(--athera-line); padding-top: var(--space-4); }
.upload-fields {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: var(--space-3);
  align-items: end;
}
.field-action { display: flex; align-items: flex-end; }
.file-input {
  width: 100%;
  padding: 11px 12px;
  font-family: var(--athera-sans);
  font-size: 14px;
  color: var(--athera-charcoal);
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 3px;
}
.file-input::file-selector-button {
  margin-right: 12px;
  padding: 7px 14px;
  font-family: var(--athera-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--athera-charcoal);
  background: var(--athera-off-white);
  border: 1px solid var(--athera-line);
  border-radius: 2px;
  cursor: pointer;
}
.file-input:focus-visible { outline: 2px solid var(--athera-blue-deep); outline-offset: 2px; }
.upload-status { margin-top: var(--space-3); color: var(--athera-grey); min-height: 1em; }

/* Validation report */
.validation-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: 4px;
  border: 1px solid var(--athera-line);
  background: var(--athera-white);
  border-left-width: 3px;
}
.validation-summary.is-ok { border-left-color: var(--athera-blue); }
.validation-summary.is-error { border-left-color: var(--athera-amber); }
.validation-verdict {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.validation-verdict.is-ok { color: var(--athera-blue-deep); }
.validation-verdict.is-error { color: var(--athera-amber); }
.validation-verdict .verdict-mark {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font-size: 11px;
}
.validation-counts {
  font-family: var(--athera-mono);
  font-size: 12px;
  color: var(--athera-grey);
}
.validation-message {
  margin-top: var(--space-2);
  font-family: var(--athera-sans);
  font-size: 14px;
  color: var(--athera-charcoal-light);
}
.validation-errors { margin-top: var(--space-3); }
.validation-errors .athera-table td { font-size: 12px; }
.validation-note {
  margin-top: var(--space-3);
  font-family: var(--athera-sans);
  font-size: 13px;
  color: var(--athera-grey);
}

/* ==========================================================================
   Screens 4–6 — shared results scaffolding
   ========================================================================== */

/* Utility: monospace inline */
.mono { font-family: var(--athera-mono); }
.cell-sub {
  display: block;
  margin-top: 3px;
  font-family: var(--athera-sans);
  font-size: 11.5px;
  color: var(--athera-grey);
  letter-spacing: 0;
}
.cell-sub.mono { font-family: var(--athera-mono); font-size: 11px; }

/* Scope bar (mirrors the Data Overview scope bar) */
.results-scopebar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--athera-line);
  margin-bottom: var(--space-4);
}
.results-scopebar-value { margin: 6px 0 0; color: var(--athera-charcoal); font-size: 16px; }
.results-scopebar-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

.results-status {
  margin: 0 0 var(--space-4);
  color: var(--athera-grey);
  min-height: 1em;
}
.results-status.is-error { color: var(--athera-amber); }

/* Accented stat card (single emphasis — e.g. active stockout risk) */
.stat-card-accent { border-left: 3px solid var(--athera-amber); }
.stat-card-accent .stat-value { color: var(--athera-charcoal); }

/* Suggestion banner (recommendations) */
.suggestion-banner { margin-bottom: var(--space-5); }

/* --- Toolbar (filter + sort) ---------------------------------------------- */
.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.filter-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.toolbar-right { display: inline-flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.toolbar-sort { display: inline-flex; align-items: center; gap: var(--space-2); }

.filter-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 999px;
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--athera-grey);
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
}
.filter-chip:hover { color: var(--athera-charcoal); border-color: var(--athera-grey-light); }
.filter-chip.is-active {
  color: var(--athera-navy);
  border-color: var(--athera-blue);
  background: rgba(95, 184, 214, 0.12);
}
.chip-count {
  font-family: var(--athera-mono);
  font-size: 11px;
  color: var(--athera-grey-light);
}
.filter-chip.is-active .chip-count { color: var(--athera-blue-deep); }

.select-wrap-inline::after { right: 12px; }
.select-wrap-inline select {
  -webkit-appearance: none;
  appearance: none;
  padding: 9px 34px 9px 14px;
  font-family: var(--athera-sans);
  font-size: 13px;
  color: var(--athera-charcoal);
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color var(--ease);
}
.select-wrap-inline select:hover { border-color: var(--athera-grey-light); }
.select-wrap-inline select:focus-visible {
  outline: 2px solid var(--athera-blue-deep);
  outline-offset: 2px;
  border-color: var(--athera-blue-deep);
}

.btn-sm { padding: 8px 16px; font-size: 11px; }
.btn-text {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 6px;
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--athera-blue-deep);
  cursor: pointer;
  transition: color var(--ease);
}
.btn-text:hover { color: var(--athera-charcoal); }

/* --- Risk / confidence / priority tags (never colour-only) ---------------- */
/* Base .tag defined in Screen 3 section; here we add variants with distinct
   marker shapes so meaning is legible without relying on colour. */
.tag-stockout::before { background: var(--athera-amber); border-radius: 50%; }
.tag-stockout { color: var(--athera-charcoal); border-color: rgba(200, 149, 90, 0.4); }
.tag-overstock::before { background: var(--athera-steel); border-radius: 2px; }
.tag-overstock { color: var(--athera-charcoal-light); border-color: rgba(138, 165, 190, 0.45); }
.tag-aging::before { background: var(--athera-grey); transform: rotate(45deg); border-radius: 1px; }
.tag-aging { color: var(--athera-charcoal-light); }
.tag-healthy::before { background: var(--athera-blue); border-radius: 50%; }
.tag-healthy { color: var(--athera-grey); }

.tag-conf-low {
  color: var(--athera-charcoal);
  border-color: rgba(200, 149, 90, 0.5);
  background: rgba(200, 149, 90, 0.08);
}
.tag-conf-low::before {
  background: transparent;
  border: 1.5px solid var(--athera-amber);
  border-radius: 50%;
  width: 8px; height: 8px;
}
.tag-conf-med::before { background: var(--athera-steel); border-radius: 50%; }
.tag-conf-med { color: var(--athera-charcoal-light); }
.tag-conf-high::before { background: var(--athera-blue); border-radius: 50%; }
.tag-conf-high { color: var(--athera-grey); }

.tag-prio-high { color: var(--athera-charcoal); border-color: rgba(200, 149, 90, 0.45); }
.tag-prio-high::before { background: var(--athera-amber); border-radius: 50%; }
.tag-prio-medium { color: var(--athera-charcoal-light); }
.tag-prio-medium::before { background: var(--athera-steel); border-radius: 2px; }
.tag-prio-low { color: var(--athera-grey); }
.tag-prio-low::before { background: var(--athera-grey-light); transform: rotate(45deg); border-radius: 1px; }

/* ==========================================================================
   Screen 4 — Forecast Results
   ========================================================================== */

/* Charts */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.chart-card {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  padding: var(--space-4);
}
.chart-sub {
  margin: 6px 0 var(--space-3);
  font-family: var(--athera-sans);
  font-size: 12.5px;
  color: var(--athera-grey);
  max-width: 52ch;
}
.chart-holder { position: relative; height: 240px; }

/* Rollups */
.rollup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.rollup-card {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  padding: var(--space-4);
}
.rollup-card > .athera-label { display: block; margin-bottom: var(--space-2); }
.rollup-empty { margin-top: var(--space-2); }
.rollup-table { font-size: 12.5px; }
.rollup-table th { padding: 8px 10px; }
.rollup-table td { padding: 9px 10px; }
.rollup-table th:first-child, .rollup-table td:first-child { padding-left: 0; }
.rollup-flags { white-space: nowrap; }
.mini-flag {
  display: inline-block;
  min-width: 22px;
  text-align: center;
  padding: 2px 6px;
  margin-right: 4px;
  font-family: var(--athera-mono);
  font-size: 11px;
  border-radius: 3px;
  color: var(--athera-charcoal);
}
.mini-stockout { background: rgba(200, 149, 90, 0.16); }
.mini-overstock { background: rgba(138, 165, 190, 0.20); }
.mini-aging { background: rgba(107, 114, 128, 0.14); }

/* Forecast table */
.fc-table td { vertical-align: top; }
.fc-row { cursor: default; }
.fc-row-low td { background: rgba(200, 149, 90, 0.04); }
.fc-toggle-cell { text-align: right; white-space: nowrap; }
.fc-toggle {
  appearance: none;
  background: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-family: var(--athera-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--athera-blue-deep);
  cursor: pointer;
  transition: color var(--ease);
}
.fc-toggle:hover { color: var(--athera-charcoal); }
.fc-chevron { transition: transform var(--ease); display: inline-block; }
.fc-toggle.is-open .fc-chevron { transform: rotate(90deg); }
.fc-row-open td { background: var(--athera-off-white); border-bottom-color: transparent; }
.fc-row-flash td { animation: fc-flash 1.4s ease; }
@keyframes fc-flash {
  0%, 100% { background: transparent; }
  25% { background: rgba(95, 184, 214, 0.16); }
}
@media (prefers-reduced-motion: reduce) { .fc-row-flash td { animation: none; } }

.fc-detail-row td { background: var(--athera-off-white); padding-top: 0; }
.fc-detail {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--space-4);
  padding: var(--space-3) 0 var(--space-4);
  border-top: 1px solid var(--athera-line);
}
.fc-detail-summary .athera-label-blue { display: block; margin-bottom: 8px; }
.fc-detail-summary p { margin: 0; max-width: 60ch; }
.fc-detail-note {
  margin-top: var(--space-2);
  padding-left: var(--space-2);
  border-left: 2px solid var(--athera-amber);
  font-size: 13px;
  color: var(--athera-charcoal-light);
}
.fc-detail-facts {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.driver-fact {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 8px 0;
  border-bottom: 1px solid var(--athera-line-light);
}
.driver-fact:last-child { border-bottom: 0; }
.driver-key {
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--athera-grey);
  flex-shrink: 0;
}
.driver-val {
  font-family: var(--athera-sans);
  font-size: 13px;
  color: var(--athera-charcoal);
  text-align: right;
}

/* ==========================================================================
   Screen 5 — Action Recommendations
   ========================================================================== */

/* Review progress bar */
.rec-review-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  margin-bottom: var(--space-4);
}
.review-tally { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.review-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 999px;
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--athera-line);
  color: var(--athera-grey);
}
.review-pill .chip-count { color: var(--athera-charcoal); }
.review-approved { border-color: rgba(42, 143, 176, 0.4); color: var(--athera-blue-deep); }
.review-adjusted { border-color: rgba(200, 149, 90, 0.45); color: var(--athera-amber); }
.review-dismissed { color: var(--athera-grey); }
.review-pending { color: var(--athera-grey-light); }

/* Priority groups */
.rec-group { margin-bottom: var(--space-5); }
.rec-group-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.rec-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

/* Recommendation card */
.rec-card {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  transition: border-color var(--ease), opacity var(--ease);
}
.rec-card.rec-state-approved { border-left: 3px solid var(--athera-blue); }
.rec-card.rec-state-adjusted { border-left: 3px solid var(--athera-amber); }
.rec-card.rec-state-dismissed { opacity: 0.62; }
.rec-card.rec-state-dismissed .rec-explain { text-decoration: line-through; text-decoration-color: var(--athera-grey-light); }

.rec-card-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.rec-card-title { flex: 1; min-width: 0; }
.rec-card-title .cell-strong { display: block; }

.action-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 3px;
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--athera-charcoal);
  border: 1px solid var(--athera-line);
  white-space: nowrap;
}
.action-badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 2px;
  background: var(--athera-grey-light);
}
.action-replenish::before { background: var(--athera-blue); border-radius: 50%; }
.action-replenish { border-color: rgba(95, 184, 214, 0.45); }
.action-transfer::before { background: var(--athera-steel); }
.action-transfer { border-color: rgba(138, 165, 190, 0.5); }
.action-markdown::before { background: var(--athera-amber); transform: rotate(45deg); border-radius: 1px; }
.action-markdown { border-color: rgba(200, 149, 90, 0.45); }
.action-hold::before { background: var(--athera-grey-light); }

.rec-status {
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.rec-status-approved { color: var(--athera-blue-deep); background: rgba(42, 143, 176, 0.12); }
.rec-status-adjusted { color: var(--athera-amber); background: rgba(200, 149, 90, 0.14); }
.rec-status-dismissed { color: var(--athera-grey); background: rgba(107, 114, 128, 0.12); }

.rec-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--athera-line-light);
  border-bottom: 1px solid var(--athera-line-light);
  margin-bottom: var(--space-3);
}
.rec-metric { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rec-metric-k {
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--athera-grey);
}
.rec-metric-v { font-family: var(--athera-sans); font-size: 14px; color: var(--athera-charcoal); }
.metric-strong { font-family: var(--athera-display); font-size: 22px; font-weight: 400; line-height: 1; }
.metric-was {
  margin-left: 8px;
  font-family: var(--athera-mono);
  font-size: 11px;
  color: var(--athera-grey-light);
  text-decoration: line-through;
}
.rec-explain { margin: 0 0 var(--space-3); color: var(--athera-charcoal-light); font-size: 14px; line-height: 1.6; }
.rec-note-shown {
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--athera-surface);
  border-radius: 3px;
  font-size: 13px;
  color: var(--athera-charcoal-light);
}
.rec-note-shown .athera-label { display: block; margin-bottom: 3px; }

.rec-review {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: var(--space-2);
}
.rec-review-label { margin-right: 4px; }
.rec-btn {
  appearance: none;
  padding: 7px 14px;
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 2px;
  font-family: var(--athera-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--athera-charcoal-light);
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.rec-btn:hover { border-color: var(--athera-grey-light); color: var(--athera-charcoal); }
.rec-approve[aria-pressed="true"] {
  background: var(--athera-blue);
  border-color: var(--athera-blue);
  color: var(--athera-navy);
}
.rec-adjust-btn[aria-pressed="true"] {
  background: rgba(200, 149, 90, 0.16);
  border-color: var(--athera-amber);
  color: var(--athera-amber);
}
.rec-dismiss[aria-pressed="true"] {
  background: var(--athera-charcoal);
  border-color: var(--athera-charcoal);
  color: #fff;
}

/* Adjust panel */
.rec-adjust {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--athera-line);
}
.rec-adjust-row { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.rec-adjust-field { display: flex; flex-direction: column; gap: 6px; }
.rec-adjust-field .athera-label { color: var(--athera-grey); }
.rec-adjust-note { flex: 1; min-width: 160px; }
.rec-adjust-qty, .rec-adjust-text {
  padding: 9px 12px;
  font-family: var(--athera-sans);
  font-size: 14px;
  color: var(--athera-charcoal);
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 3px;
}
.rec-adjust-qty { width: 120px; }
.rec-adjust-text { width: 100%; }
.rec-adjust-qty:focus-visible, .rec-adjust-text:focus-visible {
  outline: 2px solid var(--athera-blue-deep);
  outline-offset: 2px;
  border-color: var(--athera-blue-deep);
}
.rec-adjust-actions { display: flex; align-items: center; gap: var(--space-2); }

/* ==========================================================================
   Screen 6 — Inventory Planning Brief
   ========================================================================== */
.brief-doc {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  padding: var(--space-6);
  max-width: 900px;
}
.brief-doc-head { margin-bottom: var(--space-5); }
.brief-doc-head .athera-label-blue { display: block; margin-bottom: var(--space-2); }
.brief-doc-title { margin: 0; }
.brief-meta { margin: var(--space-2) 0 0; font-size: 11px; color: var(--athera-grey-light); }
.brief-doc-head .blue-rule { margin-top: var(--space-4); margin-bottom: 0; }

.brief-section { margin-bottom: var(--space-5); }
.brief-section-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.brief-num { font-size: 11px; color: var(--athera-grey-light); }
.brief-section-title {
  font-family: var(--athera-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--athera-charcoal);
}
.brief-lead { margin: 0; max-width: 70ch; }
.brief-narrative { margin: 0 0 var(--space-3); max-width: 72ch; color: var(--athera-charcoal-light); }
.brief-list { margin: 0; padding-left: 1.1em; }
.brief-list li { margin-bottom: var(--space-1); color: var(--athera-charcoal-light); }
.brief-disclaimer { margin-top: var(--space-5); }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 1000px) {
  .chart-grid { grid-template-columns: 1fr; }
  .rec-list { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .upload-fields { grid-template-columns: 1fr; }
  .field-action { align-items: stretch; }
  .rollup-grid { grid-template-columns: 1fr; }
  .fc-detail { grid-template-columns: 1fr; }
  .results-toolbar { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 720px) {
  :root { --page-pad: 24px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .site-header .container { min-height: 64px; }
  .product-name { font-size: 20px; }
  .field-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .data-scopebar { align-items: flex-start; }
}

@media (max-width: 480px) {
  .stat-row { grid-template-columns: 1fr; }
}
