/* Sender panel styles. GENERATED by web/build_bundle.py from web/css/*.css: edit the sources, then run the script. */
/* css/base.css */
/* Sender panel - design tokens, reset, type scale. 8 px grid. Light + dark via CSS variables. */
:root {
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --t-xs: 12px; --t-sm: 14px; --t-md: 16px; --t-lg: 18px; --t-xl: 22px; --t-2xl: 28px; --t-3xl: 36px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: light;
  --bg: #f4f5f8; --surface: #ffffff; --surface-2: #eff1f5; --border: #e1e4ea; --border-strong: #c6ccd6;
  --text: #11151b; --muted: #556070;
  --accent: #3355d6; --accent-soft: #e7ebfc; --on-accent: #ffffff;
  --good: #11693a; --good-soft: #dff3e7;
  --warn: #8a4f00; --warn-soft: #ffefcf;
  --bad: #b3202a; --bad-soft: #fde5e6;
  --push: #7439bd; --push-soft: #efe5fb;
  --shadow: 0 1px 2px rgba(17, 21, 27, .06), 0 2px 8px rgba(17, 21, 27, .05);
  --backdrop: rgba(17, 21, 27, .5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c0f14; --surface: #151a21; --surface-2: #1c222b; --border: #262d38; --border-strong: #3a4352;
    --text: #edf0f5; --muted: #9ba6b6;
    --accent: #8ca6ff; --accent-soft: #1d2748; --on-accent: #0c0f14;
    --good: #5ed78d; --good-soft: #112e1e;
    --warn: #f3b84b; --warn-soft: #342a10;
    --bad: #ff8a8f; --bad-soft: #3b1719;
    --push: #c8a0ff; --push-soft: #2a1d44;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --backdrop: rgba(0, 0, 0, .65);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0f14; --surface: #151a21; --surface-2: #1c222b; --border: #262d38; --border-strong: #3a4352;
  --text: #edf0f5; --muted: #9ba6b6;
  --accent: #8ca6ff; --accent-soft: #1d2748; --on-accent: #0c0f14;
  --good: #5ed78d; --good-soft: #112e1e;
  --warn: #f3b84b; --warn-soft: #342a10;
  --bad: #ff8a8f; --bad-soft: #3b1719;
  --push: #c8a0ff; --push-soft: #2a1d44;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --backdrop: rgba(0, 0, 0, .65);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--t-md)/1.5 var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100vh; min-height: 100dvh;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: var(--t-2xl); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: var(--t-lg); line-height: 1.3; font-weight: 650; }
h3 { font-size: var(--t-md); line-height: 1.35; font-weight: 650; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
svg { display: block; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .92em; }
.small { font-size: var(--t-sm); }
.xs { font-size: var(--t-xs); }
.strong { font-weight: 650; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--s2); top: -48px; z-index: 100; background: var(--accent); color: var(--on-accent);
  padding: var(--s2) var(--s4); border-radius: var(--r-sm); transition: top .15s;
}
.skip:focus { top: var(--s2); }
.tone-good { color: var(--good); }
.tone-warn { color: var(--warn); }
.tone-bad { color: var(--bad); }
.tone-accent { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
/* css/layout.css */
/* App shell: top bar, bottom tabs (phone), side nav (768+), banners, page container */
.app { min-height: 100vh; min-height: 100dvh; }
.col { min-width: 0; }

.top {
  position: sticky; top: 0; z-index: 30; background: var(--bg);
  border-bottom: 1px solid var(--border);
}
@supports (backdrop-filter: blur(8px)) {
  .top { background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); }
}
.top-bar {
  display: flex; align-items: center; gap: var(--s2); min-height: 56px; padding: 0 var(--s4);
  padding-top: env(safe-area-inset-top);
}
.top-title { font-size: var(--t-md); font-weight: 650; margin-right: auto; display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.brand-mark { width: 28px; height: 28px; flex: none; color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: var(--s1); }

.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%;
  background: transparent; border: 0; color: var(--text); text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 var(--s3);
  border-radius: 999px; font-size: var(--t-xs); font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.banner {
  display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) var(--s4);
  font-size: var(--t-sm); font-weight: 550; line-height: 1.4; border-top: 1px solid transparent;
}
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.banner.bad { background: var(--bad); color: #fff; }
.banner.accent { background: var(--accent-soft); color: var(--accent); }
:root[data-theme="dark"] .banner.bad { color: #1a0a0b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .banner.bad { color: #1a0a0b; } }

main { padding: var(--s4) var(--s4) calc(96px + env(safe-area-inset-bottom)); max-width: 1160px; margin: 0 auto; outline: none; }

/* ---- bottom tab bar (phones) ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px;
  color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; position: relative;
}
.tab svg { width: 24px; height: 24px; }
.tab:hover { text-decoration: none; color: var(--text); }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
}

/* ---- side nav (768+) ---- */
.side { display: none; }
.side-brand { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3) var(--s5); font-size: var(--t-lg); font-weight: 700; }
.side nav { display: flex; flex-direction: column; gap: var(--s1); }
.side-link {
  display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: 0 var(--s3); border-radius: var(--r-sm);
  color: var(--muted); font-weight: 600; font-size: var(--t-sm); text-decoration: none;
}
.side-link svg { width: 20px; height: 20px; flex: none; }
.side-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.side-foot { margin-top: auto; padding: var(--s3); font-size: var(--t-xs); color: var(--muted); }

@media (min-width: 768px) {
  .app { display: grid; grid-template-columns: 216px minmax(0, 1fr); }
  .side {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh;
    padding: var(--s5) var(--s3) var(--s4); border-right: 1px solid var(--border); background: var(--surface);
  }
  .tabbar, .only-phone { display: none !important; }
  .top-bar { padding: 0 var(--s5); }
  .top-title { display: none; }
  .top-actions { margin-left: auto; }
  main { padding: var(--s5) var(--s5) var(--s7); }
  .banner { padding: var(--s3) var(--s5); }
}
@media (min-width: 1100px) {
  .app { grid-template-columns: 248px minmax(0, 1fr); }
  main { padding: var(--s6) var(--s6) var(--s7); }
}
@media (max-width: 767px) { .only-wide { display: none !important; } }

/* ---- toasts ---- */
#toasts {
  position: fixed; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: var(--s2); pointer-events: none; padding: 0 var(--s4);
}
@media (min-width: 768px) { #toasts { bottom: var(--s5); } }
.toast {
  pointer-events: auto; background: var(--text); color: var(--bg); padding: var(--s3) var(--s4); border-radius: var(--r);
  font-size: var(--t-sm); font-weight: 550; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); max-width: 480px;
  animation: toast-in .2s var(--ease);
}
.toast.bad { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
/* css/components.css */
/* Reusable components */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3) var(--s4); margin-bottom: var(--s4); }
.page-head p { color: var(--muted); font-size: var(--t-sm); margin-top: var(--s1); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.section { margin-top: var(--s5); }
.section > .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.section-head .hint { color: var(--muted); font-size: var(--t-sm); }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); }
.grid { display: grid; gap: var(--s3); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s4);
  box-shadow: var(--shadow); min-width: 0;
}
.card.flat { box-shadow: none; }
.card.pad0 { padding: 0; overflow: hidden; }

