/* Aslan Outreach Hub - the one stylesheet.
   A calm, white work tool: Inter for everything, Red Hat Display only for the "Aslan" wordmark,
   neutral (zinc) greys, hairline borders instead of shadows, and ember used sparingly as the accent
   (wordmark dot, the Publish button, active nav indicator, focus rings, link hover).
   Status colours are muted and shared by every module: good (green), warn (amber), bad (red),
   info (blue). Dark mode follows the system (prefers-color-scheme): every token is redefined below.
   Mobile-first: bottom tab bar under 860px, top nav above. No inline styles (CSP). */

:root {
  color-scheme: light dark;

  /* Surfaces */
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-2: #F4F4F5;        /* quiet fill: code, message bodies, count boxes */
  --surface-hover: #F4F4F5;
  --line: #E7E7EA;             /* hairline */
  --line-strong: #D4D4D8;      /* inputs, secondary buttons */

  /* Text */
  --text: #18181B;
  --text-2: #52525B;           /* secondary */
  --text-3: #71717A;           /* small meta that still has to be read (4.5:1 on white) */
  --text-4: #A1A1AA;           /* decorative only: icons, empty-grid "+", disabled */

  /* Brand accent */
  --accent: #F04E2A;           /* ember: dot, indicators, focus */
  --accent-strong: #D63A18;    /* primary button fill: white text passes AA (4.7:1) */
  --accent-hover: #BF3112;
  --accent-text: #C8381A;      /* ember as text (links on hover) */
  --accent-ring: rgba(240, 78, 42, 0.22);
  --on-accent: #FFFFFF;

  /* Primary buttons: ink (black), calm on a busy screen */
  --ink: #18181B;
  --ink-hover: #3F3F46;
  --on-ink: #FFFFFF;

  /* Status: soft tint, darker text, a hairline in the same hue */
  --good-bg: #EEF7F0;  --good-fg: #1C6B38;  --good-line: #CDE7D4;  --good-solid: #2F9E57;
  --warn-bg: #FBF4E6;  --warn-fg: #8A4F06;  --warn-line: #EEDCB8;  --warn-solid: #D98A0B;
  --bad-bg:  #FDF0EE;  --bad-fg:  #B4271A;  --bad-line:  #F4CFC9;  --bad-solid:  #D93A2B;
  --info-bg: #EEF4FC;  --info-fg: #1E5AA8;  --info-line: #CFE0F5;

  --shadow-pop: 0 1px 2px rgba(24, 24, 27, 0.04), 0 8px 24px rgba(24, 24, 27, 0.08);
  --shadow-lift: 0 2px 4px rgba(24, 24, 27, 0.06), 0 14px 32px rgba(24, 24, 27, 0.16);

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --brand-font: 'Red Hat Display', var(--sans);
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius: 12px;              /* cards */
  --radius-sm: 8px;            /* controls */
  --col: 1120px;
  --tabbar-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --fast: 140ms;
}

