/* Keel customer portal (Syntiva). Oxblood: stone light first, warm ink dark. Oxblood accent. Albert Sans throughout. */
:root {
  --bg: #f4f1ec; --bg-2: #ebe6de; --panel: #fffdf9; --panel-2: #f9f6f1; --sunk: #efebe4; --line: #e0d9ce; --line-2: #cbc2b4;
    --text: #1c1714; --text-2: #4f453e; --muted: #6f645b; --accent: #7a1f2b; --accent-hover: #641823; --accent-ink: #fffdf9; --accent-soft: rgba(122, 31, 43, 0.09); --ring: #7a1f2b;
    --ok: #3f6b3a; --warn: #a8641b; --err: #b8401f; --info: #3b5f8a; --idle: #8d8279;
    --ok-soft: rgba(63, 107, 58, 0.1); --warn-soft: rgba(168, 100, 27, 0.1); --err-soft: rgba(184, 64, 31, 0.09); --info-soft: rgba(59, 95, 138, 0.09);
    --shadow: 0 1px 2px rgba(28, 23, 20, 0.04), 0 10px 30px -22px rgba(28, 23, 20, 0.28); --shadow-pop: 0 30px 70px -24px rgba(28, 23, 20, 0.38), 0 0 0 1px var(--line); --keel: #7a1f2b;
  --display: 'Albert Sans', ui-sans-serif, -apple-system, 'Segoe UI', system-ui, sans-serif;
  --serif: var(--display);
  --sans: 'Albert Sans', ui-sans-serif, -apple-system, 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --side-w: 248px; --tab-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #161210; --bg-2: #1b1613; --panel: #201a17; --panel-2: #271f1b; --sunk: #130f0d; --line: #33291f; --line-2: #463a2e;
    --text: #efe9e1; --text-2: #c4b8ab; --muted: #9a8d81; --accent: #d0707c; --accent-hover: #de8b96; --accent-ink: #1a0d0f; --accent-soft: rgba(208, 112, 124, 0.15); --ring: #d0707c;
    --ok: #9cc58f; --warn: #e2a65f; --err: #f08a6c; --info: #8fb2dc; --idle: #6f6359;
    --ok-soft: rgba(156, 197, 143, 0.13); --warn-soft: rgba(226, 166, 95, 0.14); --err-soft: rgba(240, 138, 108, 0.15); --info-soft: rgba(143, 178, 220, 0.13);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 30px -20px rgba(0, 0, 0, 0.7); --shadow-pop: 0 30px 70px -24px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--line-2); --keel: #d0707c; color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #161210; --bg-2: #1b1613; --panel: #201a17; --panel-2: #271f1b; --sunk: #130f0d; --line: #33291f; --line-2: #463a2e;
    --text: #efe9e1; --text-2: #c4b8ab; --muted: #9a8d81; --accent: #d0707c; --accent-hover: #de8b96; --accent-ink: #1a0d0f; --accent-soft: rgba(208, 112, 124, 0.15); --ring: #d0707c;
    --ok: #9cc58f; --warn: #e2a65f; --err: #f08a6c; --info: #8fb2dc; --idle: #6f6359;
    --ok-soft: rgba(156, 197, 143, 0.13); --warn-soft: rgba(226, 166, 95, 0.14); --err-soft: rgba(240, 138, 108, 0.15); --info-soft: rgba(143, 178, 220, 0.13);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 30px -20px rgba(0, 0, 0, 0.7); --shadow-pop: 0 30px 70px -24px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--line-2); --keel: #d0707c; color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body { font: 400 16px/1.55 var(--sans); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; min-height: 100vh; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: 0.86em; padding: 0.1em 0.4em; border-radius: 5px; background: var(--sunk); border: 1px solid var(--line); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.strong { font-weight: 600; }
.mono { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }
::selection { background: var(--accent-soft); }

/* ---------- the halo: Personello's mark, used as the assistant's presence ---------- */
.halo { position: relative; display: inline-block; width: 34px; height: 34px; flex: none; border-radius: 50%; }
.halo::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2.5px solid var(--accent); }
.halo > span { position: absolute; inset: 35%; border-radius: 50%; background: var(--accent); }
.halo-sm { width: 28px; height: 28px; }
.halo-lg { width: 56px; height: 56px; }
.halo-lg::before { border-width: 3px; }
.presence { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); flex: none; }
.presence.is-off { background: var(--idle); box-shadow: 0 0 0 3px var(--sunk); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text);
  font: 500 15px var(--sans); cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ic { width: 18px; height: 18px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; gap: 6px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--text); border-color: var(--text); color: var(--panel); font-weight: 600; }
