/* Petrichor Ops: the team's private admin app.
   Brand: cobalt + cream. Headings: Fraunces. UI text: Figtree. Numbers and labels: DM Mono.
   Fonts are declared in index.html (assets/fonts/*). Light only: an admin tool on paper. */

:root {
  color-scheme: light;

  --blue: #004a8e;
  --blue-600: #003b73;
  --blue-800: #002b55;
  --sky: #d6e6f5;
  --sky-300: #a9c9ea;
  --sky-50: #edf4fb;
  --cream: #fffbf2;
  --paper: #f6efe1;
  --paper-200: #ebe0cb;
  --paper-300: #dccfb5;
  --ink: #0b1f3a;
  --ink-soft: #435069;
  --ink-faint: #5c6679;
  --alert: #b3261e;
  --alert-bg: #fbe7e3;
  --alert-line: #ecb8b1;
  --warn: #7a4d0b;
  --warn-bg: #fbecd0;
  --warn-line: #ebcf98;
  --ok: #24613a;
  --ok-bg: #e0efdf;

  /* Chart series, validated against the cream card surface (dataviz validator: CVD + contrast pass). */
  --series-1: #1f5fa6;
  --series-2: #c8691c;
  --jar-scanned: #8db3dd;
  --jar-feedback: #1f5fa6;
  --grid: #ebe0cb;

  --display: "Fraunces", Georgia, serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius: 20px;
  --radius-sm: 12px;
  --side: 236px;
  --gap: 16px;
  --shadow: 0 1px 0 rgba(11, 31, 58, 0.03), 0 10px 30px -22px rgba(0, 43, 85, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
.icon { display: inline-block; flex: none; vertical-align: -0.2em; }
a { color: var(--blue); text-underline-offset: 2px; }
a:hover { color: var(--blue-800); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--sky); }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
mark { background: #f6d7a2; color: var(--ink); border-radius: 3px; padding: 0 2px; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.wrap-word { overflow-wrap: break-word; }
@media (max-width: 599px) {
  .hide-sm { display: none; }
  .table-compact td, .table-compact th { padding: 7px 6px; }
  td.wrap-word { overflow-wrap: anywhere; min-width: 9em; }
}
.link-sm { font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.link-sm:hover { text-decoration: underline; }
.stack { display: grid; gap: 14px; }
.stack-right { display: grid; justify-items: end; gap: 6px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- boot + sign-in */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-msg { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); text-align: center; padding: 24px; }
.signin-page { min-height: 100vh; }
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.signin-card {
  width: min(100%, 420px);
  background: var(--cream);
  border: 1px solid var(--paper-200);
  border-radius: 24px;
  padding: 36px 32px 32px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  justify-items: start;
}
.signin-title { font-family: var(--display); font-size: 26px; line-height: 1.15; letter-spacing: -0.01em; }
.signin-text { color: var(--ink-soft); }

.brand { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-name { font-family: var(--display); font-weight: 750; font-size: 22px; letter-spacing: -0.02em; color: var(--blue); font-variation-settings: "SOFT" 100, "WONK" 1; }
.brand-tag { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-soft); border: 1px solid var(--paper-300); border-radius: 999px; padding: 1px 8px; transform: translateY(-3px); }
.brand-lg .brand-name { font-size: 30px; }

/* ---------------------------------------------------------------- shell */
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--cream); color: var(--blue); padding: 8px 14px; border-radius: 999px; font-weight: 700; }
.skip:focus { top: 12px; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--side);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 14px 18px;
  background: var(--paper);
  border-right: 1px solid var(--paper-200);
  z-index: 30;
  overflow-y: auto;
}
.sidebar > .brand { padding: 2px 10px 6px; }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 12px;
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
  min-height: 42px;
}
.nav-link:hover { background: var(--paper-200); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--cream); color: var(--blue); box-shadow: inset 0 0 0 1px var(--paper-200); }
.nav-badge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--blue);
  color: var(--cream);
  font-family: var(--mono);
  font-size: 12px;
  display: inline-grid;
  place-items: center;
}
.nav-foot { margin-top: auto; border-top: 1px solid var(--paper-200); padding: 14px 10px 0; display: grid; gap: 6px; }
.nav-user { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-signout {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--blue);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.topbar { display: none; }
.scrim { display: none; }

.main {
  margin-left: var(--side);
  padding: 30px clamp(20px, 3vw, 40px) 72px;
  max-width: calc(var(--side) + 1320px);
  min-height: 100vh;
  display: grid;
  gap: var(--gap);
  align-content: start;
}
.main:focus { outline: none; }
.main > * { min-width: 0; }
.is-refreshing { opacity: 0.55; transition: opacity 0.15s; }

@media (max-width: 899px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 10px 16px;
    background: rgba(246, 239, 225, 0.94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--paper-200);
  }
  .menu-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--paper-300);
    border-radius: 12px;
    background: var(--cream);
    cursor: pointer;
  }
  .sidebar { transform: translateX(-102%); transition: transform 0.2s ease; width: min(84vw, 300px); box-shadow: 0 0 40px rgba(11, 31, 58, 0.2); visibility: hidden; }
  .menu-open .sidebar { transform: none; visibility: visible; }
  .menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(11, 31, 58, 0.28); }
  .main { margin-left: 0; padding: 18px 16px 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* ---------------------------------------------------------------- page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.page-head-text { display: grid; gap: 4px; min-width: 0; }
.page-title { font-family: var(--display); font-size: clamp(26px, 2.2vw, 32px); line-height: 1.1; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.page-title:focus { outline: none; }
.page-sub { color: var(--ink-soft); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; text-decoration: none; justify-self: start; min-height: 32px; }
.back-link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--cream);
  border: 1px solid var(--paper-200);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  min-width: 0;
}
.card-flush { padding: 6px 4px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-family: var(--display); font-size: 18px; line-height: 1.2; letter-spacing: -0.005em; display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--ink-soft); font-size: 13px; margin-top: 3px; }
.card-actions { flex: none; }
@media (max-width: 599px) {
  .card { padding: 16px 14px 16px; border-radius: 18px; }
}

