:root {
  --bg: #f4f1ea;
  --panel: #ffffff;
  --ink: #20281f;
  --muted: #7c8579;
  --line: #e3ded2;
  --accent: #4a6b3a;        /* psilly green */
  --accent-soft: #e8efe2;
  --gold: #c79a3a;
  --danger: #c0512f;
  --shadow: 0 1px 2px rgba(30, 40, 25, .06), 0 4px 14px rgba(30, 40, 25, .05);
  --radius: 12px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.brand span { letter-spacing: .2px; }
.controls { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.controls #search {
  width: 230px; padding: 7px 11px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--bg); font-size: 13px;
}
.ctl { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.ctl.checkbox { cursor: pointer; }
.ctl select { padding: 5px 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.meta { font-size: 12px; color: var(--muted); min-width: 120px; }

.btn {
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink); cursor: pointer; font-size: 13px;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn.ghost { color: var(--muted); }

/* ---- board ---- */
.board {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px; overflow-x: auto; height: calc(100vh - 58px);
}
.col {
  flex: 0 0 270px; max-width: 270px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); display: flex; flex-direction: column;
  max-height: 100%; box-shadow: var(--shadow);
}
.col.over { outline: 2px dashed var(--accent); outline-offset: -3px; background: var(--accent-soft); }
.col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 13px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--panel); border-radius: var(--radius) var(--radius) 0 0;
}
.col-title { font-weight: 650; font-size: 13px; }
.col-count {
  font-size: 12px; color: var(--muted); background: var(--bg);
  padding: 1px 8px; border-radius: 999px; min-width: 20px; text-align: center;
}
.col-cards { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.more {
  margin: 0 10px 10px; padding: 7px; border: 1px dashed var(--line);
  background: none; border-radius: 8px; color: var(--muted); cursor: pointer; font-size: 12px;
}
.more:hover { border-color: var(--accent); color: var(--accent); }

/* ---- card ---- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: 10px; padding: 9px 11px; cursor: grab;
  display: flex; flex-direction: column; gap: 6px;
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.card.dragging { opacity: .45; }
.card.dmd { border-left-color: var(--gold); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.handle { font-weight: 650; color: var(--accent); text-decoration: none; font-size: 13px; }
.handle:hover { text-decoration: underline; }
.name { font-size: 12px; color: var(--ink); }
.fit {
  font-size: 11px; font-weight: 700; min-width: 22px; text-align: center;
  padding: 1px 6px; border-radius: 6px; color: #fff;
}
.fit.hi { background: var(--accent); }
.fit.mid { background: var(--gold); }
.fit.lo { background: #b6b1a4; }
.stats { display: flex; gap: 12px; font-size: 11px; color: var(--muted); }
.niche {
  font-size: 11px; color: var(--muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 2px; }
.badge { font-size: 10.5px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); }
.badge.ok { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.badge.off { color: var(--muted); }
.dm {
  font-size: 11px; padding: 3px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
}
.dm.on { background: var(--gold); color: #fff; border-color: transparent; }
.dm:hover { border-color: var(--gold); }

/* ---- toast ---- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--danger); }

/* ---- login ---- */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 32px 30px; width: 300px; text-align: center; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.login-logo { font-size: 40px; }
.login-card h1 { margin: 0; font-size: 20px; }
.login-card .muted, .muted { color: var(--muted); margin: 0; }
.login-card input {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; margin-top: 8px;
}
.login-card button {
  padding: 10px; border: none; border-radius: 9px; background: var(--accent);
  color: #fff; font-size: 14px; cursor: pointer;
}
.login-card button:hover { filter: brightness(1.06); }
.login-error { color: var(--danger); font-size: 13px; }

/* ===== app shell (sidebar + content) ===== */
body.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  flex: 0 0 220px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 12px;
}
.side-brand { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; padding: 6px 8px 14px; }
.side-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 14px 8px 5px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: 13px;
}
.nav-item:hover { background: var(--accent-soft); }
.nav-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.soon { color: #b3b0a5; cursor: default; }
.nav-item.soon:hover { background: none; }
.nav-item.soon em {
  margin-left: auto; font-style: normal; font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .4px; background: var(--bg); color: var(--muted); padding: 1px 6px; border-radius: 999px;
}
.side-foot { margin-top: 8px; padding: 8px 9px; font-size: 12px; color: var(--muted); text-decoration: none; border-top: 1px solid var(--line); }
.side-foot:hover { color: var(--accent); }

.content { flex: 1; overflow-y: auto; padding: 22px 26px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head .muted { margin: 3px 0 0; }

/* ===== KPI cards ===== */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); }
.kpi-val { font-size: 26px; font-weight: 700; line-height: 1; }
.kpi-label { font-size: 12px; color: var(--muted); margin-top: 7px; }
.kpi.good .kpi-val { color: var(--accent); }
.kpi.gold .kpi-val { color: var(--gold); }
.kpi.warn .kpi-val { color: var(--danger); }

