/* =================================================================
   MARGIN VISIBILITY — DESIGN SYSTEM STYLESHEET
   This file is the production design system. Token names mirror
   spec 012 exactly. Changes here must also be reflected in
   specs/012-design-system.md.
   ================================================================= */

/* =================================================================
   TOKENS (spec 012)
   ================================================================= */
:root {
  /* Colour — neutrals */
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-soft: #F5F5F5;
  --surface-tint: #FAFAFB;
  --border: #EAEAEA;
  --border-strong: #D4D4D4;
  --text: #111111;
  --text-medium: #555555;
  --text-soft: #888888;

  /* Colour — brand (YinMn 3A4E93 — single in-product accent) */
  --accent: #3A4E93;
  --accent-hover: #2F4078;
  --accent-soft: #EEF0F8;
  --accent-text: #FFFFFF;

  /* Colour — semantic (data only) */
  --green: #0E7C4A;
  --green-bg: #E8F5EE;
  --amber: #B45309;
  --amber-bg: #FEF3C7;
  --red: #B91C1C;
  --red-bg: #FEE2E2;
  --neutral-chip-bg: #F0F0F0;
  --neutral-chip-text: #555555;

  /* Spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* Type */
  --t-display: 32px;
  --t-h1: 22px;
  --t-h2: 18px;
  --t-section: 13px;
  --t-body: 16px;
  --t-numeric: 15px;
  --t-small: 13px;
  --t-micro: 11px;

  /* Tap targets */
  --tap-min: 48px;
}

/* =================================================================
   RESET + BASE
   ================================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--t-body);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
.tabular { font-variant-numeric: tabular-nums; }
.numeric { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* =================================================================
   TYPOGRAPHY UTILITIES
   ================================================================= */
.t-display { font-size: var(--t-display); font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.t-h1 { font-size: var(--t-h1); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.t-h2 { font-size: var(--t-h2); font-weight: 600; line-height: 1.3; }
.t-section { font-size: var(--t-section); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-medium); }
.t-body { font-size: var(--t-body); }
.t-small { font-size: var(--t-small); }
.t-micro { font-size: var(--t-micro); font-weight: 500; }
.t-soft { color: var(--text-soft); }
.t-medium { color: var(--text-medium); }

/* =================================================================
   COMPONENTS
   ================================================================= */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap-min);
  padding: 0 20px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.btn--primary { background: var(--accent); color: var(--accent-text); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.btn--secondary:hover { background: var(--surface-soft); }
.btn--ghost { background: transparent; color: var(--accent); }
.btn--block { width: 100%; }
.btn--small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: 0.65; cursor: not-allowed; }
.btn.is-loading { cursor: progress; }

/* In-button spinner shown while a save is in flight (inherits the button's
   text colour via currentColor, so it reads on every variant). */
.btn__spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: mv-spin 0.6s linear infinite;
  flex-shrink: 0;
}
@keyframes mv-spin { to { transform: rotate(360deg); } }

/* While a save is in flight, lock the form so no edit can race the write. The
   in-flight button keeps its spinner; everything else is non-interactive and
   gently dimmed to signal the brief busy state. */
body.form-busy { cursor: progress; }
body.form-busy main,
body.form-busy .savebar { pointer-events: none; }
body.form-busy main { opacity: 0.6; transition: opacity 0.15s ease; }

/* Inputs */
.input, .select {
  width: 100%;
  min-height: var(--tap-min);
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--t-body);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input--currency { padding-left: 30px; }
.field { position: relative; }
.field__label { display: block; font-size: var(--t-small); font-weight: 500; color: var(--text-medium); margin-bottom: 6px; }
.field__hint { font-size: var(--t-micro); color: var(--text-soft); margin-top: 6px; }
.field__error { font-size: var(--t-micro); color: var(--red); margin-top: 6px; font-weight: 500; }
.field__currency-prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-soft); font-size: var(--t-body); pointer-events: none; }
.field-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .field-grid--2 { grid-template-columns: 1fr 1fr; } }

/* Toggle */
.toggle { position: relative; display: inline-block; width: 44px; height: 26px; }
.toggle input { display: none; }
.toggle__track { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background 0.2s; }
.toggle__track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; background: var(--surface); border-radius: 999px; transition: transform 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.toggle input:checked + .toggle__track { background: var(--accent); }
.toggle input:checked + .toggle__track::after { transform: translateX(18px); }

/* Pill / chip */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: var(--t-micro); font-weight: 500; border-radius: var(--r-pill); background: var(--neutral-chip-bg); color: var(--neutral-chip-text); letter-spacing: 0.02em; }
.pill--vat-s { background: #F0F0F0; color: #555; }
.pill--vat-e { background: var(--accent-soft); color: var(--accent); }
.pill--vat-m { background: var(--amber-bg); color: var(--amber); }
.pill--ai { background: var(--amber-bg); color: var(--amber); font-weight: 600; }

/* Delta chip */
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: var(--t-micro); font-weight: 600; padding: 2px 6px; border-radius: var(--r-sm); font-variant-numeric: tabular-nums; }
.delta--good { color: var(--green); background: var(--green-bg); }
.delta--bad { color: var(--red); background: var(--red-bg); }
.delta--neutral { color: var(--text-medium); background: var(--surface-soft); }
.delta--inline { padding: 0; background: transparent; }
.delta--inline.delta--good { color: var(--green); }
.delta--inline.delta--bad { color: var(--red); }

/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-4); }
.card--padded { padding: var(--s-5); }
.card--dark { background: var(--text); color: var(--surface); border-color: var(--text); }
.card--dark .t-medium, .card--dark .t-soft { color: rgba(255,255,255,0.6); }
.card--tinted { background: var(--surface-soft); border-color: var(--border); }
.card--attention { border-left: 3px solid var(--amber); padding-left: calc(var(--s-4) - 2px); }

/* RAG dot */
.rag-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.rag-dot--green { background: var(--green); }
.rag-dot--amber { background: var(--amber); }
.rag-dot--red { background: var(--red); }

/* Section header pattern (form) */
.section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 16px; overflow: hidden; }
.section__header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; width: 100%; text-align: left; min-height: 64px; }
.section__num { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--text); color: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.section--complete .section__num { background: var(--accent); }
.section__title { flex: 1; min-width: 0; }
.section__title-line { font-size: var(--t-body); font-weight: 600; color: var(--text); }
.section__summary { font-size: var(--t-small); color: var(--text-soft); margin-top: 2px; }
.section__edit-btn { font-size: 13px; font-weight: 600; color: var(--accent); padding: 8px 12px; border-radius: var(--r-sm); min-height: 36px; display: flex; align-items: center; border: 1px solid var(--accent-soft); background: var(--accent-soft); }
.section__chevron { width: 20px; height: 20px; flex-shrink: 0; color: var(--text-soft); transition: transform 0.2s; }
.section.is-open .section__chevron { transform: rotate(180deg); }
.section__body { padding: 0 16px 16px; border-top: 1px solid var(--border); padding-top: 16px; display: none; }
.section.is-open .section__body { display: block; }
.section__intro { font-size: var(--t-small); color: var(--text-medium); margin-bottom: 16px; line-height: 1.5; }
.section__save { display: flex; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Sticky save bar */
.savebar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 16px; display: flex; gap: 8px; z-index: 10; box-shadow: 0 -4px 12px rgba(0,0,0,0.04); }

/* Form top bar + intro */
.form-topbar { background: var(--surface); padding: 16px; border-bottom: 1px solid var(--border); }
.form-topbar__brand { font-size: 13px; font-weight: 600; color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 4px; }
.form-topbar__client { font-size: var(--t-h1); font-weight: 600; }
.form-topbar__sub { font-size: var(--t-small); color: var(--text-soft); margin-top: 2px; }