.grid-2 { display: grid; gap: var(--gap); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.grid-wide-left { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
/* Breakdown cards of uneven height: flow down two balanced columns instead of rows with gaps. */
.grid-flow { display: block; columns: 2; column-gap: var(--gap); }
.grid-flow > * { break-inside: avoid; margin-bottom: var(--gap); display: block; }
.grid-flow > *:last-child { margin-bottom: 0; }
@media (max-width: 1099px) {
  .grid-2, .grid-wide-left { grid-template-columns: minmax(0, 1fr); }
  .grid-flow { columns: 1; }
}

/* ---------------------------------------------------------------- KPI tiles */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpis-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpis-8 { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.kpi {
  display: grid;
  align-content: start;
  gap: 2px;
  background: var(--cream);
  border: 1px solid var(--paper-200);
  border-radius: 18px;
  padding: 14px 16px 15px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.kpi-link:hover { border-color: var(--sky-300); color: var(--ink); background: #fffdf8; }
.kpi-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.kpi-value { font-family: var(--body); font-weight: 650; font-size: clamp(24px, 2vw, 30px); line-height: 1.15; letter-spacing: -0.01em; }
.kpi-suffix { font-size: 0.55em; font-weight: 600; color: var(--ink-soft); letter-spacing: 0; }
.kpi-note { font-size: 12.5px; color: var(--ink-soft); }
.kpi-alert { border-color: var(--alert-line); background: var(--alert-bg); }
.kpi-alert .kpi-note { color: var(--alert); font-weight: 600; }
.kpi-warn { border-color: var(--warn-line); background: var(--warn-bg); }
@media (max-width: 599px) {
  .kpis, .kpis-4, .kpis-8 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 13px 13px; }
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: var(--cream); }
.btn-primary:hover:not(:disabled) { background: var(--blue-800); color: var(--cream); }
.btn-secondary { background: var(--cream); color: var(--ink); border-color: var(--paper-300); }
.btn-secondary:hover:not(:disabled) { border-color: var(--ink-soft); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--paper-200); color: var(--ink); }
.btn-danger { background: var(--alert); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8f1d17; color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--alert); border-color: var(--alert-line); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--alert-bg); color: var(--alert); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn-lg { min-height: 48px; padding: 12px 26px; font-size: 16px; }

/* ---------------------------------------------------------------- chips, tabs, pills, tags */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--paper-300);
  background: var(--cream);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { border-color: var(--ink-soft); color: var(--ink); }
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--blue); border-color: var(--blue); color: var(--cream); }
.chip-count { font-family: var(--mono); font-size: 11.5px; font-weight: 500; opacity: 0.8; }

