/* Livsprotokoll portal — «Nordic Hovudbok» evolved (L76–L78).
   Green = work chrome; ledger aesthetic; light default, dark optional;
   WCAG 2.1 AA; brass ONLY in rules/borders/large display text (L78).
   All assets self-hosted — no CDN, no runtime network requests. */

/* ── Fonts (harvested from the Åkre AI resource bank, SIL OFL 1.1) ── */
@font-face {
  font-family: 'Source Serif 4';
  src: url('/static/fonts/SourceSerif4Variable-Roman.woff2') format('woff2-variations');
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/static/fonts/SourceSerif4Variable-Italic.woff2') format('woff2-variations');
  font-weight: 200 900; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('/static/fonts/PlusJakartaSans[wght].woff2') format('woff2-variations');
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('/static/fonts/PlusJakartaSans-Italic[wght].woff2') format('woff2-variations');
  font-weight: 200 800; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Spline Sans Mono';
  src: url('/static/fonts/SplineSansMono[wght].woff2') format('woff2-variations');
  font-weight: 300 700; font-style: normal; font-display: swap;
}

/* ── Tokens (light default) ─────────────────────────────────── */
:root {
  --ink-900:#1A2B1F; --ink-800:#243829; --ink-700:#2F4D38;
  --ink-500:#5C7A64; --ink-300:#A8BFB0; --ink-100:#D6E5DA;
  --ground-50:#F7F4EF; --ground-0:#FDFCF9;
  --brass-500:#B8922A; --brass-400:#CBA543; --brass-100:#F2E9D0; --brass-50:#FAF5E8;
  --green-700:#1C4A2A; --green-600:#245932; --green-500:#2D6B3D;
  --green-100:#D4EDDA; --green-50:#EAF5EE;
  --red-600:#C0392B; --red-50:#FDF0EE;
  --amber-500:#E07A00; --amber-700:#8A4B00; --amber-50:#FEF3E2;

  --font-display:'Source Serif 4', Georgia, serif;
  --font-body:'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:'Spline Sans Mono', 'SFMono-Regular', Consolas, monospace;

  --text-xs:.75rem; --text-sm:.825rem; --text-base:.9375rem; --text-md:1.0625rem;
  --text-lg:1.25rem; --text-xl:1.5625rem; --text-2xl:1.953rem;

  --s-1:.25rem; --s-2:.5rem; --s-3:.75rem; --s-4:1rem; --s-5:1.25rem;
  --s-6:1.5rem; --s-8:2rem; --s-10:2.5rem;

  --r-sm:3px; --r-md:6px; --r-lg:10px;

  --border-hairline:1px solid var(--ink-100);
  --border-rule:.5px solid var(--ink-100);

  --shadow-sm:0 1px 4px rgba(26,43,31,.06);
  --shadow-md:0 2px 12px rgba(26,43,31,.08);

  --bg:var(--ground-50); --surface:var(--ground-0);
  --text:var(--ink-800); --text-muted:var(--ink-500);
  --primary:var(--green-600); --primary-h:var(--green-700);

  --ease-out:cubic-bezier(.22,1,.36,1);
  --dur-fast:120ms; --dur-base:200ms;

  --topbar-h:52px; --bottomnav-h:56px;
}

[data-theme="dark"] {
  --ground-50:#141A15; --ground-0:#1C2620;
  --ink-900:#EAE6DD; --ink-800:#D4D0C8; --ink-700:#A8A49C;
  --ink-500:#8F8B85; --ink-300:#4A4744; --ink-100:#2E3530;
  --brass-500:#CBA543; --brass-400:#DDB95A; --brass-100:#2A2415; --brass-50:#1E1B0F;
  --green-700:#2D7040; --green-600:#38874F; --green-500:#459E60;
  --green-100:#163324; --green-50:#0F2119;
  --red-600:#E05A4A; --red-50:#2A1512;
  --amber-500:#E8942A; --amber-700:#E8942A; --amber-50:#2A1E08;
  --shadow-sm:0 1px 4px rgba(0,0,0,.3); --shadow-md:0 2px 12px rgba(0,0,0,.4);
}