/* ---- chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 2px 10px; border-radius: 999px;
  font-size: var(--t-xs); font-weight: 600; line-height: 1.3; background: var(--surface-2); color: var(--muted); max-width: 100%;
}
.chip svg { width: 14px; height: 14px; flex: none; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.push { background: var(--push-soft); color: var(--push); }
.chip.plain { background: var(--surface-2); color: var(--text); font-weight: 550; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s1) 6px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s4);
  border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: var(--t-sm); text-decoration: none; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
:root[data-theme="dark"] .btn.danger { color: #1a0a0b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.danger { color: #1a0a0b; } }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.sm { min-height: 36px; padding: 0 var(--s3); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---- fields ---- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label:not(.check), .label { font-size: var(--t-xs); font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.input, .select {
  width: 100%; min-height: 44px; padding: 0 var(--s3); border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: var(--t-md);
}
.select { appearance: none; padding-right: 36px; background-repeat: no-repeat; background-position: right 12px center; background-size: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23788596' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.input::placeholder { color: var(--muted); opacity: .8; }
.input:focus-visible, .select:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; }
.search { position: relative; flex: 1 1 240px; min-width: 0; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 40px; }
.help { font-size: var(--t-xs); color: var(--muted); }

/* ---- segmented control ---- */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 10px; max-width: 100%; }
.seg button {
  flex: 1; min-height: 40px; padding: 0 var(--s4); border: 0; background: transparent; border-radius: 8px; color: var(--muted);
  font-weight: 600; font-size: var(--t-sm); white-space: nowrap; transition: background .15s, color .15s;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.seg.block { display: flex; width: 100%; }
.seg.sm button { min-height: 32px; padding: 0 var(--s3); }

/* ---- switch ---- */
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 48px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 48px; height: 28px; border-radius: 999px; background: var(--border-strong); position: relative; flex: none; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--accent); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: var(--s2); min-height: 44px; font-size: var(--t-sm); font-weight: 550; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---- skeleton / empty / error ---- */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-card { height: 132px; border-radius: var(--r-lg); }
.skel-line { height: 14px; margin: 8px 0; }
.empty { text-align: center; padding: var(--s6) var(--s4); display: flex; flex-direction: column; align-items: center; gap: var(--s3); }
.empty .art { width: 72px; height: 72px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.empty .art svg { width: 36px; height: 36px; }
.empty h2 { font-size: var(--t-xl); }
.empty p { color: var(--muted); max-width: 460px; margin: 0 auto; }
.empty.err .art { background: var(--bad-soft); color: var(--bad); }
.empty ul { text-align: left; color: var(--muted); font-size: var(--t-sm); display: grid; gap: var(--s1); }
.token-form { display: flex; gap: var(--s2); width: 100%; max-width: 420px; flex-wrap: wrap; }
.token-form .input { flex: 1 1 200px; }

/* ---- change chip ---- */
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: var(--t-xs); font-weight: 700; padding: 2px 8px 2px 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.delta svg { width: 12px; height: 12px; }
.delta.good { background: var(--good-soft); color: var(--good); }
.delta.bad { background: var(--bad-soft); color: var(--bad); }

/* ---- responsive table: table on wide screens, cards on phones ---- */
.rtable { width: 100%; font-size: var(--t-sm); }
.rtable th { text-align: left; font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.rtable td { padding: var(--s3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.rtable tr:last-child td { border-bottom: 0; }
.rtable .r { text-align: right; }
@media (max-width: 767px) {
  .rtable thead { display: none; }
  .rtable, .rtable tbody { display: block; }
  .rtable tr { display: block; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
  .rtable tr:last-child { border-bottom: 0; }
  .rtable td { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: 3px 0; border: 0; text-align: right; min-height: 28px; }
  .rtable td::before { content: attr(data-label); color: var(--muted); font-size: var(--t-xs); font-weight: 600; flex: none; text-align: left; }
  .rtable td.title { font-weight: 650; font-size: var(--t-md); text-align: left; justify-content: flex-start; padding-bottom: var(--s2); }
  .rtable td.title::before { display: none; }
  .rtable td.nolabel::before { display: none; }
  .rtable td.nolabel { justify-content: flex-start; text-align: left; }
  /* grid: number-heavy tables become 2 or 3 column cards (label above value) */
  .rtable.rt-cards tr { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: var(--s2) var(--s3); }
  .rtable.rt-cards td { flex-direction: column; align-items: flex-start; justify-content: flex-start; text-align: left; gap: 2px; padding: 0; }
  .rtable.rt-cards td.title { grid-column: 1 / -1; flex-direction: row; align-items: center; padding-bottom: 0; }
}

/* ---- bars (svg) ---- */
.hbar { width: 100%; height: 8px; }
.hbar .track { fill: var(--surface-2); }
.hbar .fill { fill: var(--accent); }
.hbar.good .fill { fill: var(--good); }
.hbar.warn .fill { fill: var(--warn); }
.hbar.bad .fill { fill: var(--bad); }
.hbar.push .fill { fill: var(--push); }
.hbar .tick { stroke: var(--text); stroke-width: 1.5; opacity: .5; }

/* ---- dialog ---- */
dialog.dlg { border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--text); padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 24px 64px rgba(0, 0, 0, .35); }
dialog.dlg::backdrop { background: var(--backdrop); }
dialog.dlg[open] { animation: dlg-in .18s var(--ease); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.dlg-body { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); }
.dlg-body h2 { font-size: var(--t-xl); display: flex; align-items: center; gap: var(--s2); }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); padding: 0 var(--s5) var(--s5); }
.dlg-warn { background: var(--bad-soft); color: var(--bad); border-radius: var(--r-sm); padding: var(--s3); font-weight: 650; }

details.fold > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; font-size: var(--t-sm); color: var(--accent); list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "+"; display: inline-block; width: 20px; font-weight: 700; }
details.fold[open] > summary::before { content: "-"; }

.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: var(--s3) var(--s4); }
.kv dt { font-size: var(--t-xs); color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.kv dd { margin: 2px 0 0; font-weight: 550; overflow-wrap: anywhere; }

/* ---- chart bits ---- */
.spark { width: 100%; height: 36px; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .area { fill: var(--accent); opacity: .12; }
.spark .flat { stroke: var(--border-strong); stroke-width: 2; stroke-dasharray: 3 4; }
.pal0 { fill: var(--accent); background: var(--accent); }
.pal1 { fill: var(--push); background: var(--push); }
.pal2 { fill: var(--good); background: var(--good); }
.pal3 { fill: var(--warn); background: var(--warn); }
.pal4 { fill: var(--muted); background: var(--muted); }
.vstack rect { stroke: var(--surface); stroke-width: 2; }
.dlg-body h2 svg { width: 26px; height: 26px; flex: none; color: var(--bad); }
/* css/screens.css */
/* Screen-specific layout: Today, Users, User story, Funnels, Agent, System, Settings */

/* ---- Today ---- */
.health { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.health .chip { min-height: 28px; padding: 3px 10px; font-size: 13px; }
@media (min-width: 768px) { .health .chip { min-height: 32px; padding: 4px 12px; font-size: var(--t-sm); } }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.metrics > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.metric { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4); }
.metric .m-label { font-size: var(--t-xs); font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.metric .m-value { font-size: var(--t-2xl); font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.metric .m-spark { margin-top: auto; height: 36px; }
.metric .m-spark svg { width: 100%; height: 36px; }
@media (min-width: 768px) { .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } .metrics > :last-child:nth-child(odd) { grid-column: auto; } }
@media (min-width: 1100px) { .metric .m-value { font-size: var(--t-3xl); } }
@media (min-width: 1500px) { .metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.metric .m-sub { font-size: var(--t-xs); color: var(--muted); line-height: 1.3; }
.metric .m-sub:empty { display: none; }

.trend-readout { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); margin-bottom: var(--s3); flex-wrap: wrap; }
.trend-readout .big { font-size: var(--t-xl); font-weight: 700; }
.bars-svg { width: 100%; height: 150px; touch-action: manipulation; }
.bars-svg .bar { fill: var(--accent); opacity: .35; cursor: pointer; transition: opacity .15s; }
.bars-svg .bar.sel { opacity: 1; }
.bars-svg .grid-line { stroke: var(--border); stroke-width: 1; }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--t-xs); margin-top: var(--s1); }

.changes { display: grid; gap: var(--s2); grid-template-columns: 1fr; }
@media (min-width: 768px) { .changes { grid-template-columns: 1fr 1fr; } }
.change { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); }
.change .ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); }
.change .ico svg { width: 18px; height: 18px; }
.change.up .ico { background: var(--good-soft); color: var(--good); }
.change.down .ico, .change.warn .ico { background: var(--warn-soft); color: var(--warn); }
.change.down .ico { background: var(--bad-soft); color: var(--bad); }
.change.info .ico { background: var(--accent-soft); color: var(--accent); }
.change p { font-size: var(--t-sm); line-height: 1.45; padding-top: 5px; }

