/* ─────────────────────────────────────────────
   Reset & custom properties
   ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --red:    #B22234;
  --navy:   #3C3B6E;
  --bg:     #F9F9F7;
  --amber:  #F5A623;
  --text:   #1A1A1A;
  --muted:  #6B7280;
  --border: #D1D5DB;
  --white:  #FFFFFF;
}

/* ─────────────────────────────────────────────
   Base
   ───────────────────────────────────────────── */
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─────────────────────────────────────────────
   Shared layout — Header
   ───────────────────────────────────────────── */
header {
  background: var(--white);
  border-bottom: 3px solid var(--red);
  padding: 0 2rem;
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0;
  gap: 0.5rem;
}
.logo img { height: 80px; display: block; }
.tagline {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

/* ─────────────────────────────────────────────
   Shared layout — Nav strip
   ───────────────────────────────────────────── */
.site-nav {
  background: var(--navy);
  padding: 0 2rem;
}
.site-nav-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  height: 46px;
}
.nav-link {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 5px;
  transition: all 0.15s;
}
.nav-link:hover  { color: #fff; background: rgba(255,255,255,0.1); }
.nav-link.active { color: #fff; background: rgba(255,255,255,0.15); }
.nav-cta {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 1rem;
  border-radius: 5px;
  transition: background 0.15s;
}
.nav-cta:hover { background: #9B1C2C; }

/* ─────────────────────────────────────────────
   Shared layout — Main content area
   ───────────────────────────────────────────── */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

/* ─────────────────────────────────────────────
   Shared layout — Footer
   ───────────────────────────────────────────── */
footer {
  border-top: 3px solid var(--border);
  background: var(--white);
  margin-top: 2rem;
}
.footer-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 2rem 1rem;
}
@media (max-width: 640px) { .footer-boxes { grid-template-columns: 1fr; } }
.footer-box {
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  font-size: 0.82rem;
  line-height: 1.55;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-weight: 500;
}
.footer-box-privacy    { background: #F0FDF4; border: 1px solid #86EFAC; color: #166534; }
.footer-box-disclaimer { background: #EFF6FF; border: 1px solid #93C5FD; color: #1E40AF; }
.footer-box-icon { font-size: 1rem; flex-shrink: 0; margin-top: 0.1rem; }
.footer-copyright {
  text-align: center;
  padding: 0.75rem 2rem 1.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ─────────────────────────────────────────────
   About page — Hero
   ───────────────────────────────────────────── */
.page-hero {
  margin-bottom: 3rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 2.5rem;
}
.page-hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.25rem;
  color: var(--navy);
  line-height: 1.2;
  margin-bottom: 1rem;
}
.page-hero h1 span { color: var(--red); }
.page-hero p {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 680px;
}

/* ─────────────────────────────────────────────
   About page — Sections
   ───────────────────────────────────────────── */
.about-section {
  margin-bottom: 3rem;
}
.about-section h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--navy);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.about-section h2::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--border);
  margin-left: 0.5rem;
}
.about-section p {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.75;
  margin-bottom: 0.75rem;
}
.about-section p:last-child { margin-bottom: 0; }

/* ─────────────────────────────────────────────
   About page — Steps list
   ───────────────────────────────────────────── */
.steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}
.steps-list li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.step-num-circle {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.step-text strong { display: block; font-size: 0.9rem; margin-bottom: 0.2rem; }
.step-text span { font-size: 0.85rem; color: var(--muted); line-height: 1.6; }

/* ─────────────────────────────────────────────
   About page — Tariff timeline table
   ───────────────────────────────────────────── */
.timeline-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.timeline-table thead {
  background: var(--navy);
  color: #fff;
}
.timeline-table thead th {
  padding: 0.6rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
}
.timeline-table tbody tr { border-bottom: 1px solid var(--border); }
.timeline-table tbody tr:last-child { border-bottom: none; }
.timeline-table tbody tr:nth-child(even) { background: #F5F5FA; }
.timeline-table td {
  padding: 0.65rem 1rem;
  vertical-align: top;
  line-height: 1.5;
}
.timeline-table td:first-child { white-space: nowrap; font-weight: 600; }
.rate-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}
.rate-low    { background: #FEF3C7; color: #92400E; }
.rate-mid    { background: #FFEDD5; color: #9A3412; }
.rate-high   { background: #FEE2E2; color: #991B1B; }
.rate-excl   { background: #D1FAE5; color: #065F46; }

/* ─────────────────────────────────────────────
   About page — Formula box
   ───────────────────────────────────────────── */
.formula-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy);
  border-radius: 0 8px 8px 0;
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}
.formula-box .formula-title {
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.formula-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-family: monospace;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}
.formula-line:last-child { margin-bottom: 0; }
.f-var { color: var(--navy); font-weight: 700; }
.f-op  { color: var(--muted); }
.formula-note {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
}

/* ─────────────────────────────────────────────
   About page — Category grid
   ───────────────────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
  margin-top: 0.75rem;
}
.cat-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
}
.cat-item-label { font-weight: 500; }
.cat-prob {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}
.prob-very-high { background: #FEE2E2; color: #991B1B; }
.prob-high      { background: #FFEDD5; color: #9A3412; }
.prob-medium    { background: #FEF3C7; color: #92400E; }
.prob-low       { background: #DBEAFE; color: #1E40AF; }
.prob-very-low  { background: #F3F4F6; color: #374151; }

/* ─────────────────────────────────────────────
   About page — Confidence table
   ───────────────────────────────────────────── */
.conf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-top: 0.75rem;
}
.conf-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
.conf-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); line-height: 1.55; vertical-align: top; }
.conf-table tr:last-child td { border-bottom: none; }
.conf-badge {
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.conf-high   { background: #D1FAE5; color: #065F46; }
.conf-medium { background: #FEF3C7; color: #92400E; }
.conf-low    { background: #FEE2E2; color: #991B1B; }

/* ─────────────────────────────────────────────
   About page — Source cards
   ───────────────────────────────────────────── */
.source-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.75rem;
}
@media (max-width: 600px) { .source-cards { grid-template-columns: 1fr; } }
.source-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}
.source-card-title {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.4rem;
  color: var(--navy);
}
.source-card p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0;
}
.source-card a { color: var(--navy); }
.source-card a:hover { color: var(--red); }

/* ─────────────────────────────────────────────
   About page — Limitations callout
   ───────────────────────────────────────────── */
.limitation-box {
  background: #FFFBEB;
  border: 1.5px solid var(--amber);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.65;
  color: #78350F;
}
.limitation-box strong { color: #92400E; }
.limitation-box ul {
  margin-top: 0.6rem;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ─────────────────────────────────────────────
   Steps progress bar
   ───────────────────────────────────────────── */
.steps-bar {
  background: rgba(60,59,110,0.85);
  padding: 0 2rem;
}
.steps-bar-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 52px;
}
.steps-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.steps-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255,255,255,0.45);
  background: transparent;
  transition: all 0.2s;
}
.steps-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  transition: color 0.2s;
}
/* Active step */
.steps-step--active .steps-circle {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.steps-step--active .steps-label { color: #fff; }
/* Completed step */
.steps-step--done .steps-circle {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.5);
  color: #fff;
}
.steps-step--done .steps-label { color: rgba(255,255,255,0.7); }
/* Connector line */
.steps-connector {
  flex: 1;
  height: 2px;
  background: rgba(255,255,255,0.2);
  margin: 0 0.75rem;
}
.steps-connector.done { background: rgba(255,255,255,0.45); }

/* ─────────────────────────────────────────────
   Upload page — Hero
   ───────────────────────────────────────────── */
.upload-hero {
  text-align: center;
  margin-bottom: 2.5rem;
}
.upload-hero-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.9rem;
  color: var(--navy);
  line-height: 1.25;
  margin-bottom: 0.6rem;
}
.upload-hero-title span { color: var(--red); }
.upload-hero-sub {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.65;
  max-width: 560px;
  margin: 0 auto;
}

