/* modkaren panel — phone first, no build step, system fonts only. */
:root {
  --bg: #f3f5f6; --surface: #ffffff; --surface-2: #eaeef0; --line: #dbe2e6;
  --text: #16202a; --dim: #5a6b78; --faint: #8395a0;
  --accent: #0e6e78; --accent-ink: #ffffff; --accent-soft: #dceff1;
  --bad: #b3261e; --bad-soft: #fbe8e6;
  --warn: #8a5a00; --warn-soft: #faf0dc;
  --ok: #2f7a45; --ok-soft: #e3f2e7;
  --info: #2f5d9a; --info-soft: #e5edf8;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1518; --surface: #161e23; --surface-2: #1d272d; --line: #28343a;
    --text: #dce6ea; --dim: #8da1ab; --faint: #6b808b;
    --accent: #4fc3ce; --accent-ink: #06262a; --accent-soft: #0e3238;
    --bad: #f0857a; --bad-soft: #3a1c19;
    --warn: #e3ac4a; --warn-soft: #2f2513;
    --ok: #6fbf80; --ok-soft: #16281a;
    --info: #8db4f0; --info-soft: #16233a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.boot { padding: 40px 20px; color: var(--dim); text-align: center; }

/* Shell */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-left)); background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .01em; }
.brand small { font-weight: 400; color: var(--faint); margin-left: 6px; }
.who { margin-left: auto; font-size: 14px; color: var(--dim); text-align: right; line-height: 1.25; }
.who b { display: block; color: var(--text); font-weight: 600; }
.nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.nav a {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; text-decoration: none;
  color: var(--dim); font-size: 15px; white-space: nowrap;
}
.nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.nav a.off { opacity: .45; pointer-events: none; }
main { max-width: 980px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 22px 0 8px; font-weight: 600; }

/* Cards and grids */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card .k { font-size: 13px; color: var(--faint); }
.card .v { font-size: 22px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.card .s { font-size: 14px; color: var(--dim); margin-top: 2px; }
.muted { color: var(--dim); }
.mono { font-family: var(--mono); font-size: 13px; }

/* Attention list */
.att { display: grid; gap: 8px; }
.att .row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.att .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex: 0 0 auto; }
.att .bad { background: var(--bad-soft); border-color: transparent; } .att .bad .dot { background: var(--bad); }
.att .warn { background: var(--warn-soft); border-color: transparent; } .att .warn .dot { background: var(--warn); }
.att .info { background: var(--info-soft); border-color: transparent; } .att .info .dot { background: var(--info); }
.att .ok { background: var(--ok-soft); border-color: transparent; } .att .ok .dot { background: var(--ok); }

/* Errors */
.errs { display: grid; gap: 6px; }
.err { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.err time { font-size: 12px; color: var(--faint); }
.err pre { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12.5px; max-height: 7.5em; overflow: auto; }

/* Login */
.login { max-width: 420px; margin: 8vh auto; padding: 0 20px; }
.login .card { padding: 24px; }
.login h1 { margin-top: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: var(--radius); border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; min-height: 46px;
}
.btn.ghost { background: transparent; color: var(--dim); border: 1px solid var(--line); }
.btn:focus-visible, .nav a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.stack { display: grid; gap: 12px; }
.note { font-size: 14px; color: var(--dim); }
.alert { padding: 10px 12px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 14px; }
.placeholder { padding: 28px 18px; text-align: center; color: var(--dim); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Inbox */
.cards { display: grid; gap: 12px; }
.ic { display: grid; gap: 10px; }
.ic.done { opacity: .55; }
.ic-head { display: flex; gap: 10px; align-items: flex-start; }
.ic-name { font-weight: 650; font-size: 17px; }
.ic-sub { font-size: 12.5px; margin-top: 2px; }
.ic-sigs { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 12.5px; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--info-soft); color: var(--info); }
.ic-reason { font-size: 14px; color: var(--dim); }
.ic-msg {
  font-size: 14.5px; background: var(--surface-2); border-radius: 8px; padding: 9px 11px;
  white-space: pre-wrap; word-break: break-word; max-height: 10em; overflow: auto;
}
.ic-hist { font-size: 13px; }
.ic-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ic-status { font-size: 13px; color: var(--dim); }
.btn.small { min-height: 38px; padding: 8px 14px; font-size: 14px; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.safe { background: transparent; color: var(--ok); border: 1px solid var(--ok); }
.btn:disabled { opacity: .5; cursor: default; }
.done-ban { color: var(--bad); font-weight: 600; }
.done-ok { color: var(--ok); font-weight: 600; }

/* Nav badge */
.nav a { position: relative; }
.badge {
  display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 5px;
  font-size: 12px; line-height: 18px; text-align: center; border-radius: 999px;
  background: var(--bad); color: #fff; font-variant-numeric: tabular-nums;
}
.nav a[aria-current="page"] .badge { background: rgba(255,255,255,.3); }

/* People */
.search {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); margin-bottom: 14px; -webkit-appearance: none;
}
.search:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.person-row { display: flex; align-items: center; justify-content: space-between; text-decoration: none; color: inherit; }
.pr-name { font-weight: 600; }
.back { display: inline-block; margin: 2px 0 10px; text-decoration: none; color: var(--dim); font-size: 15px; }
.person-head h1 { margin: 0 0 2px; }
.person-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.stack-sm { margin-top: 14px; }
.note-edit { width: 100%; border: 0; background: transparent; resize: vertical; color: inherit; font: inherit; }
.note-edit:focus-visible { outline: none; }
.note-status { font-size: 13px; min-height: 1.2em; margin-top: 4px; }
.hist { display: grid; gap: 6px; }
.hist-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; }
.hist-reason { font-size: 14px; }
.hist-meta { font-size: 12.5px; white-space: nowrap; }
.chats { display: grid; gap: 8px; }
.chat-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.chat-row > div:first-child { flex: 1; min-width: 0; }
.chat-row .btn { margin-left: auto; }
@media (max-width: 560px) {
  .hist-row { grid-template-columns: auto 1fr; }
  .hist-meta { grid-column: 2; }
}

/* Knowledge */
.kchip { text-align: left; }
.kchip.warn-card { border-color: var(--warn); }
.kchip.info-card { border-color: var(--info); }
.kbar { display: flex; gap: 8px; margin: 4px 0 8px; }
.kcat { font-size: 16px; margin: 18px 0 6px; }
.klist { display: grid; gap: 6px; }
.krow { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.krow.link { text-decoration: none; color: inherit; }
.krow.link:hover { border-color: var(--accent); }
.kq { flex: 1; min-width: 0; }
.kq .muted { font-size: 12.5px; margin-top: 2px; }
.kact { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.ta { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: inherit; font: inherit; padding: 9px 11px; resize: vertical; }
.ta:focus-visible, .search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.flab { display: block; font-size: 13px; color: var(--faint); margin: 6px 0 3px; text-transform: uppercase; letter-spacing: .06em; }
.danger-text { color: var(--bad); }
