/* ── pages.css ──────────────────────────────────────────────────
   Shared stylesheet for utility pages (Privacy, Terms, Support,
   Contact). Reuses the dashboard design system tokens exactly.
   ────────────────────────────────────────────────────────────── */

:root {
  /* Slate neutrals — same as dashboard */
  --bg: #f1f5f9;
  --surface: #fff;
  --border: #d9dee5;
  --inset: #f8fafc;
  --text: #0f172a;
  --muted: #586881;
  --faint: #8494a7;

  /* Single accent blue */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-tint: rgba(37, 99, 235, 0.04);
  --accent-border: rgba(37, 99, 235, 0.18);

  /* Callout variants */
  --info-bg: rgba(37, 99, 235, 0.04);
  --info-border: rgba(37, 99, 235, 0.14);
  --success-bg: rgba(22, 163, 74, 0.04);
  --success-border: rgba(22, 163, 74, 0.14);
  --warn-bg: rgba(217, 119, 6, 0.04);
  --warn-border: rgba(217, 119, 6, 0.14);
  --important-bg: rgba(15, 23, 42, 0.03);
  --important-border: rgba(15, 23, 42, 0.12);

  /* Spacing scale — same as dashboard */
  --sp-xs: 0.25rem;
  --sp-s: 0.5rem;
  --sp-m: 0.75rem;
  --sp-l: 1rem;
  --sp-xl: 1.5rem;
  --sp-2xl: 2rem;

  /* Page-level stack spacing */
  --page-stack-gap: 1.375rem;
  --page-stack-gap-callout: 1.625rem;

  /* Radius — same as dashboard */
  --radius: 8px;
  --shadow-rest: 0 1px 3px rgba(0, 0, 0, 0.05);
}

*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  line-height: 1.65;
}


/* ── Container ── */

.container {
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--sp-xl);
  padding-right: var(--sp-xl);
  width: 100%;
}


/* ── Header — matches dashboard exactly ── */

header {
  background: var(--surface);
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--sp-m);
  flex-shrink: 0;
}

.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 760;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.header-brand-logo {
  display: block;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.header-brand-wordmark {
  line-height: 1.05;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-l);
}

.nav-link {
  font-size: 0.8125rem;
  color: #334155;
  text-decoration: none;
  font-weight: 500;
}

.nav-link:hover { color: var(--text); }


/* ── Main ── */

main {
  flex: 1;
  padding: var(--sp-xl) 0 var(--sp-2xl) 0;
}

/* Top-level stack rhythm */
main > .container > * {
  margin-top: var(--page-stack-gap);
}

main > .container > :first-child {
  margin-top: 0;
}

main > .container > .callout {
  margin-top: var(--page-stack-gap-callout);
}

main > .container > :last-child {
  margin-bottom: var(--sp-xl);
}

/* Optional wrapper support for pages that use .page-stack. */
.page-stack > * {
  margin-top: var(--page-stack-gap);
}

.page-stack > :first-child {
  margin-top: 0;
}

.page-stack > .callout {
  margin-top: var(--page-stack-gap-callout);
}


/* ── Footer — matches dashboard exactly ── */

footer {
  background: var(--inset);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: auto;
}

.footer-inner { text-align: left; }

.footer-disclosure {
  font-size: 0.8125rem;
  color: #475569;
  line-height: 1.5;
  margin-bottom: var(--sp-l);
}

.footer-links {
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  padding: var(--sp-xs) 0;
}

.footer-links a:hover { color: var(--accent); }

.footer-sep {
  color: var(--border);
  margin: 0 var(--sp-m);
}


/* ── Intro Card (Hero) ── */

.intro-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-rest);
  padding: 2.25rem var(--sp-2xl) 2.25rem;
}

.intro-card h1 {
  font-size: 1.85rem;
  font-weight: 800;
  color: #020617;
  letter-spacing: -0.035em;
  margin-bottom: 0.65rem;
  line-height: 1.08;
}

.intro-sub {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0;
  max-width: 52ch;
}

.intro-sub + .intro-meta {
  margin-top: var(--sp-m);
}

.intro-meta {
  font-size: 0.7rem;
  color: #475569;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  letter-spacing: 0.005em;
}

.intro-meta strong {
  color: #334155;
  font-weight: 700;
}

.intro-meta .meta-dot {
  margin: 0 0.375rem;
  color: var(--border);
}

.intro-meta .meta-link {
  color: var(--accent);
  text-decoration: none;
}

.intro-meta .meta-link:hover {
  text-decoration: underline;
}

.intro-meta-support {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  margin-top: 1rem;
}

.intro-contact-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

.intro-contact-email {
  font-size: 0.8125rem;
  color: #1e293b;
  font-weight: 650;
  text-decoration: none;
}