/* ─────────────────────────────────────────────
   Upload page — Cards grid
   ───────────────────────────────────────────── */
.upload-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}
@media (max-width: 640px) { .upload-cards { grid-template-columns: 1fr; } }

.upload-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.upload-card-header {
  background: var(--navy);
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.upload-card-retailer {
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
}
.upload-card-logo {
  height: 26px;
  object-fit: contain;
  vertical-align: middle;
}
#amazon-card .upload-card-logo {
  filter: brightness(0) invert(1);
}
.upload-card-optional {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.upload-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* ─────────────────────────────────────────────
   Upload page — Drop zone
   ───────────────────────────────────────────── */
.file-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}
.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--navy);
  background: #F0F2FA;
}
.file-drop-zone.has-file {
  border-color: #22C55E;
  background: #F0FDF4;
}
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.file-drop-icon { font-size: 1.75rem; line-height: 1; }
.file-drop-primary {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}
.file-browse-link {
  color: var(--navy);
  text-decoration: underline;
  font-weight: 600;
}
.file-drop-hint {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: monospace;
}
.file-selected-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #15803D;
  word-break: break-all;
}

/* ─────────────────────────────────────────────
   Upload page — Help expand
   ───────────────────────────────────────────── */
.help-expand {
  font-size: 0.82rem;
}
.help-expand summary {
  cursor: pointer;
  color: var(--navy);
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.help-expand summary::-webkit-details-marker { display: none; }
.help-expand summary::before {
  content: '▶';
  font-size: 0.6rem;
  transition: transform 0.2s;
  display: inline-block;
}
.help-expand[open] summary::before { transform: rotate(90deg); }
.help-content {
  margin-top: 0.65rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.help-content p {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.65;
  margin: 0;
}
.help-content code {
  font-family: monospace;
  font-size: 0.8rem;
  background: var(--border);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

/* ─────────────────────────────────────────────
   Upload page — Template download link
   ───────────────────────────────────────────── */
.template-download-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  border: 1px solid var(--navy);
  border-radius: 5px;
  padding: 0.35rem 0.75rem;
  align-self: flex-start;
  transition: background 0.15s, color 0.15s;
}
.template-download-link:hover {
  background: var(--navy);
  color: #fff;
}

/* ─────────────────────────────────────────────
   Upload page — Actions & error
   ───────────────────────────────────────────── */
.upload-error {
  background: #FEF2F2;
  border: 1.5px solid #FECACA;
  color: #991B1B;
  border-radius: 8px;
  padding: 0.8rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}
.upload-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}
.btn-primary {
  background: var(--red);
  color: #fff;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.85rem 2.25rem;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary:hover { background: #9B1C2C; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.privacy-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ─────────────────────────────────────────────
   Upload page — Spinner overlay
   ───────────────────────────────────────────── */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(249, 249, 247, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 100;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
}

/* ─────────────────────────────────────────────
   Review page — Summary bar
   ───────────────────────────────────────────── */
.review-summary-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.review-summary-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 1rem;
  flex-wrap: wrap;
}
.summary-stats {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 0;
}
.stat-item { font-size: 0.88rem; color: var(--muted); }
.stat-item strong { color: var(--text); }
.needs-review-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid var(--amber);
  border-radius: 20px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
}
.summary-hint { font-size: 0.8rem; color: var(--muted); padding: 0.75rem 0; }
.summary-hint strong { color: var(--text); }