/* ── Base ───────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: var(--text-base); line-height: 1.55;
}
/* Ledger paper texture (desktop only) */
@media (min-width: 600px) {
  body::before {
    content:''; position:fixed; inset:0; pointer-events:none; z-index:0;
    background-image: repeating-linear-gradient(0deg,
      transparent, transparent 31px, var(--ink-100) 31px, var(--ink-100) 32px);
    opacity:.18;
  }
}
a { color: var(--green-600); }
:focus-visible {
  outline: 2px solid var(--green-600); outline-offset: 2px;
  border-radius: var(--r-sm);
}
[data-theme="dark"] :focus-visible { outline-color: var(--green-500); }

.amount { font-family: var(--font-mono); font-variant-numeric: tabular-nums lining-nums; }

.rule { border: none; border-top: var(--border-rule); margin: var(--s-3) 0; }
.rule-brass { border-top: 1px solid var(--brass-500); opacity: .7; }
.rule-short { width: 48px; margin: var(--s-4) auto; }

/* ── Topbar (green = work chrome, L76) ──────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  background: var(--green-700); border-bottom: .5px solid var(--brass-500);
}
[data-theme="dark"] .topbar { background: #12301C; }
.topbar-inner {
  display: flex; align-items: center; gap: var(--s-4);
  height: 100%; max-width: 1100px; margin: 0 auto; padding: 0 var(--s-4);
}
.brand {
  font-family: var(--font-display); font-size: var(--text-md); font-weight: 600;
  color: #FDFCF9; letter-spacing: -.02em;
}
.brand-rule { width:1px; height:24px; background: var(--brass-500); opacity:.5; }
.topnav { display:flex; gap: var(--s-2); flex:1; }
.topnav a {
  color: rgba(253,252,249,.85); text-decoration: none; font-size: var(--text-sm);
  padding: var(--s-1) var(--s-3); border-radius: var(--r-sm);
}
.topnav a:hover { background: rgba(253,252,249,.10); }
.topnav a.active { background: rgba(253,252,249,.14); color:#FDFCF9; }
.topbar-user { font-size: var(--text-xs); color: rgba(253,252,249,.65); }
.logout-form { margin:0; }
.btn-ghost {
  border: 1px solid var(--ink-300); background: transparent; color: inherit;
  font-family: var(--font-body); font-size: var(--text-xs);
  padding: 4px 10px; border-radius: var(--r-sm); cursor: pointer;
}
.topbar .btn-ghost {
  border-color: rgba(253,252,249,.25); background: rgba(253,252,249,.08); color:#FDFCF9;
}
.topbar .btn-ghost:hover { background: rgba(253,252,249,.18); }

/* ── Page / bottom nav ──────────────────────────────────────── */
.page {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 0 auto; padding: var(--s-5) var(--s-4) var(--s-10);
}
.page-title {
  font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600;
  color: var(--ink-900); letter-spacing: -.02em; margin: 0 0 var(--s-2);
}
.page-sub { color: var(--text-muted); font-size: var(--text-sm); margin-top: 0; }

.bottomnav { display: none; }
@media (max-width: 767px) {
  .topnav, .topbar-user { display: none; }
  .page { padding-bottom: calc(var(--bottomnav-h) + var(--s-8)); }
  /* Fann i wave-4-walk (mobil, /leiar/timelister): fokus (Tab/klikk) på eit
     skjemaelement nær botnen av sida scrollar nettlesaren berre til KANTEN
     av viewporten — som er dekt av den faste .bottomnav-linja. Utan
     scroll-margin-bottom hamnar feltet delvis under menyen. */
  .page input, .page select, .page textarea, .page button, .page a {
    scroll-margin-bottom: calc(var(--bottomnav-h) + var(--s-4));
  }
  .bottomnav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    height: var(--bottomnav-h);
    display: flex; justify-content: space-around; align-items: stretch;
    background: var(--surface); border-top: var(--border-hairline);
  }
  .bottomnav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; flex: 1; text-decoration: none;
    font-size: var(--text-xs); color: var(--text-muted);
  }
  .bottomnav a.active { color: var(--green-600); font-weight: 600; }
  [data-theme="dark"] .bottomnav a.active { color: var(--green-500); }
  .bn-glyph { font-size: 1.05rem; line-height: 1; }
}