.two { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.share-cell { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); }
.vstack { width: 100%; height: 20px; border-radius: 10px; overflow: hidden; }
.legend { display: grid; gap: var(--s2); margin-top: var(--s3); }
.legend-row { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-sm); }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }

/* ---- Users ---- */
.filters { display: grid; gap: var(--s2); grid-template-columns: 1fr 1fr; margin-bottom: var(--s3); }
.filters .checks { display: flex; flex-direction: column; justify-content: flex-end; }
@media (min-width: 768px) { .filters { grid-template-columns: repeat(3, 1fr) auto; align-items: end; } .filters .checks { flex-direction: row; gap: var(--s4); } }
.ulist { display: flex; flex-direction: column; }
.uhead { display: none; }
.urow {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "id seen" "dev dev" "ints ints" "push push"; gap: var(--s1) var(--s3);
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; min-height: 64px; align-items: center;
}
.urow:last-child { border-bottom: 0; }
.urow:hover { background: var(--surface-2); text-decoration: none; }
.urow .c-id { grid-area: id; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.urow .c-seen { grid-area: seen; text-align: right; color: var(--muted); font-size: var(--t-sm); }
.urow .c-dev { grid-area: dev; font-size: var(--t-sm); color: var(--muted); }
.urow .c-ints { grid-area: ints; }
.urow .c-push { grid-area: push; font-size: var(--t-sm); color: var(--muted); }
.urow .c-ver, .urow .c-lang, .urow .c-cc2 { display: none; }
.cc-badge { font-weight: 700; font-size: var(--t-xs); padding: 2px 8px; border-radius: 6px; background: var(--surface-2); letter-spacing: .04em; }
@media (min-width: 768px) {
  .uhead, .urow {
    display: grid; grid-template-areas: none; grid-template-columns: 104px 44px 44px minmax(120px, 1.2fr) 64px 100px minmax(140px, 1.6fr) 132px; gap: var(--s3); align-items: center;
  }
  .uhead { padding: var(--s2) var(--s4); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; color: var(--muted); border-bottom: 1px solid var(--border); }
  .urow .c-id, .urow .c-seen, .urow .c-dev, .urow .c-ints, .urow .c-push { grid-area: auto; }
  .urow .c-seen { text-align: left; }
  .urow .c-ver, .urow .c-lang, .urow .c-cc2 { display: block; font-size: var(--t-sm); }
  .urow .c-cc-inline { display: none; }
}
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) 0; flex-wrap: wrap; }