/* ─────────────────────────────────────────────
   Review page — Main area (extra bottom padding for fixed footer)
   ───────────────────────────────────────────── */
.review-main { padding-bottom: 6rem; }

/* ─────────────────────────────────────────────
   Review page — Filter bar
   ───────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.filter-label { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.filter-btn {
  border: 1.5px solid var(--border);
  background: var(--white);
  border-radius: 6px;
  padding: 0.35rem 0.85rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
}
.filter-btn:hover   { border-color: var(--navy); color: var(--navy); }
.filter-btn.active  { background: var(--navy); border-color: var(--navy); color: #fff; }
.filter-btn--amber  { border-color: var(--amber); color: #92400E; background: #FFFBEB; }
.filter-btn--amber.active { background: var(--amber); border-color: var(--amber); color: #1A1A1A; }
.filter-divider     { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ─────────────────────────────────────────────
   Review page — Error banner
   ───────────────────────────────────────────── */
.review-error {
  background: #FEF2F2;
  border: 1.5px solid #FECACA;
  color: #991B1B;
  border-radius: 8px;
  padding: 0.8rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}

/* ─────────────────────────────────────────────
   Review page — Table
   ───────────────────────────────────────────── */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.review-table {
  width: 100%;
  border-collapse: collapse;
}
.review-table thead {
  background: var(--navy);
  color: #fff;
}
.review-table thead th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.review-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
.review-table tbody tr:last-child { border-bottom: none; }
.review-table tbody tr:hover { background: #F5F5FA; }
.review-table tbody tr.needs-review-row { background: #FFFBEB; }
.review-table tbody tr.needs-review-row:hover { background: #FEF3C7; }
.review-table td { padding: 0.75rem 1rem; font-size: 0.88rem; vertical-align: middle; }

.conf-cell { text-align: center; }

.date-cell { color: var(--muted); white-space: nowrap; font-size: 0.82rem; }

.source-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.source-amazon { background: #FFF3E0; color: #E65100; border: 1px solid #FFCC80; }
.source-target { background: #FCE4EC; color: #880E4F; border: 1px solid #F48FB1; }

.description-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amount-cell { font-weight: 600; white-space: nowrap; text-align: right; }

.cat-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
}
.cat-select {
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  background: var(--white);
  cursor: pointer;
  color: var(--text);
  min-width: 185px;
}
.cat-select:focus   { outline: none; border-color: var(--navy); }
.cat-select.needs-select { border-color: var(--amber); }

.needs-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: var(--amber);
  color: #1A1A1A;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.review-empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ─────────────────────────────────────────────
   Review table — mobile card layout
   ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .review-table thead { display: none; }
  .review-table,
  .review-table tbody { display: block; }

  .review-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto auto;
    column-gap: 0.75rem;
    row-gap: 0;
    padding: 0.875rem 1rem;
  }

  /* row 1: source badge (left) + amount (right) */
  .review-table td[data-label="Source"]  { grid-column: 1; grid-row: 1; padding: 0 0 0.35rem; }
  .review-table td[data-label="Amount"]  { grid-column: 2; grid-row: 1; padding: 0 0 0.35rem; text-align: right; }

  /* row 2: description full-width, allow 2-line wrap */
  .review-table td[data-label="Description"] {
    grid-column: 1 / -1; grid-row: 2;
    padding: 0 0 0.35rem;
    max-width: 100%;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-weight: 500;
  }

  /* row 3: date (left) + confidence (right) */
  .review-table td[data-label="Date"]       { grid-column: 1; grid-row: 3; padding: 0 0 0.35rem; }
  .review-table td[data-label="Confidence"] { grid-column: 2; grid-row: 3; padding: 0 0 0.35rem; text-align: right; }

  /* row 4: category dropdown full-width */
  .review-table td[data-label="Category"] {
    grid-column: 1 / -1; grid-row: 4;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.35rem 0 0;
  }

  .cat-select { min-width: 0; flex: 1; }
}

/* ─────────────────────────────────────────────
   Review page — Sticky action footer
   ───────────────────────────────────────────── */
.action-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 2px solid var(--border);
  padding: 1rem 2rem;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}
.action-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.action-hint { font-size: 0.82rem; color: var(--muted); }
.action-hint strong { color: #B45309; }
.action-btns { display: flex; gap: 0.75rem; }

.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 2px solid var(--navy);
  border-radius: 8px;
  padding: 0.7rem 1.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
}
.btn-secondary:hover { background: #F0F0F8; }

/* ─────────────────────────────────────────────
   Results page — Layout
   ───────────────────────────────────────────── */
.results-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}
.results-actions-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
}

