/* BD CRM — chrome + chart tokens (light and dark are both selected, not auto-flipped) */
:root {
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --ring: rgba(11,11,11,0.10);
  --series-1: #2a78d6;  /* blue    — campaign slot 1 */
  --series-2: #1baf7a;  /* aqua    — slot 2 */
  --series-3: #eda100;  /* yellow  — slot 3 */
  --series-4: #008300;  /* green   — slot 4 */
  --series-5: #4a3aa7;  /* violet  — slot 5 */
  --series-6: #e34948;  /* red     — slot 6 */
  --series-7: #e87ba4;  /* magenta — slot 7 */
  --series-8: #eb6834;  /* orange  — slot 8 */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --good-text: #006300;
  --accent: #2a78d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface-1: #1a1a19;
    --page: #0d0d0d;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --ring: rgba(255,255,255,0.10);
    --series-1: #3987e5;
    --series-2: #199e70;
    --series-3: #c98500;
    --series-4: #008300;
    --series-5: #9085e9;
    --series-6: #e66767;
    --series-7: #d55181;
    --series-8: #d95926;
    --good-text: #0ca30c;
    --accent: #3987e5;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
}
a { color: var(--accent); text-decoration: none; }

.app { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface-1);
  border-right: 1px solid var(--grid);
  padding: 20px 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { font-weight: 700; font-size: 17px; padding: 0 20px 16px; letter-spacing: .04em; }
#nav { display: flex; flex-direction: column; }
#nav a {
  padding: 9px 20px; color: var(--ink-2); border-left: 3px solid transparent;
}
#nav a:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
#nav a.active { color: var(--ink); border-left-color: var(--accent); font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 12px 20px; }
.mode-badge {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 4px; border: 1px solid var(--ring); color: var(--ink-2);
}
.mode-badge.local { color: var(--status-critical); border-color: var(--status-critical); }

.main { padding: 28px 36px; max-width: 1200px; }
.loading { color: var(--muted); padding: 40px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 26px 0 10px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.sub { color: var(--muted); margin: 0 0 20px; }

/* Cards & tiles */
.card {
  background: var(--surface-1); border: 1px solid var(--grid);
  border-radius: 10px; padding: 16px 18px; margin-bottom: 14px;
}
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { background: var(--surface-1); border: 1px solid var(--grid); border-radius: 10px; padding: 14px 16px; }
.tile .label { font-size: 12px; color: var(--ink-2); }
.tile .value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.tile .delta { font-size: 12px; color: var(--muted); }
.tile .delta.good { color: var(--good-text); }

/* Alert banner */
.alert-banner {
  border-radius: 10px; padding: 14px 16px; margin-bottom: 16px;
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--grid); background: var(--surface-1);
}
.alert-banner.critical { border-color: var(--status-critical); border-width: 2px; }
.alert-banner .icon { font-size: 18px; line-height: 1.2; }
.alert-banner.critical .title { color: var(--status-critical); font-weight: 700; }
.alert-banner .detail { color: var(--ink-2); font-size: 13px; margin-top: 2px; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--surface-1); border: 1px solid var(--grid); border-radius: 10px; overflow: hidden; }
th { text-align: left; font-size: 12px; color: var(--ink-2); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--grid); }
td { padding: 10px 12px; border-bottom: 1px solid var(--grid); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Chips */
.chip {
  display: inline-block; font-size: 11.5px; padding: 2px 8px; margin: 1px 3px 1px 0;
  border-radius: 20px; border: 1px solid var(--grid); color: var(--ink-2); background: transparent;
}
.chip.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
button.chip { cursor: pointer; font: inherit; font-size: 11.5px; }

/* Status chips: icon + label, never color alone */
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; }
.status.accepted .dot { background: var(--status-good); }
.status.accepted { color: var(--good-text); }
.status.declined .dot { background: var(--status-critical); }
.status.declined { color: var(--status-critical); }
.status.pending .dot { background: var(--status-warning); }
.status.pending { color: var(--ink-2); }
.status.referred-out .dot { background: var(--muted); }
.status.referred-out { color: var(--ink-2); }

/* Give:ask meter */
.ga-meter { display: inline-flex; gap: 4px; align-items: center; }
.ga-meter .pip { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--baseline); }
.ga-meter .pip.filled { background: var(--series-2); border-color: var(--series-2); }
.ga-meter .lbl { font-size: 12px; color: var(--ink-2); margin-left: 6px; }
.ga-meter.eligible .lbl { color: var(--good-text); font-weight: 600; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 92px 26px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--grid); }
.timeline li:last-child { border-bottom: none; }
.timeline .date { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.timeline .ch { text-align: center; }
.timeline .kind { font-size: 11px; font-weight: 700; letter-spacing: .05em; }
.timeline .kind.give { color: var(--good-text); }
.timeline .kind.ask { color: var(--series-8); }
.timeline .kind.neutral { color: var(--muted); }
.timeline .resp { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.timeline .resp.none { color: var(--muted); font-style: italic; }
.timeline .in-flag { color: var(--accent); font-weight: 600; font-size: 11px; }

/* Calendar */
.cal-head { display: flex; align-items: center; gap: 14px; margin: 14px 0; }
.cal-head .mon { font-size: 16px; font-weight: 700; min-width: 150px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--grid); border-radius: 10px; overflow: hidden; background: var(--surface-1); }
.cal-grid .dow { padding: 6px 8px; font-size: 11px; color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--grid); background: color-mix(in srgb, var(--ink) 3%, transparent); }
.cal-cell { min-height: 74px; border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid); padding: 5px 7px; position: relative; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell .d { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-cell.today .d { color: var(--accent); font-weight: 700; }
.cal-cell.other { background: color-mix(in srgb, var(--ink) 2.5%, transparent); }
.cal-cell.has:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); cursor: pointer; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.cal-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--surface-1); box-sizing: content-box; }
.cal-dot.future { background: transparent !important; border: 2px solid; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 2px; font-size: 12.5px; color: var(--ink-2); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 50%; }

/* Bars (single-hue analytics) */
.bar-row { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 10px; padding: 5px 0; }
.bar-row .lbl { font-size: 12.5px; color: var(--ink-2); }
.bar-row .track { height: 14px; background: transparent; }
.bar-row .fill { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row .val { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }

/* Forms */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface-1);
  border: 1px solid var(--baseline); border-radius: 7px; padding: 7px 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
label { display: block; font-size: 12px; color: var(--ink-2); font-weight: 600; margin: 10px 0 4px; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 7px;
  padding: 7px 14px; border: 1px solid var(--baseline); background: var(--surface-1); color: var(--ink);
}
.btn:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 3px 10px; font-size: 12.5px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin: 14px 0; flex-wrap: wrap; }
.toolbar input[type="search"] { min-width: 240px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.badge {
  background: var(--status-critical); color: #fff; border-radius: 10px;
  font-size: 10.5px; padding: 1px 6px; margin-left: 4px; font-weight: 700;
}
.muted { color: var(--muted); }
.right { text-align: right; }
.mt0 { margin-top: 0; }
.profile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .app { grid-template-columns: 64px 1fr; } }