/* ---- User story ---- */
.back { display: inline-flex; align-items: center; gap: var(--s1); min-height: 44px; font-weight: 600; font-size: var(--t-sm); margin-bottom: var(--s2); }
.back svg { width: 18px; height: 18px; }
.story-head { display: flex; gap: var(--s4); align-items: flex-start; }
.avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: var(--t-lg); background: var(--accent-soft); color: var(--accent); font-family: var(--mono); }
.summary { font-size: var(--t-lg); line-height: 1.45; font-weight: 500; margin-top: var(--s2); }
.ibar { display: grid; grid-template-columns: 112px 1fr 44px; align-items: center; gap: var(--s3); font-size: var(--t-sm); min-height: 32px; }
.ibar .hbar { height: 10px; }
.tl-session { margin-top: var(--s4); }
.tl-head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; font-weight: 650; margin-bottom: var(--s3); }
.tl { margin-left: 7px; padding-left: 24px; border-left: 2px solid var(--border); }
.ev { position: relative; padding-bottom: var(--s3); --dot: var(--muted); }
.ev::before { content: ""; position: absolute; left: -32px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--dot); border: 2px solid var(--surface); }
.ev[data-k="ui"] { --dot: var(--accent); }
.ev[data-k="dl"] { --dot: var(--good); }
.ev[data-k="fail"] { --dot: var(--bad); }
.ev[data-k="push"] { --dot: var(--push); }
.ev[data-k="ad"] { --dot: var(--warn); }
.ev[data-k="start"] { --dot: var(--text); }
.ev-top { display: flex; gap: var(--s2); align-items: baseline; flex-wrap: wrap; }
.ev-time { font-size: var(--t-xs); color: var(--muted); min-width: 56px; }
.ev-label { font-weight: 600; font-size: var(--t-sm); }
.ev-detail { font-size: var(--t-sm); color: var(--muted); overflow-wrap: anywhere; margin-left: 64px; }
.ev-n { font-size: var(--t-xs); font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tl-tools { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); }
.ev-raw { font-size: 11px; color: var(--muted); opacity: .8; font-family: var(--mono); }
@media (max-width: 480px) { .ev-detail { margin-left: 0; } .ibar { grid-template-columns: 96px 1fr 40px; } }
.tick-ok { color: var(--good); display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: var(--t-xs); }
.tick-no { color: var(--muted); display: inline-flex; align-items: center; gap: 2px; font-size: var(--t-xs); }
.tick-ok svg, .tick-no svg { width: 14px; height: 14px; }
.tick-bad { color: var(--bad); display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: var(--t-xs); }
.tick-bad svg { width: 14px; height: 14px; }

