:root {
  --ink: #0f1720;
  --ink-2: #47535f;
  --ink-3: #7b8794;
  --line: #e3e7eb;
  --line-2: #eef1f4;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #1f5f8b;
  --accent-soft: #eaf2f8;
  --good: #1f7a4d;
  --good-soft: #e8f5ee;
  --warn: #9a6206;
  --warn-soft: #fdf3e2;
  --bad: #a32b2b;
  --bad-soft: #fbeceb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 23, 32, .05), 0 1px 3px rgba(16, 23, 32, .04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 'Manrope', -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 22px;
  height: 60px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 210px; }

.mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px; letter-spacing: .5px;
}

.brand-name { font-weight: 650; font-size: 14px; line-height: 1.1; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); }

.tabs { display: flex; gap: 2px; flex: 1; }

.tab {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  padding: 7px 12px;
  border-radius: 7px;
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { background: var(--line-2); color: var(--ink); }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.pill {
  background: var(--ink);
  color: #fff;
  border-radius: 20px;
  font-size: 11px;
  padding: 1px 7px;
  font-weight: 600;
}
.tab.active .pill { background: var(--accent); }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.badge {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 650;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 4px 9px;
}

.banner {
  padding: 10px 22px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--accent);
}
.banner.error { background: var(--bad-soft); color: var(--bad); }

/* ---------------------------------------------------------------- layout */

main { padding: 22px; max-width: 1500px; margin: 0 auto; }

.view { display: none; }
.view.active { display: block; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 15px; margin: 0; font-weight: 650; letter-spacing: -.1px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1050px) { .grid-2 { grid-template-columns: 1fr; } }

