/* EUI Adviser Portal – sidebar app shell, EUI navy, phone-first behaviours. */
:root {
  --bg: #FFFFFF; --bg-soft: #F5F7FA; --side: #FAFBFC; --surface: #FFFFFF; --ink: #0F1B2D; --muted: #5A6476; --faint: #8C95A6; --line: #E7EAF0; --line-strong: #D6DBE4;
  --navy: #00608B; --navy-ink: #FFFFFF;
  --primary: #00608B; --primary-ink: #FFFFFF; --primary-soft: #E6F2F8; --primary-hover: #004C6E;
  --good: #137A43; --good-soft: #E4F5EB; --warn: #A2490A; --warn-soft: #FFF2E5; --bad: #B42318; --bad-soft: #FEEDEC; --info: #3B4FC4; --info-soft: #EEF0FF;
  --glow: radial-gradient(60% 80% at 50% 0%, #E1F0F7 0%, rgba(225,240,247,0) 70%);
  --shadow: 0 1px 2px rgba(15,27,45,.04), 0 2px 8px rgba(15,27,45,.04);
  --shadow-lg: 0 10px 40px rgba(0,96,139,.10), 0 2px 6px rgba(15,27,45,.05);
  --shadow-pop: 0 24px 80px rgba(8,20,40,.22), 0 4px 14px rgba(8,20,40,.08);
  --sk: linear-gradient(90deg, #EEF1F5 0%, #F7F9FB 50%, #EEF1F5 100%);
  --scrim: rgba(8,14,28,.38);
  --f: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --side-w: 252px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0B111D; --bg-soft: #111A2A; --side: #0E1522; --surface: #131C2D; --ink: #E8EDF6; --muted: #A1ACC0; --faint: #78849A; --line: #222D42; --line-strong: #2E3A52;
  --navy: #E8EDF6; --navy-ink: #0B111D;
  --primary: #5FB8DD; --primary-ink: #04202D; --primary-soft: #0E2B3A; --primary-hover: #82CBE8;
  --good: #7DD3A0; --good-soft: #12301F; --warn: #F5B36B; --warn-soft: #382511; --bad: #F59A92; --bad-soft: #3A1714; --info: #A9B6FF; --info-soft: #1D2550;
  --glow: radial-gradient(60% 80% at 50% 0%, #0E2B3A 0%, rgba(14,43,58,0) 70%);
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 40px rgba(0,0,0,.4); --shadow-pop: 0 24px 80px rgba(0,0,0,.6);
  --sk: linear-gradient(90deg, #172133 0%, #1E2A40 50%, #172133 100%);
  --scrim: rgba(0,0,0,.55);
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0B111D; --bg-soft: #111A2A; --side: #0E1522; --surface: #131C2D; --ink: #E8EDF6; --muted: #A1ACC0; --faint: #78849A; --line: #222D42; --line-strong: #2E3A52;
  --navy: #E8EDF6; --navy-ink: #0B111D;
  --primary: #5FB8DD; --primary-ink: #04202D; --primary-soft: #0E2B3A; --primary-hover: #82CBE8;
  --good: #7DD3A0; --good-soft: #12301F; --warn: #F5B36B; --warn-soft: #382511; --bad: #F59A92; --bad-soft: #3A1714; --info: #A9B6FF; --info-soft: #1D2550;
  --glow: radial-gradient(60% 80% at 50% 0%, #0E2B3A 0%, rgba(14,43,58,0) 70%);
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 40px rgba(0,0,0,.4); --shadow-pop: 0 24px 80px rgba(0,0,0,.6);
  --sk: linear-gradient(90deg, #172133 0%, #1E2A40 50%, #172133 100%);
  --scrim: rgba(0,0,0,.55);
  color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--f); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ---------- icons (SVG masks) ---------- */
.ic { display: inline-block; width: 20px; height: 20px; flex: none; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.ic-home  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E"); }
.ic-chat  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z'/%3E%3C/svg%3E"); }
.ic-cal   { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
.ic-user  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c1.5-4 4.5-6 8-6s6.5 2 8 6'/%3E%3C/svg%3E"); }
.ic-check { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12 3 3 5-6'/%3E%3C/svg%3E"); }
.ic-doc   { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M6 3h8l5 5v13H6z'/%3E%3Cpath d='M14 3v5h5M9 13h7M9 17h7'/%3E%3C/svg%3E"); }
.ic-tpl   { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='2'/%3E%3Cpath d='M4 9h16M9 9v11'/%3E%3C/svg%3E"); }
.ic-know  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2z'/%3E%3Cpath d='M4 21V5M8 7h7'/%3E%3C/svg%3E"); }
.ic-shield{ --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M12 3 4 6v6c0 4.5 3.4 8 8 9 4.6-1 8-4.5 8-9V6z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E"); }
.ic-send  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'/%3E%3C/svg%3E"); }
.ic-mic   { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5 11a7 7 0 0 0 14 0M12 18v3'/%3E%3C/svg%3E"); }
.ic-search{ --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E"); }
.ic-arrow { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E"); }
.ic-spark { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2l1.8 5.6L19 9.5l-5.2 1.9L12 17l-1.8-5.6L5 9.5l5.2-1.9z'/%3E%3Cpath d='M19 15l.9 2.6 2.6.9-2.6.9L19 22l-.9-2.6-2.6-.9 2.6-.9z'/%3E%3C/svg%3E"); }
.ic-alert { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6M12 16.5v.5'/%3E%3C/svg%3E"); }
.ic-folder{ --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M3 6a1 1 0 0 1 1-1h5l2 2h9a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E"); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 22px 16px 16px; padding-left: max(16px, env(safe-area-inset-left, 0px));
  border-right: 1px solid var(--line); background: var(--bg); overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--navy); padding: 0 6px; }
.logo-mark { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--navy); display: grid; place-items: center; font-weight: 800; font-size: 17px; line-height: 1; }
.logo-word { font-weight: 800; font-size: 26px; letter-spacing: -.02em; line-height: 1; }
.logo-sub { font-size: 11px; line-height: 1.15; color: var(--muted); border-left: 1px solid var(--line); padding-left: 8px; margin-left: 2px; }
.logo.small .logo-mark { width: 24px; height: 24px; border-width: 2.5px; font-size: 13px; }
.logo.small .logo-word { font-size: 20px; }
.new-wrap { position: relative; }
.btn-new { width: 100%; min-height: 44px; border: 0; border-radius: 10px; background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: 15px; cursor: pointer; box-shadow: 0 4px 14px rgba(0,96,139,.25); }
.btn-new:hover { background: var(--primary-hover); }
.menu { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; }
.menu a { padding: 10px 12px; border-radius: 8px; font-weight: 500; }
.menu a:hover { background: var(--bg-soft); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: var(--ink); font-weight: 500; }
.nav a .ic { color: var(--muted); }
.nav a:hover { background: var(--bg-soft); }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a[aria-current="page"] .ic { color: var(--primary); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { display: block; color: var(--muted); font-size: 12px; }
.badge-sample { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--warn-soft); color: var(--warn); padding: 3px 9px; border-radius: 999px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
main { outline: none; flex: 1; }
.scrim { position: fixed; inset: 0; background: rgba(8,14,28,.4); z-index: 45; }
.tabbar { display: none; }

@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: min(300px, 85vw); height: auto; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow-lg); padding-top: calc(22px + env(safe-area-inset-top, 0px)); }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line); padding: calc(10px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 10px max(12px, env(safe-area-inset-left, 0px)); }
  .topbar-title { font-weight: 600; color: var(--muted); font-size: 14px; margin-left: auto; }
  .icon-btn { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 18px; cursor: pointer; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding: 4px env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; min-height: 52px; font-size: 11px; font-weight: 600; color: var(--muted); }
  .tabbar a[aria-current="page"] { color: var(--primary); }
  main { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- page layouts ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 36px max(20px, env(safe-area-inset-right, 0px)) 48px max(20px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 22px; }
.page.wide { max-width: 1080px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; min-height: 100vh; }
.split > .page { max-width: 760px; width: 100%; }
.ai-panel { border-left: 1px solid var(--line); background: var(--bg); padding: 28px 22px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
@media (max-width: 1279px) { .split { grid-template-columns: minmax(0, 1fr); } .ai-panel { display: none; } }
@media (max-width: 899px) { .page { padding-top: 22px; } }

.hero { text-align: center; padding: 34px 0 6px; background: var(--glow); border-radius: 24px; }
.hero h1 { margin: 0; font-size: clamp(32px, 6vw, 54px); font-weight: 800; letter-spacing: -.035em; line-height: 1.05; text-wrap: balance; }
.hero p { margin: 10px 0 0; color: var(--muted); font-size: 18px; }
.h1 { margin: 0; font-size: clamp(26px, 4vw, 34px); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; text-wrap: balance; }
.h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.link { color: var(--primary); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.link .ic { width: 16px; height: 16px; }
.lead { margin: 0; color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- composer ---------- */
.composer { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 14px 14px 10px 18px; display: flex; flex-direction: column; gap: 6px; }
.composer textarea { border: 0; outline: none; resize: none; background: transparent; font: 16px/1.5 var(--f); color: var(--ink); min-height: 56px; padding: 4px 0; }
.composer textarea::placeholder { color: var(--faint); }
.composer-bar { display: flex; align-items: center; gap: 8px; }
.composer-bar .grow { flex: 1; }
.composer-hint { font-size: 12px; color: var(--faint); }
.round { width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: transparent; color: var(--muted); }
.round.send { background: var(--primary); color: var(--primary-ink); }
.round.send:disabled { opacity: .45; cursor: default; }
.round .ic { width: 18px; height: 18px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-weight: 500; font-size: 14px; cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--primary); }
.chip .ic { width: 16px; height: 16px; color: var(--primary); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip[aria-pressed="true"] .ic { color: var(--primary-ink); }

/* ---------- lists & cards ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); min-height: 64px; transition: border-color .15s, box-shadow .15s; }
a.item:hover, button.item:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); box-shadow: var(--shadow); }
button.item { width: 100%; text-align: left; cursor: pointer; font: inherit; }
.item .body { flex: 1; min-width: 0; }
.item b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.item .sub { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.item .end { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.item .end.late { color: var(--bad); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.tile .ic { width: 20px; height: 20px; }
.t-blue { background: var(--primary-soft); color: var(--primary); } .t-warn { background: var(--warn-soft); color: var(--warn); } .t-bad { background: var(--bad-soft); color: var(--bad); } .t-good { background: var(--good-soft); color: var(--good); } .t-info { background: var(--info-soft); color: var(--info); }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 14px; letter-spacing: .02em; }
.me .av { width: 34px; height: 34px; font-size: 12px; background: var(--navy); color: var(--navy-ink); }
.av-0 { background: #E8F5E9; color: #2E7D32; } .av-1 { background: #FDECEC; color: #C62828; } .av-2 { background: #E3F1F7; color: #00608B; } .av-3 { background: #FFF4E5; color: #B45309; } .av-4 { background: #F3E8FF; color: #7E22CE; } .av-5 { background: #E0F7FA; color: #00838F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .av:not(.me .av) { background: var(--bg-soft); } }
:root[data-theme="dark"] .av:not(.me .av) { background: var(--bg-soft); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.p-good { background: var(--good-soft); color: var(--good); } .p-warn { background: var(--warn-soft); color: var(--warn); } .p-bad { background: var(--bad-soft); color: var(--bad); } .p-info { background: var(--info-soft); color: var(--info); } .p-plain { background: var(--bg-soft); color: var(--muted); }
.card { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card h3 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--surface); }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.stat .k { font-size: 13px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv:first-of-type { border-top: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { text-align: right; min-width: 0; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .tile { margin: 0 auto 12px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ---------- controls ---------- */
.search { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: var(--surface); min-height: 46px; }
.search .ic { width: 18px; height: 18px; color: var(--faint); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: 16px var(--f); color: var(--ink); }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--bg-soft); border-radius: 12px; }
.seg button { flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.tabs-u { display: flex; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs-u button { border: 0; background: none; padding: 10px 0; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs-u button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.count { font-size: 12px; background: var(--bg-soft); color: var(--muted); border-radius: 999px; padding: 1px 8px; }
.btn { min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn .ic { width: 18px; height: 18px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: 16px var(--f); background: var(--surface); color: var(--ink); }
.textarea { resize: vertical; line-height: 1.5; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 20px; height: 20px; }

/* ---------- chat ---------- */
.chat-wrap { display: flex; flex-direction: column; min-height: calc(100vh - 0px); }
.chat-scroll { flex: 1; }
.msgs { display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 92%; line-height: 1.6; }
.msg.me { align-self: flex-end; background: var(--primary-soft); color: var(--ink); padding: 10px 14px; border-radius: 16px 16px 4px 16px; }
.msg.ai { align-self: flex-start; }
.msg.ai .who { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.msg.ai .who .ic { width: 14px; height: 14px; }
.msg.ai .txt { white-space: pre-wrap; }
.msg.ai .notice { background: var(--info-soft); padding: 12px 14px; border-radius: 12px; }
.ans-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.chat-dock { position: sticky; bottom: 0; padding: 12px 0 8px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
@media (max-width: 899px) { .chat-dock { bottom: calc(60px + env(safe-area-inset-bottom, 0px)); } }
.brand-ai { text-align: center; }
.brand-ai .t { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--primary); }
.brand-ai .s { color: var(--muted); font-size: 20px; }
.prompt-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.pcard { display: flex; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; text-align: left; font: inherit; font-weight: 600; box-shadow: var(--shadow); }
.pcard:hover { border-color: var(--primary); }
.output { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--surface); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.output.muted { color: var(--muted); }
.output.notice { background: var(--info-soft); border-color: transparent; color: var(--ink); white-space: normal; }
.out-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; white-space: normal; }

/* ---------- client page ---------- */
.client-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.client-head .av { width: 56px; height: 56px; font-size: 18px; }
.back { color: var(--primary); font-weight: 600; font-size: 14px; }
.hist { padding: 10px 0; border-top: 1px solid var(--line); }
.hist:first-of-type { border-top: 0; }
.hist p { margin: 4px 0 0; font-size: 14px; white-space: pre-wrap; }
.verdict { font-weight: 700; font-size: 17px; margin: 0 0 6px; }
.verdict.good { color: var(--good); } .verdict.back { color: var(--warn); } .verdict.review { color: var(--info); }

/* compliance (mounted module) */
.counts { display: flex; gap: 8px; flex-wrap: wrap; }
.counts .chip .n { font-variant-numeric: tabular-nums; margin-left: 4px; color: var(--muted); }
.case { border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: var(--surface); display: flex; flex-direction: column; gap: 12px; }
.case-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.case h2 { margin: 0; font-size: 17px; }
.meta { font-size: 13px; color: var(--muted); }
.case .pill.good { background: var(--good-soft); color: var(--good); } .case .pill.back { background: var(--warn-soft); color: var(--warn); } .case .pill.review { background: var(--info-soft); color: var(--info); }
.life { display: flex; flex-direction: column; gap: 6px; }
.steps { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.steps i { height: 6px; border-radius: 3px; background: var(--line); }
.steps i.done, .steps i.now { background: var(--primary); }
.steps i.now.flag { background: var(--warn); }
.life-label { font-size: 12px; color: var(--muted); }
.note { font-size: 15px; line-height: 1.6; display: flex; flex-direction: column; gap: 8px; }
.note p { margin: 0; } .note .ask { font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.actions .btn.primary, .case .btn.primary { background: var(--primary); }
.done-msg { font-size: 13px; color: var(--muted); background: var(--bg-soft); border-radius: 8px; padding: 10px 12px; }
.h1.compl { margin-bottom: 4px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.ai-panel .composer { margin-top: auto; }
.chips.left { justify-content: flex-start; }
.sec-head .select { width: auto; min-height: 40px; }
@media (max-width: 599px) { .sec-head { flex-wrap: wrap; } }

.logo img { display: block; width: 190px; height: auto; }
.logo.small img { width: 120px; }
.backbar { display: flex; align-items: center; gap: 8px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px 0 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; }
.back:hover { border-color: var(--primary); color: var(--primary); }
.k-item { display: flex; gap: 14px; align-items: flex-start; }
.k-item .body { flex: 1; min-width: 0; }
.k-item p { margin: 6px 0 0; font-size: 14px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.k-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--primary); background: var(--primary-soft); }
.status { font-size: 14px; }
.status.err { color: var(--bad); } .status.ok { color: var(--good); }

/* ======================= v0.4 design pass ======================= */
body { font-size: 15px; letter-spacing: -.003em; }
.ic-plus  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.ic-gear  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z'/%3E%3C/svg%3E"); }
.ic-menu  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 7h16M4 12h16M4 17h10'/%3E%3C/svg%3E"); }
.ic-chev  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E"); }
.ic-back  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 6-6 6 6 6'/%3E%3C/svg%3E"); }
.ic-ext   { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5'/%3E%3C/svg%3E"); }
.ic-plug  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 2v5M15 2v5M6 7h12v4a6 6 0 0 1-12 0zM12 17v5'/%3E%3C/svg%3E"); }
.ic-bell  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8a6 6 0 1 1 12 0c0 7 3 8 3 8H3s3-1 3-8M10 20a2 2 0 0 0 4 0'/%3E%3C/svg%3E"); }
.ic-sun   { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E"); }
.ic-building { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M4 21V4a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v17M15 9h4a1 1 0 0 1 1 1v11M3 21h18M8 7h3M8 11h3M8 15h3'/%3E%3C/svg%3E"); }
.ic-info  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v6M12 7.5v.5'/%3E%3C/svg%3E"); }
.ic-chart { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20V4M4 20h16M8 16l4-5 3 3 5-6'/%3E%3C/svg%3E"); }
.ic-lock  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E"); }

/* logo follows the theme */
.logo-d { display: none !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-l { display: none !important; } :root:not([data-theme="light"]) .logo-d { display: block !important; } }
:root[data-theme="dark"] .logo-l { display: none !important; } :root[data-theme="dark"] .logo-d { display: block !important; }
.logo img { width: 168px; }
.logo.small img { width: 112px; }

/* sidebar */
.side { background: var(--side); gap: 16px; padding: 22px 14px 14px; padding-left: max(14px, env(safe-area-inset-left, 0px)); }
.side-actions { display: flex; flex-direction: column; gap: 8px; }
.btn-new { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border-radius: 10px; font-size: 14px; box-shadow: 0 1px 2px rgba(0,96,139,.2), 0 6px 16px rgba(0,96,139,.18); transition: background .15s, transform .1s; }
.btn-new:active { transform: translateY(1px); }
.btn-new .ic { width: 16px; height: 16px; }
.menu a { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.menu a .ic { width: 16px; height: 16px; color: var(--muted); }
.search-btn { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--faint); font-size: 14px; cursor: pointer; text-align: left; }
.search-btn span { flex: 1; }
.search-btn .ic { width: 16px; height: 16px; }
.search-btn:hover { border-color: var(--line-strong); color: var(--muted); }
kbd { font: 600 11px var(--f); color: var(--muted); background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.nav { gap: 1px; }
.nav a { min-height: 38px; gap: 11px; padding: 0 10px; border-radius: 8px; font-size: 14px; color: var(--muted); font-weight: 500; transition: background .12s, color .12s; }
.nav a .ic { width: 18px; height: 18px; color: var(--faint); }
.nav a:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.nav a[aria-current="page"] .ic { color: var(--primary); }
.nav-label { margin: 14px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.side-foot { border-top: 0; padding: 0; gap: 8px; }
.me { padding: 8px; border-radius: 10px; transition: background .12s; }
.me:hover, .me[aria-current="page"] { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.me-txt { flex: 1; min-width: 0; }
.me > .ic { width: 16px; height: 16px; color: var(--faint); }
.badge-sample { margin-left: 8px; }

/* topbar on phone */
@media (max-width: 899px) {
  .topbar { gap: 10px; }
  .topbar-title { margin-left: auto; margin-right: 4px; }
  .icon-btn { display: grid; place-items: center; color: var(--ink); }
  .icon-btn .ic { width: 20px; height: 20px; }
  .tabbar a .ic { width: 22px; height: 22px; }
}

/* page rhythm & typography */
.page { gap: 20px; padding-top: 40px; }
@media (max-width: 899px) { .page { padding-top: 20px; } }
.h1 { font-size: clamp(24px, 3.4vw, 30px); letter-spacing: -.025em; }
.h2 { font-size: 17px; letter-spacing: -.01em; }
.h2.small { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); margin-bottom: 4px; }
.page-head .lead { margin-top: 6px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); }
.item { border-radius: 12px; min-height: 60px; padding: 12px 14px; }
.item b { font-size: 14.5px; }
a.item::after, button.item::after { content: ""; width: 16px; height: 16px; flex: none; background: var(--line-strong); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat; transition: transform .15s, background .15s; }
a.item:hover::after, button.item:hover::after { background: var(--primary); transform: translateX(2px); }
.ans-list a.item::after { display: none; }
.card { border-radius: 14px; padding: 18px 20px; }
.card h3 { font-size: 12px; letter-spacing: .07em; }
.stat { border-radius: 12px; }
.stat .v { font-size: 22px; }
.tile { border-radius: 10px; width: 38px; height: 38px; }
.av { width: 38px; height: 38px; font-size: 13px; }
.chip { min-height: 36px; padding: 6px 14px; font-size: 13.5px; box-shadow: none; }
.composer { border-radius: 18px; }
.btn { min-height: 40px; border-radius: 9px; font-size: 14px; transition: background .12s, border-color .12s; }
.btn:hover { border-color: var(--line-strong); }
.back { min-height: 34px; padding: 0 12px 0 6px; font-size: 13.5px; }
.back .ic { width: 16px; height: 16px; }

/* view transition + skeletons */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#view > * { animation: rise .22s ease-out both; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.sk { background: var(--sk); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 8px; }
.sk-line { height: 12px; } .sk-title { height: 26px; width: 45%; } .sk-row { height: 62px; border-radius: 12px; }
.sk-stack { display: flex; flex-direction: column; gap: 10px; }
@media (prefers-reduced-motion: reduce) { #view > *, .sk { animation: none !important; } }

/* command palette */
.palette-wrap { position: fixed; inset: 0; z-index: 80; background: var(--scrim); display: flex; justify-content: center; align-items: flex-start; padding: max(12vh, calc(16px + env(safe-area-inset-top, 0px))) max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); }
.palette { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-pop); overflow: hidden; animation: rise .16s ease-out; display: flex; flex-direction: column; max-height: min(70vh, 560px); }
.palette-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.palette-in .ic { width: 18px; height: 18px; color: var(--faint); }
.palette-in input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: 17px var(--f); color: var(--ink); min-height: 56px; }
.esc { border: 1px solid var(--line); background: var(--bg-soft); color: var(--muted); border-radius: 6px; font-size: 12px; font-weight: 600; padding: 3px 8px; cursor: pointer; }
.palette-list { overflow-y: auto; padding: 6px; }
.pal-group { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 10px 10px 4px; }
.pal-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; font: inherit; color: var(--ink); min-height: 48px; }
.pal-item .tile, .pal-item .av { width: 32px; height: 32px; font-size: 12px; border-radius: 8px; }
.pal-item .av { border-radius: 50%; }
.pal-item .tile .ic { width: 16px; height: 16px; }
.pal-item .body { flex: 1; min-width: 0; }
.pal-item b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item[aria-selected="true"] { background: var(--primary-soft); }
.pal-empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* client page */
.client-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.client-hero .av { width: 56px; height: 56px; font-size: 18px; }
.client-hero .body { flex: 1; min-width: 0; }
.client-hero .meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tabs-u { gap: 4px; scrollbar-width: none; }
.tabs-u::-webkit-scrollbar { display: none; }
.tabs-u button { padding: 10px 12px; font-size: 14px; border-radius: 8px 8px 0 0; }
.tabs-u button:hover { color: var(--ink); }
.tab-panel { display: flex; flex-direction: column; gap: 16px; }
.val-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.val-total .v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.holding { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.holding:first-of-type { border-top: 0; }
.holding .body { flex: 1; min-width: 0; }
.holding b { display: block; font-weight: 600; font-size: 14.5px; }
.holding .bar { height: 4px; border-radius: 2px; background: var(--bg-soft); margin-top: 8px; overflow: hidden; }
.holding .bar i { display: block; height: 100%; background: var(--primary); border-radius: 2px; }
.holding .amt { text-align: right; }
.holding .amt .btn { margin-top: 6px; }
.timeline { display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 14px; padding-bottom: 18px; position: relative; }
.tl::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl .dot { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--primary); background: var(--surface); margin-top: 3px; }
.tl p { margin: 4px 0 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.doc-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.doc-row:first-of-type { border-top: 0; }
.doc-row .body { flex: 1; min-width: 0; }
.doc-row b { display: block; font-weight: 600; font-size: 14.5px; }

/* settings */
.set-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.set-nav { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 1px; }
.set-nav a { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 14px; }
.set-nav a .ic { width: 17px; height: 17px; }
.set-nav a:hover { color: var(--ink); background: var(--bg-soft); }
.set-nav a[aria-current="page"] { color: var(--ink); background: var(--bg-soft); font-weight: 600; }
.set-nav a[aria-current="page"] .ic { color: var(--primary); }
.set-body { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.set-section { display: flex; flex-direction: column; gap: 4px; }
.set-section > h2 { margin: 0 0 2px; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.set-section > .lead { margin-bottom: 10px; font-size: 14px; }
.set-card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); min-height: 60px; }
.set-row:first-child { border-top: 0; }
.set-row .body { flex: 1; min-width: 0; }
.set-row b { display: block; font-weight: 600; font-size: 14.5px; }
.set-row .sub { display: block; font-size: 13px; color: var(--muted); }
.set-row .val { color: var(--muted); font-size: 14px; text-align: right; overflow-wrap: anywhere; }
.set-row.stack { flex-direction: column; align-items: stretch; }
.int-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.int { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.int-top { display: flex; align-items: center; gap: 12px; }
.int-top .body { flex: 1; min-width: 0; }
.int-top b { display: block; font-weight: 700; }
.int p { margin: 0; font-size: 13.5px; color: var(--muted); }
.int ul { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--muted); }
.logo-tile { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: -.02em; flex: none; border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.seg.inline { display: inline-flex; flex: none; }
.seg.inline button { flex: none; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; }
.plat-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 8px; align-items: center; }
.plat-row .input { min-height: 40px; font-size: 14px; padding: 8px 10px; }
.plat-head { font-size: 12px; font-weight: 600; color: var(--muted); }
@media (max-width: 899px) {
  .set-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-nav a { flex: none; border: 1px solid var(--line); border-radius: 999px; min-height: 36px; padding: 0 12px; }
  .plat-row { grid-template-columns: minmax(0, 1fr) auto; }
  .plat-row .plat-url, .plat-row .plat-match { grid-column: 1 / 2; }
  .plat-head { display: none; }
}
.grow { flex: 1; }
.m0 { margin: 0; }
a.set-row:hover { background: var(--bg-soft); }
a.set-row > .ic { width: 16px; height: 16px; color: var(--faint); }
@media (max-width: 899px) {
  .plat-row { grid-template-columns: minmax(0, 1fr); }
  .plat-row .plat-url, .plat-row .plat-match { grid-column: auto; }
  .plat-row .btn { justify-self: start; }
}
.set-row { flex-wrap: wrap; }
.set-row .body { flex: 1 1 220px; }
.set-row .val { flex: 0 1 auto; }
.int-top .body .pill { margin-top: 4px; }
.client-hero .body { flex: 1 1 260px; }
@media (max-width: 599px) {
  .client-hero { align-items: flex-start; }
  .client-hero .av { width: 48px; height: 48px; font-size: 16px; }
  .client-hero .body { flex: 1 1 0; }
  .client-hero > .btn { flex: 1 1 100%; }
  .set-row .val { flex: 1 1 100%; text-align: left; }
}

/* welcome / sign-in page */
body.welcome { min-height: 100vh; background: var(--glow), var(--bg-soft); }
.w-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  padding-block: calc(32px + env(safe-area-inset-top, 0px)) calc(24px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.w-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 40px 36px 32px; display: flex; flex-direction: column; gap: 14px; animation: rise .3s ease-out both; }
.w-logo img { width: 200px; height: auto; display: block; }
.w-card h1 { margin: 18px 0 0; font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.w-lead { margin: 0; color: var(--muted); font-size: 15.5px; }
.w-btn { margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 52px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 700; font-size: 16px; transition: transform .1s, opacity .15s; }
.w-btn:hover { opacity: .92; } .w-btn:active { transform: translateY(1px); }
.w-note { margin: 0; font-size: 13.5px; color: var(--muted); text-align: center; }
.w-points { margin: 10px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--muted); }
.w-points li { display: flex; gap: 10px; align-items: flex-start; }
.w-points li::before { content: ""; flex: none; width: 16px; height: 16px; margin-top: 2px; background: var(--primary); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat; }
.w-foot { margin: 0; font-size: 12.5px; color: var(--faint); text-align: center; }
@media (max-width: 480px) { .w-card { padding: 32px 22px 24px; border-radius: 18px; } }

/* client tabs wrap as pills on phones so every tab is visible */
@media (max-width: 599px) {
  .tabs-u.client-tabs { flex-wrap: wrap; gap: 6px; border-bottom: 0; overflow: visible; }
  .tabs-u.client-tabs button { border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 13.5px; background: var(--surface); }
  .tabs-u.client-tabs button[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
  .tabs-u.client-tabs button[aria-selected="true"] .count { background: rgba(255,255,255,.25); color: inherit; }
}
a.stat { display: block; transition: border-color .15s; }
a.stat:hover { border-color: var(--primary); }
a.stat .k::after { content: " ›"; }
.row-btns.nowrap { flex-wrap: nowrap; }
.row-btns.nowrap .select { flex: 1; min-width: 0; }
.connect { flex-direction: row; align-items: center; gap: 14px; flex-wrap: wrap; }
.connect .body { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.output .row-btns { margin-top: 10px; white-space: normal; align-items: center; }
.status.small { font-size: 13px; }
.ic-logout { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 4h3a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-3M10 17l5-5-5-5M15 12H4'/%3E%3C/svg%3E"); }
.me-row { display: flex; align-items: center; gap: 4px; }
.me-row .me { flex: 1; min-width: 0; }
.signout { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--faint); transition: background .12s, color .12s; }
.signout:hover { background: var(--bad-soft); color: var(--bad); }
.signout .ic { width: 18px; height: 18px; }
.msg { scroll-margin-top: calc(84px + env(safe-area-inset-top, 0px)); }
@media (min-width: 900px) { .msg { scroll-margin-top: 24px; } }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap button { flex: 1 1 140px; padding: 0 10px; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
/* recorder */
.rec { gap: 12px; }
.rec-ui { display: flex; flex-direction: column; gap: 12px; }
.rec-btn { min-height: 52px; font-size: 16px; gap: 10px; border-color: var(--bad); color: var(--bad); }
.rec-btn:disabled { opacity: .45; cursor: default; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); flex: none; }
.rec-live { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rec-live .rec-dot { animation: pulse 1.2s ease-in-out infinite; }
.rec-live.paused .rec-dot { animation: none; background: var(--faint); }
.rec-time { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
@keyframes pulse { 50% { opacity: .25; } }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.rec-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); }
.rec-left span { flex: 1 1 200px; }
@media (prefers-reduced-motion: reduce) { .rec-live .rec-dot, .spinner { animation: none; } }
.capture { background: var(--bg-soft); border-color: transparent; }
.capture .seg { background: var(--line); }
.capture .rec-btn { flex: 1 1 200px; }
/* tasks */
.task { display: flex; flex-direction: column; gap: 0; }
.task-row { gap: 12px; }
.task-row .task-open { flex: 1; min-width: 0; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.task-row.done b { text-decoration: line-through; color: var(--muted); }
.tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; color: transparent; }
.tick .ic { width: 18px; height: 18px; }
.tick:hover { border-color: var(--good); color: var(--good); }
.tick.on { background: var(--good); border-color: var(--good); color: #fff; }
.task-edit { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; margin: -6px 0 0; padding: 16px; background: var(--bg-soft); display: flex; flex-direction: column; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.task-new { gap: 10px; }

/* Cases */
.case-card { display: grid; gap: 6px; }
.case-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.case-sum { margin: 0; overflow-wrap: anywhere; }
.lc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 4px; }
.lc i { height: 6px; border-radius: 3px; background: var(--line); }
.lc i.done { background: var(--primary); }
.lc i.now.wait { background: var(--warn); } .lc i.now.good { background: var(--good); } .lc i.now.bad { background: var(--bad); } .lc i.now.muted { background: var(--muted); }
.output.notice .warn-line { color: var(--warn); margin: 6px 0 0; }
.output.notice p { margin: 0; }

/* Agency list answer */
.ans-list .ag-group { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface); display: grid; gap: 10px; }
.ag-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ag-head b { font-size: 14px; color: var(--ink); }
.ag-count { font-size: 12px; font-weight: 600; color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 2px 9px; }
.ag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ag-chip { font-size: 13px; line-height: 1.3; padding: 5px 10px; border-radius: 8px; background: var(--bg-soft); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; }