.intro-contact-email:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.support-status-section h2 {
  margin-bottom: 0.9rem;
}


/* ── Callout blocks ── */

.callout {
  border-radius: var(--radius);
  padding: var(--sp-l) var(--sp-xl);
  border: 1px solid;
}

.callout-info {
  background: var(--info-bg);
  border-color: var(--info-border);
}

.callout-success {
  background: var(--success-bg);
  border-color: var(--success-border);
}

.callout-warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.callout-important {
  background: var(--important-bg);
  border-color: var(--important-border);
}

.callout-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.375rem;
  letter-spacing: -0.01em;
}

.callout ul,
.callout ol {
  margin: 0;
  padding-left: 1.25rem;
}

.callout li {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: var(--sp-xs);
}

.callout li:last-child { margin-bottom: 0; }

.callout p {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.6;
}

.callout-foot {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: var(--sp-m);
}

.callout-body {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: var(--sp-m);
}


/* ── Content Card ── */

.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-rest);
  padding: var(--sp-xl) var(--sp-2xl) var(--sp-2xl);
}

/* Contact-page micro polish */
.content-card-compact-bottom {
  padding-bottom: var(--sp-xl);
}

.body-intro {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}


/* ── Section headings ── */

.content-card h2 {
  font-size: 1.1875rem;
  font-weight: 750;
  color: #020617;
  margin-top: 0;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.section-num {
  color: #94a3b8;
  font-weight: 600;
  margin-right: 0.3rem;
}


/* ── Subheadings ── */

.content-card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin-top: var(--sp-xl);
  margin-bottom: var(--sp-s);
  line-height: 1.3;
}


/* ── Body text ── */

.content-card p {
  font-size: 0.9rem;
  color: #1e293b;
  line-height: 1.75;
  margin-bottom: var(--sp-m);
  max-width: 65ch;
}

.content-card p:last-child { margin-bottom: 0; }


/* ── Lists ── */

.content-card ul,
.content-card ol {
  margin: 0 0 var(--sp-m) 0;
  padding-left: 1.25rem;
}

.content-card li {
  font-size: 0.9rem;
  color: #1e293b;
  line-height: 1.75;
  margin-bottom: var(--sp-xs);
}

.content-card li:last-child { margin-bottom: 0; }


/* ── Links ── */

.content-card a {
  color: var(--accent);
  text-decoration: none;
}

.content-card a:hover {
  text-decoration: underline;
}


/* ── Inline emphasis ── */

.content-card strong {
  font-weight: 600;
  color: var(--text);
}


/* ── Section footnote ── */

.section-footnote {
  font-size: 0.8125rem;
  color: var(--faint);
  line-height: 1.5;
  margin-top: var(--sp-l);
}


/* ── Legal caps text ── */

.content-card .legal-caps {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.6;
}


/* ── Code ── */

code {
  font-size: 0.8125rem;
  background: rgba(0, 0, 0, 0.04);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
}


/* ── Dividers ── */

.divider {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  margin: 0.875rem 0;
}


/* ── Key-value rows ── */

.kv-block {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: var(--sp-m) 0;
}

.kv-row {
  display: flex;
  align-items: flex-start;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 0.875rem;
  gap: var(--sp-l);
}

.kv-row:last-child { border-bottom: none; }

.kv-key {
  color: var(--muted);
  font-weight: 500;
  flex-shrink: 0;
  min-width: 8rem;
}

.kv-val {
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.kv-val a {
  color: var(--accent);
  text-decoration: none;
}

.kv-val a:hover { text-decoration: underline; }

.kv-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--faint);
  line-height: 1.4;
  margin-top: 0.25rem;
}


/* ── Numbered list (for Terms) ── */

.content-card ol {
  list-style: decimal;
}

.content-card ol li {
  padding-left: var(--sp-xs);
}


/* ── Table (for policies) ── */

.content-card table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--sp-m) 0 var(--sp-l);
  font-size: 0.875rem;
}

.content-card th {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  padding: var(--sp-s) var(--sp-m);
  background: var(--inset);
  border-bottom: 1px solid var(--border);
}

.content-card td {
  padding: var(--sp-s) var(--sp-m);
  color: var(--text);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  vertical-align: top;
}

.content-card tr:last-child td { border-bottom: none; }


/* ── TOC card ── */

.toc-card {
  padding-top: var(--sp-l);
  padding-bottom: var(--sp-l);
  background: #fcfdff;
}

.toc-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1.5rem;
  row-gap: 0.5rem;
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
}

.toc-list li {
  margin-bottom: 0;
  line-height: 1.9;
}

.toc-list a {
  color: #52627a;
  text-decoration: none;
  font-size: 0.84rem;
  display: block;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: color 120ms ease, background-color 120ms ease;
}

.toc-list a:hover {
  color: var(--accent);
  text-decoration: none;
  background: rgba(37, 99, 235, 0.06);
}