/* ── Login ──────────────────────────────────────────────────── */
.login-wrap { display:flex; justify-content:center; padding: var(--s-10) var(--s-4); }
.login-card {
  width: 400px; max-width: 100%; background: var(--surface);
  border: var(--border-hairline); border-radius: var(--r-lg);
  box-shadow: var(--shadow-md); padding: var(--s-10) var(--s-8);
}
.login-brand {
  font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700;
  color: var(--ink-900); letter-spacing: -.02em; text-align: center;
  margin: var(--s-2) 0 0;
}
.login-sub { text-align:center; color: var(--text-muted); font-size: var(--text-sm); }
.login-form { display:flex; flex-direction:column; gap: var(--s-2); }
.login-form label:not(.check-label) {
  font-size: var(--text-xs); font-weight: 600; color: var(--ink-500);
  letter-spacing: .08em; text-transform: uppercase; margin-top: var(--s-2);
}
input[type=email], input[type=password], input[type=text], input[type=search],
input[type=date], input[type=number], select, textarea {
  font-family: var(--font-body); font-size: var(--text-base); color: var(--text);
  background: var(--surface); border: var(--border-hairline); border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(36,89,50,.12); outline: none;
}
.check-label { display:flex; align-items:center; gap: var(--s-2); font-size: var(--text-sm); }
.btn-primary {
  background: var(--green-600); color: #FDFCF9; border: none;
  font-family: var(--font-body); font-weight: 600; font-size: var(--text-base);
  border-radius: var(--r-md); padding: var(--s-2) var(--s-4); min-height: 44px;
  cursor: pointer; transition: background var(--dur-fast) var(--ease-out);
}
.btn-primary:hover { background: var(--green-700); }
.btn-primary:active { transform: scale(.98); }
[data-theme="dark"] .btn-primary { color: #0F2119; }
.btn-sm { min-height: 34px; font-size: var(--text-sm); padding: var(--s-1) var(--s-3); }
.error-note {
  border-left: 3px solid var(--red-600); background: var(--red-50); color: var(--red-600);
  border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: var(--s-2) var(--s-3);
  font-size: var(--text-sm);
}
.ok-note {
  border-left: 3px solid var(--green-600); background: var(--green-50); color: var(--green-700);
  border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: var(--s-2) var(--s-3);
  font-size: var(--text-sm);
}
[data-theme="dark"] .ok-note { color: var(--green-500); }

/* ── Week stripe ────────────────────────────────────────────── */
.week-stripe {
  display: flex; align-items: baseline; gap: var(--s-3); flex-wrap: wrap;
  background: var(--surface); border: var(--border-hairline);
  border-left: 2px solid var(--brass-500);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: var(--s-2) var(--s-4); margin-bottom: var(--s-5);
  font-size: var(--text-sm);
}
.week-stripe-label {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-500); white-space: nowrap;
}
.week-stripe-items { display:flex; flex-wrap:wrap; gap: var(--s-2) var(--s-4); }
.week-item { color: var(--text); text-decoration: none; }
.week-item:hover { color: var(--green-600); }
.week-stripe-empty { color: var(--ink-700); font-family: var(--font-display); }

/* ── Ledger table / cards (L76: fristliste først) ───────────── */
.ledger {
  background: var(--surface); border: var(--border-hairline);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm); overflow: hidden;
}
.ledger-head, .frist-row {
  display: grid; align-items: center;
  grid-template-columns: 1.4fr 1.2fr .9fr .8fr .9fr 2fr;
  gap: var(--s-2); padding: var(--s-2) var(--s-4);
}
.ledger-compact .frist-row { grid-template-columns: 1.4fr 1.2fr .9fr .8fr .9fr; }
.ledger-head {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-500);
  border-bottom: 1px solid var(--brass-500);
}
.frist-row { border-bottom: var(--border-rule); position: relative; }
.frist-row:last-child { border-bottom: none; }
.frist-row.is-thisweek { background: var(--brass-50); }
.frist-row.is-done .fr-client, .frist-row.is-done .fr-task { color: var(--text-muted); }
.fr-cell { min-width: 0; overflow-wrap: anywhere; }
.fr-actions { display:flex; gap: var(--s-2); flex-wrap: wrap; align-items:center; }
.inline-form { display:flex; gap: var(--s-2); align-items:center; margin:0; }
.inline-comment { max-width: 180px; font-size: var(--text-sm); min-height:34px; padding: var(--s-1) var(--s-2); }
.fr-cell::before { content: none; }