.btn-primary:hover { background: var(--text-2); border-color: var(--text-2); }
:root[data-theme='dark'] .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } }
:root[data-theme='dark'] .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); } }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--sunk); border-color: transparent; color: var(--text); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; font-weight: 600; }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--err); }
.btn-danger-ghost:hover { background: var(--err-soft); border-color: transparent; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--sunk); color: var(--text); }
.icon-btn.on { color: var(--accent); }
.icon-btn.danger:hover { color: var(--err); background: var(--err-soft); }
.icon-btn .ic { width: 18px; height: 18px; }

/* ---------- form atoms ---------- */
.fld, .mini { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > span, .mini > span { font-size: 14px; font-weight: 600; color: var(--text-2); }
.mini > span em, .fld > span em { font-style: normal; font-weight: 400; color: var(--muted); }
.fld small, .hint { color: var(--muted); font-size: 13.5px; }
.fld input, .fld textarea, .fld select, .mini input, .mini select, .mini textarea, textarea.mono-area, .search input, .copy-row input {
  font: 400 16px var(--sans); color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  min-height: 46px; padding: 10px 13px; width: 100%; min-width: 0;
}
.fld textarea, .mini textarea, textarea.mono-area { resize: vertical; line-height: 1.5; }
textarea.mono-area { font: 400 14px/1.6 var(--mono); }
.fld input:focus, .fld textarea:focus, .fld select:focus, .mini input:focus, .mini select:focus, .mini textarea:focus, textarea.mono-area:focus, .rem-form textarea:focus, .mem-edit textarea:focus, .search input:focus, .copy-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mini.grow { flex: 1 1 200px; }
.fld-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.fld-link { font-weight: 500; font-size: 13.5px; color: var(--accent); text-decoration: none; }
.fld-link:hover { text-decoration: underline; }
.gate-foot a { color: var(--accent); font-weight: 500; }
.fld-static { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 13px; border-radius: var(--r-sm); background: var(--sunk); color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.fld-static .ic { color: var(--muted); width: 18px; height: 18px; }
.form-err { color: var(--err); background: var(--err-soft); border-radius: var(--r-sm); padding: 10px 12px; font-size: 14.5px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 2px 0 0; flex: none; }
.checks { display: flex; flex-direction: column; gap: 2px; }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.search { position: relative; display: flex; align-items: center; flex: 0 1 280px; }
.search .ic { position: absolute; left: 13px; color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.search input { padding-left: 40px; border-radius: 999px; min-height: 42px; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; }
.side { display: none; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.top-brand { display: inline-flex; }
.top .switch-host { flex: 1; min-width: 0; }
.top-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text-2); }
.top-btn:hover { background: var(--sunk); text-decoration: none; }
.main { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px); }
#view { outline: none; }
.page { padding: 20px 16px 32px; max-width: 1080px; margin: 0 auto; }

.switch { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 10px; border-radius: 999px; }
.switch-many { cursor: pointer; }
.switch-many:hover { background: var(--sunk); }
.switch-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.switch-text b { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch-text small { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch-chev { width: 16px; height: 16px; color: var(--muted); margin-left: auto; }
.switch-select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; font-size: 16px; }
.switch:has(.switch-select:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; cursor: pointer; color: var(--muted); font: 500 12px var(--sans); text-decoration: none !important; }
.tab .ic { width: 22px; height: 22px; }
.tab.active { color: var(--text); }
.tab.active .ic { color: var(--accent); }
.tab .badge { position: absolute; top: 7px; left: calc(50% + 6px); }
.badge { min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--err); color: #fff; font: 700 11.5px/19px var(--sans); text-align: center; }

.mock-flag { font-size: 12.5px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 4px 10px; text-align: center; }

.offline { display: flex; align-items: flex-start; gap: 12px; margin: 12px 16px 0; padding: 12px 14px; border-radius: var(--r); background: var(--warn-soft); color: var(--text); flex-wrap: wrap; }
.offline > .ic { color: var(--warn); margin-top: 2px; }
.offline div { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; }
.offline span { color: var(--text-2); font-size: 14.5px; }

/* More sheet (mobile) */
.sheet { margin: auto 0 0; width: 100%; max-width: 100%; border: 0; padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: var(--panel); color: var(--text); box-shadow: var(--shadow-pop); animation: sheet-up .22s ease-out; }
.sheet::backdrop { background: rgba(8, 14, 20, 0.45); }
.sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 4px auto 10px; }
.sheet-nav { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-link { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r); background: var(--panel-2); color: var(--text); font-weight: 500; text-decoration: none !important; border: 1px solid var(--line); }
.sheet-link.active { border-color: var(--accent); }
.sheet-link .ic { color: var(--accent); }
.sheet-foot { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.side-btn { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--text-2); font: 500 15px var(--sans); border: 0; background: none; width: 100%; cursor: pointer; text-align: left; }
.side-btn:hover { background: var(--sunk); color: var(--text); }
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* desktop shell */
@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .top, .tabbar { display: none; }
  .side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: 22px 14px 16px; border-right: 1px solid var(--line); background: var(--bg-2); }
  .brand { display: flex; align-items: center; gap: 11px; padding: 2px 10px 14px; color: var(--text); text-decoration: none !important; }
  .brand-name { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 21px; line-height: 1; }
  .switch-side { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 8px; }
  .switch-side.switch-many:hover { border-color: var(--line-2); background: var(--panel); }
  .side-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
  .side-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; font-size: 15px; text-decoration: none !important; }
  .side-link .ic { color: var(--muted); }
  .side-link:hover { background: var(--sunk); color: var(--text); }
  .side-link.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
  .side-link.active .ic { color: var(--accent); }
  .side-link .badge { margin-left: auto; }
  .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
  .main { padding-bottom: 0; min-width: 0; }
  .page { padding: 40px 48px 72px; }
  .offline { margin: 20px 48px 0; }
}