/* Onboarding progress strip */
.progress-strip { background: var(--accent-soft); border-bottom: 1px solid var(--accent-soft); padding: 14px 16px; }
.progress-strip__title { font-size: var(--t-small); font-weight: 600; color: var(--accent); margin-bottom: 8px; }
.progress-strip__steps { display: flex; gap: 6px; }
.progress-strip__step { flex: 1; height: 4px; background: rgba(58, 78, 147, 0.2); border-radius: 2px; }
.progress-strip__step.is-done { background: var(--accent); }
.progress-strip__step.is-current { background: var(--accent); }

.form-page { padding: 16px; padding-bottom: 16px; }

/* Sources section */
.sources-grid { display: flex; flex-direction: column; gap: 8px; }
.source-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.source-row__check { width: 22px; height: 22px; border: 2px solid var(--border-strong); border-radius: 5px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.source-row.is-selected .source-row__check { background: var(--accent); border-color: var(--accent); color: white; }
.source-row__name { flex: 1; font-weight: 500; }
.source-row__type { font-size: var(--t-small); color: var(--text-soft); }
.source-row__fee { width: 96px; }
.source-row__fee .input { min-height: 40px; padding: 8px 10px; font-size: 14px; text-align: right; }

/* Categories list */
.cat-row { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); margin-bottom: 8px; }
.cat-row__drag { color: var(--text-soft); flex-shrink: 0; }
.cat-row__main { flex: 1; min-width: 0; }
.cat-row__name { font-weight: 500; font-size: var(--t-body); }
.cat-row__meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.cat-row__cost { font-size: var(--t-small); color: var(--text-medium); font-variant-numeric: tabular-nums; }
.cat-row__edit { color: var(--accent); font-size: 13px; font-weight: 600; padding: 8px 10px; min-height: 36px; }
/* Spec 020 — the contained 'Open / Miscellaneous' placeholder bucket. Reads as a
   holding pen (dashed border, muted surface) rather than a normal costed group. */