@media (max-width: 639px) {
  .ledger, .ledger-compact { background: transparent; border: none; box-shadow: none; }
  .ledger-head { display: none; }
  .frist-row, .ledger-compact .frist-row {
    display: block; background: var(--surface); border: var(--border-hairline);
    border-radius: var(--r-md); box-shadow: var(--shadow-sm);
    padding: var(--s-3) var(--s-4); margin-bottom: var(--s-3);
  }
  .frist-row.is-thisweek { border-left: 2px solid var(--brass-500); }
  .fr-cell { padding: 2px 0; }
  .fr-cell::before {
    content: attr(data-label) ' · ';
    font-size: var(--text-xs); letter-spacing: .08em; text-transform: uppercase;
    color: var(--ink-500);
  }
  .fr-actions::before { content: none; }
  .fr-actions { margin-top: var(--s-2); }
}

/* Status chips */
.chip {
  display: inline-block; font-size: var(--text-xs); font-family: var(--font-mono);
  border-radius: var(--r-sm); padding: 1px var(--s-2); border: var(--border-hairline);
}
.chip-status.chip-notstarted { background: var(--ground-50); color: var(--ink-700); }
.chip-status.chip-inprogress { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-500); }
.chip-status.chip-onhold { background: var(--brass-50); color: var(--ink-700); border-bottom: 1px dashed var(--brass-400); }
.chip-status.chip-completed, .chip-status.chip-controlled {
  background: var(--green-50); color: var(--green-700); border-color: var(--green-100);
}
[data-theme="dark"] .chip-status.chip-completed,
[data-theme="dark"] .chip-status.chip-controlled { color: var(--green-500); }
.chip-status.chip-notapplicable { background: var(--ground-50); color: var(--text-muted); }
.chip-muted { background: var(--ground-50); color: var(--text-muted); }
.chip-warn { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-500); }

/* Row dialogs (datoflytt, rekk ikkje, angre) */
.row-dialog summary { list-style: none; display: inline-block; }
.row-dialog summary::-webkit-details-marker { display: none; }
.row-dialog[open] .dialog-body {
  display: flex; flex-direction: column; gap: var(--s-2);
  background: var(--surface); border: var(--border-hairline);
  border-left: 2px solid var(--brass-500);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  box-shadow: var(--shadow-md); padding: var(--s-3) var(--s-4);
  margin-top: var(--s-2); max-width: 340px;
  font-size: var(--text-sm);
}
.cmi-choice { border: var(--border-rule); border-radius: var(--r-sm); padding: var(--s-2); }
.cmi-choice legend { font-size: var(--text-xs); letter-spacing:.08em; text-transform:uppercase; color: var(--ink-500); }
.cmi-overtime-fields input[type=number] { width: 60px; min-height: 34px; }

/* ── Empty / celebration states (L76: quiet warmth, NO confetti) ── */
.empty-state {
  text-align: center; max-width: 420px; margin: var(--s-10) auto;
  color: var(--ink-700); font-family: var(--font-display); font-size: var(--text-md);
}

/* ── Toasts (undo-toast, ikkje modal — L76) ─────────────────── */
.toast-region {
  position: fixed; bottom: calc(var(--bottomnav-h) + var(--s-3)); left: 50%;
  transform: translateX(-50%); z-index: 50; display: flex;
  flex-direction: column; gap: var(--s-2); width: min(420px, 92vw);
}
@media (min-width: 768px) { .toast-region { bottom: var(--s-5); } }
.toast {
  display: flex; align-items: center; gap: var(--s-3);
  background: var(--surface); border: var(--border-hairline);
  border-left: 3px solid var(--green-600); border-radius: 0 var(--r-md) var(--r-md) 0;
  box-shadow: var(--shadow-md); padding: var(--s-2) var(--s-4);
  font-size: var(--text-sm);
  animation: toast-in var(--dur-base) var(--ease-out) both;
}
.toast-error { border-left-color: var(--red-600); color: var(--red-600); }
.toast-stamp { color: var(--green-600); font-weight: 700; }
@keyframes toast-in { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform:none; } }