/* Dark: the same roles, redefined. Kept in one block so nothing is missed. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E0E10;
    --surface: #17171A;
    --surface-2: #202024;
    --surface-hover: #222226;
    --line: #2A2A2F;
    --line-strong: #3A3A41;

    --text: #F4F4F5;
    --text-2: #B4B4BC;
    --text-3: #8E8E98;
    --text-4: #5E5E66;

    --accent: #F2603F;
    --accent-strong: #D63A18;
    --accent-hover: #E4481F;
    --accent-text: #FF8A6B;
    --accent-ring: rgba(242, 96, 63, 0.35);

    --ink: #F4F4F5;
    --ink-hover: #D4D4D8;
    --on-ink: #17171A;

    --good-bg: rgba(52, 168, 96, 0.14);  --good-fg: #7FD69C;  --good-line: rgba(52, 168, 96, 0.30);  --good-solid: #3FB86A;
    --warn-bg: rgba(226, 150, 30, 0.14); --warn-fg: #F0B860;  --warn-line: rgba(226, 150, 30, 0.30); --warn-solid: #E5A13A;
    --bad-bg:  rgba(232, 72, 58, 0.15);  --bad-fg:  #FF9C90;  --bad-line:  rgba(232, 72, 58, 0.32);  --bad-solid:  #F0604F;
    --info-bg: rgba(70, 140, 230, 0.15); --info-fg: #8EBCF5;  --info-line: rgba(70, 140, 230, 0.32);

    --shadow-pop: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.4), 0 14px 32px rgba(0, 0, 0, 0.55);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); scrollbar-color: var(--line-strong) transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--sans);
  font-optical-sizing: auto;   /* Inter's opsz axis: large headings get the Display cut */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  caret-color: var(--accent);
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px);
}
@media (min-width: 860px) { body { font-size: 14px; } }
::selection { background: var(--accent-ring); color: var(--text); }
a { color: inherit; text-decoration-color: var(--line-strong); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color var(--fast) var(--ease), text-decoration-color var(--fast) var(--ease); }
a:hover { color: var(--accent-text); text-decoration-color: currentColor; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
h1 { font-size: 22px; line-height: 1.25; letter-spacing: -0.022em; }
h2 { font-size: 15px; line-height: 1.35; letter-spacing: -0.008em; margin-bottom: 6px; }
h3 { font-size: 14px; line-height: 1.4; }
@media (min-width: 860px) { h1 { font-size: 24px; } }
p { margin: 0 0 8px; }
strong, b { font-weight: 600; }
code { font-family: var(--mono); font-size: 0.85em; background: var(--surface-2); border: 1px solid var(--line); padding: 0 5px; border-radius: 5px; overflow-wrap: anywhere; }
pre { font-family: var(--mono); font-size: 12px; line-height: 1.5; background: var(--surface-2); border: 1px solid var(--line); padding: 10px 12px; border-radius: var(--radius-sm); overflow-x: auto; max-width: 70vw; margin: 6px 0 0; white-space: pre; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.num, td.num, .stat-value { font-variant-numeric: tabular-nums; }

/* ---- Mode banner: a slim neutral strip with a status dot ---- */
.banner { padding: 6px 16px; padding-top: calc(6px + var(--safe-t)); font-size: 12.5px; line-height: 1.45; text-align: center; border-bottom: 1px solid var(--line); }
.banner::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.banner strong { font-weight: 600; letter-spacing: 0.04em; font-size: 11.5px; }
.banner a { font-weight: 500; }
.banner-dry { background: var(--surface); color: var(--text-2); }
.banner-dry strong { color: var(--text); }
.banner-dry::before { background: var(--warn-solid); box-shadow: 0 0 0 3px var(--warn-bg); }
.banner-live { background: var(--bad-bg); color: var(--bad-fg); border-bottom-color: var(--bad-line); }
.banner-live::before { background: var(--bad-solid); }
.banner-live a { color: inherit; }

/* ---- Top bar ---- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: var(--col); margin: 0 auto; padding: 0 16px; min-height: 56px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; margin-right: auto; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-word { font-family: var(--brand-font); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; line-height: 1; }
.brand-sub { font-size: 13px; font-weight: 500; color: var(--text-3); letter-spacing: -0.005em; }
/* The dot is drawn, not typeset: an empty span (see CLAUDE.md "decorative glyph"). */
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); vertical-align: 1px; margin-left: 2px; }
.topnav { display: none; gap: 2px; align-self: stretch; }
.topnav-link { position: relative; display: flex; align-items: center; padding: 0 10px; text-decoration: none; font-weight: 500; font-size: 14px; color: var(--text-2); }
.topnav-link:hover { color: var(--text); }
.topnav-link.is-active { color: var(--text); }
.topnav-link.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.logout { margin: 0; }
.logout .btn { border-color: transparent; background: transparent; color: var(--text-2); }
.logout .btn:hover { background: var(--surface-hover); color: var(--text); border-color: transparent; }