/* ---- Funnels ---- */
.fsteps { display: flex; flex-direction: column; }
.fstep { padding: var(--s3) 0; }
.fstep-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); margin-bottom: 6px; flex-wrap: wrap; }
.fstep-top .lbl { font-weight: 600; }
.fstep-top .users { font-weight: 700; font-size: var(--t-lg); }
.fbar { width: 100%; height: 28px; }
.fbar .track { fill: var(--surface-2); }
.fbar .fill { fill: var(--accent); }
.fbar .fill.worst { fill: var(--bad); }
.fmeta { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: var(--t-sm); color: var(--muted); margin-top: 6px; }
.fdrop { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-sm); color: var(--muted); padding: 2px 0 2px var(--s3); border-left: 2px dashed var(--border-strong); margin-left: var(--s2); }
.fdrop.worst { color: var(--bad); font-weight: 650; border-left-color: var(--bad); }
.fdrop svg { width: 16px; height: 16px; }

/* ---- Agent ---- */
.mode-seg button { display: flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 48px; font-size: var(--t-md); }
.mode-seg svg { width: 18px; height: 18px; }
.mode-seg button.live[aria-pressed="true"] { background: var(--bad-soft); color: var(--bad); box-shadow: inset 0 0 0 2px var(--bad); }
.mode-desc { margin-top: var(--s3); color: var(--muted); font-size: var(--t-sm); min-height: 22px; }
.mode-desc.live { color: var(--bad); font-weight: 600; }
.rollout { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.rollout input[type=range] { flex: 1 1 200px; min-width: 160px; accent-color: var(--accent); height: 32px; }
.rollout .pct { font-size: var(--t-xl); font-weight: 700; min-width: 64px; text-align: right; }
.livebar { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad); border-radius: var(--r); padding: var(--s3) var(--s4); font-weight: 650; display: flex; gap: var(--s2); align-items: center; margin-bottom: var(--s3); }
.livebar svg { width: 20px; height: 20px; flex: none; }
.stat3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.stat { padding: var(--s3) var(--s4); }
.stat .v { font-size: var(--t-2xl); font-weight: 700; line-height: 1.15; }
.stat .l { font-size: var(--t-xs); color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.reasons { display: grid; gap: var(--s2); margin-top: var(--s3); }
.reason { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr 36px; gap: var(--s3); align-items: center; font-size: var(--t-sm); }
.alerts { display: grid; gap: var(--s2); }
.alert { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); border-left-width: 4px; font-size: var(--t-sm); }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert.info { border-left-color: var(--accent); } .alert.info svg { color: var(--accent); }
.alert.warn { border-left-color: var(--warn); } .alert.warn svg { color: var(--warn); }
.alert.bad { border-left-color: var(--bad); } .alert.bad svg { color: var(--bad); }
.mult { display: flex; align-items: center; gap: var(--s2); min-width: 110px; }
.mult .hbar { width: 64px; flex: none; }
.dec { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
.dec:last-child { border-bottom: 0; }
.dec-top { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); font-size: var(--t-sm); }
.dec-top .when { color: var(--muted); font-size: var(--t-xs); margin-left: auto; }
.review p + p { margin-top: var(--s3); }
.review p { line-height: 1.6; max-width: 72ch; }
.slots { display: flex; flex-wrap: wrap; gap: var(--s2); }
.slot { padding: var(--s2) var(--s3); background: var(--surface-2); border-radius: var(--r-sm); font-size: var(--t-sm); display: flex; gap: var(--s2); align-items: baseline; }

/* ---- System / Settings ---- */
.sys-grid { display: grid; gap: var(--s3); grid-template-columns: 1fr; }
@media (min-width: 768px) { .sys-grid { grid-template-columns: 1fr 1fr; } }
.facts { display: grid; gap: var(--s2); font-size: var(--t-sm); }
.facts div { display: flex; justify-content: space-between; gap: var(--s3); border-bottom: 1px solid var(--border); padding-bottom: var(--s2); }
.facts div:last-child { border-bottom: 0; padding-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.settings { display: grid; gap: var(--s4); max-width: 640px; }
.set-group { display: grid; gap: var(--s3); }