.toc-list a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Two-column divider for privacy TOC */
.toc-card > section > .toc-list {
  position: relative;
}

/* Back to top link — placed at bottom of policy card */
.back-to-top {
  margin-top: 2.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  text-align: center;
}

.back-to-top a {
  font-size: 0.72rem;
  color: #b0bac8;
  text-decoration: none;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.back-to-top a:hover {
  color: var(--accent);
}


/* ── Glance table (Privacy at a glance) — premium spec-sheet ── */

.glance-card {
  background: var(--surface);
}

.glance-table {
  margin: var(--sp-m) 0 0;
}

.glance-table th {
  background: #dfe8f4;
  color: #0b1220;
  border-bottom: 2px solid #bfcce0;
  padding: 0.8rem 1.1rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.glance-table th:first-child {
  width: 26%;
}

.glance-table td {
  padding: 1.1rem 1.1rem;
  border-bottom: 1px solid #eef1f5;
  line-height: 1.65;
}

.glance-table td:first-child {
  width: 26%;
  font-weight: 700;
  color: #1e293b;
  font-size: 0.84rem;
}

.glance-table td:last-child {
  font-size: 0.9rem;
}

.glance-table tbody tr:last-child td {
  border-bottom: none;
}

.glance-table tbody tr:nth-child(even) td {
  background: #fbfcfe;
}

.glance-table td strong {
  font-weight: 700;
}


/* ── Privacy policy card ── */

.privacy-policy-card {
  padding-bottom: 2.5rem;
}

.privacy-policy-card h2 {
  font-size: 1.25rem;
  font-weight: 750;
  margin-bottom: 1.15rem;
}

.privacy-policy-card h3 {
  font-size: 0.93rem;
  font-weight: 700;
  color: #1e293b;
  margin-top: 1.5rem;
  margin-bottom: 0.65rem;
}

.privacy-policy-card p,
.privacy-policy-card li {
  line-height: 1.9;
}

.privacy-policy-card .divider {
  border-top-color: rgba(15, 23, 42, 0.07);
  margin: 2.75rem 0;
}


/* ── Sub-cards (Section 2 A/B/C in privacy) ── */

.sub-card {
  background: #f8fafc;
  border-left: 3px solid rgba(37, 99, 235, 0.22);
  border-radius: 0 6px 6px 0;
  padding: 1.15rem 1.35rem;
  margin-top: 1.1rem;
  margin-bottom: 1.1rem;
}

.sub-card h3 {
  margin-top: 0;
  margin-bottom: 0.6rem;
}

.sub-card p:last-child,
.sub-card ul:last-child {
  margin-bottom: 0;
}


/* ── Mini-blocks (within sub-cards for 2C) ── */

.mini-block {
  margin-bottom: 0.85rem;
}

.mini-block:last-of-type {
  margin-bottom: 0.6rem;
}

.mini-block-label {
  font-size: 0.8125rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 0.3rem;
  letter-spacing: -0.005em;
}

.mini-block p {
  margin-bottom: 0;
}

.muted-note {
  font-size: 0.8125rem;
  color: var(--faint);
  font-style: italic;
  margin-top: 0.5rem;
  line-height: 1.5;
}


/* ── Contact grid (distinct card for contact section) ── */

.contact-grid {
  background: #f8fafc;
  border: 1px solid #e8ecf1;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
}

.contact-grid .kv-block {
  margin: 0;
}

.contact-grid .kv-row {
  padding: 0.5rem 0;
}

.contact-grid .kv-key {
  color: var(--faint);
  font-weight: 600;
  font-size: 0.8125rem;
  min-width: 8rem;
}

.contact-grid .kv-val {
  font-weight: 500;
}

.contact-grid .kv-val a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.contact-grid .kv-val a:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}


/* ── Callout note (policy footer) ── */

.callout-note {
  background: rgba(15, 23, 42, 0.025);
  border-color: rgba(15, 23, 42, 0.11);
}


/* ── Roomy kv-block ── */

.kv-block-roomy .kv-row {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}


/* ── Terms page: TOC grid ── */

.terms-toc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
}

.terms-toc-group {
  border: 1px solid rgba(15, 23, 42, 0.05);
  border-radius: 8px;
  background: #fdfeff;
  padding: 1.45rem 1.25rem 1.2rem;
}

.terms-toc-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: #0b1220;
  letter-spacing: -0.015em;
  margin-bottom: 0.25rem;
  padding: 0 0 0.6rem 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.terms-toc-desc {
  font-size: 0.72rem;
  color: #8494a7;
  line-height: 1.45;
  margin-bottom: 1.25rem;
  font-style: normal;
  letter-spacing: 0.005em;
}