/* ---- Bottom tab bar (phones) ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--text-3); font-size: 11px; font-weight: 500; min-height: 44px; transition: color var(--fast) var(--ease); }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); }
.tab.is-active::before { content: ""; position: absolute; top: -1px; left: 50%; width: 24px; margin-left: -12px; height: 2px; border-radius: 0 0 2px 2px; background: var(--accent); }
.tab svg { width: 22px; height: 22px; }
.tab-icon { position: relative; display: inline-flex; }
/* Nav count badge (e.g. Inbox drafts waiting). Same pill in the top nav and on the tab icon. */
.nav-badge { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--text); color: var(--surface); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; vertical-align: 1px; font-variant-numeric: tabular-nums; }
.tab-icon .nav-badge { position: absolute; top: -6px; left: 14px; margin-left: 0; box-shadow: 0 0 0 2px var(--surface); }

@media (min-width: 860px) {
  body { padding-bottom: 40px; }
  .topnav { display: flex; }
  .tabbar { display: none; }
}

/* ---- Page ---- */
.page { max-width: var(--col); margin: 0 auto; padding: 20px 16px 0; }
.page-head { margin: 4px 0 18px; }
.lede { color: var(--text-2); margin: 6px 0 0; max-width: 70ch; }
.eyebrow { font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 2px; }
@media (min-width: 860px) { .page { padding-top: 28px; } .page-head { margin-bottom: 22px; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
@media (min-width: 860px) { .card { padding: 20px; margin-bottom: 16px; } }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; }
.card-head h2 { margin-bottom: 0; }
.hint { color: var(--text-2); font-size: 13px; line-height: 1.5; margin: 4px 0 10px; }
.meta { color: var(--text-2); font-size: 13px; margin: 10px 0 0; }
.empty { color: var(--text-3); padding: 10px 0; margin: 0; }
.plan { margin: 6px 0 0; padding-left: 18px; }
.plan li { margin: 4px 0; }
.plan li::marker, .card ul li::marker { color: var(--text-4); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat-value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.stat-label { color: var(--text-2); font-size: 12px; font-weight: 500; }

/* ---- Pills and notices ---- */
.pill { display: inline-flex; align-items: center; padding: 0 7px; min-height: 20px; border-radius: 6px; font-size: 12px; font-weight: 500; line-height: 1.5; white-space: nowrap; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.pill-good { background: var(--good-bg); color: var(--good-fg); border-color: var(--good-line); }
.pill-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-line); }
.pill-bad { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-line); }
.pill-info { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-line); }
.notice { padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 500; margin-bottom: 14px; border: 1px solid transparent; }
.notice-good { background: var(--good-bg); color: var(--good-fg); border-color: var(--good-line); }
.notice-bad { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-line); }
.notice-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-line); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-size: 12px; color: var(--text-3); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background-color var(--fast) var(--ease); }
td.num { color: var(--text-2); }
table.data code { overflow-wrap: normal; white-space: nowrap; }
@media (max-width: 639px) { .hide-sm { display: none; } }

/* Disclosures ("Technical details", "More"): quiet summary, muted marker. */
details summary { cursor: pointer; color: var(--text-2); font-weight: 500; white-space: nowrap; transition: color var(--fast) var(--ease); }
details summary:hover { color: var(--text); }
details summary::marker { color: var(--text-4); }

/* Filter tabs: a quiet segmented row. */
.filters { display: flex; flex-wrap: wrap; gap: 4px; }
.filters a { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--radius-sm); text-decoration: none; font-size: 13px; font-weight: 500; color: var(--text-2); border: 1px solid var(--line); background: var(--surface); transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.filters a:hover { color: var(--text); border-color: var(--line-strong); }
.filters a[aria-current] { background: var(--text); color: var(--surface); border-color: var(--text); }