/* ---------- gate (login / invite) ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.gate-card { width: min(420px, 100%); display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.gate-card .halo-lg { align-self: flex-start; margin-bottom: 6px; }
.gate-title { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 37px; line-height: 1.02; }
.gate-sub { color: var(--text-2); font-size: 17px; margin-bottom: 8px; }
.gate-form { display: flex; flex-direction: column; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); }
.gate-foot { color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- page header ---------- */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.ph-title { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 32px; line-height: 1.05; }
.ph-sub { color: var(--text-2); margin-top: 8px; max-width: 64ch; }
@media (min-width: 960px) { .ph-title { font-size: 50px; } .ph { margin-bottom: 32px; } }

/* ---------- cards & sections ---------- */
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; margin: 0 0 18px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 19px; }
.card-sub { color: var(--muted); font-size: 14.5px; margin-top: 3px; max-width: 60ch; }
.card-title-sm { font-size: 17px; margin-bottom: 12px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 30px 0 12px; }
.sec-head h2, .sec-title { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 24px; line-height: 1.1; }
.sec-title { margin: 28px 0 12px; }
.calm { display: flex; align-items: flex-start; gap: 10px; color: var(--text-2); padding: 4px 0; }
.calm .ic { color: var(--ok); margin-top: 2px; }
@media (min-width: 960px) { .card { padding: 22px 24px; } }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill-ok { color: var(--ok); background: var(--ok-soft); }
.pill-err { color: var(--err); background: var(--err-soft); }
.pill-warn { color: var(--warn); background: var(--warn-soft); }
.pill-idle { color: var(--muted); background: var(--sunk); }
.pill-sub { font-weight: 400; opacity: .8; }
.ctx-tag { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: 12.5px; font-weight: 500; }

.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--sunk); border: 1px solid var(--line); margin-bottom: 16px; }
.seg-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 999px; border: 0; background: none; color: var(--text-2); font: 500 14.5px var(--sans); cursor: pointer; }
.seg-btn[aria-selected='true'], .seg-btn:has(input:checked) { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.seg-btn input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-btn:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 1px; }
.seg-field { border: 0; padding: 0; margin: 0; }
.seg-field legend { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; padding: 0; }
.seg-field .seg { margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); font: 500 14px var(--sans); cursor: pointer; }
.chip span { font-size: 12.5px; color: var(--muted); }
.chip[aria-pressed='true'] { background: var(--text); color: var(--panel); border-color: var(--text); }
.chip[aria-pressed='true'] span { color: inherit; opacity: .7; }

/* ---------- empty / loading ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 22px; color: var(--text); }
.empty p { max-width: 46ch; }
.empty .btn { margin-top: 8px; }
.empty-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.empty-err .empty-mark { background: var(--err-soft); color: var(--err); }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 14px 2px; font-size: 15px; }
.spinner, .spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- markdown ---------- */
.md { overflow-wrap: anywhere; }
.md p + p, .md p + ul, .md ul + p, .md p + ol { margin-top: 6px; }
.md ul, .md ol { margin: 4px 0; padding-left: 22px; }
.md li + li { margin-top: 3px; }
.md h2, .md h3, .md h4, .md h5 { font-size: 16px; margin: 12px 0 4px; }
.md h2:first-child, .md h3:first-child { margin-top: 0; }
.md .md-gap { height: 6px; }
.md pre.code { background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; overflow-x: auto; font-size: 13.5px; }
.md pre.code code { border: 0; background: none; padding: 0; }