.terms-toc-group .toc-list {
  display: block;
  grid-template-columns: none;
  row-gap: 0;
  border-top: none;
  padding-top: 0;
}

.terms-toc-group .toc-list li + li {
  margin-top: 0.3rem;
}

.terms-toc-group .toc-list a {
  padding: 0.3rem 0.45rem;
  font-size: 0.8125rem;
  color: #475569;
  font-weight: 500;
  background: transparent;
  border: none;
  border-radius: 4px;
  transition: background-color 120ms ease, color 120ms ease;
}

.terms-toc-group .toc-list a:hover {
  color: var(--accent);
  background: rgba(37, 99, 235, 0.04);
  text-decoration: none;
}

.terms-toc-card h2 {
  margin-bottom: 1.1rem;
  color: #0b1220;
}


/* ── Terms policy card ── */

.terms-policy-card {
  padding-bottom: 2.5rem;
}

.terms-policy-card h2 {
  font-size: 1.25rem;
  font-weight: 750;
  margin-bottom: 1.15rem;
}

.terms-policy-card h3 {
  font-size: 0.93rem;
  margin-top: 1.4rem;
  margin-bottom: 0.65rem;
  color: #1e293b;
}

.terms-policy-card p,
.terms-policy-card li {
  line-height: 1.9;
}

.terms-policy-card .divider {
  margin: 2.75rem 0;
  border-top-color: rgba(15, 23, 42, 0.09);
}


/* ── Terms: legal critical sections ── */

.terms-critical {
  border-left: 3px solid rgba(15, 23, 42, 0.14);
  padding-left: 1.5rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.terms-legal-tail {
  padding-top: 0;
}

.terms-legal-tail h2 {
  margin-bottom: 1.15rem;
}

.terms-critical p {
  line-height: 2.2;
}

.terms-critical li {
  line-height: 2.2;
  margin-bottom: 0.55rem;
}

.terms-critical .legal-caps {
  letter-spacing: 0.015em;
  line-height: 1.78;
  margin-bottom: 1rem;
}

.terms-policy-card p + ul,
.terms-policy-card p + ol {
  margin-top: 0.38rem;
}


/* ── Terms: billing inset ── */

.billing-inset {
  background: #f8fafc;
  border: 1px solid #e8ecf1;
  border-radius: 6px;
  padding: 1.15rem 1.35rem;
  margin-top: 1.1rem;
}

.billing-inset h3 {
  margin-top: 0;
  margin-bottom: 0.6rem;
  font-size: 0.875rem;
}

.billing-inset p {
  line-height: 1.95;
}

.billing-inset p:last-child {
  margin-bottom: 0;
}


/* ── Terms: liability cap emphasis ── */

.liability-cap {
  background: rgba(15, 23, 42, 0.045);
  border: 1px solid rgba(15, 23, 42, 0.13);
  border-left: 3px solid rgba(15, 23, 42, 0.22);
  border-radius: 5px;
  padding: 1.05rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.75;
  margin-top: 0.85rem;
  margin-bottom: 1rem;
}


/* ── Terms: summary callout ── */

.terms-summary-callout .callout-title {
  color: #0b1220;
  margin-bottom: 0.58rem;
}

.terms-summary-callout li {
  margin-bottom: 0.48rem;
}

.terms-summary-callout li strong {
  color: #0b1220;
}


/* ── Utility spacing ── */

.mt-s { margin-top: var(--sp-s); }
.mt-l { margin-top: var(--sp-l); }
.mt-xl { margin-top: var(--sp-xl); }
.mt-2xl { margin-top: var(--sp-2xl); }


/* ── Responsive ── */

@media (max-width: 640px) {
  :root {
    --page-stack-gap: 1rem;
    --page-stack-gap-callout: 1.25rem;
  }

  .container {
    padding-left: var(--sp-l);
    padding-right: var(--sp-l);
  }

  .intro-card {
    padding: var(--sp-xl) var(--sp-l);
  }

  .intro-card h1 {
    font-size: 1.375rem;
  }

  .content-card {
    padding: var(--sp-xl) var(--sp-l);
  }

  .callout {
    padding: var(--sp-l);
  }

  .kv-row {
    flex-direction: column;
    gap: 0.125rem;
  }

  .kv-key {
    min-width: 0;
    font-size: 0.75rem;
    color: var(--faint);
  }

  .intro-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
  }

  .intro-meta .meta-dot { display: none; }

  .content-card h2 { font-size: 1.0625rem; }

  .content-card table {
    display: block;
    overflow-x: auto;
  }

  .toc-list {
    grid-template-columns: 1fr;
    row-gap: 0.35rem;
  }

  .terms-toc-grid {
    grid-template-columns: 1fr;
  }

  .sub-card {
    padding: 0.75rem 1rem;
  }

  .contact-grid {
    padding: 0.5rem 0.75rem;
  }
}