/* ===== panels ===== */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.panel h2 { margin: 0 0 14px; font-size: 15px; }
.dash-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
@media (max-width: 900px) { .dash-cols { grid-template-columns: 1fr; } }

/* ===== funnel + bars ===== */
.funnel-row, .bar-row { display: grid; grid-template-columns: 150px 1fr 52px; align-items: center; gap: 10px; margin-bottom: 9px; }
.funnel-label, .bar-label { font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-bar, .bar-track { background: var(--bg); border-radius: 999px; height: 14px; overflow: hidden; }
.funnel-bar span, .bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-fill.good { background: var(--accent); }
.bar-fill.gold { background: var(--gold); }
.bar-fill.lo { background: #b6b1a4; }
.funnel-count, .bar-count { text-align: right; font-size: 12.5px; font-weight: 600; color: var(--muted); }

/* ===== needs attention ===== */
.att-list { list-style: none; padding: 0; margin: 0 0 12px; font-size: 13px; }
.att-list li { padding: 4px 0; }
.att-list b { color: var(--accent); font-size: 15px; }
.att-sub { font-size: 12px; color: var(--muted); margin: 6px 0; }
.att-cards { display: flex; flex-direction: column; gap: 6px; }
.att-card { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; text-decoration: none; color: var(--ink); }
.att-card:hover { border-color: var(--accent); }
.att-fit { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; }
.att-handle { font-weight: 600; color: var(--accent); font-size: 12.5px; }
.att-niche { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== tabs ===== */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: none; padding: 9px 14px; font-size: 13px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ===== board toolbar (pipeline page) ===== */
.board-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.board-toolbar #search { width: 230px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-size: 13px; }
.board { height: calc(100vh - 200px); }

/* ===== roster / fulfillment ===== */
.view-toggle { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 14px; }
.vt { background: none; border: none; padding: 6px 18px; border-radius: 999px; font-size: 13px; color: var(--muted); cursor: pointer; }
.vt.on { background: var(--panel); color: var(--accent); font-weight: 600; box-shadow: var(--shadow); }

.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }

.add-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; box-shadow: var(--shadow); }
.add-form input, .add-form select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: var(--bg); }
.add-form input { min-width: 200px; }