/* ---------- home ---------- */
.hero { padding: 8px 0 26px; }
.hero-date { color: var(--muted); font-size: 15px; margin-bottom: 4px; }
.hero-title { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: clamp(36px, 9vw, 62px); line-height: 0.98; }
.hero-status { display: flex; align-items: center; gap: 10px; color: var(--text-2); margin: 14px 0 20px; font-size: 16.5px; }
.ask { position: relative; display: flex; align-items: flex-end; gap: 8px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 26px; padding: 8px 8px 8px 20px; box-shadow: var(--shadow); max-width: 760px; transition: border-color .15s, box-shadow .15s; }
.ask:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.ask textarea { flex: 1; border: 0; background: transparent; resize: none; font: 400 18px/1.45 var(--sans); padding: 9px 0; min-height: 44px; max-height: 180px; outline: none; color: var(--text); }
.ask textarea::placeholder { color: var(--muted); }
.ask-send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: var(--text); color: var(--panel); }
.ask-send:hover { background: var(--accent); color: var(--accent-ink); }
.ask-hints { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ask-hints::-webkit-scrollbar { display: none; }
.ask-hint { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px dashed var(--line-2); background: transparent; color: var(--text-2); font: 400 14px var(--sans); cursor: pointer; white-space: nowrap; }
.ask-hint:hover { border-style: solid; color: var(--text); background: var(--panel); }

.home-grid { display: grid; gap: 18px; }
.home-main, .home-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.block-head h2 { font-size: 18px; }
.block-link { font-size: 14px; font-weight: 500; }
.block-note { font-size: 13.5px; color: var(--muted); }
.more-link { display: inline-block; margin-top: 12px; font-weight: 500; }
@media (min-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); align-items: start; }
}
@media (min-width: 960px) { .hero { padding: 6px 0 38px; } .block { padding: 20px 22px; } }