/* ─────────────────────────────────────────────
   Results page — Section heading
   ───────────────────────────────────────────── */
.section-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  color: var(--navy);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-left: 0.5rem;
}

/* ─────────────────────────────────────────────
   Results page — Summary cards
   ───────────────────────────────────────────── */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
@media (max-width: 680px) { .summary-cards { grid-template-columns: 1fr; } }

.res-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.res-card-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.res-card-value {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
}
.res-card-value--red { color: var(--red); }
.res-card-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.3rem;
}
.pct-badge {
  display: inline-block;
  background: #FEF3C7;
  color: #92400E;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-weight: 600;
  font-size: 0.78rem;
}

/* ─────────────────────────────────────────────
   Results page — Monthly chart
   ───────────────────────────────────────────── */
.chart-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.chart-legend {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.legend-dot {
  width: 12px; height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-dot--navy { background: var(--navy); }
.legend-dot--red  { background: var(--red); }
.chart-canvas-wrap { position: relative; height: 220px; }

/* ─────────────────────────────────────────────
   Results page — Tables
   ───────────────────────────────────────────── */
.res-table-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 2.5rem;
  overflow-x: auto;
}
.res-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 540px;
}
.res-table thead { background: var(--navy); color: #fff; }
.res-table thead th {
  padding: 0.7rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.res-table thead th:not(:first-child) { text-align: right; }
.res-table tbody tr { border-bottom: 1px solid var(--border); }
.res-table tbody tr:last-child { border-bottom: none; }
.res-table tbody tr:hover { background: #F5F5FA; }
.res-table td { padding: 0.7rem 1rem; font-size: 0.875rem; vertical-align: middle; }
.res-table td:not(:first-child) { text-align: right; }

.res-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ─────────────────────────────────────────────
   Results tables — mobile card layout
   ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .res-table-section { overflow-x: unset; }
  .res-table { min-width: 0; }
  .res-table thead { display: none; }
  .res-table,
  .res-table tbody { display: block; }

  /* Category breakdown cards */
  .res-table tbody tr {
    display: grid;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
  }
  .res-table tbody tr:last-child { border-bottom: none; }

  /* Category table: name full-width, then pairs */
  #cat-tbody tr {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
  }
  #cat-tbody td[data-label="Category"] {
    grid-column: 1 / -1; grid-row: 1;
    font-weight: 600;
    padding-bottom: 0.35rem;
    text-align: left;
  }
  #cat-tbody td[data-label="Total Spend"]    { grid-column: 1; grid-row: 2; padding-bottom: 0.2rem; text-align: left; }
  #cat-tbody td[data-label="Exposed Spend"]  { grid-column: 2; grid-row: 2; padding-bottom: 0.2rem; text-align: right; }
  #cat-tbody td[data-label="Est. Cost Range"] { grid-column: 1; grid-row: 3; padding-bottom: 0; text-align: left; }
  #cat-tbody td[data-label="Sensitivity"]    { grid-column: 2; grid-row: 3; padding-bottom: 0; text-align: right; }

  /* Add soft labels via ::before */
  #cat-tbody td[data-label="Total Spend"]::before    { content: "Total: "; font-size: 0.72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; margin-right: 0.2rem; }
  #cat-tbody td[data-label="Exposed Spend"]::before  { content: "Exposed: "; font-size: 0.72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; margin-right: 0.2rem; }
  #cat-tbody td[data-label="Est. Cost Range"]::before { content: "Est. Cost: "; font-size: 0.72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; margin-right: 0.2rem; }

  /* Items table: description full-width, then pairs */
  #items-tbody tr {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
  }
  #items-tbody td[data-label="Item"] {
    grid-column: 1 / -1; grid-row: 1;
    font-weight: 500;
    padding-bottom: 0.35rem;
    text-align: left;
    max-width: 100%;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  #items-tbody td[data-label="Source"] { grid-column: 1; grid-row: 2; padding-bottom: 0.2rem; text-align: left; }
  #items-tbody td[data-label="Amount"] { grid-column: 2; grid-row: 2; padding-bottom: 0.2rem; text-align: right; }
  #items-tbody td[data-label="Est. Tariff Cost"] { grid-column: 1; grid-row: 3; padding-bottom: 0; text-align: left; }
  #items-tbody td[data-label="Confidence"]       { grid-column: 2; grid-row: 3; padding-bottom: 0; text-align: right; }

  #items-tbody td[data-label="Est. Tariff Cost"]::before { content: "Est. Cost: "; font-size: 0.72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; margin-right: 0.2rem; }

  /* Reset right-align rule for all mobile td */
  .res-table td:not(:first-child) { text-align: unset; }
}