/* ── Cards (flagg, nei-protokoll, profil) ───────────────────── */
.card-list { display: flex; flex-direction: column; gap: var(--s-4); }
.lp-card {
  background: var(--surface); border: var(--border-hairline); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm); padding: var(--s-4) var(--s-5); margin-bottom: var(--s-4);
}
.lp-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.lp-card-title {
  font-family: var(--font-display); font-size: var(--text-md); font-weight: 600;
  color: var(--ink-900); margin: var(--s-2) 0;
}
.lp-card-date { color: var(--text-muted); font-size: var(--text-xs); }
.decision-card { border-left: 2px solid var(--brass-500); border-radius: 0 var(--r-md) var(--r-md) 0; }
.decision-number {
  font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600;
  color: var(--ink-900); letter-spacing: -.02em;
}
.decision-rationale-label {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-500); margin-bottom: 0;
}
.basis-links { font-size: var(--text-sm); }
.search-form { display: flex; gap: var(--s-2); margin-bottom: var(--s-5); }
.search-form input[type=search] { flex: 1; max-width: 420px; }

/* ── Oversyn ────────────────────────────────────────────────── */
.person-group { margin-bottom: var(--s-6); }
.person-name {
  font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600;
  color: var(--ink-900); letter-spacing: -.02em;
  border-bottom: 1px solid var(--brass-500); padding-bottom: var(--s-1);
  display: flex; justify-content: space-between; align-items: baseline;
}
.person-count { font-size: var(--text-xs); color: var(--text-muted); font-weight: 400; }
.person-none { color: var(--text-muted); font-size: var(--text-sm); margin: var(--s-2) 0 0; font-style: italic; }

/* ── Nærværsplan ────────────────────────────────────────────── */
.presence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s-4); }
.presence-day {
  background: var(--surface); border: var(--border-hairline); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm); padding: var(--s-3) var(--s-4);
}
.presence-day-name {
  font-family: var(--font-display); font-size: var(--text-md); margin: 0 0 var(--s-2);
  border-bottom: var(--border-rule); padding-bottom: var(--s-1);
}
.presence-blocks { list-style: none; margin: 0; padding: 0; display:flex; flex-direction:column; gap: var(--s-1); }
.presence-block { display: flex; gap: var(--s-3); font-size: var(--text-sm); }

/* ── Meir ───────────────────────────────────────────────────── */
.meir-list { display: flex; flex-direction: column; gap: var(--s-2); max-width: 480px; }
.meir-item {
  background: var(--surface); border: var(--border-hairline);
  border-left: 2px solid var(--brass-500); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: var(--s-3) var(--s-4); text-decoration: none; color: var(--text);
  font-weight: 500;
}
.meir-item:hover { background: var(--brass-50); }
.meir-logout { margin-top: var(--s-6); }

/* ── Profil ─────────────────────────────────────────────────── */
.choice-form { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.recovery-codes { columns: 2; font-size: var(--text-sm); }
.totp-secret { font-size: var(--text-md); letter-spacing: .08em; overflow-wrap: anywhere; }

/* ── Chat (sidepanel desktop / own page mobile) ─────────────── */
.chat-body .page { max-width: 1100px; }
.chat-layout { display: flex; justify-content: flex-end; }
.chat-panel {
  display: flex; flex-direction: column;
  width: 420px; max-width: 100%;
  height: calc(100vh - var(--topbar-h) - var(--s-8));
  background: var(--surface); border: var(--border-hairline);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md); overflow: hidden;
}
@media (max-width: 767px) {
  .chat-layout { justify-content: stretch; }
  .chat-panel {
    width: 100%; border: none; border-radius: 0; box-shadow: none;
    height: calc(100vh - var(--bottomnav-h) - var(--s-10));
    background: transparent;
  }
}
.queue-banner {
  background: var(--brass-50); border-bottom: 1px dashed var(--brass-400);
  color: var(--ink-700); font-size: var(--text-sm);
  padding: var(--s-2) var(--s-4); text-align: center;
}
.chat-thread { flex: 1; overflow-y: auto; padding: var(--s-4); }
.chat-empty { margin: var(--s-8) auto; }
.chat-empty-brand {
  font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600;
  color: var(--ink-900); letter-spacing: -.02em; margin: 0;
}
.msg-row { display: flex; margin-bottom: var(--s-3); }
.msg-row.user { justify-content: flex-end; }
.msg-row.user .bubble {
  background: var(--green-700); color: #FDFCF9;
  border-radius: var(--r-lg) var(--r-lg) var(--r-sm) var(--r-lg);
  padding: var(--s-2) var(--s-4); max-width: 80%;
  animation: bubble-in var(--dur-base) var(--ease-out) both;
}
.msg-row.bot .bubble {
  background: var(--surface); color: var(--text);
  border: var(--border-hairline); border-left: 2px solid var(--brass-500);
  border-radius: var(--r-sm) var(--r-lg) var(--r-lg) var(--r-lg);
  padding: var(--s-2) var(--s-4); max-width: 88%; box-shadow: var(--shadow-sm);
  line-height: 1.7; white-space: pre-wrap;
  animation: bubble-in var(--dur-base) var(--ease-out) both;
}
@keyframes bubble-in { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform:none; } }

