:root {
  color-scheme: light;
  --ink: #22262B;
  --ink-2: #3A4047;
  --muted: #5F666D;
  --faint: #8A9096;
  --line: #ECECEA;
  --line-2: #DCDDDA;
  --bg: #FFFFFF;
  --side: #F0F6F1;
  --side-on: #DCEEE2;
  --side-hover: #E3EEE6;
  --accent: #1F8F4E;
  --accent-dark: #166B3A;
  --accent-soft: #E6F5EC;
  --accent-ring: #86CFA2;
  --accent-line: #B7DFC6;
  --tint: #EAF2EC;
  --who-bg: #E1F2E8;
  --who-fg: #14562F;
  --amber: #8F5300;
  --amber-bg: #FFF4E0;
  --personal: #6A4C9C;
  --personal-bg: #F1ECF9;
  --ok: #17703F;
  --ok-bg: #E7F4EC;
  --risk: #8F5300;
  --risk-bg: #FDF1DC;
  --bad: #B4302A;
  --bad-bg: #FBE9E7;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.loading { padding: 48px 24px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* ---------- app frame ---------- */
.app { display: flex; min-height: 100vh; }
.side { width: 264px; flex-shrink: 0; background: var(--side); border-right: 1px solid var(--line); padding: 22px 12px 18px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; font-size: 15px; min-height: 36px; }
.side a:hover { background: var(--side-hover); }
.side a[aria-current="page"] { background: var(--side-on); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.side a .n { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 500; }
.side a .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.side .lbl { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 20px 10px 4px; text-transform: uppercase; letter-spacing: .06em; }
.side .lbl button { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; }
.side .lbl button:hover { background: var(--side-hover); color: var(--ink); }
.side .bottom { margin-top: auto; padding-top: 16px; }
.main { flex: 1; min-width: 0; padding: 48px 64px 96px; }
.content { max-width: 820px; }
.tabs { display: none; }

/* ---------- headings ---------- */
.view-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.view-head h1 { font-size: 32px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.view-sub { color: var(--muted); margin: 4px 0 24px; }
.view-sub.indent { margin-left: 44px; }
.head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #F7F7F5; color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-danger { color: var(--bad); border-color: #F0B8B3; }
.btn-danger:hover { background: var(--bad-bg); color: #8E221D; }
.btn-big { min-height: 50px; font-size: 16px; border-radius: 10px; padding: 0 20px; }
.btn-link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; font-size: 14px; }
.btn[disabled] { opacity: .6; cursor: default; }

/* ---------- forms ---------- */
label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--ink);
}
select { padding: 0 10px; }
textarea { resize: vertical; min-height: 80px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; }
.form-error { color: var(--bad); font-size: 14px; font-weight: 600; }
.form-error:empty { display: none; }

/* segmented choice (When / Status / Type) */
.seg { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0; }
.seg legend { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.seg label { position: relative; font-weight: 500; font-size: 14px; color: var(--ink); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; background: #fff; }
.seg input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.seg.health-seg input[value="on_track"]:checked + span { background: var(--ok); border-color: var(--ok); }
.seg.health-seg input[value="at_risk"]:checked + span { background: #A86400; border-color: #A86400; }
.seg.health-seg input[value="blocked"]:checked + span { background: var(--bad); border-color: var(--bad); }

/* ---------- quick add ---------- */
.quick { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; padding: 6px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.quick .ring { width: 20px; height: 20px; border: 1.6px dashed #B4B8BC; border-radius: 50%; margin-top: 11px; flex-shrink: 0; }
.quick textarea { flex: 999 1 260px; border: 0; padding: 9px 2px; min-height: 42px; height: 42px; resize: none; overflow: hidden; line-height: 1.5; font-size: 16px; }
.quick textarea:focus { outline: none; }
.quick select { flex: 1 1 180px; width: auto; min-width: 0; max-width: 100%; min-height: 40px; font-size: 14px; color: var(--ink-2); text-overflow: ellipsis; }
.quick .btn { min-height: 40px; }
.quick .new-project { order: 1; }
.quick .hint { order: 2; }
.quick .form-error { order: 3; }
.new-project { display: flex; gap: 10px; flex: 1 1 100%; margin-left: 30px; }
.new-project input { flex: 1 1 200px; min-height: 40px; }
.new-project select { flex: 0 0 auto; margin-left: 0; }
.quick .hint { flex-basis: 100%; margin: -6px 0 0 30px; }
.quick .form-error { flex-basis: 100%; margin-left: 30px; }
textarea[data-enter-submit] { resize: none; overflow: hidden; }

/* ---------- task rows ---------- */
.group { margin-bottom: 26px; }
.group-head { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.group-head a { color: var(--ink); text-decoration: none; }
.group-head a:hover { text-decoration: underline; }
.group-head.doctors { color: var(--amber); }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 4px 0; }
.chk { width: 22px; height: 22px; margin-top: 9px; border: 1.6px solid #A9AEB3; border-radius: 50%; background: #fff; flex-shrink: 0; cursor: pointer; padding: 0; position: relative; }
.chk:hover { border-color: var(--accent); }
.chk[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.chk[aria-pressed="true"]::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.task-body { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 8px 6px; margin: 0 -6px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.task-body:hover { background: #F7F7F5; }
.task-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task-title { overflow-wrap: anywhere; }
.task-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 8px; }
.task.done .task-title { text-decoration: line-through; color: var(--faint); }
.task-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.when { font-size: 13px; color: var(--muted); white-space: nowrap; }
.when.late { color: var(--bad); font-weight: 600; }
.when.soon { color: #A35200; font-weight: 600; }
.tag { font-size: 12px; font-weight: 600; border-radius: 4px; padding: 1px 7px; white-space: nowrap; }
.tag-doctor { color: var(--amber); background: var(--amber-bg); }
.tag-personal { color: var(--personal); background: var(--personal-bg); }
.tag-waiting { color: #5B4A00; background: #F3EDCF; }
.tag-pri-urgent { color: #B4302A; background: #FBE9E7; }
.tag-pri-high { color: #8F5300; background: #FFEBD0; }
.pmark { display: inline-flex; flex-shrink: 0; margin-left: auto; }
.group-head .pmark { margin-left: 0; }
.view-head .pri-ctl { margin-left: 4px; }
.pri-ctl { display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; margin-top: 6px; }
.pri-ctl button { border: 0; background: none; cursor: pointer; padding: 0; width: 28px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.pri-ctl button:hover:not(:disabled) { background: var(--tint); color: var(--ink); }
.pri-ctl button:disabled { opacity: .25; cursor: default; }
.pri-ctl .pri-step { opacity: 0; width: 22px; transition: opacity .12s; }
.pri-ctl .pri-step:disabled { opacity: 0; }
.task:hover .pri-step:not(:disabled), .pri-ctl:focus-within .pri-step:not(:disabled), .view-head .pri-step:not(:disabled) { opacity: 1; }
.task.pri-urgent .task-title { font-weight: 700; }
.pri-menu { position: fixed; z-index: 30; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 6px; min-width: 150px; }
.pri-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 15px; text-align: left; min-height: 40px; }
.pri-menu button:hover, .pri-menu button:focus-visible { background: var(--tint); }
.pri-menu button[aria-checked="true"] { font-weight: 700; background: var(--accent-soft); }
.empty { padding: 28px 0; color: var(--muted); }
.empty strong { color: var(--ink); display: block; margin-bottom: 4px; font-size: 16px; }

/* ---------- health ---------- */
.health { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.health::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.h-on_track { color: var(--ok); background: var(--ok-bg); }
.h-at_risk { color: var(--risk); background: var(--risk-bg); }
.h-blocked { color: var(--bad); background: var(--bad-bg); }

/* ---------- panels ---------- */
.panel { border: 1px solid var(--line-2); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; margin-bottom: 22px; }
.panel h2 { font-size: 16px; font-weight: 700; }
.panel.personal { background: var(--personal-bg); border-color: #DCD0EE; color: var(--personal); font-size: 14px; }
.panel-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.panel-row .field { flex: 999 1 260px; }
.desc { white-space: pre-wrap; color: var(--muted); margin-bottom: 18px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { text-decoration: none; }
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 30px 0 10px; }

/* ---------- project list (phone "Projects" tab) ---------- */
.plist { list-style: none; margin: 0 0 24px; padding: 0; }
.plist a { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.plist a .name { flex: 1; min-width: 0; }
.plist a small { display: block; color: var(--muted); font-size: 13px; }

/* ---------- send update ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pick { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pick input { width: 22px; height: 22px; accent-color: var(--accent); margin: 2px 0 0; flex-shrink: 0; }
.pick label { flex: 1; font-weight: 400; font-size: 15px; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.pick label b { font-weight: 700; }
.pick .warn { color: var(--bad); font-size: 13px; }
.email { border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.email-head { background: #F7F7F5; padding: 12px 18px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line-2); }
.email-head b { color: var(--ink); }
.email-body { padding: 18px; font-size: 15px; }
.send-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---------- settings ---------- */
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.steps summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 32px; }
.steps ol { padding-left: 22px; display: flex; flex-direction: column; gap: 10px; color: var(--ink-2); font-size: 14px; }
.steps ul { padding-left: 18px; margin: 6px 0 0; display: flex; flex-direction: column; gap: 4px; }
code.block { display: block; overflow-wrap: anywhere; background: #F2F3F1; border-radius: 6px; padding: 8px 10px; font-size: 13px; margin: 6px 0; }
.keybox { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--side); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line-2); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-size: 24px; font-weight: 800; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }

/* ---------- dialog ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(540px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 20px 50px rgba(20, 24, 28, .25); }
dialog::backdrop { background: rgba(20, 24, 28, .4); }
dialog form { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
dialog h2 { font-size: 19px; font-weight: 800; }
.dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dialog-actions .spacer { flex: 1; }

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

/* ---------- phone ---------- */
@media (max-width: 760px) {
  .side { display: none; }
  .main { padding: 24px 18px 110px; }
  .view-head h1 { font-size: 28px; }
  .view-sub.indent { margin-left: 40px; }
  .tabs { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); z-index: 10; }
  .tabs.t4 { grid-template-columns: repeat(4, 1fr); }
  .tabs.t6 { grid-template-columns: repeat(6, 1fr); }
  .tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); text-decoration: none; min-height: 48px; justify-content: center; position: relative; }
  .tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; }
  .tabs .badge { position: absolute; top: 2px; left: calc(50% + 6px); background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 0 5px; min-width: 16px; text-align: center; }
  #toast { bottom: 96px; }
  .quick textarea { flex: 1 1 calc(100% - 40px); }
  .quick select[name="project_id"] { flex: 1 1 calc(100% - 30px); margin-left: 30px; }
  .quick .hint { display: none; }
  .pri-ctl .pri-step { display: none; }
  .view-head .pri-ctl .pri-step { display: inline-flex; }
}

/* ---------- small utilities ---------- */
.pie { flex-shrink: 0; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.full { flex-basis: 100%; }
.span-all { grid-column: 1 / -1; }
.field-end { justify-content: flex-end; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.email-body p { margin: 0 0 12px; }
.em-sum { background: #F5F6F7; padding: 10px 14px; border-radius: 6px; }
.em-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.em-row .health { margin-top: 2px; min-width: 84px; }
.em-row:last-of-type { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.em-ask { border-left: 3px solid var(--risk); padding-left: 10px; }
.pick .btn { min-height: 34px; font-size: 13px; }

/* ---------- team & multi-user ---------- */
.tag-who { color: var(--who-fg); background: var(--who-bg); }
.tag-from { color: #5B4A00; background: #F3EDCF; }
.tag-remove { color: #8F2E28; background: #FBE9E7; }
.tag-role { color: var(--muted); background: #EEF1EE; font-weight: 600; }
.chk:disabled { cursor: default; opacity: .45; }
.chk:disabled:hover { border-color: #A9AEB3; }
.pri-static { min-width: 80px; justify-content: center; }
.pri-static .pmark { margin-left: 0; }
.person { border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px 12px; margin: 0 0 20px; background: #fff; }
.person-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.person-head h2 { font-size: 20px; font-weight: 800; line-height: 1.2; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.plist.compact { margin-bottom: 8px; }
.plist.compact a { padding: 9px 0; }
.mini-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 2px; }
.more { padding: 4px 0 8px 32px; }
.notice { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin: 0 0 18px; border-radius: 10px; background: #FBE9E7; color: #7A2620; text-decoration: none; }
.notice:hover { background: #F7DDD9; color: #7A2620; }
.req { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); }
.req > div:first-child { flex: 1 1 260px; min-width: 0; }
.req-actions, .row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.warn-panel { background: #FFF4E0; border-color: #F0D9A8; color: #5A3A00; padding: 12px 14px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px; margin: 0; }
.facts dt { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 15px; }
.quick .qa-assignee { flex: 0 1 150px; }
.rows .row-actions { justify-content: flex-end; }
@media (max-width: 760px) {
  .person { padding: 14px 14px 8px; }
  .quick .qa-assignee { margin-left: 30px; flex: 1 1 0; min-width: 0; }
  .pri-static { min-width: 28px; }
  .tabs a { font-size: 10px; }
}

/* ---------- themes: pick one in Settings → Appearance ---------- */
:root[data-theme="teal"] {
  --side: #F2F5F5; --side-on: #E0EBEA; --side-hover: #E6EDEC;
  --accent: #0E7C7B; --accent-dark: #0A5F5E; --accent-soft: #E3F2F1; --accent-ring: #7CC4C3; --accent-line: #B5DCDA;
  --tint: #EAF3F2; --who-bg: #DDF0EF; --who-fg: #0B4D4C;
}
:root[data-theme="blue"] {
  --side: #F0F5FA; --side-on: #DCE9F5; --side-hover: #E3ECF5;
  --accent: #1D6FB8; --accent-dark: #14538C; --accent-soft: #E4F0FA; --accent-ring: #8DBCE6; --accent-line: #B9D6EE;
  --tint: #EAF2FA; --who-bg: #E0EDF9; --who-fg: #144A7A;
}
:root[data-theme="pink"] {
  --side: #FBF1F4; --side-on: #F6DDE6; --side-hover: #F5E6EB;
  --accent: #C2255C; --accent-dark: #9C1A47; --accent-soft: #FCE8EF; --accent-ring: #F2A3BE; --accent-line: #F0BFD0;
  --tint: #FBEAF0; --who-bg: #FCE3EC; --who-fg: #7A1A3C;
}
:root[data-theme="red"] {
  --side: #FBF1F1; --side-on: #F5DEDE; --side-hover: #F3E5E5;
  --accent: #B93232; --accent-dark: #8F2424; --accent-soft: #FBE9E9; --accent-ring: #EFA3A3; --accent-line: #EEC2C2;
  --tint: #FBEDED; --who-bg: #FADFDF; --who-fg: #7A2020;
}
:root[data-theme="gold"] {
  --side: #FBF6E8; --side-on: #F5EACB; --side-hover: #F4EDD8;
  --accent: #9A6200; --accent-dark: #7A4E00; --accent-soft: #FFF4D6; --accent-ring: #F0C766; --accent-line: #EBD79B;
  --tint: #FBF2DA; --who-bg: #FBEBC4; --who-fg: #6B4500;
}
.ic-accent { stroke: var(--accent); }
.pie .pa { stroke: var(--accent); }
.themes { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 0; padding: 0; border: 0; }
.theme-opt { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; border: 1.5px solid var(--line-2); border-radius: 999px; background: #fff; cursor: pointer; font-size: 15px; min-height: 44px; }
.theme-opt:hover { border-color: var(--accent); }
.theme-opt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.swatch { width: 22px; height: 22px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.sw-green { background: #1F8F4E; } .sw-teal { background: #0E7C7B; } .sw-blue { background: #1D6FB8; }
.sw-pink { background: #C2255C; } .sw-red { background: #B93232; } .sw-gold { background: #D49A1A; }

/* ---------- traction goals ---------- */
.gs { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.gs-on_track { color: #14603A; background: #E3F3E9; }
.gs-off_track { color: #A12A24; background: #FBE5E2; }
.gs-done { color: #4A5560; background: #EBEEF1; }
.traction { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 16px; margin: 0 0 18px; border: 1px solid var(--accent-line); border-left: 4px solid var(--accent); border-radius: 10px; background: var(--accent-soft); color: var(--ink); text-decoration: none; }
.traction:hover { background: var(--tint); color: var(--ink); }
.traction.has-off { border-left-color: var(--bad); }
.traction .t-title { font-weight: 800; }
.traction .t-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.traction .t-go { margin-left: auto; font-size: 22px; line-height: 1; color: var(--muted); }
.gsum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 4px 0 22px; }
.gtile { border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.gtile strong { font-size: 30px; line-height: 1.1; font-weight: 800; }
.gtile span { font-size: 13px; font-weight: 700; }
.goal { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; justify-content: space-between; padding: 12px 14px; margin: 6px 0; border: 1px solid var(--line); border-left: 4px solid var(--line-2); border-radius: 10px; background: #fff; }
.goal-on_track { border-left-color: var(--ok); }
.goal-off_track { border-left-color: var(--bad); }
.goal-done { border-left-color: #8A96A2; }
.goal-done .goal-title { color: var(--muted); text-decoration: line-through; text-decoration-color: #B4BAC0; }
.goal-main { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; border: 0; background: none; padding: 2px 0; cursor: pointer; border-radius: 6px; }
.goal-main:hover .goal-title { text-decoration: underline; }
.goal-title { font-weight: 700; font-size: 16px; }
.goal-note { font-size: 14px; color: var(--ink-2); }
.goal-meta { font-size: 12px; color: var(--muted); }
.goal-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.goal-progress { display: inline-flex; align-items: center; gap: 8px; }
.goal-progress .pct { font-size: 13px; font-weight: 700; min-width: 38px; text-align: right; }
progress.bar { -webkit-appearance: none; appearance: none; width: 130px; height: 8px; border: 0; border-radius: 99px; background: #E6E8E6; overflow: hidden; }
progress.bar::-webkit-progress-bar { background: #E6E8E6; border-radius: 99px; }
progress.bar::-webkit-progress-value { background: var(--ok); border-radius: 99px; }
progress.bar::-moz-progress-bar { background: var(--ok); border-radius: 99px; }
progress.bar.off_track::-webkit-progress-value { background: var(--bad); }
progress.bar.off_track::-moz-progress-bar { background: var(--bad); }
progress.bar.done::-webkit-progress-value { background: #8A96A2; }
progress.bar.done::-moz-progress-bar { background: #8A96A2; }
.gs-seg { display: inline-flex; border: 1.5px solid var(--line-2); border-radius: 999px; overflow: hidden; background: #fff; }
.gs-btn { border: 0; background: none; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); min-height: 34px; }
.gs-btn + .gs-btn { border-left: 1px solid var(--line-2); }
.gs-btn:hover { background: var(--tint); }
.gs-btn[aria-pressed="true"].gs-on_track { background: var(--ok); color: #fff; }
.gs-btn[aria-pressed="true"].gs-off_track { background: var(--bad); color: #fff; }
.gs-btn[aria-pressed="true"].gs-done { background: #5F6B77; color: #fff; }
.seg.goal-seg input[value="on_track"]:checked + span { background: var(--ok); border-color: var(--ok); }
.seg.goal-seg input[value="off_track"]:checked + span { background: var(--bad); border-color: var(--bad); }
.seg.goal-seg input[value="done"]:checked + span { background: #5F6B77; border-color: #5F6B77; }
.avatar.sm { width: 22px; height: 22px; font-size: 12px; }
@media (max-width: 760px) {
  .gsum { gap: 8px; }
  .gtile { padding: 10px 12px; }
  .gtile strong { font-size: 24px; }
  .goal-side { align-items: flex-start; width: 100%; }
  progress.bar { width: 110px; }
}