.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--sky); color: var(--blue-800); font-size: 13px; }
.filter-chip-x { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; color: var(--blue-800); }
.filter-chip-x:hover { background: var(--sky-300); color: var(--ink); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--paper-300); overflow-x: auto; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--blue); border-bottom-color: var(--blue); }
.tab-count { font-family: var(--mono); font-size: 12px; background: var(--paper-200); color: var(--ink); border-radius: 999px; padding: 1px 8px; }
.tab[aria-current="page"] .tab-count { background: var(--sky); color: var(--blue-800); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--paper-200);
  color: var(--ink);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
/* People statuses: each a distinct hue, dark text on a light wash (all ≥ 7:1). */
.pill-new { background: #dce8f6; color: #174a82; }
.pill-talking { background: #d4ecea; color: #155553; }
.pill-vip { background: #f8e2b8; color: #6b4108; }
.pill-wholesale { background: #e6dff4; color: #46307f; }
.pill-customer { background: #dcebcc; color: #2b5514; }
.pill-dnc { background: #f6dad5; color: #8c1c16; }
.pill-dnc::before { border-radius: 1px; width: 8px; height: 2px; }
/* Campaign statuses */
.pill-c-draft { background: var(--paper-200); color: var(--ink-soft); }
.pill-c-queued { background: var(--warn-bg); color: var(--warn); }
.pill-c-sending { background: var(--sky); color: var(--blue-800); }
.pill-c-sent { background: var(--ok-bg); color: var(--ok); }
.pill-c-failed { background: var(--alert-bg); color: var(--alert); }
/* Generic tones */
.pill-t-ok { background: var(--ok-bg); color: var(--ok); }
.pill-t-info { background: var(--sky); color: var(--blue-800); }
.pill-t-bad { background: var(--alert-bg); color: var(--alert); }
.pill-t-muted { background: var(--paper-200); color: var(--ink-soft); }

.chip-new[aria-pressed="true"] { background: #174a82; border-color: #174a82; }
.chip-talking[aria-pressed="true"] { background: #155553; border-color: #155553; }
.chip-vip[aria-pressed="true"] { background: #6b4108; border-color: #6b4108; }
.chip-wholesale[aria-pressed="true"] { background: #46307f; border-color: #46307f; }
.chip-customer[aria-pressed="true"] { background: #2b5514; border-color: #2b5514; }
.chip-dnc[aria-pressed="true"] { background: #8c1c16; border-color: #8c1c16; }

.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 8px; background: var(--paper-200); font-family: var(--mono); font-size: 12px; color: var(--ink); }
.tiny-tag { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 6px; background: var(--paper-200); color: var(--ink-soft); font-size: 11.5px; font-weight: 600; }
.tiny-bad { background: var(--alert-bg); color: var(--alert); }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-weight: 650; font-size: 14px; }
.field-help { font-size: 13px; color: var(--ink-soft); }
.field-error { color: var(--alert); font-size: 13px; font-weight: 600; }
.field-error:empty { display: none; }
.field-inline { display: flex; align-items: center; gap: 10px; }
.input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--paper-300);
  background: #fffefb;
  color: var(--ink);
}
.input:hover { border-color: #c9b994; }
.input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); border-radius: var(--radius-sm); }
.input:disabled { background: var(--paper); color: var(--ink-soft); }
.input-sm { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.textarea { resize: vertical; line-height: 1.55; min-height: 90px; }
.textarea-body { min-height: 320px; font-size: 15px; }
.select { width: auto; max-width: 100%; padding-right: 32px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }

.filters { display: grid; gap: 12px; }
.filters-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.search-wrap { position: relative; max-width: 480px; }
.search-wrap .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
.input-search { padding-left: 38px; }
.filter-selects { display: flex; flex-wrap: wrap; gap: 8px; }
.date-range { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.date-range .input { width: auto; }

/* ---------------------------------------------------------------- notices + states */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; border: 1px solid; font-size: 14px; }
.notice > .icon { margin-top: 2px; }
.notice > div { display: grid; gap: 6px; min-width: 0; }
.notice-error { background: var(--alert-bg); border-color: var(--alert-line); color: #7e1a14; }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); color: #5c3a06; }
.notice .muted { color: inherit; opacity: 0.85; }
.status-line { font-size: 14px; font-weight: 600; min-height: 1.4em; }
.status-line:empty { min-height: 0; }
.status-line[data-tone="ok"] { color: var(--ok); }
.status-line[data-tone="error"] { color: var(--alert); }
.status-line[data-tone="warn"] { color: var(--warn); }
.status-line[data-tone="busy"] { color: var(--ink-soft); font-weight: 500; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); padding: 28px 4px; font-size: 14px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--paper-300); border-top-color: var(--blue); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 36px 16px; color: var(--ink-soft); }
.empty-title { font-family: var(--display); font-size: 19px; color: var(--ink); }
.empty-text { max-width: 44ch; font-size: 14px; }
.empty-actions { margin-top: 8px; }
.empty-inline { color: var(--ink-soft); font-size: 14px; padding: 6px 0; }

/* Irritation reports: pinned at the top of Today and Beta. */
.banner-alert { background: var(--alert); color: #fff; border-radius: var(--radius); padding: 16px 20px; display: grid; gap: 10px; }
.banner-alert-head { display: flex; align-items: center; gap: 10px; }
.banner-alert h2 { font-family: var(--display); font-size: 19px; }
.banner-alert ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.banner-alert li { background: rgba(255, 255, 255, 0.12); border-radius: 12px; padding: 10px 12px; display: grid; gap: 3px; }
.banner-alert a { color: #fff; }
.banner-alert a:hover { color: #fff; text-decoration-thickness: 2px; }
.banner-alert p { font-size: 14px; opacity: 0.95; }
.banner-alert :focus-visible { outline-color: #fff; }

/* ---------------------------------------------------------------- charts */
.chart { margin: 0; display: grid; gap: 10px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-soft); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.key { display: inline-block; flex: none; }
.key-bar { width: 11px; height: 11px; border-radius: 3px; background: var(--series-1); }
.key-bar.s2 { background: var(--series-2); }
.key-line { width: 16px; height: 2px; border-radius: 2px; background: var(--series-1); }
.key-line.s2 { background: var(--series-2); }
.key-cell { width: 14px; height: 14px; border-radius: 4px; }
.chart-wrap { position: relative; }
.chart-plot { width: 100%; min-height: 120px; border-radius: 10px; touch-action: pan-y; }
.chart-plot:focus-visible { outline-offset: 4px; }
.chart-svg { display: block; overflow: visible; }
.chart-panel-title { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; fill: var(--ink-soft); }
.chart-grid { stroke: var(--grid); stroke-width: 1; }
.chart-base { stroke: var(--paper-300); stroke-width: 1; }
.chart-tick { font-family: var(--mono); font-size: 10.5px; fill: var(--ink-faint); font-variant-numeric: tabular-nums; }
.chart-label { font-family: var(--body); font-size: 12px; font-weight: 650; fill: var(--ink); }
.chart-cross { stroke: var(--ink-soft); stroke-width: 1; pointer-events: none; }
.chart-band { fill: var(--sky-50); }
.marks.s1 path { fill: var(--series-1); }
.marks.s2 path { fill: var(--series-2); }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line.s1 { stroke: var(--series-1); }
.line.s2 { stroke: var(--series-2); }
.area.s1 { fill: var(--series-1); opacity: 0.1; }
.area.s2 { fill: var(--series-2); opacity: 0.1; }
.dot { stroke: var(--cream); stroke-width: 2; }
.dot.s1 { fill: var(--series-1); }
.dot.s2 { fill: var(--series-2); }
.chart-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: var(--ink);
  color: var(--cream);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13px;
  min-width: 150px;
  box-shadow: 0 10px 30px -10px rgba(11, 31, 58, 0.5);
}
.chart-tip-date { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; opacity: 0.8; margin-bottom: 4px; }
.chart-tip ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.chart-tip li { display: flex; align-items: center; gap: 8px; }
.chart-tip strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.chart-tip .key-line.s1 { background: #8db3dd; }
.chart-tip .key-line.s2 { background: #eaa262; }
.chart-table summary, .cheatsheet summary, .pv-text-wrap summary, .evt-more summary, .show-email > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  width: fit-content;
  min-height: 28px;
  display: flex;
  align-items: center;
}
.table-scroll { overflow-x: auto; max-height: 360px; margin-top: 8px; }

.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hbar { display: grid; gap: 4px; min-width: 0; }
.hbar-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 14px; min-width: 0; }
.hbar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-button { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 600; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--sky-300); text-underline-offset: 3px; }
.hbar-button:hover { text-decoration-color: currentColor; }
.hbar-button[aria-pressed="true"] { color: var(--ink); text-decoration: none; }
.hbar-value { flex: none; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-value strong { color: var(--ink); font-weight: 650; font-size: 14px; }
.hbar-track { height: 8px; }
.hbar-fill { height: 8px; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 0; }
.hbar-fill.s2 { background: var(--series-2); }
@media (max-width: 599px) {
  .hbar-top { flex-wrap: wrap; row-gap: 0; }
  .hbar-name { flex: 1 1 7em; }
  .hbar-value { margin-left: auto; white-space: normal; text-align: right; }
}

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table-tall { max-height: 520px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); padding: 10px 12px; border-bottom: 1px solid var(--paper-300); white-space: nowrap; position: sticky; top: 0; background: var(--cream); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--paper-200); vertical-align: top; }
.table tbody tr:last-child td, .table tbody tr:last-child th { border-bottom: 0; }
.table tbody tr:hover { background: #fdf7ea; }
.table tbody th { text-align: left; font-family: var(--body); font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 500; position: static; background: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-compact td, .table-compact th { padding: 7px 10px; }
.pt-person { display: grid; gap: 1px; min-width: 210px; }
.pt-name { font-weight: 650; text-decoration: none; overflow-wrap: break-word; }
.pt-name:hover { text-decoration: underline; }
.pt-email { font-size: 13px; color: var(--ink-soft); overflow-wrap: break-word; }
.pt-activity { font-size: 13px; }
.people-table td:nth-child(2) { white-space: nowrap; }
.ct-subject a { font-weight: 650; }

@media (max-width: 759px) {
  .people-table thead, .campaign-table thead { display: none; }
  .people-table, .people-table tbody, .people-table tr, .people-table td,
  .campaign-table, .campaign-table tbody, .campaign-table tr, .campaign-table td { display: block; width: 100%; }
  .people-table tr, .campaign-table tr { padding: 12px 14px; border-bottom: 1px solid var(--paper-200); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .people-table td, .campaign-table td { padding: 0; border: 0; text-align: left; font-size: 13.5px; }
  .people-table td::before, .campaign-table td::before { content: attr(data-label); display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 1px; }
  .people-table td.pt-person, .campaign-table td.ct-subject { grid-column: 1 / -1; }
  .people-table td.pt-person { display: grid; min-width: 0; }
  .people-table td.is-empty { display: none; }
  .people-table td.pt-person::before, .campaign-table td.ct-subject::before { display: none; }
  .people-table td:nth-child(6), .people-table td:nth-child(7) { grid-column: 1 / -1; }
  .table .num { text-align: left; }
  .card-flush { padding: 0; }
}

/* ---------------------------------------------------------------- Today */
.card-chart { padding-bottom: 14px; }
.people-mini { list-style: none; margin: 0; padding: 0; display: grid; }
.people-mini li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--paper-200); }
.people-mini li:last-child { border-bottom: 0; }
.people-mini a { display: grid; min-width: 0; text-decoration: none; color: var(--ink); }
.people-mini a:hover .pm-name { text-decoration: underline; }
.pm-name { font-weight: 650; color: var(--blue); overflow-wrap: anywhere; }
.pm-email { font-size: 12.5px; color: var(--ink-soft); overflow-wrap: anywhere; }
.pm-activity { font-size: 13px; color: var(--ink); }
.pm-meta { display: grid; justify-items: end; gap: 4px; font-size: 12.5px; color: var(--ink-soft); flex: none; }

.export { display: grid; gap: 6px; justify-items: end; }
.export-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.export .btn-row { justify-content: flex-end; }
@media (max-width: 759px) {
  .export { justify-items: start; }
  .export .btn-row { justify-content: flex-start; }
}

/* ---------------------------------------------------------------- Inbox */
.inbox-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.inbox-col { background: var(--cream); border: 1px solid var(--paper-200); border-radius: var(--radius); overflow: hidden; }
.inbox-list { list-style: none; margin: 0; padding: 0; }
.inbox-list li + li { border-top: 1px solid var(--paper-200); }
.inbox-item { display: grid; gap: 3px; padding: 13px 16px; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
.inbox-item:hover { background: #fdf7ea; color: var(--ink); }
.inbox-item[aria-current="true"] { background: var(--sky-50); border-left-color: var(--blue); }
.inbox-item.is-flagged { border-left-color: var(--alert); }
.inbox-item:focus-visible { outline-offset: -3px; border-radius: 0; }
.ii-top { display: flex; align-items: center; gap: 8px; }
.ii-time { margin-left: auto; font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
.ii-from { font-weight: 650; overflow-wrap: anywhere; }
.ii-subject { font-size: 14px; overflow-wrap: anywhere; }
.ii-preview { font-size: 13px; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.kind { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.kind-email { color: var(--blue); }
.kind-feedback { color: #7a4d0b; }
.flag-mark { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--alert); color: #fff; font-size: 11.5px; font-weight: 700; }
.detail-col { position: sticky; top: 16px; min-width: 0; max-height: calc(100vh - 32px); overflow-y: auto; border-radius: var(--radius); overscroll-behavior: contain; }
.detail { display: grid; gap: 14px; }
.detail-back { display: none; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.detail-title { font-family: var(--display); font-size: 24px; line-height: 1.2; overflow-wrap: anywhere; }
.detail-title:focus { outline: none; }
.detail-from { font-size: 14px; color: var(--ink-soft); overflow-wrap: anywhere; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; background: #fffefb; border: 1px solid var(--paper-200); border-radius: 14px; padding: 14px 16px; font-size: 15px; line-height: 1.6; max-height: 60vh; overflow-y: auto; }
.attachments { display: grid; gap: 6px; font-size: 14px; }
.attachments-note { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.attachments ul { margin: 0; padding-left: 22px; }
.att-name { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.detail-actions { padding-top: 4px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; margin: 0; }
.fact { min-width: 0; }
.fact dt { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.fact dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.facts-stack { grid-template-columns: 1fr; gap: 12px; }
@media (max-width: 999px) {
  .inbox-layout { grid-template-columns: minmax(0, 1fr); }
  .inbox-layout.has-detail .inbox-col { display: none; }
  .inbox-layout:not(.has-detail) .detail-col { display: none; }
  .detail-col { position: static; max-height: none; overflow: visible; }
  .detail-back { display: inline-flex; }
}

/* ---------------------------------------------------------------- composer */
.composer { display: grid; gap: 14px; border-color: var(--sky-300); background: #fffdf7; }
.composer-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; }
.composer-to { font-size: 14px; color: var(--ink-soft); overflow-wrap: anywhere; }
.composer-to strong { color: var(--ink); font-weight: 600; }
.composer.is-sent { border-color: #b7d8bd; }
.composer-slot:empty { display: none; }
.lint-title { font-weight: 700; }
.lint-list { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: 13.5px; }

/* ---------------------------------------------------------------- Person */
.person-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 20px; align-items: start; }
.ph-main { display: grid; gap: 3px; min-width: 0; }
.ph-email { font-family: var(--mono); font-size: 13.5px; color: var(--ink-soft); overflow-wrap: anywhere; }
.ph-activity { font-size: 14px; }
.ph-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: flex-end; }
.ph-tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 12px; border-top: 1px solid var(--paper-200); }
.person-head > .status-line { grid-column: 1 / -1; }
.tag-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.tag-edit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-edit { padding: 2px 4px 2px 10px; font-size: 12.5px; }
.tag-x { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-soft); cursor: pointer; }
.tag-x:hover { background: var(--paper-300); color: var(--ink); }
.tag-add { display: flex; gap: 6px; align-items: center; }
.tag-add .input { width: 150px; }
.person-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: var(--gap); align-items: start; }
.person-side { display: grid; gap: var(--gap); }
@media (max-width: 1099px) {
  .person-grid { grid-template-columns: minmax(0, 1fr); }
  .person-side { display: contents; }
  .person-side > :first-child { order: -1; }
}
@media (max-width: 599px) {
  .person-head { grid-template-columns: minmax(0, 1fr); }
  .ph-controls { justify-content: flex-start; }
}

.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.evt { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; position: relative; padding-bottom: 16px; }
.evt::before { content: ""; position: absolute; left: 15.5px; top: 32px; bottom: 0; width: 1px; background: var(--paper-300); }
.evt:last-child::before { display: none; }
.evt-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--paper-200); color: var(--ink-soft); }
.evt-blue .evt-icon { background: var(--sky); color: var(--blue-800); }
.evt-in .evt-icon { background: #f8e2b8; color: #6b4108; }
.evt-out .evt-icon { background: var(--ok-bg); color: var(--ok); }
.evt-bad .evt-icon { background: var(--alert-bg); color: var(--alert); }
.evt-body { display: grid; gap: 3px; min-width: 0; padding-top: 3px; }
.evt-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.evt-type { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.evt-time { font-size: 12.5px; color: var(--ink-soft); }
.evt-summary { font-size: 14.5px; overflow-wrap: anywhere; }
.evt-by { font-size: 12.5px; color: var(--ink-soft); }
.evt-sub { font-size: 13px; color: var(--ink-soft); overflow-wrap: anywhere; }
.evt-sub .icon { display: inline-block; }
.evt-quote { font-size: 14px; border-left: 3px solid var(--paper-300); padding-left: 10px; color: var(--ink); overflow-wrap: anywhere; }
.evt-more .message-text { margin-top: 6px; font-size: 14px; }

/* ---------------------------------------------------------------- Beta */
.jar-grid { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; max-width: 620px; }
.jar {
  aspect-ratio: 1.25;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--paper-300);
  position: relative;
  cursor: default;
}
.jar-none { background: var(--paper); }
.jar-scanned { background: var(--jar-scanned); color: var(--ink); box-shadow: none; }
.jar-feedback { background: var(--jar-feedback); color: #fff; box-shadow: none; }
.jar-flagged { box-shadow: inset 0 0 0 2px var(--alert), 0 0 0 2px var(--cream); }
.jar-flagged::after { content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--alert); box-shadow: 0 0 0 1.5px var(--cream); }
.key-cell.jar-none { background: var(--paper); box-shadow: inset 0 0 0 1px var(--paper-300); }
.key-cell.jar-scanned { background: var(--jar-scanned); }
.key-cell.jar-feedback { background: var(--jar-feedback); }
.key-cell.jar-flagged { box-shadow: inset 0 0 0 2px var(--alert); }
@media (max-width: 599px) {
  .jar { font-size: 9px; border-radius: 5px; }
  .jar-grid { gap: 3px; }
}
.comments { list-style: none; margin: 0; padding: 0; display: grid; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--paper-200); display: grid; gap: 4px; }
.comment:first-child { padding-top: 0; }
.comment:last-child { border-bottom: 0; }
.comment.is-flagged { background: var(--alert-bg); border-radius: 12px; padding: 12px; border-bottom: 0; margin-bottom: 6px; }
.comment-text { font-size: 15px; overflow-wrap: anywhere; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12.5px; color: var(--ink-soft); }
.comment-meta a { overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- Campaign */
.campaign-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.editor { display: grid; gap: 16px; }
.preview { display: grid; gap: 12px; position: sticky; top: 16px; }
.preview .card-head { margin-bottom: 0; }
@media (max-width: 1199px) {
  .campaign-layout { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; }
}
.cheatsheet { border-top: 1px solid var(--paper-200); padding-top: 10px; }
.cheatsheet table { margin-top: 8px; }
.cheatsheet code { background: var(--paper); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.cheatsheet td:first-child { width: 45%; }
.pv-count { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 14px; }
.pv-h { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.check-item { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; }
.check-item .icon { margin-top: 2px; }
.check-item.is-todo .icon { color: var(--alert); }
.check-item.is-done { color: var(--ok); font-weight: 650; }
.pv-subject { display: grid; gap: 2px; font-weight: 650; overflow-wrap: anywhere; }
.pv-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); font-weight: 500; }
.pv-frame { border-radius: 14px; overflow: hidden; border: 1px solid var(--paper-200); background: var(--paper); transition: opacity 0.15s; }
.pv-frame:empty { min-height: 200px; }
.email-frame { display: block; width: 100%; height: 640px; border: 0; background: var(--paper); }
@media (max-width: 599px) { .email-frame { height: 520px; } }
.pv-text { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12.5px; background: #fffefb; border: 1px solid var(--paper-200); border-radius: 12px; padding: 12px; margin: 8px 0 0; max-height: 360px; overflow: auto; }
.save-state { font-size: 13px; color: var(--ink-soft); }
.save-state[data-dirty="true"] { color: var(--warn); font-weight: 600; }
.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 16px;
  margin: 0 -4px;
  background: rgba(255, 251, 242, 0.96);
  border: 1px solid var(--paper-200);
  border-radius: 18px;
  box-shadow: 0 -8px 24px -18px rgba(11, 31, 58, 0.4);
}
.show-email { padding: 14px 20px; }
.show-email[open] { display: grid; gap: 10px; }
.progress-card { display: grid; gap: 8px; }
.meter { height: 10px; border-radius: 999px; background: var(--sky); overflow: hidden; }
.meter-fill { height: 100%; background: var(--blue); border-radius: 999px; transition: width 0.3s; }

/* ---------------------------------------------------------------- dialogs */
.dialog { border: 0; border-radius: 22px; padding: 0; width: min(100% - 32px, 460px); background: var(--cream); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(11, 31, 58, 0.5); }
.dialog::backdrop { background: rgba(11, 31, 58, 0.4); }
.dialog-body { display: grid; gap: 14px; padding: 24px; }
.dialog-title { font-family: var(--display); font-size: 22px; line-height: 1.2; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.dialog-error { color: var(--alert); font-size: 14px; font-weight: 600; display: grid; gap: 4px; }
.dialog-error:empty { display: none; }
.dialog-error ul { margin: 0; padding-left: 18px; font-weight: 500; }

/* ---------------------------------------------------------------- Settings */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
@media (max-width: 1099px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } }
.setup-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 14px; }
.setup-item { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; }
.setup-icon { color: var(--ink-soft); padding-top: 1px; }
.setup-item.is-done .setup-icon { color: var(--ok); }
.setup-item.is-todo .setup-icon { color: var(--alert); }
.setup-title { font-weight: 650; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.setup-state { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 7px; border-radius: 6px; background: var(--paper-200); color: var(--ink-soft); font-weight: 500; }
.is-done .setup-state { background: var(--ok-bg); color: var(--ok); }
.is-todo .setup-state { background: var(--alert-bg); color: var(--alert); }
.setup-text { font-size: 14px; color: var(--ink-soft); margin-top: 2px; }

@media (forced-colors: active) {
  .hbar-fill, .marks path, .jar-scanned, .jar-feedback, .meter-fill { forced-color-adjust: none; }
  .pill::before { forced-color-adjust: none; }
}