/* Receipt-stamp tool chips (design spec §5.5) */
.tool-chips { display: flex; flex-wrap: wrap; gap: var(--s-1); margin: var(--s-1) 0 var(--s-2); }
.tool-chip {
  display: inline-flex; align-items: center; gap: var(--s-1);
  background: var(--brass-50); border: 1px solid var(--brass-100);
  border-bottom: 1px dashed var(--brass-400);
  border-radius: var(--r-sm); padding: 2px var(--s-2);
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-700);
  animation: chip-in var(--dur-fast) var(--ease-out) both;
}
.tool-chip::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  border: 1.5px solid var(--brass-500); border-top-color: transparent;
  animation: chip-spin .7s linear infinite;
}
.tool-chip.done {
  background: var(--green-50); border: 1px solid var(--green-100); color: var(--green-700);
}
[data-theme="dark"] .tool-chip.done { color: var(--green-500); }
.tool-chip.done::before {
  border: none; width: auto; height: auto; border-radius: 0;
  content: '✓'; animation: none; color: var(--green-600); font-weight: 700;
}
@keyframes chip-in { from { opacity:0; transform: scale(.85); } to { opacity:1; transform:none; } }
@keyframes chip-spin { to { transform: rotate(360deg); } }

/* Confirmation card (L5) */
.confirm-card {
  border: var(--border-hairline); border-left: 3px solid var(--brass-500);
  background: var(--brass-50); border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--s-3) var(--s-4); margin: var(--s-2) 0; max-width: 88%;
  font-size: var(--text-sm);
}
.confirm-head { display: flex; gap: var(--s-2); align-items: center; color: var(--ink-900); }
.confirm-detail {
  background: var(--ground-50); border: var(--border-rule); border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3); font-size: var(--text-xs); overflow-x: auto;
}
.confirm-form { display: flex; gap: var(--s-2); }

/* Chat input */
.chat-inputbar { border-top: var(--border-rule); padding: var(--s-3) var(--s-4) var(--s-4); }
.input-row {
  display: flex; align-items: flex-end; gap: var(--s-2);
  background: var(--surface); border: var(--border-hairline); border-radius: var(--r-lg);
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4); box-shadow: var(--shadow-sm);
}
.input-row:focus-within { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(36,89,50,.10); }
.input-row textarea {
  flex: 1; border: none; background: transparent; resize: none;
  max-height: 160px; padding: var(--s-1) 0; box-shadow: none;
}
.input-row textarea:focus { box-shadow: none; border: none; }
.btn-send { min-height: 36px; width: 40px; padding: 0; }
.btn-mic {
  min-height: 36px; width: 36px; border: var(--border-hairline);
  background: var(--surface); color: var(--ink-500); border-radius: var(--r-md);
  cursor: pointer; font-size: var(--text-sm);
}
.btn-mic.listening { color: var(--red-600); border-color: var(--red-600); }
.chat-hint { font-size: var(--text-xs); color: var(--ink-300); margin: var(--s-1) 0 0; }

/* ── Motion discipline ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