.cat-row--placeholder { border-style: dashed; background: var(--neutral-chip-bg, #f4f5f7); }
.cat-row__note { font-size: var(--t-small); color: var(--text-medium); margin-top: 6px; line-height: 1.4; }
.pill--placeholder { background: var(--neutral-chip-bg, #eceef1); color: var(--text-medium, #556); }
.cat-editor--placeholder .input[data-edit-cost][disabled] { opacity: 0.6; cursor: not-allowed; }

.add-row { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 14px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); background: transparent; color: var(--accent); font-weight: 600; font-size: 14px; width: 100%; margin-top: 4px; }

/* Product card */
.product-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 8px; overflow: hidden; }
.product-card.is-attention { border-left: 3px solid var(--amber); }
.product-card__compact { display: flex; align-items: center; gap: 12px; padding: 14px; width: 100%; text-align: left; min-height: 56px; }
.product-card__code { font-size: var(--t-micro); color: var(--text-soft); font-family: 'Inter', monospace; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.product-card__name { font-size: var(--t-body); font-weight: 500; margin-top: 2px; }
.product-card__cat { font-size: var(--t-small); color: var(--text-medium); }
.product-card__main { flex: 1; min-width: 0; }
.product-card__chevron { color: var(--text-soft); flex-shrink: 0; }
.product-card__expanded { display: none; padding: 0 14px 14px; border-top: 1px solid var(--border); padding-top: 14px; }
.product-card.is-open .product-card__expanded { display: block; }
.product-card.is-open .product-card__chevron { transform: rotate(180deg); }
.product-card__prices { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); font-size: var(--t-small); }
.product-card__prices dt { color: var(--text-soft); }
.product-card__prices dd { font-variant-numeric: tabular-nums; font-weight: 500; text-align: right; }
.product-card__ai-banner { background: var(--amber-bg); color: var(--amber); padding: 8px 14px; font-size: var(--t-micro); font-weight: 600; display: flex; align-items: center; gap: 6px; letter-spacing: 0.02em; text-transform: uppercase; }

.products-summary { background: var(--amber-bg); border: 1px solid #FACC15; border-radius: var(--r-md); padding: 14px; margin-bottom: 16px; font-size: var(--t-small); color: var(--amber); }
.products-summary strong { font-weight: 700; }

/* Help text inline */
.helptext { font-size: var(--t-small); color: var(--text-medium); background: var(--accent-soft); border-radius: var(--r-sm); padding: 10px 12px; line-height: 1.5; margin-bottom: 16px; }

/* Fixed costs grid — 1 column on mobile, 3 columns on tablet+ (added pass 1.36) */
.fixed-cost-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 600px) { .fixed-cost-grid { grid-template-columns: repeat(3, 1fr); } }
.fixed-cost-input__label { display: block; font-size: var(--t-small); font-weight: 500; color: var(--text-medium); margin-bottom: 6px; }
.fixed-cost-input__hint { font-size: var(--t-micro); color: var(--text-soft); margin-top: 6px; line-height: 1.4; }

/* Bulk-assign — initial categorization flow when 40-200 items first land (added pass 1.36) */
.bulk-intro { background: var(--accent-soft); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 16px; }
.bulk-intro__title { font-size: 14px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.bulk-intro__body { font-size: 13px; color: var(--text-medium); line-height: 1.5; }
.bulk-intro__body strong { color: var(--text); font-weight: 600; }

.bulk-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px 12px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
.bulk-group--mixed { border-left: 3px solid var(--amber); }
.bulk-group--unsorted { border-left: 3px solid var(--text-soft); background: var(--surface-soft); }

.bulk-group__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.bulk-group__name { font-size: 15px; font-weight: 600; color: var(--text); }
.bulk-group__count { font-size: 11px; font-weight: 600; color: var(--text-soft); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.bulk-group__meta { font-size: 11px; color: var(--text-soft); margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.bulk-group__meta .pill { vertical-align: middle; margin-right: 6px; }

.bulk-group__preview { font-size: 13px; color: var(--text-medium); line-height: 1.5; margin-bottom: 12px; padding: 10px 12px; background: var(--surface-soft); border-radius: var(--r-sm); }
.bulk-group__preview-more { color: var(--text-soft); font-style: italic; }

.bulk-group__actions { display: flex; flex-direction: column; gap: 6px; }
.bulk-group__primary { display: flex; align-items: center; justify-content: center; min-height: var(--tap-min); padding: 0 14px; background: var(--accent); color: var(--accent-text); border-radius: var(--r-md); font-size: 14px; font-weight: 600; border: none; cursor: pointer; }
.bulk-group__primary:hover { background: var(--accent-hover); }
.bulk-group__primary--review { background: transparent; color: var(--accent); border: 1px solid var(--border-strong); }
.bulk-group__primary--review:hover { background: var(--surface-soft); }
.bulk-group__expand { font-size: 13px; color: var(--text-medium); background: transparent; border: none; padding: 8px 0 4px; cursor: pointer; text-align: center; font-weight: 500; }
.bulk-group__expand:hover { color: var(--accent); }

/* VAT pill variants used in the form (some defined elsewhere; consolidated here) */
.pill--vat-z { background: #E0F2FE; color: #075985; }

/* Category inline editor — appears in place of a category row when editing or adding (added pass 1.37) */
.cat-editor { background: var(--surface); border: 1.5px solid var(--accent); border-radius: var(--r-md); padding: 18px 16px 14px; margin: 8px 0; box-shadow: 0 2px 8px rgba(58, 78, 147, 0.08); }
.cat-editor__title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin-bottom: 14px; }

.cat-editor__field { margin-bottom: 14px; }
.cat-editor__field:last-of-type { margin-bottom: 0; }

.cat-editor__items { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.cat-editor__items-head { margin-bottom: 12px; }
.cat-editor__items-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-medium); margin-bottom: 4px; }
.cat-editor__items-help { font-size: 12px; color: var(--text-soft); line-height: 1.5; margin: 0; }
.cat-editor__items-help strong { color: var(--text-medium); font-weight: 600; }

.cat-editor__items-list { margin-top: 10px; }
.cat-editor__item { display: grid; grid-template-columns: 1fr auto 100px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.cat-editor__item:last-child { border-bottom: none; }
.cat-editor__item-name { font-size: 14px; font-weight: 500; color: var(--text); }
.cat-editor__item-price { font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; min-width: 50px; text-align: right; }
.cat-editor__item-exempt { position: relative; }
.cat-editor__item-exempt .field__currency-prefix { left: 10px; font-size: 12px; }
.cat-editor__item-exempt .input { padding-left: 22px; height: 38px; font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; padding-right: 10px; }

.cat-editor__items-empty { padding: 16px 12px; background: var(--surface-soft); border-radius: var(--r-sm); font-size: 13px; color: var(--text-soft); text-align: center; line-height: 1.5; }

.cat-editor__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.cat-editor__actions .btn { min-width: 0; }

/* Hide items section when editor is not in mixed mode */
.cat-editor:not([data-vat="mixed"]) .cat-editor__items { display: none; }

/* Subtle slide-in for the editor */
.cat-editor { animation: catEditorIn 0.15s ease-out; }
@keyframes catEditorIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* Fixed costs total — appears below the 3-input grid (added pass 1.40) */
.fixed-cost-total { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-medium); font-variant-numeric: tabular-nums; display: flex; justify-content: space-between; align-items: baseline; }
.fixed-cost-total strong { color: var(--text); font-size: 18px; font-weight: 700; }
.fixed-cost-total__label { font-size: 13px; color: var(--text-medium); }

/* Source row — interactive variant. Toggle on left, fee disappears when inactive (added pass 1.40) */
.source-row { cursor: pointer; transition: border-color 0.15s; }
.source-row:hover { border-color: var(--accent); }
.source-row.is-selected { background: var(--accent-soft); border-color: var(--accent-soft); }
.source-row__fee-suffix { display: inline-block; margin-left: 4px; color: var(--text-soft); font-size: 13px; }
.source-row__fee-cell { display: flex; align-items: center; gap: 4px; }
.source-row__fee-cell .input { min-height: 38px; padding: 6px 8px; font-size: 13px; text-align: right; max-width: 60px; }

/* Source row "no orders" state — a platform shown but inactive with no order data */
.source-row.is-blank { opacity: 0.7; background: var(--surface-soft); }
.source-row.is-blank .source-row__type { font-style: italic; }

/* Source row "detected but not enabled" state — order data exists for this channel
   but the operator hasn't switched it on. An accent nudge (spec 004 §1), visually
   distinct from active (filled) and dormant (dimmed). */
.source-row.is-detected { border-color: var(--accent); border-style: dashed; background: var(--accent-soft); }
.source-row.is-detected .source-row__type { color: var(--accent); font-weight: 500; }

/* Product card "new item" reframe — confident, no permission-asking (added pass 1.40) */
.product-card--new { border-left: 3px solid var(--accent); }
.product-card__new-pill { display: inline-block; padding: 1px 7px; background: var(--accent); color: var(--accent-text); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; border-radius: var(--r-pill); margin-left: 8px; vertical-align: 2px; }
.product-card__change-link { font-size: 12px; color: var(--accent); font-weight: 500; padding: 4px 0; cursor: pointer; }

/* Management mode — products grouped by category (accordion).
   Each category is a collapsible group. Groups containing newly auto-assigned items
   are highlighted (.has-new) and expanded by default. Matches operator workflow:
   Tuesday email says "we added X to Mains" → operator opens form → Mains group
   already expanded with X at the top. (Added pass 1.41 — Form polish PR.) */
.mgmt-cat-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 12px; overflow: hidden; }
.mgmt-cat-group.has-new { border-left: 3px solid var(--accent); }
.mgmt-cat-group__header { display: flex; align-items: center; gap: 12px; padding: 14px; width: 100%; text-align: left; background: transparent; border: 0; cursor: pointer; font: inherit; color: inherit; }
.mgmt-cat-group__header:hover { background: var(--surface-soft); }
.mgmt-cat-group__name { font-size: var(--t-body); font-weight: 600; flex: 1; }
.mgmt-cat-group__count { font-size: var(--t-small); color: var(--text-soft); font-variant-numeric: tabular-nums; }
.mgmt-cat-group__new-pill { display: inline-block; padding: 1px 7px; background: var(--accent); color: var(--accent-text); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; border-radius: var(--r-pill); margin-left: 8px; vertical-align: 2px; }
.mgmt-cat-group__chevron { color: var(--text-soft); flex-shrink: 0; transition: transform 0.15s ease; }
.mgmt-cat-group.is-open .mgmt-cat-group__chevron { transform: rotate(180deg); }
.mgmt-cat-group__body { display: none; padding: 0 14px 14px; }
.mgmt-cat-group.is-open .mgmt-cat-group__body { display: block; }
.mgmt-cat-group__body .product-card { margin-bottom: 8px; }
.mgmt-cat-group__body .product-card:last-child { margin-bottom: 0; }

/* Per-item review row inside an expanded bulk-group (added pass 1.38) */
.bulk-item-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 8px; }
.bulk-item-row:last-child { margin-bottom: 0; }
.bulk-item-row__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.bulk-item-row__name { font-size: 14px; font-weight: 600; color: var(--text); }
.bulk-item-row__price { font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.bulk-item-row.is-confirmed { background: #F0F9F4; border-color: #C8E6D2; }
.bulk-item-row.is-confirmed .bulk-item-row__name::after { content: ' ✓'; color: var(--green); font-weight: 700; }

.bulk-group__done-banner { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--green); }
.bulk-group--done { background: #F0F9F4; border-color: #C8E6D2; }
.bulk-group--done .bulk-group__primary { background: var(--green); }

/* ── Item → group assignment (onboarding Section 4) ─────────────────────── */
.assign-progress { margin-bottom: 14px; }
.assign-progress__bar { height: 8px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--r-pill); overflow: hidden; }
.assign-progress__fill { height: 100%; width: 0; background: var(--accent); border-radius: var(--r-pill); transition: width 0.3s ease; }
.assign-progress.is-complete .assign-progress__fill { background: var(--green); }
.assign-progress__label { font-size: var(--t-micro); font-weight: 600; color: var(--text-soft); margin-top: 6px; font-variant-numeric: tabular-nums; }
.assign-progress.is-complete .assign-progress__label { color: var(--green); }

.assign-list { display: flex; flex-direction: column; gap: 8px; }
.assign-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
.assign-row__top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.assign-row__info { flex: 1 1 140px; min-width: 0; }
.assign-row__name { font-size: 14px; font-weight: 600; color: var(--text); }
.assign-row__price { font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; margin-top: 2px; }
.assign-row__select { flex: 1 1 200px; min-width: 180px; }
.assign-row__exempt { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border-strong); }

/* UI-7: multi-select bulk assignment */
.assign-row__check { flex: 0 0 auto; width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.assign-row__info[data-bulk-toggle] { cursor: pointer; }
.assign-row.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* Feedback for a Mixed-VAT bulk move: the rows stay put, so pulse them + note it. */
.assign-row--just { animation: recap-item-pulse 0.9s ease; }
.bulk-grouped-note { font-size: 13px; font-weight: 500; color: var(--accent); background: var(--accent-soft); border-radius: var(--r-md); padding: 10px 14px; margin-bottom: 8px; line-height: 1.4; }

.bulk-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.bulk-controls__search { flex: 1 1 160px; min-width: 0; }
.bulk-controls__selectall { flex: 0 0 auto; min-height: var(--tap-min); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: transparent; color: var(--accent); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.bulk-controls__selectall:hover { background: var(--surface-soft); }
.bulk-controls__sort { flex: 0 0 auto; max-width: 200px; }

/* Dark neutral (not accent) so it reads as a separate selection toolbar, distinct
   from the blue "Save and finish setup" bar it sits above. */
.bulk-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; background: var(--text); color: var(--surface); box-shadow: 0 -4px 12px rgba(0,0,0,0.18); }
/* display:flex above would otherwise defeat the `hidden` attribute — restore it. */
.bulk-bar[hidden] { display: none; }
.bulk-bar__count { flex: 0 0 auto; font-size: 14px; font-weight: 600; white-space: nowrap; }
.bulk-bar__action { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.bulk-bar__group { flex: 1 1 auto; min-width: 140px; max-width: 260px; }
.bulk-bar__clear { flex: 0 0 auto; min-height: 40px; padding: 0 14px; border: 1px solid rgba(255,255,255,0.5); border-radius: var(--r-md); background: transparent; color: var(--accent-text); font-size: 13px; font-weight: 600; cursor: pointer; }
.bulk-bar__clear:hover { background: rgba(255,255,255,0.12); }

.bulk-empty { font-size: 13px; color: var(--text-medium); background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; text-align: center; line-height: 1.5; }
.bulk-allset { text-align: center; background: var(--green-bg); border: 1px solid #C8E6D2; border-radius: var(--r-md); padding: 16px; }
.bulk-allset__title { font-size: 14px; font-weight: 700; color: var(--green); }
.bulk-allset__body { font-size: 13px; color: var(--text-medium); margin-top: 4px; }

.assigned-recap { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.assigned-recap__toggle { display: flex; align-items: center; gap: 6px; width: 100%; background: transparent; border: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-medium); padding: 4px 0; }
.assigned-recap__toggle .icon { width: 16px; height: 16px; transition: transform 0.2s; }
.assigned-recap.is-open .assigned-recap__toggle .icon { transform: rotate(180deg); }
.assigned-recap__body { display: none; margin-top: 8px; }
.assigned-recap.is-open .assigned-recap__body { display: block; }
.assigned-recap__group { margin-bottom: 10px; }
.assigned-recap__group-head { font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: 4px; }
.assigned-recap__group-head span { color: var(--text-soft); font-weight: 500; }
.assigned-recap__item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 10px; background: var(--green-bg); border-radius: var(--r-sm); margin-bottom: 4px; }
.assigned-recap__item-name { font-size: 13px; color: var(--text); }
.assigned-recap__change { background: transparent; border: none; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; flex-shrink: 0; }

/* UI-4: one gentle green pulse confirming a just-assigned item. Row ring when the
   recap is expanded; header wash when it's collapsed (row is hidden then). */
.assigned-recap__item--just { animation: recap-item-pulse 0.9s ease; }
@keyframes recap-item-pulse {
  0%   { box-shadow: 0 0 0 0 var(--green); }
  40%  { box-shadow: 0 0 0 2px var(--green); }
  100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}
.assigned-recap__toggle--pulse { animation: recap-head-pulse 0.9s ease; border-radius: var(--r-sm); }
@keyframes recap-head-pulse {
  0%, 100% { background: transparent; }
  40%      { background: var(--green-bg); }
}

.section--flash { animation: section-flash 1.2s ease; }
@keyframes section-flash { 0%, 100% { box-shadow: none; } 25%, 65% { box-shadow: 0 0 0 3px var(--red-bg), 0 0 0 4px var(--red); } }

/* ── Onboarding completion overlay ──────────────────────────────────────── */
.success-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(17,17,17,0.45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
/* An author `display` rule overrides the UA `[hidden] { display: none }`, so the
   overlay would otherwise render on page load. Keep it hidden until
   showSuccessOverlay() clears the `hidden` attribute after a successful finish. */
.success-overlay[hidden] { display: none; }
.success-card { background: var(--surface); border-radius: var(--r-lg); max-width: 460px; width: 100%; padding: 32px 28px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.18); animation: success-pop 0.35s ease; }
@keyframes success-pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.success-card__check { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: var(--green-bg); color: var(--green); display: flex; align-items: center; justify-content: center; }
.success-card__check svg { width: 32px; height: 32px; }
.success-card__title { font-size: 22px; font-weight: 700; color: var(--text); margin: 0 0 6px; line-height: 1.25; }
.success-card__sub { font-size: 14px; color: var(--text-medium); margin: 0 0 24px; }
.success-card__next { text-align: left; background: var(--surface-soft); border-radius: var(--r-md); padding: 18px 18px 6px; margin-bottom: 20px; }
.success-card__next-title { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-soft); margin-bottom: 14px; }
.success-next-list { list-style: none; margin: 0; padding: 0; }
.success-next-list li { display: flex; gap: 12px; margin-bottom: 14px; font-size: 13px; color: var(--text-medium); line-height: 1.5; }
.success-next-list strong { color: var(--text); font-weight: 600; }
.success-next-list__num { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.success-card__foot { font-size: 12px; color: var(--text-soft); margin: 14px 0 0; }

/* =================================================================
   REPORT
   ================================================================= */
.report-topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 0; position: sticky; top: 0; z-index: 20; }
.report-topbar__inner { max-width: 720px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.report-topbar__client { display: flex; flex-direction: column; min-width: 0; }
.report-topbar__brand { font-size: 11px; font-weight: 600; color: var(--accent); letter-spacing: 0.06em; text-transform: uppercase; }
.report-topbar__name { font-size: 15px; font-weight: 600; }
.report-topbar__nav { display: flex; align-items: center; gap: 4px; }
.report-topbar__nav-btn { min-width: var(--tap-min); min-height: var(--tap-min); display: flex; align-items: center; justify-content: center; border-radius: var(--r-md); color: var(--text-medium); }
.report-topbar__nav-btn:hover { background: var(--surface-soft); color: var(--text); }
.report-topbar__nav-btn:disabled { color: var(--border-strong); cursor: not-allowed; }
.report-topbar__week { font-size: 13px; font-weight: 500; color: var(--text-medium); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Week picker (REP-03, spec 009 §Topbar) — a native <select> styled to match the
   __week label: same type + tabular figures, centred, with a ▾ affordance drawn by
   the wrapper. Native control keeps keyboard/SR behaviour out of the box. */
.report-topbar__picker-wrap { position: relative; display: inline-flex; align-items: center; }
.report-topbar__picker-wrap::after { content: "▾"; position: absolute; right: 7px; top: 50%; transform: translateY(-50%); font-size: 10px; line-height: 1; color: var(--text-medium); pointer-events: none; }
.report-topbar__picker { appearance: none; -webkit-appearance: none; -moz-appearance: none; font: inherit; font-size: 13px; font-weight: 500; color: var(--text-medium); font-variant-numeric: tabular-nums; white-space: nowrap; background: transparent; border: none; border-radius: var(--r-md); min-height: var(--tap-min); padding: 0 20px 0 8px; cursor: pointer; text-align: center; text-align-last: center; }
.report-topbar__picker:hover { background: var(--surface-soft); color: var(--text); }
.report-topbar__picker:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }


/* =================================================================
   AUTH (added pass 1.43) — magic-link login. Single-card centered layout.
   Two states: input (collect email) + sent (confirm link delivered).
   ================================================================= */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--surface-soft); padding: 24px 16px; box-sizing: border-box; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 32px 28px 28px; max-width: 400px; width: 100%; box-shadow: 0 4px 16px rgba(0,0,0,0.05); box-sizing: border-box; }
.auth-brand { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-bottom: 28px; text-align: center; }
.auth-state { display: none; }
.auth-state.is-active { display: block; }
.auth-title { font-size: 22px; font-weight: 600; color: var(--text); margin: 0 0 10px; text-align: center; line-height: 1.3; letter-spacing: -0.01em; }
.auth-subtitle { font-size: 14px; color: var(--text-medium); line-height: 1.55; margin: 0 0 24px; text-align: center; }
.auth-subtitle strong { color: var(--text); font-weight: 600; }
.auth-form { margin-bottom: 18px; }
.auth-form .field { margin-bottom: 14px; }
.auth-form .btn { width: 100%; }
.auth-footnote { font-size: 12px; color: var(--text-soft); line-height: 1.55; text-align: center; margin: 0; }
.auth-footnote a { color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.auth-success-icon { width: 56px; height: 56px; background: #E8F5EE; color: var(--green); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.auth-success-icon svg { width: 26px; height: 26px; }
.auth-error { background: #FEF2F2; border: 1px solid #FCA5A5; color: #B91C1C; padding: 10px 12px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 14px; line-height: 1.5; }

/* Stale-data banner — top-of-report warning when cost inputs are >90 days old (added pass 1.42) */
/* Constrained to the report content column (max-width matches .page / .foot),
   not full-bleed, so it lines up with the guide, steps and footer beneath it
   (spec 009 §Stale-costs banner). Auto side margins centre it on wide viewports;
   its own padding provides the gutter on narrow ones, mirroring .page. */
.stale-banner { background: #FEF3C7; border: 1px solid #FBBF24; border-radius: var(--r-md); padding: 14px 16px; max-width: 720px; margin: 16px auto 8px; display: flex; align-items: flex-start; gap: 12px; }
.stale-banner__icon { flex-shrink: 0; color: #C2851D; margin-top: 1px; width: 24px; height: 24px; }

/* Generic SVG icon sizing — keeps inline SVGs constrained to small sizes by default. */
.icon { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.icon--lg { width: 20px; height: 20px; }

/* Flag — "Things you should know" row (per spec 009 §6 + spec 012 §Components). Icon (32px circle, accent-soft bg) + body. Stale variant uses amber. */
.flag { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 8px; }
.flag__icon { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.flag__icon .icon { width: 16px; height: 16px; }
.flag__body { font-size: 13px; color: var(--text-medium); line-height: 1.55; flex: 1; min-width: 0; }
.flag__text { color: var(--text); }
.flag__text strong { font-weight: 600; }
.flag__link { color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.flag--stale .flag__icon { background: var(--amber-bg); color: var(--amber); }
.stale-banner__body { font-size: 13px; color: var(--text); line-height: 1.5; flex: 1; }
.stale-banner__body strong { font-weight: 600; }
.stale-banner__action { display: inline-block; margin-top: 6px; font-size: 13px; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* =================================================================
   REPORT — layout v2 (spec 009, the guided five-step reading path).
   Ported from mockups/report.html. The v2 palette/radius tokens are
   SCOPED to .report-shell so the form / email / auth surfaces keep the
   spec-012 tokens untouched. The .report-topbar (REP-03) and .stale-banner
   above use the global tokens and are defined earlier in this file.
   ================================================================= */
.report-shell {
  --bg: #F6F7F9; --surface: #FFFFFF; --surface-soft: #F4F6FA;
  --ink: #16192B; --text: #242A3D; --text-medium: #4C5468; --text-soft: #8A92A6;
  --line: #E4E7EE; --line-strong: #CBD2E0;
  --accent: #344A91; --accent-deep: #24376F; --accent-soft: #EEF1FA;
  --green: #197A55; --amber: #B7791F; --red: #B83A3A;
  --r: 14px; --r-sm: 10px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.report-shell .mono { font-variant-numeric: tabular-nums; }

/* Shared profit→green / loss→red mechanism (spec 009 §Shared formatting). One
   symmetric pair of classes applied at every OUTCOME £/% figure site (money kept
   or a margin) so a profit is never left in the default (or brand) ink while a
   sibling loss is red, and a loss is never left uncoloured. Neutral ink only at
   exactly zero (neither class applied). Cost line items/totals and plain counts
   never carry these — a cost is not a profit or a loss. !important so the pair
   wins over the contextual colours the figure elements otherwise carry (kept-card
   brown, qtd accent, break-even green, waterfall navy). */
.report-shell .is-neg { color: var(--red) !important; }
.report-shell .is-pos { color: var(--green) !important; }
/* The step-1 net-margin hero figure is the one outcome figure that opts out of the
   colour rule (spec 009 §Hero exception): it renders white on both profit and loss
   weeks — the minus sign + sub-line carry the sign — so it carries no is-pos/is-neg
   class and needs no hero-panel colour override. */

.page { max-width: 720px; margin: 0 auto; padding: 20px 18px 56px; }
.meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; margin: 2px 2px 14px; }
.period { font-size: 13px; color: var(--text-soft); }
.sources { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; max-width: 440px; justify-content: flex-end; }
.sources .lbl { font-size: 11px; color: var(--text-soft); }
.chip-src { font-size: 11.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 3px 10px; white-space: nowrap; }

/* reading-guide strip */
.guide { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: flex; overflow-x: auto; scrollbar-width: none; min-height: 74px; }
.guide::-webkit-scrollbar { display: none; }
.guide__start { flex: 0 0 142px; background: linear-gradient(135deg, #0D2B70, #173D90); color: #fff; padding: 12px 14px; display: flex; flex-direction: column; justify-content: center; border-radius: var(--r) 0 0 var(--r); }
.guide__start b { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.guide__start span { font-size: 10.5px; color: #D9E1F7; line-height: 1.35; margin-top: 3px; }
/* The slim mobile header line ("· read in order") shows only on the one-row
   mobile layout (spec 009 §Reading-guide strip); the full desktop panel copy is
   the default. */
.guide__start-slim { display: none; }
.guide__step { flex: 1 0 106px; padding: 12px 9px; border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; gap: 4px; text-decoration: none; color: inherit; }
.guide__step:hover { background: var(--surface-soft); }
.guide__top { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.guide__num { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.guide__step b { font-size: 12px; color: var(--ink); font-weight: 700; }
.guide__step small { font-size: 10px; color: var(--text-soft); white-space: nowrap; padding-left: 25px; }

/* numbered step beats */
.beat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-top: 16px; padding: 20px 22px; scroll-margin-top: 64px; break-inside: avoid; }
.beat__head { display: flex; gap: 12px; align-items: flex-start; }
.beat__num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: #12377F; color: #fff; font-size: 15px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin-top: 3px; }
.beat__eyebrow { font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.beat__title { font-size: 19px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; margin-top: 1px; }
.beat__line { font-size: 13.5px; color: var(--text-medium); margin-top: 2px; }
.beat__line strong { color: var(--accent-deep); font-weight: 750; }
.beat__subline { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.beat--sub .beat__head { padding-left: 42px; }

/* step 1 — margin is the primary result */
.result { display: grid; grid-template-columns: 1.04fr .96fr; gap: 12px; margin-top: 14px; align-items: stretch; }
.hero { position: relative; overflow: hidden; background: linear-gradient(145deg, #173A82 0%, #273F82 58%, #344A91 100%); border: 1px solid #183675; border-radius: var(--r-sm); padding: 18px 20px; color: #fff; display: flex; flex-direction: column; justify-content: center; min-height: 184px; }
.hero:after { content: ""; position: absolute; width: 150px; height: 150px; border-radius: 50%; right: -58px; bottom: -78px; border: 26px solid rgba(255,255,255,.055); }
.hero span { position: relative; z-index: 1; display: block; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #DDE5F8; }
.hero b { position: relative; z-index: 1; display: block; font-size: 58px; line-height: .98; font-weight: 820; letter-spacing: -.045em; color: #fff; margin-top: 8px; }
.hero small { position: relative; z-index: 1; display: block; font-size: 14px; font-weight: 650; color: #fff; margin-top: 10px; }
.hero em { position: relative; z-index: 1; font-style: normal; display: block; font-size: 11px; color: #C6D1EC; margin-top: 3px; }
.hero em a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
/* fixed-costs-not-on-file — muted so the "—" reads as pending, not a real figure */
.hero--muted { background: linear-gradient(145deg, #545E7E 0%, #5E6788 58%, #6C769A 100%); border-color: #4A5372; }
.result__side { display: grid; grid-template-rows: auto 1fr; gap: 8px; min-width: 0; }
.kept-card { background: var(--accent-soft); border: 1px solid #CAD3E8; border-radius: var(--r-sm); padding: 13px 15px; }
.kept-card span { display: block; font-size: 10px; font-weight: 800; letter-spacing: .075em; text-transform: uppercase; color: var(--accent); }
.kept-card b { display: block; font-size: 29px; line-height: 1; font-weight: 820; letter-spacing: -.025em; color: var(--accent-deep); margin-top: 5px; }
.kept-card small { display: block; font-size: 11px; color: var(--text-medium); margin-top: 5px; }
.kept-card--loss { background: #FBEEE6; border-color: #EBD3BE; }
.kept-card--loss span, .kept-card--loss b { color: #A85A17; }
.support { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sup { background: var(--surface-soft); border: 1px solid #EDF0F5; border-radius: var(--r-sm); padding: 8px 11px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.sup span { font-size: 9.5px; font-weight: 700; letter-spacing: .055em; text-transform: uppercase; color: var(--text-soft); }
.sup b { font-size: 15px; font-weight: 750; margin-top: 1px; color: var(--ink); }

/* ─────────────────────────────────────────────────────────────────────────
   Step 2 — the vertical equation stack (money-path spine), spec 009 §Step 2.
   Reference mock local/section2-equation-mock.html (frozen 2026-07-26). One
   reusable .eq* component: a slim AOV frame → − → Variable hero block → − →
   Fixed hero block → = → green Kept result, laid down a gradient spine with a
   decorative icon node per step. The spine (::before) + nodes are progressive
   enhancement (aria-hidden); the equation still reads without them. Supersedes
   the removed .order-summary / .cost-detail / .cost-rollup markup.
   ───────────────────────────────────────────────────────────────────────── */
.eq { position: relative; margin-top: 16px; padding-left: 36px; }
.eq::before { content: ""; position: absolute; left: 14px; top: 17px; bottom: 22px; width: 2px; border-radius: 999px; background: linear-gradient(180deg, #CAD3E8 0%, #B9C7E8 100%); }
.eq__step { position: relative; }
.eq__node { position: absolute; left: -36px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #fff; color: var(--accent); border: 2px solid #C9D3E8; box-shadow: 0 3px 10px rgba(30,48,93,.08); z-index: 2; }
.eq__node svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.eq__op { text-align: center; font-size: 20px; font-weight: 800; color: #6E7890; line-height: 1; margin: 7px 0; }

.eq__slim { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 15px; background: linear-gradient(180deg, #F8F9FC 0%, #F3F5F9 100%); border: 1px solid var(--line); border-radius: var(--r-sm); }
.eq__slim .copy { min-width: 0; }
.eq__slim .k { display: block; font-size: 11px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; color: var(--accent-deep); }
.eq__slim .s { display: block; margin-top: 1px; font-size: 10.5px; color: var(--text-soft); }
.eq__slim .v { font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); white-space: nowrap; }

.eq__block { overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--r); background: #fff; }
.eq__block--variable { box-shadow: inset 4px 0 0 #7187C7; }
.eq__block--fixed { box-shadow: inset 4px 0 0 #596FAE; }
.eq__bhead { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 15px 11px 18px; background: linear-gradient(180deg, #F1F4FC 0%, #ECEFF8 100%); border-bottom: 1px solid var(--line); }
.eq__bhead .h { min-width: 0; }
.eq__bhead .h b { display: block; font-size: 13px; font-weight: 800; color: var(--accent-deep); }
.eq__bhead .h span { display: block; margin-top: 1px; font-size: 10.5px; color: var(--text-medium); }
.eq__bhead .t { flex: none; font-size: 21px; font-weight: 800; letter-spacing: -.02em; color: var(--accent-deep); white-space: nowrap; }
.eq__item { display: grid; grid-template-columns: minmax(0,1fr) 104px 76px; gap: 10px; align-items: center; padding: 10px 15px 10px 18px; border-top: 1px solid var(--line); }
.eq__item:first-of-type { border-top: 0; }
.eq__iname { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 13px; font-weight: 650; color: var(--ink); }
.eq__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.eq__dot--g { background: var(--green); }
.eq__dot--a { background: var(--amber); }
.eq__dot--n { background: #AAB3C6; }
.eq__tag { flex: none; padding: 1px 5px; border-radius: 4px; background: #FBF0DE; color: var(--amber); font-size: 8.5px; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
.eq__ipct { font-size: 11.5px; color: var(--text-soft); text-align: right; }
.eq__iamt { font-size: 14px; font-weight: 750; color: var(--ink); text-align: right; }

.eq__result { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; background: linear-gradient(135deg, #EDF7F1 0%, #E5F3EB 100%); border: 1px solid #B7DEC7; border-radius: var(--r-sm); box-shadow: 0 8px 20px rgba(25,122,85,.08); }
.eq__result .copy { min-width: 0; }
.eq__result .k { display: block; font-size: 12px; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; color: var(--green); }
.eq__result .s { display: block; margin-top: 1px; font-size: 10.5px; color: #4F7D67; }
.eq__result .v { display: flex; align-items: baseline; gap: 9px; white-space: nowrap; }
.eq__result .v b { font-size: 28px; font-weight: 800; letter-spacing: -.025em; color: var(--green); }
.eq__result .pct { padding: 3px 7px; border-radius: 999px; background: #fff; border: 1px solid #C6E4D2; color: var(--green); font-size: 11px; font-weight: 750; }
/* Loss variant (spec 009 §Result panels colour by sign): mirror the green panel in
   red when kept < 0, so a negative kept-per-order no longer sits in a green box. The
   figure + pill text already go red via is-neg; this restyles the box + label. */
.eq__result--loss { background: linear-gradient(135deg, #FDECEC 0%, #FBE3E3 100%); border-color: #EBC2C2; box-shadow: 0 8px 20px rgba(185,28,28,.08); }
.eq__result--loss .k { color: var(--red); }
.eq__result--loss .s { color: #9A5656; }
.eq__result--loss .pct { border-color: #EDCBCB; }

@media (max-width: 580px) {
  .eq { padding-left: 31px; }
  .eq::before { left: 11px; }
  .eq__node { left: -31px; width: 24px; height: 24px; }
  .eq__node svg { width: 12px; height: 12px; }
  .eq__bhead .t { font-size: 19px; }
  .eq__item { grid-template-columns: 1fr auto; grid-template-areas: "name amt" "pct amt"; row-gap: 1px; }
  .eq__iname { grid-area: name; }
  .eq__iamt { grid-area: amt; align-self: center; }
  .eq__ipct { grid-area: pct; text-align: left; }
  .eq__result { align-items: flex-start; }
  .eq__result .v { display: block; text-align: right; }
  .eq__result .v b { display: block; font-size: 25px; }
  .eq__result .pct { display: inline-block; margin-top: 3px; }
}

/* ─────────────────────────────────────────────────────────────────────────
   Source contribution — two-layer magnitude (spec 009 §Source comparison;
   frozen mock local/waterfall-twolayer-mock.html, 2026-07-26). Supersedes the
   earlier cumulative-bridge waterfall. Condensed 2-line rows: line 1 = label ·
   left-aligned magnitude bar with £ effect at its tip · running total inline;
   line 2 = muted per-order meta. Colour + sign carry direction (add green / sub
   red / net navy); no £0 axis. Geometry (bar_width, running) precomputed in
   _waterfall. Dormant in v1 (single-source Agra never renders it); the
   multi-source demo tenant is the proving ground.
   ───────────────────────────────────────────────────────────────────────── */
.cc { margin-top: 16px; }
.cc__heads { display: grid; grid-template-columns: 104px 1fr 64px; column-gap: 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line-strong); margin-bottom: 2px; }
.cc__heads span { font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-soft); }
.cc__heads span:last-child { text-align: right; }

.cc__row { display: grid; grid-template-columns: 104px 1fr 64px; column-gap: 12px; row-gap: 2px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.cc__row:first-of-type { border-top: 0; }
.cc__label { grid-row: 1; grid-column: 1; min-width: 0; }
.cc__label .tag { display: block; font-size: 8px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-soft); line-height: 1.2; }
.cc__label b { font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* line 1: left-aligned magnitude bar with £ effect at its tip */
.cc__track { grid-row: 1; grid-column: 2; position: relative; height: 17px; }
.cc__bar { position: absolute; left: 0; top: 0; height: 17px; border-radius: 4px; }
.cc__bar--add { background: var(--green); }
.cc__bar--sub { background: var(--red); }
.cc__bar--net { background: var(--accent); }
.cc__eff { position: absolute; top: 0; font-size: 12.5px; font-weight: 800; line-height: 17px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cc__eff--add { color: var(--green); }
.cc__eff--sub { color: var(--red); }
.cc__eff--net { color: var(--accent-deep); }

/* line 1: running total inline right, threaded down to the result */
.cc__run { grid-row: 1; grid-column: 3; text-align: right; position: relative; }
.cc__run b { font-size: 13px; font-weight: 800; color: var(--text-medium); font-variant-numeric: tabular-nums; }
.cc__row:not(.cc__row--net):not(:last-child) .cc__run::after { content: ""; position: absolute; right: 5px; top: calc(50% + 10px); height: calc(100% - 6px); border-right: 1.5px dotted var(--line-strong); }

/* line 2: muted per-order meta under the bar */
.cc__meta { grid-row: 2; grid-column: 2; font-size: 9.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; }

/* result row — navy "What you kept", set apart by a heavier top border */
.cc__row--net { border-top: 2px solid var(--line-strong); margin-top: 1px; padding-top: 10px; }
.cc__row--net .tag { color: var(--accent); }
.cc__row--net .cc__run b { color: var(--accent-deep); }
.cc__row--net .cc__run small { display: block; font-size: 8px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--accent); line-height: 1.1; }

/* ≤520px: bar drops to its own full-width line; £ + running stay on every row */
@media (max-width: 520px) {
  .cc__heads { display: none; }
  .cc__row { grid-template-columns: 1fr auto; column-gap: 8px; row-gap: 5px; padding: 9px 0; }
  .cc__label { grid-row: 1; grid-column: 1; }
  .cc__run { grid-row: 1; grid-column: 2; }
  .cc__run::after { display: none; }
  .cc__track { grid-row: 2; grid-column: 1 / -1; }
  .cc__meta { grid-row: 3; grid-column: 1 / -1; }
}

/* plain-English takeaway strip + screen-reader-only summary */
.takeaway { margin-top: 16px; padding: 11px 13px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; font-size: 12.5px; line-height: 1.5; color: var(--text-medium); }
.takeaway + .takeaway { margin-top: 8px; }
.takeaway b { color: var(--ink); }
.report-shell .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* step 3 — break-even */
.trio { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 14px; }
.trio div { background: var(--surface-soft); border-radius: var(--r-sm); padding: 11px; text-align: center; }
.trio span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-soft); }
.trio b { display: block; font-size: 21px; font-weight: 800; margin-top: 2px; }
.trio .hl b { color: var(--green); }
.be__track { height: 12px; border-radius: 6px; background: #E9EDF4; position: relative; margin-top: 16px; }
.be__seg { position: absolute; top: 0; bottom: 0; }
.be__mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #162446; }
.be__mark--wk { background: var(--accent); }
.be__fallback { margin-top: 14px; padding: 12px 14px; border-left: 3px solid var(--amber); background: #FCF4E6; border-radius: 0 8px 8px 0; font-size: 13px; line-height: 1.5; color: var(--text-medium); }
.levers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.lever { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-soft); border-radius: var(--r-sm); padding: 12px; }
.lever i { font-style: normal; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.lever b { display: block; font-size: 13.5px; color: var(--ink); }
.lever span { font-size: 12px; color: var(--text-soft); }

/* step 4 — quarter */
.q { display: grid; grid-template-columns: 1fr 200px; gap: 18px; margin-top: 14px; align-items: stretch; }
.qchartwrap { background: var(--surface-soft); border-radius: var(--r-sm); padding: 12px 12px 8px; }
.qchartwrap svg { width: 100%; height: 160px; display: block; }
.qtd { background: var(--surface-soft); border-radius: var(--r-sm); padding: 12px 14px; }
/* QTD heading stays on one line on desktop — the range "weeks 1–N" must never
   break "1–" / "N" (spec 009 §Step 4). nowrap + a size-to-fit type scale so the
   longest form "Quarter to date · weeks 1–13" clears the 200px QTD column with
   margin to spare (on mobile the QTD is full-width, so it has room regardless). */
.qtd b.title { display: block; font-size: 9px; font-weight: 800; letter-spacing: .01em; text-transform: uppercase; color: #193C85; margin-bottom: 8px; white-space: nowrap; }
.qtd__row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.qtd__row span { color: var(--text-soft); }
.qtd__row b { font-weight: 700; }
.qtd__row .keep { color: var(--accent); }

/* step 5 — weekly change log */
.know-stack { margin-top: 14px; display: grid; gap: 10px; }
.notice { border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; overflow: hidden; }
.notice__head { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 11px; align-items: start; padding: 13px 14px; }
.notice__icon { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); font-size: 15px; font-weight: 850; line-height: 1; }
.notice--warn .notice__icon { background: #FFF4E3; color: var(--amber); }
.notice--good .notice__icon { background: #EAF6F1; color: var(--green); }
.notice__eyebrow { font-size: 9.5px; font-weight: 800; letter-spacing: .075em; text-transform: uppercase; color: var(--text-soft); }
.notice__title { font-size: 14px; font-weight: 760; color: var(--ink); line-height: 1.35; margin-top: 1px; }
.notice__copy { font-size: 11.5px; line-height: 1.45; color: var(--text-medium); margin-top: 3px; }
.notice__badge { align-self: center; white-space: nowrap; border-radius: 99px; background: var(--surface-soft); padding: 5px 9px; font-size: 10px; font-weight: 750; color: var(--text-medium); }
.notice__body { border-top: 1px solid var(--line); background: var(--surface-soft); padding: 8px 14px 11px 59px; }
.notice__line { font-size: 12.3px; line-height: 1.55; color: var(--text-medium); padding: 5px 0; border-top: 1px solid var(--line); }
.notice__line:first-child { border-top: 0; }
.notice__line b { color: var(--ink); }
.notice__line .cnt { color: var(--text-soft); font-weight: 650; }
.notice__change { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12px; }
.notice__change:first-child { border-top: 0; }
.notice__change b { color: var(--ink); }
.notice__change small { display: block; font-size: 10px; color: var(--text-soft); margin-top: 1px; }
.notice__change span { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-medium); }
.notice__change strong { color: var(--accent-deep); }
.notice__action { display: inline-block; margin: 8px 14px 12px 59px; font-size: 12.5px; font-weight: 750; color: var(--accent); text-decoration: none; }
.notice__action:hover { text-decoration: underline; }
@media (max-width: 520px) {
  .notice__head { grid-template-columns: 30px minmax(0,1fr); padding: 12px; }
  .notice__icon { width: 28px; height: 28px; }
  .notice__badge { grid-column: 2; justify-self: start; margin-top: 1px; }
  .notice__body { padding-left: 12px; padding-right: 12px; }
  .notice__action { margin-left: 12px; }
  .notice__change { grid-template-columns: 1fr; gap: 2px; }
  .notice__change span { white-space: normal; }
}

/* footer */
.foot { max-width: 720px; margin: 0 auto; padding: 18px 18px 40px; font-size: 12px; color: var(--text-soft); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); }

/* report responsive — single-column beats + narrower gutters */
@media (max-width: 650px) {
  .beat { padding: 16px; }
  .result, .q { grid-template-columns: 1fr; }
  .levers { grid-template-columns: 1fr; }
  .beat--sub .beat__head { padding-left: 0; }
  .guide__start { flex-basis: 136px; }
  .hero { min-height: 158px; }
  .hero b { font-size: 52px; }
}
@media (max-width: 470px) {
  .page { padding-left: 12px; padding-right: 12px; }
  /* Stack the week-nav beneath the title so the full client name is never
     starved for horizontal space (spec 009 §Responsive header). */
  .report-topbar__inner { flex-direction: column; align-items: stretch; gap: 10px; padding-left: 12px; padding-right: 12px; }
  .report-topbar__name { font-size: 14px; overflow-wrap: anywhere; }
  .report-topbar__nav { justify-content: space-between; }
  .beat__line { font-size: 13px; }
}
/* Reading-guide strip — mobile one-row (spec 009 §Reading-guide strip, #59).
   The desktop scroll hid steps 3–5; instead the .guide__start panel collapses to
   a slim full-width header line and all five steps sit as equal-width columns on
   ONE row beneath it — no horizontal scroll. Reference: local/guide-strip-mobile-mock.html. */
@media (max-width: 520px) {
  .guide { flex-wrap: wrap; overflow: visible; min-height: 0; }
  /* Full-width slim header: forces the five steps to wrap onto the row below. */
  .guide__start {
    flex: 1 0 100%;
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-start;
    gap: 6px;
    padding: 9px 13px;
    border-radius: var(--r) var(--r) 0 0;
  }
  .guide__start-full { display: none; }
  .guide__start-slim { display: inline; margin-top: 0; }
  /* Five equal columns, each stacking number → title → sub-label, centred. */
  .guide__step { flex: 1 1 0; min-width: 0; padding: 10px 4px 11px; align-items: center; gap: 4px; }
  .guide__step:first-of-type { border-left: 0; }
  .guide__top { flex-direction: column; align-items: center; gap: 4px; white-space: normal; }
  .guide__num { width: 20px; height: 20px; font-size: 11px; }
  .guide__step b { font-size: 10.5px; line-height: 1.12; text-align: center; }
  /* Sub-label kept on mobile; centred and free to wrap within its column. */
  .guide__step small { padding-left: 0; white-space: normal; text-align: center; line-height: 1.15; font-size: 9px; }
}
@media print {
  .beat { break-inside: avoid; }
  .report-shell { background: #fff; }
}

/* =================================================================
   EMAIL TEMPLATE
   The Tuesday email — primary touchpoint. Mobile-first, single column,
   600px max width. Production version requires inline styles + table
   layouts for mail-client compatibility; this stylesheet is the
   visual reference only.
   ================================================================= */
.email-shell { max-width: 600px; margin: 0 auto; padding: 16px; }

.inbox-meta { background: #F0F0F0; border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 16px; font-size: 12px; color: var(--text-medium); border: 1px solid var(--border); }
.inbox-meta__row { display: flex; gap: 6px; padding: 2px 0; }
.inbox-meta__key { color: var(--text-soft); min-width: 64px; flex-shrink: 0; }
.inbox-meta__val { color: var(--text); }
.inbox-meta__subject { font-weight: 600; }
.inbox-meta__preview { color: var(--text-medium); }

.email-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.email-section { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.email-section:last-child { border-bottom: none; }
.email-section--muted { background: var(--surface-soft); }

.email-header__brand { font-size: 11px; font-weight: 600; color: var(--accent); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 6px; }
.email-header__client { font-size: 18px; font-weight: 600; line-height: 1.3; }
.email-header__period { font-size: 13px; color: var(--text-soft); margin-top: 2px; font-variant-numeric: tabular-nums; }

.email-hero__label { font-size: 11px; font-weight: 600; color: var(--text-medium); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.email-hero__figure { font-size: 36px; font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.email-hero__pct { font-size: 18px; font-weight: 500; color: var(--text-medium); margin-left: 6px; letter-spacing: 0; }
.email-hero__delta { font-size: 14px; color: var(--green); margin-top: 8px; font-weight: 500; }

.email-lever { background: var(--amber-bg); border-radius: var(--r-md); padding: 14px 16px; }
.email-lever__label { font-size: 11px; font-weight: 700; color: var(--amber); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.email-lever__body { font-size: 14px; line-height: 1.55; color: var(--text); }
.email-lever__body strong { font-weight: 700; }
.email-lever--good { background: var(--green-bg); }
.email-lever--good .email-lever__label { color: var(--green); }

.email-channels { font-size: 13px; color: var(--text-medium); line-height: 1.6; }
.email-channels__title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-medium); margin-bottom: 6px; }
.email-channels__list { font-variant-numeric: tabular-nums; }
.email-channels__list strong { color: var(--text); font-weight: 600; }

.email-proof { background: var(--accent-soft); border-radius: var(--r-md); padding: 14px 16px; }
.email-proof__label { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.email-proof__body { font-size: 14px; line-height: 1.55; color: var(--text); }
.email-proof__body strong { font-weight: 700; }

/* Email context — single calm sentence that gives the per-order + baseline shape (added pass 1.31) */
.email-context { font-size: 14px; color: var(--text-medium); line-height: 1.6; margin: 0; font-variant-numeric: tabular-nums; }
.email-context strong { color: var(--text); font-weight: 600; }

/* Email hero context tail — small subtitle below the figure giving the week shape (added pass 1.44) */
.email-hero__context { font-size: 12px; color: var(--text-soft); margin-top: 6px; font-variant-numeric: tabular-nums; }
.email-hero__context strong { color: var(--text-medium); font-weight: 600; }

/* Email channel mini-table — replaces the one-line dot-separated channel list with a visual table (added pass 1.44) */
.email-channel-mini { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 4px 0 0; }
.email-channel-mini__title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-medium); margin-bottom: 8px; }
.email-channel-mini td { padding: 7px 0; vertical-align: middle; }
.email-channel-mini td.email-channel-mini__name { font-size: 13px; color: var(--text); padding-right: 10px; white-space: nowrap; }
.email-channel-mini td.email-channel-mini__bar { padding: 0 10px; width: 40%; }
.email-channel-mini__bar-track { background: var(--surface-soft); height: 6px; border-radius: 3px; overflow: hidden; }
.email-channel-mini__bar-fill { background: var(--accent); height: 100%; border-radius: 3px; }
.email-channel-mini__bar-fill--low { background: #B91C1C; opacity: 0.7; }
.email-channel-mini__bar-fill--med { background: #B45309; opacity: 0.8; }
.email-channel-mini td.email-channel-mini__amt { font-size: 14px; font-weight: 600; color: var(--text); text-align: right; padding-left: 10px; white-space: nowrap; }

/* Email iteration thread — calm callout showing how a past operator action is playing out (added pass 1.44). v1.1 only — depends on spec 014 audit trail. */
.email-iteration { background: var(--accent-soft); border-radius: var(--r-md); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; }
.email-iteration__icon { color: var(--accent); font-size: 16px; line-height: 1.3; flex-shrink: 0; font-weight: 700; }
.email-iteration__body { font-size: 13px; color: var(--text); line-height: 1.55; }
.email-iteration__body strong { font-weight: 600; }

/* Email quarter callout — smoothed multi-week context per spec 013 §5. Single sentence: total + average + margin band + this-week delta vs average. */
.email-quarter { background: var(--accent-soft); border-radius: var(--r-md); padding: 14px 16px; }
.email-quarter__title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-bottom: 6px; }
.email-quarter__body { font-size: 14px; color: var(--text); line-height: 1.5; }
.email-quarter__body strong { font-weight: 600; }

.email-ctas { display: flex; flex-direction: column; gap: 10px; }
.email-cta { display: block; text-align: center; padding: 14px; border-radius: var(--r-md); font-size: 15px; font-weight: 600; text-decoration: none; min-height: var(--tap-min); box-sizing: border-box; }
.email-cta--primary { background: var(--accent); color: var(--accent-text); }
.email-cta--primary:hover { background: var(--accent-hover); }
.email-cta--secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.email-cta--secondary:hover { background: var(--surface-soft); }

.email-flag { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-medium); line-height: 1.5; }
.email-flag__icon { color: var(--accent); font-weight: 700; flex-shrink: 0; }
.email-flag__body strong { color: var(--text); font-weight: 600; }

.email-footer { padding: 16px 20px; font-size: 12px; color: var(--text-soft); text-align: center; line-height: 1.6; }
.email-footer a { color: var(--text-soft); text-decoration: underline; }