/* ---- Forms ---- */
label { font-weight: 500; font-size: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; }
.field .hint { margin: 6px 0 0; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], input[type=email], input[type=url], select, textarea {
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
input[type=text], input[type=password], input[type=number], input[type=date], select {
  font: inherit; font-size: 16px; /* 16px stops iOS zooming on focus */
  width: 100%; max-width: 320px; min-height: 44px; padding: 8px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
}
@media (min-width: 860px) {
  input[type=text], input[type=password], input[type=number], input[type=date], select { font-size: 14px; min-height: 38px; }
}
select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
input:hover, select:hover, textarea:hover { border-color: var(--text-4); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--bad-solid); }
.field-error { color: var(--bad-fg); font-size: 13px; font-weight: 500; margin: 6px 0 0; }
.form-error { color: var(--bad-fg); font-weight: 500; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 8px 0; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--text); }
input[type=checkbox], input[type=radio] { accent-color: var(--text); }
.grid-2 { display: grid; gap: 0 20px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.segmented { border: 0; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.segmented label { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease); }
.segmented label:hover { border-color: var(--text-4); }
.segmented label:has(input:checked) { background: var(--text); color: var(--surface); border-color: var(--text); }
.segmented input { accent-color: var(--accent); margin: 0; }
.confirm-live { background: var(--bad-bg); color: var(--bad-fg); border: 1px solid var(--bad-line); padding: 10px 12px; border-radius: var(--radius-sm); }
.js .confirm-live.is-hidden { display: none; }

.provider-list { list-style: none; margin: 0; padding: 0; }
.provider { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.provider:last-child { border-bottom: 0; }
.provider .check { margin: 4px 0; }
.provider-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.provider-send .pill { white-space: normal; }

table.ramp { border-collapse: collapse; margin: 4px 0; font-variant-numeric: tabular-nums; }
table.ramp th { text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3); padding: 2px 8px 6px 0; }
table.ramp td { padding: 3px 8px 3px 0; }
table.ramp input { width: 110px; }

/* ---- Buttons: primary, secondary (btn-quiet), ghost, danger ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 500; font-size: 14px; line-height: 1.2; letter-spacing: -0.005em;
  border-radius: var(--radius-sm); padding: 10px 16px; border: 1px solid transparent; cursor: pointer; min-height: 44px;
  text-decoration: none;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: var(--ink-hover); color: var(--on-ink); }
/* Ember fill is kept for the rare key action (Publish), so it stands out. */
.btn-accent { background: var(--accent-strong); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-quiet { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-quiet:hover { background: var(--surface-hover); color: var(--text); border-color: var(--text-4); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-danger { background: var(--surface); color: var(--bad-fg); border-color: var(--bad-line); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad-fg); }
.btn:active:not([disabled]) { filter: brightness(0.96); }
.btn[disabled] { cursor: not-allowed; }
.btn-sm { font-size: 13px; padding: 6px 12px; min-height: 36px; }
@media (max-width: 859px) { .btn-sm { min-height: 44px; } }
.btn-block { width: 100%; }
.form-actions { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); display: flex; justify-content: flex-end; padding: 8px 0 4px; }
@media (min-width: 860px) { .form-actions { bottom: 12px; } }

/* ---- More page ---- */
.more-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.more-list li + li { border-top: 1px solid var(--line); }
.more-list a { display: flex; gap: 12px; align-items: center; padding: 14px 16px; text-decoration: none; font-weight: 500; min-height: 52px; transition: background-color var(--fast) var(--ease); }
.more-list a:hover { background: var(--surface-hover); color: var(--text); }
.more-list svg { color: var(--text-3); }

/* ---- Bare pages (login) ---- */
body.bare { padding-bottom: 0; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; }
.bare-main { width: 100%; max-width: 380px; padding: 24px 16px; }
.bare-brand { display: flex; justify-content: center; margin-bottom: 20px; }
.bare-brand .brand { margin: 0; }
.login { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 20px; }
.login h1 { font-size: 18px; margin-bottom: 14px; }
.login label { display: block; margin-bottom: 6px; }
.login input[type=password] { max-width: none; margin-bottom: 16px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