.muted { color: var(--ink-3); font-size: 12.5px; }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- kpis */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow);
}
.kpi .label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .55px;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 7px;
}
.kpi .value { font-size: 25px; font-weight: 680; letter-spacing: -.6px; line-height: 1.1; }
.kpi .sub { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.kpi.alert { border-color: #f0cfcd; background: linear-gradient(180deg, #fff, var(--bad-soft)); }
.kpi.alert .value { color: var(--bad); }
.kpi.good .value { color: var(--good); }

/* ---------------------------------------------------------------- buckets */

.buckets { display: flex; flex-direction: column; gap: 9px; }

.bucket { display: grid; grid-template-columns: 74px 1fr 116px; align-items: center; gap: 12px; }
.bucket .name { font-size: 12.5px; font-weight: 620; color: var(--ink-2); }
.bucket .bar-wrap { background: var(--line-2); border-radius: 5px; height: 22px; overflow: hidden; }
.bucket .bar { height: 100%; background: var(--accent); border-radius: 5px; min-width: 2px; transition: width .3s; }
.bucket.hot .bar { background: var(--bad); }
.bucket.warm .bar { background: #c98a2e; }
.bucket .meta { font-size: 12px; color: var(--ink-3); text-align: right; }

/* ---------------------------------------------------------------- lists */

.mini-list { display: flex; flex-direction: column; }

.mini-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
}
.mini-item:last-child { border-bottom: 0; }
.mini-item:hover { background: #fafbfc; }
.mini-item .score {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 680; font-size: 12.5px;
  background: var(--line-2); color: var(--ink-2);
  flex: none;
}
.mini-item .score.hot { background: var(--bad-soft); color: var(--bad); }
.mini-item .score.warm { background: var(--warn-soft); color: var(--warn); }
.mini-item .body { flex: 1; min-width: 0; }
.mini-item .t { font-size: 13px; font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-item .s { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { color: var(--ink-3); font-size: 13px; padding: 16px 2px; }

/* ---------------------------------------------------------------- queue */

/* .queue and .qitem styles removed: superseded by the Today list. */


/* ---------------------------------------------------------------- buttons */

.btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 7px;
  padding: 7px 13px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  font-weight: 540;
}
.btn:hover { background: var(--line-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #1d2833; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ink-3);
  font-weight: 650;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr:hover td { background: #fafbfc; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.search {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 11px;
  font: inherit;
  font-size: 13px;
  min-width: 280px;
}

/* ---------------------------------------------------------------- coi */

.coi-list { display: flex; flex-direction: column; gap: 10px; }
.coi {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 13px 15px;
}
.coi-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.coi-head .holder { font-weight: 580; font-size: 14px; }
.checks { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.check { display: flex; gap: 9px; font-size: 12.5px; align-items: flex-start; }
.check .ico { width: 15px; flex: none; font-weight: 700; }
.check.ok .ico { color: var(--good); }
.check.bad .ico { color: var(--bad); }
.check.warn .ico { color: var(--warn); }

/* ---------------------------------------------------------------- forms */

.form { display: flex; flex-direction: column; gap: 9px; }
.form input, textarea, .search {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  font: inherit;
  font-size: 13.5px;
  width: 100%;
}
textarea { min-height: 150px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; margin-top: 12px; }

.result { margin-top: 14px; font-size: 13px; }
.result pre {
  background: #f8f9fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  font-size: 12px;
  margin: 0;
}

/* ---------------------------------------------------------------- events */

.events { display: flex; flex-direction: column; }
.event { display: flex; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--line-2); font-size: 12.8px; }
.event:last-child { border-bottom: 0; }
.event .when { color: var(--ink-3); min-width: 132px; font-variant-numeric: tabular-nums; font-size: 12px; }
.event .kind { color: var(--accent); font-weight: 600; min-width: 130px; }

/* ---------------------------------------------------------------- drawer */

/* `[hidden]` in the UA sheet is only display:none, and any author rule that
   sets display wins over it. Without this the overlay covers the app at all
   times, dimming everything behind it. */
.drawer[hidden] { display: none; }

.drawer {
  position: fixed; inset: 0;
  background: rgba(15, 23, 32, .38);
  z-index: 60;
  display: flex; justify-content: flex-end;
}
.drawer-inner {
  width: min(680px, 96vw);
  background: var(--card);
  height: 100%;
  overflow-y: auto;
  padding: 26px;
  position: relative;
  box-shadow: -8px 0 28px rgba(15,23,32,.14);
}
.drawer-close {
  position: absolute; top: 14px; right: 16px;
  border: 0; background: transparent; font-size: 26px; line-height: 1;
  cursor: pointer; color: var(--ink-3);
}
.drawer-close:hover { color: var(--ink); }

.draft {
  background: #f8f9fb;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 15px;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.58;
  font-family: inherit;
}
.draft-subject { font-weight: 620; margin-bottom: 4px; font-size: 13.5px; }
.draft-to { font-size: 12px; color: var(--ink-3); margin-bottom: 12px; }
.drawer h3 { font-size: 17px; margin: 0 0 6px; letter-spacing: -.2px; }
.drawer .meta-line { font-size: 12.5px; color: var(--ink-3); margin-bottom: 16px; }
.drawer h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .55px; color: var(--ink-3); margin: 20px 0 9px; }

/* ---------------------------------------------------------------- connections */

.coverage { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.coverage-num { font-size: 44px; line-height: 1; font-weight: 700; letter-spacing: -1.5px; }
.coverage-num span { font-size: 20px; color: var(--ink-3); margin-left: 2px; }
.coverage-body { flex: 1; min-width: 260px; }
.coverage-bar { height: 8px; background: var(--line-2); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.coverage-bar span { display: block; height: 100%; background: var(--good); border-radius: 999px; transition: width .4s; }
.coverage-note { font-size: 13.5px; line-height: 20px; color: var(--ink-2); }
.coverage-note b { color: var(--ink); }

.conn-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

.conn {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.conn-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.conn-name { font-size: 14px; font-weight: 640; }
.conn-cat { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.conn-blurb { font-size: 12.5px; line-height: 18px; color: var(--ink-2); }
.conn-unlocks { display: flex; flex-wrap: wrap; gap: 5px; }
.conn-unlocks span {
  font-size: 11px;
  background: var(--line-2);
  border-radius: 5px;
  padding: 3px 7px;
  color: var(--ink-2);
}
.conn-actions { display: flex; gap: 8px; align-items: center; margin-top: auto; padding-top: 4px; }
.conn-note { font-size: 12px; line-height: 17px; color: var(--warn); }

.conn.connected { border-color: #bfe3cd; background: linear-gradient(180deg, #fff, var(--good-soft)); }
.conn.pending { border-color: #e8dcc0; }
.conn.error { border-color: #f0cfcd; }

[data-theme="dark"] .conn.connected { background: #16281d; border-color: #245139; }
[data-theme="dark"] .conn.pending { border-color: #3a3320; }
[data-theme="dark"] .conn-unlocks span { background: #272727; }

.conn-logo { width: 30px; height: 30px; flex: none; display: block; }
.conn-logo svg { width: 30px; height: 30px; display: block; }
.conn-logo-plain {
  display: grid; place-items: center; border-radius: 8px;
  background: var(--line-2); color: var(--ink-3);
  font-weight: 700; font-size: 14px;
}
.conn-head { flex: 1; min-width: 0; }
.conn-top { align-items: center; }

.profile { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-body { flex: 1; min-width: 240px; }
.profile-label { font-size: 16px; font-weight: 650; letter-spacing: -.3px; }
.profile-reason { font-size: 12.5px; line-height: 18px; color: var(--ink-3); margin-top: 3px; }

.traits { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.traits li { font-size: 13px; line-height: 19px; color: var(--ink-2); padding-left: 16px; position: relative; }
.traits li:before { content: ''; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 999px; background: var(--good); }
.traits b { color: var(--ink); font-weight: 640; }

/* ============================================================
   TODAY, DETAIL AND RESPONSIVE SHELL
   Today leads, and every row opens onto what was actually done.
   ============================================================ */

.mark { width: 30px; height: 30px; border-radius: 0; background: none; display: block; flex: none; }
.mark svg { width: 30px; height: 30px; display: block; }

.progress { height: 3px; background: var(--line-2); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.progress span { display: block; height: 100%; background: var(--good); border-radius: 999px; transition: width .5s var(--ease, ease); width: 4%; }

.today { list-style: none; margin: 0; padding: 0; }

.today li {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  background: var(--card);
  transition: border-color 400ms ease, background 400ms ease;
}
.today li:last-child { margin-bottom: 0; }
.today li:hover { border-color: #cbd5dd; background: #fafbfc; }

.today .t-title { font-size: 14px; line-height: 20px; font-weight: 620; }
.today .t-sub { font-size: 12px; line-height: 17px; color: var(--ink-3); margin-top: 2px; }

.task-mark {
  width: 26px; height: 26px; border-radius: 999px;
  background: var(--good-soft); display: grid; place-items: center; flex: none;
}
.task-mark svg { width: 15px; height: 15px; }
.task-mark path { stroke: var(--good); stroke-width: 2.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- detail */

.detail {
  position: fixed; inset: 0;
  background: rgba(15, 23, 32, .38);
  z-index: 70;
  display: flex; justify-content: flex-end;
}
.detail[hidden] { display: none; }
.detail-inner {
  width: min(580px, 100%);
  background: var(--card);
  height: 100%;
  overflow-y: auto;
  padding: 28px 26px 40px;
  position: relative;
  box-shadow: -8px 0 28px rgba(15, 23, 32, .14);
}
.detail-close {
  position: absolute; top: 16px; right: 18px;
  border: 0; background: transparent; font-size: 26px; line-height: 1;
  cursor: pointer; color: var(--ink-3);
}
.detail-close:hover { color: var(--ink); }
.detail h3 { font-size: 19px; line-height: 26px; margin: 0 0 6px; letter-spacing: -.3px; }
.detail h4 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .55px;
  color: var(--ink-3); margin: 24px 0 10px; font-weight: 680;
}
.detail .facts { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--ink-2); }
.detail .facts b { color: var(--ink); font-weight: 620; }
.detail .why { font-size: 13.5px; line-height: 21px; color: var(--ink-2); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li:before {
  content: ''; position: absolute; left: -6px; top: 3px;
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--line); border: 2px solid var(--card);
}
.timeline li.sent:before, .timeline li.closed:before { background: var(--good); }
.timeline .tl-text { font-size: 13px; line-height: 19px; }
.timeline .tl-when { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.draft-box {
  background: #f8f9fb; border: 1px solid var(--line); border-radius: 10px;
  padding: 15px; white-space: pre-wrap; font-size: 13px; line-height: 1.55;
}
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 12px 14px; gap: 10px; }
  .brand { flex: 1; min-width: 0; }
  .brand-sub { display: none; }
  .tabs { order: 3; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; flex: none; }
  .plan-badge { display: none; }
  main { padding: 14px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .grid-2 { grid-template-columns: 1fr; }
  .conn-list { grid-template-columns: 1fr; }
  .coverage-num { font-size: 34px; }
}

@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi .value { font-size: 22px; }
  .today li { grid-template-columns: 26px 1fr; }
  .today .tag { display: none; }
  .detail-inner { width: 100%; padding: 24px 18px 40px; }
  .panel { padding: 15px; }
  .section h2, .panel-head h2 { font-size: 15px; }
}

[data-theme="dark"] .today li:hover { background: #1f1f1f; border-color: #3d3d3d; }
[data-theme="dark"] .draft-box { background: #181818; }
[data-theme="dark"] .detail-inner { background: #181818; }
[data-theme="dark"] .timeline li:before { border-color: #181818; }

/* Title and subtitle stack; they are spans inside a grid cell. */
.today .t-title { display: block; }
.today .t-sub { display: block; }

/* Mobile header: give the brand its room and drop what does not fit. */
@media (max-width: 900px) {
  .badge { display: none; }
  .brand > div { min-width: 0; }
  .brand-name { white-space: nowrap; }
  .brand { min-width: 0; }
  .topbar-right { flex: none; }
  .topbar-right .btn { padding: 8px 14px; font-size: 13px; }
}
@media (max-width: 420px) {
  .brand-name { font-size: 13.5px; }
}

/* Urgency is carried by the whole card, not a bar down one side. */
.today li.overdue { border-color: #f0cfcd; }
.today li.overdue .t-sub { color: var(--bad); }
[data-theme="dark"] .today li.overdue { border-color: #4a2626; }
[data-theme="dark"] .today li.overdue .t-sub { color: #ff8a80; }

/* ---------------------------------------------------------------- mobile shell */

@media (max-width: 900px) {
  /* Two clear rows: identity and actions, then the sections. */
  .topbar {
    height: auto;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 14px 0;
    gap: 10px;
    row-gap: 0;
  }
  .brand { flex: 1 1 auto; gap: 9px; }
  .brand-name { font-size: 14px; letter-spacing: -.2px; }
  .brand-sub { font-size: 11px; margin-top: 1px; }
  .topbar-right { flex: 0 0 auto; }
  .topbar-right .btn { padding: 7px 13px; font-size: 13px; }

  .tabs {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
    gap: 2px;
    margin-top: 10px;
    padding-bottom: 9px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; padding: 7px 11px; font-size: 13px; }
  .pill { font-size: 10.5px; padding: 1px 6px; }
}

@media (max-width: 420px) {
  .brand-sub { display: none; }
  .topbar-right .btn { padding: 7px 11px; }
}

/* A fade on the right edge says "there are more sections" without a scrollbar. */
@media (max-width: 900px) {
  .tabs {
    padding-right: 34px;
    -webkit-mask-image: linear-gradient(to right, #000 84%, transparent);
    mask-image: linear-gradient(to right, #000 84%, transparent);
  }
}

/* ============================================================
   DARK MODE
   Same surface scale as the marketing site: page #000000,
   raised #181818, card on raised #1F1F1F, nested #272727.
   ============================================================ */

:root { color-scheme: light; }

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ffffff;
  --ink-2: #b8b8b8;
  --ink-3: #8a8a8a;
  --line: #313131;
  --line-2: #272727;
  --bg: #000000;
  --card: #181818;
  --accent: #7aa2ff;
  --accent-soft: #1f1f1f;
  --good: #3ddc84;
  --good-soft: #16281d;
  --warn: #ffb86b;
  --warn-soft: #2a2318;
  --bad: #ff8a80;
  --bad-soft: #2a1a1a;
  --shadow: none;
}

/* buttons: the primary inverts so it stays the strongest thing on screen */
[data-theme="dark"] .btn { background: #181818; border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .btn:hover { background: #272727; }
[data-theme="dark"] .btn.primary { background: #ffffff; border-color: #ffffff; color: #000000; }
[data-theme="dark"] .btn.primary:hover { background: #e6e6e6; }
[data-theme="dark"] .btn.good { background: var(--good); border-color: var(--good); color: #0a0a0a; }
[data-theme="dark"] .btn.good:hover { background: #4fe694; }

/* surfaces that carried an explicit light background */
[data-theme="dark"] .mini-item:hover,
[data-theme="dark"] tr:hover td,
[data-theme="dark"] .today li:hover { background: #1f1f1f; }
[data-theme="dark"] .today li:hover { border-color: #3d3d3d; }
[data-theme="dark"] .drawer-inner,
[data-theme="dark"] .detail-inner { background: #181818; }
[data-theme="dark"] .draft-box,
[data-theme="dark"] .result pre { background: #1f1f1f; border-color: var(--line); }
[data-theme="dark"] .task-mark { background: #16281d; }
[data-theme="dark"] .ico { background: #1f1f1f; }

[data-theme="dark"] .form input,
[data-theme="dark"] textarea,
[data-theme="dark"] .search { background: #181818; border-color: var(--line); color: var(--ink); }

[data-theme="dark"] .coverage-bar { background: #272727; }
[data-theme="dark"] .mark { background: none; }
[data-theme="dark"] .foot-base,
[data-theme="dark"] .foot-col h4 { color: #8a8a8a; }

/* ---------------------------------------------------------------- toggle */

.theme-toggle {
  width: 34px; height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  display: grid; place-items: center;
  cursor: pointer; padding: 0; flex: none;
  transition: background 200ms ease, color 200ms ease;
}
.theme-toggle:hover { background: var(--line-2); color: var(--ink); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-sun { display: none; }
[data-theme="dark"] .theme-toggle .i-moon { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }

/* Count pills used var(--ink) as a background with hardcoded white text,
   which is white on white in dark mode. */
[data-theme="dark"] .pill { background: #ffffff; color: #000000; }
[data-theme="dark"] .tab.active .pill { background: var(--accent); color: #0a0a0a; }

/* ---------------------------------------------------------------- modal */

.modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 32, .42);
  z-index: 80;
  display: grid; place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none; }

.modal-inner {
  width: 100%; max-width: 460px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px;
  position: relative;
  box-shadow: 0 18px 48px rgba(15, 23, 32, .22);
}
.modal-inner h3 { font-size: 18px; margin: 0 0 6px; letter-spacing: -.3px; }
.modal-sub { font-size: 13.5px; line-height: 20px; color: var(--ink-2); margin: 0 0 18px; }
.modal-label { display: block; font-size: 13px; font-weight: 620; margin-bottom: 6px; }
.modal-input {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 9px;
  font: inherit; font-size: 14px;
  background: var(--bg); color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.modal-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,95,139,.12); }
.modal-note { font-size: 12px; line-height: 17px; color: var(--ink-3); margin: 10px 0 0; }
.modal-err { font-size: 13px; color: var(--bad); margin: 12px 0 0; min-height: 18px; }
.modal-close {
  position: absolute; top: 14px; right: 16px;
  border: 0; background: transparent; font-size: 24px; line-height: 1;
  cursor: pointer; color: var(--ink-3);
}
.modal-close:hover { color: var(--ink); }

[data-theme="dark"] .modal-inner { background: #181818; }
[data-theme="dark"] .modal-input { background: #000000; }

/* a connected source can be re-read on demand */
.conn-meta { font-size: 11.5px; color: var(--ink-3); }

/* The mark draws itself, then the check closes the ring. Hover replays. */
.od-ring {
  stroke-dasharray: 70.8 17;
  animation: odRingDraw 900ms cubic-bezier(0.32, 0.72, 0, 1) both;
}
.od-tick {
  stroke-dasharray: 25;
  animation: odTickDraw 460ms cubic-bezier(0.32, 0.72, 0, 1) 620ms both;
}
@keyframes odRingDraw {
  from { stroke-dasharray: 0 88; }
  to   { stroke-dasharray: 70.8 17; }
}
@keyframes odTickDraw {
  from { stroke-dashoffset: 25; }
  to   { stroke-dashoffset: 0; }
}
.od-logo:hover .od-ring { animation: odRingDraw 620ms cubic-bezier(0.32, 0.72, 0, 1) both; }
.od-logo:hover .od-tick { animation: odTickDraw 380ms cubic-bezier(0.32, 0.72, 0, 1) 360ms both; }
.od-logo { cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .od-ring, .od-tick,
  .od-logo:hover .od-ring, .od-logo:hover .od-tick { animation: none; }
  .od-tick { stroke-dasharray: none; stroke-dashoffset: 0; }
}

/* ============================================================
   BILLING
   ============================================================ */

.plan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1150px) { .plan-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px)  { .plan-grid { grid-template-columns: 1fr; } }

.plan {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line-2);
}
.plan.current { border-color: var(--good); background: var(--good-soft); }
.plan-name { font-size: 13px; font-weight: 650; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-price { font-size: 27px; font-weight: 700; letter-spacing: -.7px; line-height: 1; }
.plan-price span { font-size: 12px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; margin-left: 3px; }
.plan-units { font-size: 12px; color: var(--ink-2); }
.plan-blurb { font-size: 12px; line-height: 17px; color: var(--ink-3); flex: 1; }
.plan .btn { width: 100%; justify-content: center; margin-top: 2px; }

/* A row of label and value, not a card. */
.bill-line {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13px;
}
.bill-line:last-of-type { border-bottom: 0; }
.bill-line .k { color: var(--ink-3); }
.bill-line .v { font-weight: 600; }
.bill-total { font-size: 15px; }

.bill-meter { display: flex; align-items: baseline; gap: 8px; }
.bill-meter b { font-size: 30px; font-weight: 700; letter-spacing: -.9px; }
.bill-meter span { font-size: 12.5px; color: var(--ink-3); }

/* ============================================================
   TAGS
   app.js has always emitted .tag / .tag.good / .tag.warm / .tag.hot
   and no rule ever existed for them, so every status chip on Today,
   COI, Book, Activity and Connections rendered as bare text.
   ============================================================ */

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
  line-height: 16px;
  white-space: nowrap;
  background: var(--line-2);
  color: var(--ink-2);
}
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warm { background: var(--warn-soft); color: var(--warn); }
.tag.hot  { background: var(--bad-soft);  color: var(--bad); }

/* ============================================================
   PORTALS
   ============================================================ */

.portal-list { display: grid; gap: 14px; }

.portal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line-2);
  padding: 16px;
}
.portal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.portal-name { font-size: 14px; font-weight: 650; letter-spacing: -.1px; }
.portal-what { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; line-height: 18px; }
.portal-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-top: 12px; }
.portal-field { display: flex; flex-direction: column; gap: 5px; min-width: 200px; flex: 1; }
.portal-field label { font-size: 11px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; color: var(--ink-3); }
.portal-field input {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font: inherit; font-size: 13px; background: var(--card); color: var(--ink);
}
.portal-field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.portal-note { font-size: 12px; color: var(--ink-3); margin-top: 10px; line-height: 17px; }

.portal-result { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.portal-kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: 13px; }
.portal-kv dt { color: var(--ink-3); }
.portal-kv dd { margin: 0; font-weight: 550; }

.portal-shot {
  margin-top: 12px; border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; max-width: 520px; background: var(--card);
}
.portal-shot img { display: block; width: 100%; height: auto; }

.portal-matches { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.portal-matches li {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  font-size: 13px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card);
}
.portal-matches .nm { font-weight: 600; }
.portal-matches .meta { color: var(--ink-3); font-size: 12px; }