.sensitivity-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.sens-very-high { background: #FEE2E2; color: #991B1B; }
.sens-high      { background: #FFEDD5; color: #9A3412; }
.sens-medium    { background: #FEF3C7; color: #92400E; }
.sens-low       { background: #D1FAE5; color: #065F46; }
.sens-very-low  { background: #DBEAFE; color: #1E40AF; }

/* ─────────────────────────────────────────────
   Results page — Retailer callout
   ───────────────────────────────────────────── */
.retailer-callout {
  background: #FFFBEB;
  border: 1.5px solid var(--amber);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.callout-icon { font-size: 1.5rem; flex-shrink: 0; }
.callout-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: #92400E;
}
.callout-body { font-size: 0.85rem; color: #78350F; line-height: 1.55; }
.callout-ticker {
  display: inline-block;
  background: var(--amber);
  color: #1A1A1A;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

/* ─────────────────────────────────────────────
   Results page — Disclaimer
   ───────────────────────────────────────────── */
.res-disclaimer {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.25rem;
  margin-bottom: 2.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
}
.res-disclaimer strong { color: var(--text); }

/* ─────────────────────────────────────────────
   Results page — Share image card (off-screen)
   ───────────────────────────────────────────── */
#share-card {
  display: none;
  position: fixed;
  top: -9999px;
  left: -9999px;
  width: 600px;
  background: var(--navy);
  color: #fff;
  border-radius: 16px;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  flex-direction: column;
}
/* White logo bar — no CSS filter needed so html2canvas renders it correctly */
#share-card .sc-logo-bar {
  background: #ffffff;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
}
#share-card .sc-logo { height: 44px; object-fit: contain; display: block; }
#share-card .sc-body {
  padding: 2rem 2.25rem 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
#share-card .sc-headline {
  font-family: 'Playfair Display', serif;
  font-size: 2.25rem;
  font-weight: 900;
  color: var(--amber);
  line-height: 1.15;
}
#share-card .sc-sub {
  font-size: 1.05rem;
  color: #ffffff;
  font-weight: 500;
}
#share-card .sc-cta {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.65);
  line-height: 1.55;
  margin-top: 0.25rem;
}

/* ─────────────────────────────────────────────
   Results page — Action buttons
   ───────────────────────────────────────────── */
.actions-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.6rem;
}
.share-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-pdf {
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s;
}
.btn-pdf:hover { background: #2C2B5E; }

.btn-share {
  border: 1.5px solid var(--border);
  background: var(--white);
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s;
  color: var(--text);
}
.btn-share:hover { border-color: var(--navy); color: var(--navy); }
.btn-share--x    { border-color: #1A1A1A; }
.btn-share--x:hover { background: #1A1A1A; color: #fff; }
.btn-share--fb   { border-color: #1877F2; color: #1877F2; }
.btn-share--fb:hover { background: #1877F2; color: #fff; }
.btn-share--img  { border-color: #E1306C; color: #E1306C; }
.btn-share--img:hover { background: #E1306C; color: #fff; }
.btn-share--native {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-start-over {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 0.65rem 1.25rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-start-over:hover { border-color: var(--red); color: var(--red); }