.roster #board[data-view] { }
.card .card-top { display: flex; align-items: center; gap: 8px; }
.avatar { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.cname { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); text-decoration: none; }
a.cname:hover { color: var(--accent); }
.who .handle { font-size: 11px; }
.del { margin-left: auto; background: none; border: none; color: #c2bdb0; font-size: 16px; cursor: pointer; line-height: 1; }
.del:hover { color: var(--danger); }
.prod { font-size: 11.5px; color: var(--ink); margin-top: 2px; }
.meta-line { font-size: 11px; margin-top: 2px; }
.meta-line .mut { color: var(--muted); }
.meta-line .od, .roster-table .od { color: var(--danger); font-weight: 600; }
.card-actions { display: flex; gap: 6px; margin-top: 8px; }
.mini { flex: 1; padding: 5px 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 7px; font-size: 11.5px; color: var(--ink); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini:hover { border-color: var(--accent); }
.mini.approve { flex: 0 0 auto; background: var(--accent); color: #fff; border-color: transparent; }
.card.overdue { border-left-color: var(--danger); }

.roster-table { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.roster-table table { width: 100%; border-collapse: collapse; }
.roster-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); }
.roster-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
.roster-table .mut { color: var(--muted); font-size: 11px; }
.roster-table tr:last-child td { border-bottom: none; }
.roster-table a { color: var(--accent); text-decoration: none; }
.roster-table a:hover { text-decoration: underline; }
.stage-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }

/* ===== campaign detail (Phase 4) ===== */
.back { font-size: 12px; color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 4px; }
.back:hover { color: var(--accent); }
.stepper { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 7px; padding: 8px 14px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; color: var(--muted); }
.step .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--bg); color: var(--muted);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.step.done { color: var(--accent); border-color: var(--accent); }
.step.done .dot { background: var(--accent); color: #fff; }
.step.current { color: var(--ink); border-color: var(--ink); }
.step.current .dot { background: var(--ink); color: #fff; }

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.status { font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.status.ok { background: var(--accent-soft); color: var(--accent); }

.ta { width: 100%; min-height: 70px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 9px; font: inherit; font-size: 13px; resize: vertical; margin: 4px 0 12px; background: var(--bg); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 14px; }
.form-grid label { font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.form-grid input, .form-grid select { padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; background: var(--panel); color: var(--ink); }
.switch-row { flex-direction: row !important; align-items: center; justify-content: space-between;
  background: var(--bg); border-radius: 8px; padding: 8px 12px; }
.switch-row input { width: 18px; height: 18px; }
.row-actions { display: flex; gap: 10px; align-items: center; }
.btn.disabled { opacity: .45; pointer-events: none; }

/* ===== Track (email) ===== */
.banner { padding: 10px 14px; border-radius: 9px; font-size: 13px; margin-bottom: 14px; }
.banner.warn { background: #fbf1e6; border: 1px solid #e8c89a; color: #8a5a1c; }
.banner code { background: #fff; padding: 1px 5px; border-radius: 4px; }
.track { display: grid; grid-template-columns: 320px 1fr; gap: 14px; height: calc(100vh - 170px); }
.convo-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-y: auto; box-shadow: var(--shadow); }
.convo { padding: 11px 13px; border-bottom: 1px solid var(--line); cursor: pointer; }
.convo:hover { background: var(--bg); }
.convo.on { background: var(--accent-soft); }
.convo-top { display: flex; justify-content: space-between; font-size: 13px; }
.convo-top .mut, .convo-sub .mut { color: var(--muted); font-size: 11px; }
.convo-sub { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin: 2px 0; }
.convo-snip { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 20px; font-size: 13px; }
.ctag { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: var(--bg); }
.ctag.yes { background: var(--accent-soft); color: var(--accent); }
.ctag.no { background: #f7e4dd; color: var(--danger); }
.ctag.maybe { background: #faf0d8; color: var(--gold); }
.ctag.human { background: #f7e4dd; color: var(--danger); }
.ai { margin-top: 8px; padding: 8px 10px; background: #f6f9f3; border: 1px solid #dfe7d6; border-radius: 8px; font-size: 12px; }
.ai-tag { display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-right: 5px; }
.ai-tag.human { background: #f7e4dd; color: var(--danger); }
.ai-line { color: var(--muted); margin-top: 4px; }
.ai-sug { margin-top: 6px; display: flex; gap: 8px; align-items: flex-start; background: #fff; border: 1px dashed var(--line); border-radius: 7px; padding: 7px 9px; }
.ai-sug span { flex: 1; white-space: pre-wrap; line-height: 1.4; }
.ai-sug .mini { flex: 0 0 auto; }

/* ===== FAQ (settings) ===== */
.faq-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.faq-item { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.faq-q { font-weight: 600; font-size: 13px; }
.faq-a { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.faq-item .del { float: right; }
.faq-add { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.faq-add input, .faq-add textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; font: inherit; font-size: 13px; background: var(--bg); }
#dmQueue.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===== conversion funnel (Analysis) ===== */
.cfunnel { display: flex; flex-direction: column; gap: 13px; }
.cf-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; }
.cf-title { font-weight: 600; }
.cf-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.cf-track { height: 20px; background: #eef1ec; border-radius: 6px; overflow: hidden; margin-top: 4px; }
.cf-fill { height: 100%; background: var(--accent); border-radius: 6px; transition: width .3s; }
.cf-fill.gold { background: var(--gold); }
.cf-fill.lo { background: #d98b6a; }
.cf-conv { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.cf-conv.good { color: var(--accent); }
.cf-conv.gold { color: var(--gold); }
.cf-conv.lo { color: var(--danger); }
.toggle-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; }
.toggle-row input { width: 16px; height: 16px; }
.num-in { width: 80px; border: 1px solid var(--line); border-radius: 7px; padding: 5px 9px; font: inherit; font-size: 13px; text-align: right; background: var(--bg); }

/* ===== Pipeline card flags + detail drawer ===== */
.card { cursor: pointer; }
.card-flags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.cflag { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: #eef1ec; color: var(--muted); }
.cflag.comm { background: var(--accent-soft); color: var(--accent); }
.cflag.human { background: #f7e4dd; color: var(--danger); }
.cflag.gift-due { background: #f7e4dd; color: var(--danger); }
.cflag.gift-soon { background: #faf0d8; color: var(--gold); }

.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(20, 22, 18, 0.32); }
.drawer-panel { position: absolute; top: 0; right: 0; height: 100%; width: min(460px, 92vw);
  background: var(--panel); box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12); overflow-y: auto;
  padding: 20px 22px; animation: slidein 0.16s ease; }
@keyframes slidein { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.dr-load { color: var(--muted); padding: 30px 0; }
.dr-head { position: relative; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.dr-x { position: absolute; top: -4px; right: -4px; border: none; background: none; font-size: 16px; cursor: pointer; color: var(--muted); }
.dr-name { font-size: 18px; font-weight: 700; }
.dr-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.dr-fb { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.dr-fb code { background: #eef1ec; padding: 1px 6px; border-radius: 5px; font-size: 11.5px; }
.dr-handoff { display: flex; flex-direction: column; gap: 6px; margin-top: 10px;
  padding: 10px; border: 1px dashed var(--line); border-radius: 9px; }
.dr-handoff-t { font-size: 12px; color: var(--muted); }
.dr-handoff input, .dr-handoff select, .dr-handoff textarea {
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; font: inherit;
  font-size: 12.5px; background: var(--bg); }
.dr-handoff textarea { min-height: 48px; resize: vertical; }
.dr-handoff .btn { align-self: flex-start; font-size: 12px; }
.dr-marks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0;
  padding: 10px; border: 1px solid var(--accent); border-radius: 9px; background: var(--accent-soft); }
.dr-marks-t { flex: 1 1 100%; font-size: 12px; font-weight: 600; color: var(--accent); }
.dr-actions { display: flex; gap: 8px; margin: 14px 0 8px; }
.dr-gift-meta { font-size: 12px; color: var(--muted); }
.dr-gift-meta .due { color: var(--danger); font-weight: 600; }
.gift-form { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; padding: 12px;
  border: 1px dashed var(--line); border-radius: 10px; }
.gift-form select, .gift-form input[type=text], .gift-form #gNote { border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 10px; font: inherit; font-size: 13px; background: var(--bg); }
.dr-tl-head { font-weight: 600; margin: 18px 0 10px; }
.dr-tl { display: flex; flex-direction: column; gap: 12px; }
.tl { display: flex; gap: 10px; }
.tl-ic { flex: 0 0 auto; font-size: 14px; width: 22px; text-align: center; }
.tl-main { flex: 1; min-width: 0; }
.tl-head { font-size: 12px; font-weight: 600; }
.tl-subj { font-size: 12.5px; font-weight: 600; margin-top: 2px; }
.tl-body { font-size: 12.5px; color: var(--text); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.tl.out .tl-body { color: var(--muted); }
.tl-brain { margin-top: 5px; }
.tl-flag { display: inline-block; font-size: 11px; font-weight: 600; color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent); padding: 1px 8px; border-radius: 999px; }
.tl-sug { margin-top: 5px; font-size: 12px; color: var(--text); background: var(--accent-soft);
  border-left: 2px solid var(--accent); border-radius: 6px; padding: 6px 9px; white-space: pre-wrap; }
.tl-sug b { color: var(--accent); font-size: 11px; }
.tl.ev .tl-body { color: var(--text); }

.thread { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; box-shadow: var(--shadow); overflow: hidden; }
.thread-empty { padding: 40px; text-align: center; }
.thread-head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.thread-head .handle { font-size: 12px; }
.thread-head .mut { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.bubbles { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 78%; padding: 10px 13px; border-radius: 12px; font-size: 13px; }
.bubble.in { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.bubble.out { align-self: flex-end; background: var(--accent-soft); }
.bub-head { font-size: 10.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 7px; align-items: center; }
.bub-subj { font-weight: 600; font-size: 12.5px; margin-bottom: 3px; }
.bub-body { white-space: pre-wrap; line-height: 1.5; }
.composer { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.composer input, .composer textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; font: inherit; font-size: 13px; background: var(--bg); }
.composer textarea { min-height: 90px; resize: vertical; }
.comp-actions { display: flex; align-items: center; justify-content: space-between; }
.comp-actions .mut { font-size: 11.5px; color: var(--muted); }
.compose .compose-row { display: flex; gap: 8px; margin-bottom: 8px; }
.compose .compose-row input { flex: 1; }
.compose .ci, .compose .compose-row input { padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px; background: var(--bg); }
.compose .ci { width: 100%; margin-bottom: 8px; }
.auto-stat { font-size: 13px; color: var(--ink); }
.auto-stat b { color: var(--accent); }

/* ===== resources ===== */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.res-card { border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; display: flex; flex-direction: column; gap: 6px; }
.res-title { font-weight: 600; font-size: 14px; }
.res-desc { font-size: 12px; color: var(--muted); flex: 1; }
.res-actions { display: flex; gap: 8px; margin-top: 4px; }
.res-actions .btn { padding: 5px 11px; font-size: 12px; }

/* ===== settings ===== */
.int-list { display: flex; flex-direction: column; gap: 8px; }
.int-row, .kv-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.int-row:last-child, .kv-row:last-child { border-bottom: none; }
.pill { font-size: 11px; padding: 2px 10px; border-radius: 999px; }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.off { background: var(--bg); color: var(--muted); }
.kv-row b { color: var(--ink); }