.today { list-style: none; margin: 0; padding: 0; }
.today li + li { border-top: 1px solid var(--line); }
.today-item { display: flex; gap: 12px; padding: 12px 4px; color: var(--text); text-decoration: none !important; border-radius: var(--r-sm); }
a.today-item:hover { background: var(--panel-2); }
.imp { width: 8px; height: 8px; border-radius: 50%; margin-top: 9px; flex: none; background: var(--info); }
.imp-urgent { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.today-main { min-width: 0; flex: 1; }
.today-top { display: flex; justify-content: space-between; gap: 10px; }
.today-top b { font-weight: 600; }
.today-top time { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.today-from { color: var(--text-2); font-size: 14.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.today-note { margin-top: 6px; font-size: 14.5px; color: var(--text-2); padding-left: 10px; border-left: 2px solid var(--accent); }

.notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.note { padding: 12px 14px; border-radius: 4px 16px 16px 16px; background: var(--panel-2); border: 1px solid var(--line); }
.note time { display: block; font-size: 13px; color: var(--muted); margin-top: 6px; }
.upcoming { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.upcoming li { display: flex; gap: 14px; align-items: center; padding: 8px 0; }
.upcoming li div { display: flex; flex-direction: column; min-width: 0; }
.upcoming small { color: var(--muted); font-size: 13.5px; }
.up-when { flex: none; width: 70px; display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: var(--r-sm); background: var(--sunk); line-height: 1.15; }
.up-when b { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.up-when span { font-size: 14px; font-weight: 600; }
.learned { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.learned li { display: flex; gap: 12px; }
.learned p { font-size: 15px; }
.learned small { color: var(--muted); font-size: 13px; }
.learn-ic { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.learn-ic .ic { width: 16px; height: 16px; }
.learn-skill { background: var(--info-soft); color: var(--info); }

/* ---------- approvals ---------- */
.appr-list, .appr-stack { display: flex; flex-direction: column; gap: 14px; }
.appr { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; transition: opacity .25s, transform .25s; box-shadow: var(--shadow); }
.appr-stack .appr { box-shadow: none; background: var(--panel-2); }
.appr.is-pending { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.appr.is-deciding { opacity: .7; }
.appr.is-approved, .appr.is-rejected { opacity: 0; transform: translateX(16px); }
.appr-head { display: flex; align-items: center; gap: 12px; }
.appr-head > div { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.appr-head time { color: var(--muted); font-size: 13.5px; }
.appr-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); flex: none; }
.appr-summary { font-size: 16.5px; line-height: 1.5; }
.appr-more summary { cursor: pointer; color: var(--accent); font-weight: 500; font-size: 14.5px; }
.appr-more[open] summary { margin-bottom: 10px; }
.appr-result { color: var(--muted); font-size: 14px; }
.appr-actions { display: flex; gap: 8px; justify-content: flex-end; }
.appr-actions .btn { flex: 1 1 0; max-width: 200px; }
@media (max-width: 520px) { .appr-actions .btn { max-width: none; } }
.pl { display: flex; flex-direction: column; gap: 10px; }
.pl-head { margin: 0; display: grid; gap: 3px; font-size: 14.5px; }
.pl-head div { display: grid; grid-template-columns: 70px 1fr; gap: 8px; }
.pl-head dt { color: var(--muted); }
.pl-head dd { margin: 0; overflow-wrap: anywhere; }
.pl-letter { padding: 14px 16px; background: var(--sunk); border-radius: var(--r); border-left: 3px solid var(--accent); font-size: 15.5px; line-height: 1.6; }
.pl-att { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.pl-event { flex-direction: row; gap: 14px; align-items: flex-start; }
.pl-date { flex: none; width: 54px; border-radius: var(--r-sm); border: 1px solid var(--line-2); overflow: hidden; text-align: center; background: var(--panel); }
.pl-date span { display: block; background: var(--err); color: #fff; font-size: 11.5px; font-weight: 700; padding: 2px 0; }
.pl-date b { display: block; font-size: 22px; padding: 2px 0 4px; }
.pl-chat blockquote { margin: 6px 0 0; padding: 10px 14px; border-radius: 4px 14px 14px 14px; background: var(--sunk); }

/* ---------- chat ---------- */
.page-chat { padding-top: 0; padding-bottom: 0; }
.chat { display: flex; flex-direction: column; height: calc(100dvh - 61px - var(--tab-h) - env(safe-area-inset-bottom)); max-width: 820px; margin: 0 auto; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.chat-who { display: flex; align-items: center; gap: 12px; }
.chat-who h1 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 24px; line-height: 1; }
.chat-who p { color: var(--muted); font-size: 13.5px; }
@media (max-width: 959px) { .chat-who h1, .chat-who .presence { display: none; } .chat-head { padding: 8px 0; } }
.msgs { flex: 1; overflow-y: auto; padding: 18px 2px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.msg { display: flex; flex-direction: column; max-width: min(88%, 620px); }
.msg-user { align-self: flex-end; align-items: flex-end; }
.msg-agent, .msg-system { align-self: flex-start; }
.msg-body { padding: 11px 15px; border-radius: 20px; line-height: 1.5; font-size: 16px; }
.msg-agent .msg-body { background: var(--panel); border: 1px solid var(--line); border-top-left-radius: 6px; }
.msg-user .msg-body { background: var(--text); color: var(--panel); border-top-right-radius: 6px; }
.msg-user .msg-body a { color: inherit; text-decoration: underline; }
.msg-system .msg-body { background: transparent; color: var(--muted); font-size: 14px; padding: 4px 6px; }
.msg-error .msg-body { background: var(--err-soft); color: var(--text); border-radius: var(--r); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.msg-meta { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); padding: 4px 8px 0; }
.msg-meta span { display: inline-flex; align-items: center; gap: 4px; }
.msg-meta .ic { width: 13px; height: 13px; }
.msg-files, .md .msg-files { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 12px; border-radius: 12px; background: var(--sunk); border: 1px solid var(--line); color: var(--text); font: 500 14px var(--sans); }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip small { color: var(--muted); }
.file-chip .ic { width: 16px; height: 16px; color: var(--muted); }
.file-chip.is-dl { cursor: pointer; }
.file-chip.is-dl:hover { border-color: var(--accent); }
.file-chip.is-dl .ic:last-child { color: var(--accent); }
.msg-user .file-chip { background: color-mix(in srgb, var(--panel) 14%, transparent); border-color: transparent; color: inherit; }
.chip-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; display: inline-flex; }
.play { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 6px 12px; font: 600 14px var(--sans); cursor: pointer; }
.day-sep { text-align: center; margin: 8px 0; }
.day-sep span { font-size: 12.5px; color: var(--muted); background: var(--bg); padding: 0 10px; }
.chat-empty { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 30px 10px; color: var(--text-2); max-width: 420px; }
.chat-empty h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 27px; color: var(--text); line-height: 1.1; }

.think { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 20px; border-top-left-radius: 6px; background: var(--panel); border: 1px solid var(--line); }
.think > div { display: flex; flex-direction: column; gap: 4px; }
.think b { font-weight: 600; }
.think-t { font-size: 13px; color: var(--muted); margin-left: 8px; font-variant-numeric: tabular-nums; }
.think-line { display: flex; align-items: baseline; gap: 0; }
.think-orb { position: relative; width: 28px; height: 28px; flex: none; border-radius: 50%; margin-top: 1px;
  background: conic-gradient(from 0deg, transparent 0 55%, var(--accent) 100%);
  -webkit-mask: radial-gradient(circle, transparent 9px, #000 10px); mask: radial-gradient(circle, transparent 9px, #000 10px);
  animation: spin 1.1s linear infinite; }
.think-orb::after { content: ''; position: absolute; inset: 10px; border-radius: 50%; background: var(--accent); }
.think-steps { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14.5px; color: var(--text-2); }
.think-steps li { display: flex; gap: 8px; align-items: center; animation: fade-in .3s ease-out; }
.think-steps li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); flex: none; }
.think-steps li:last-child::before { background: var(--accent); }
.think-long { font-size: 13.5px; color: var(--muted); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.composer { padding: 10px 0 12px; }
.attach-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.composer-row { display: flex; align-items: flex-end; gap: 6px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 26px; padding: 6px; box-shadow: var(--shadow); }
.composer-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.composer textarea { flex: 1; min-width: 0; border: 0; background: transparent; resize: none; font: 400 16.5px/1.45 var(--sans); padding: 10px 4px; min-height: 44px; max-height: 200px; outline: none; color: var(--text); }
.c-btn, .c-send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: transparent; color: var(--text-2); }
.c-btn:hover { background: var(--sunk); color: var(--text); }
.c-mic { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.c-mic.rec { background: var(--err); color: #fff; box-shadow: 0 0 0 6px var(--err-soft); }
.c-send { background: var(--text); color: var(--panel); }
.c-send:hover { background: var(--accent); color: var(--accent-ink); }
.c-send:disabled { opacity: .4; cursor: not-allowed; }
.rec-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px 0; color: var(--text-2); font-size: 14px; }
.rec-bar #recTime { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--err); animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
@media (min-width: 960px) {
  .page-chat { padding: 0 48px; }
  .chat { height: 100dvh; }
  .chat-head { padding: 22px 0 14px; }
  .composer { padding-bottom: 22px; }
}

/* ---------- memory ---------- */
.remember { background: linear-gradient(var(--panel), var(--panel)) padding-box; }
.rem-form textarea { width: 100%; font: 400 17px/1.5 var(--sans); border: 1px solid var(--line-2); border-radius: var(--r); padding: 12px 14px; background: var(--panel-2); color: var(--text); resize: vertical; min-height: 64px; }
.rem-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.rem-row .mini { flex: 1 1 140px; }
.rem-row .btn { flex: 0 0 auto; }
.mem-group + .mem-group { margin-top: 22px; }
.mem-group h3 { font-size: 14.5px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.mem-list { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.mem { display: flex; gap: 10px; padding: 14px 12px 14px 16px; align-items: flex-start; }
.mem + .mem { border-top: 1px solid var(--line); }
.mem.is-pinned { background: linear-gradient(90deg, var(--accent-soft), transparent 60%); }
.mem-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mem-subj { font-size: 14.5px; }
.mem-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 13px; color: var(--muted); }
.pin-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 500; }
.pin-tag .ic { width: 14px; height: 14px; }
.mem-acts { display: flex; flex: none; }
.mem.is-editing { display: block; }
.mem-edit textarea { width: 100%; font: 400 16px/1.5 var(--sans); border: 1px solid var(--accent); border-radius: var(--r-sm); padding: 10px 12px; background: var(--panel-2); color: var(--text); margin-bottom: 8px; }
.prof-form { display: flex; flex-direction: column; gap: 8px; }
.profile-md { max-width: 70ch; }
.ctx-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.ctx-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--panel-2); border: 1px solid var(--line); }
.ctx-list p { color: var(--text-2); font-size: 14.5px; }
.ctx-kind { flex: none; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 9px; margin-top: 2px; }
.ctx-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.ctx-form .mini:not(.grow) { flex: 0 0 150px; }
.persona summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.persona summary::-webkit-details-marker { display: none; }
.persona summary span { display: flex; flex-direction: column; }
.persona summary small { color: var(--muted); font-size: 14px; }
.persona summary .ic { color: var(--muted); transition: transform .15s; }
.persona[open] summary .ic { transform: rotate(180deg); }
.persona[open] .card-body { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--text-2); }

/* ---------- skills ---------- */
.skills-grid { display: grid; gap: 18px; }
@media (min-width: 1100px) { .skills-grid { grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); align-items: start; } .teach { position: sticky; top: 24px; } }
.skill-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.skill { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.skill:hover { border-color: var(--line-2); }
.skill:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.skill > .ic { color: var(--muted); }
.skill-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--info-soft); color: var(--info); flex: none; }
.skill-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.skill-main b { font-size: 16.5px; }
.skill-main span { color: var(--text-2); font-size: 14.5px; }
.skill-main small { color: var(--muted); font-size: 13px; }
.skill-view .lede { color: var(--text-2); margin-bottom: 14px; font-size: 16px; }
.skill-view .md { padding: 14px 16px; border-radius: var(--r); background: var(--sunk); }
.skill-view .small { margin-top: 10px; }

/* ---------- files ---------- */
.upload { padding: 0; overflow: hidden; }
.drop { display: flex; gap: 16px; align-items: center; padding: 22px; cursor: pointer; border-bottom: 1px dashed var(--line-2); transition: background .15s; }
.drop > .ic { width: 28px; height: 28px; color: var(--accent); flex: none; }
.drop h2 { font-size: 18px; }
.drop p { color: var(--text-2); font-size: 15px; }
.drop .link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.drop:hover, .drop.is-over { background: var(--accent-soft); }
.drop:focus-visible { outline-offset: -4px; }
.up-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; padding: 14px 22px 18px; }
.up-row .mini { flex: 0 1 280px; }
.up-status { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14.5px; }
.up-status .ic { color: var(--ok); }
.doc-list { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.doc { display: flex; gap: 14px; align-items: center; padding: 12px 12px 12px 16px; }
.doc + .doc { border-top: 1px solid var(--line); }
.doc-kind { flex: none; width: 52px; height: 40px; display: grid; place-items: center; border-radius: 8px; background: var(--sunk); color: var(--text-2); font-size: 12.5px; font-weight: 700; }
.doc-made { background: var(--accent-soft); color: var(--accent); }
.doc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.doc-main b { font-weight: 600; overflow-wrap: anywhere; }
.doc-main small { color: var(--muted); font-size: 13.5px; }

/* ---------- tasks ---------- */
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.task { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; padding: 16px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.task.is-off { background: var(--panel-2); box-shadow: none; }
.task.is-off .task-ic { background: var(--sunk); color: var(--muted); }
.task-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); grid-row: span 2; }
.task-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.task-main > b { font-size: 16.5px; }
.task-when { font-weight: 500; color: var(--text-2); }
.task-main p { color: var(--text-2); font-size: 15px; }
.task-main small { color: var(--muted); font-size: 13.5px; }
.task-last { margin-top: 6px; }
.task-last summary { cursor: pointer; color: var(--accent); font-weight: 500; font-size: 14px; }
.task-last .md { margin-top: 8px; padding: 12px 14px; border-radius: var(--r); background: var(--sunk); font-size: 15px; }
.task-acts { grid-column: 2; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.switch-tgl { position: relative; display: inline-flex; width: 48px; height: 28px; cursor: pointer; margin-right: 6px; }
.switch-tgl input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch-tgl > span:first-of-type { position: absolute; inset: 0; border-radius: 999px; background: var(--line-2); transition: background .15s; }
.switch-tgl > span:first-of-type::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s; }
.switch-tgl input:checked + span { background: var(--ok); }
.switch-tgl input:checked + span::after { transform: translateX(20px); }
.switch-tgl input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }
.sched-row { display: flex; gap: 10px; flex-wrap: wrap; }
.sched-row .mini { flex: 1 1 140px; }

/* ---------- settings ---------- */
.settings { max-width: 820px; }
.pref { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.pref legend { font-size: 15.5px; font-weight: 600; padding: 0; margin-bottom: 8px; }
.pref .hint { margin-bottom: 8px; }
.pref-2 { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 20px; }
@media (min-width: 640px) { .pref-2 { grid-template-columns: 1fr 1fr; } }
.radio-cards { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .radio-cards { grid-template-columns: repeat(3, 1fr); } }
.radio-card { position: relative; cursor: pointer; }
.radio-card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.radio-card span { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--panel); transition: border-color .12s, box-shadow .12s; }
.radio-card small { color: var(--muted); font-size: 13.5px; }
.radio-card input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.radio-card input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }
.radio-card input:disabled + span { opacity: .55; cursor: not-allowed; }
.save-state { color: var(--warn); font-size: 14px; }
.pair { display: flex; flex-direction: column; gap: 16px; }
.pair-code { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border-radius: var(--r); background: var(--sunk); border: 1px dashed var(--line-2); }
.pair-code b { font-family: var(--mono); font-size: 30px; font-weight: 500; letter-spacing: 0.08em; }
.pair-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pair-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; }
.pair-list li + li { border-top: 1px solid var(--line); }
.pair-list li > div { flex: 1; min-width: 0; }
.pair-list p { color: var(--text-2); font-size: 15px; }
.pair-list li.is-off p { color: var(--muted); }
.pair-ic { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--sunk); color: var(--text-2); }
.code-inline { font-size: 0.92em; white-space: nowrap; }
.invite-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.invite-form .mini:not(.grow) { flex: 1 1 100%; }
.invite-out { margin-top: 14px; padding: 14px 16px; border-radius: var(--r); background: var(--ok-soft); display: flex; flex-direction: column; gap: 10px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font: 400 13.5px var(--mono); background: var(--panel); }
.pw-grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 12px; }
@media (min-width: 720px) { .pw-grid { grid-template-columns: repeat(3, 1fr); } }
#pwForm .form-err { margin-bottom: 12px; }
.signout { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 0 24px; }
@media (max-width: 520px) { .copy-row { flex-direction: column; } .signout .btn { width: 100%; } }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width: 960px) { .toasts { left: auto; right: 24px; transform: none; bottom: 24px; } }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border-radius: var(--r); background: var(--text); color: var(--panel); box-shadow: var(--shadow-pop); font-size: 15px; animation: toast-in .2s ease-out; transition: opacity .3s, transform .3s; }
.toast > .ic { margin-top: 1px; width: 18px; height: 18px; }
.toast span { flex: 1; }
.toast-success > .ic { color: var(--ok); }
.toast-error { background: var(--err); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast-x { border: 0; background: none; color: inherit; opacity: .7; cursor: pointer; padding: 0; display: inline-flex; }
.toast-x .ic { width: 16px; height: 16px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- modal ---------- */
.modal { border: 0; padding: 0; border-radius: var(--r-lg); background: var(--panel); color: var(--text); width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); box-shadow: var(--shadow-pop); }
.modal-wide { width: min(760px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(8, 14, 20, 0.5); backdrop-filter: blur(2px); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.modal-head h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 23px; line-height: 1.1; }
.modal-body { padding: 10px 20px 16px; overflow-y: auto; }
.modal-msg { color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .btn-danger-ghost { margin-right: auto; }
@media (max-width: 520px) {
  .modal { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 22px 22px 0 0; }
  .modal-foot { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .think-orb { animation: spin 3s linear infinite !important; animation-iteration-count: infinite !important; animation-duration: 3s !important; }
}
@media (max-width: 520px) { .task-acts { grid-column: 1 / -1; } .task-ic { grid-row: auto; } }

/* ---------- Home: connect your phone (shown until something is paired) ---------- */
.phone-cta {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px 20px;
  margin: 0 0 24px; padding: 20px 22px; border-radius: var(--r-lg); background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 0 0 4px var(--accent-soft);
}
.phone-cta-mark { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.phone-cta-mark .ic { width: 26px; height: 26px; }
.phone-cta h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 24px; line-height: 1.1; }
.phone-cta p { color: var(--text-2); margin-top: 4px; max-width: 58ch; }
@media (max-width: 640px) {
  .phone-cta { grid-template-columns: auto minmax(0, 1fr); padding: 18px 16px; }
  .phone-cta .btn { grid-column: 1 / -1; width: 100%; }
}
.invite-more { margin-top: 10px; }
.invite-more summary { cursor: pointer; color: var(--accent); font-weight: 500; font-size: 14px; }
.invite-more .copy-row { margin-top: 8px; }

/* Keel brand mark (K-keel monogram): ink follows the theme text colour; the keel blade is brand teal */
.brand-mark { width: 30px; height: 30px; flex: none; display: grid; place-items: center; background: none; border: 0; border-radius: 0; color: currentColor; }
.brand-mark::before, .brand-mark::after { content: none; display: none; }
.keel-mark { width: 100%; height: 100%; display: block; overflow: visible; }
.keel-mark path { fill: none; stroke: currentColor; stroke-width: 8; stroke-linecap: round; }
.keel-mark .wl { stroke-width: 2.5; opacity: .4; }
.keel-mark .kb { stroke: var(--keel); }
.top-brand .brand-mark { width: 26px; height: 26px; }
.brand .brand-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.05; }
.brand .brand-sub { font-family: var(--f-body, inherit); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; opacity: .6; }
.brand .brand-mark { width: 30px; height: 30px; }
