/* sw-ai console - design system v3.
   Colour tokens, shadow scale, radii and the striped page background follow Beautiful UI
   (https://www.beautifului.dev, github.com/slev12397/beautiful-ui), MIT License, Copyright (c) 2026 Shane Levine.
   Recreated here in plain CSS; no code or packages from that project are used. */

:root {
  --page: oklch(98.5% .001 286.376);
  --canvas: oklch(96.1% .002 247.84);
  --surface: oklch(100% 0 0);
  --inset: oklch(97.9% .002 247.839);
  --hover: oklch(97% .002 247.839);
  --hover-2: oklch(93.3% .003 247.86);
  --ink: oklch(24.7% .006 258.361);
  --ink-2: oklch(50.6% .01 264.477);
  --ink-3: oklch(69.5% .009 264.505);
  --line: oklch(94.6% .003 264.542);
  --line-strong: oklch(91.2% .005 258.326);
  --line-soft: oklch(96.6% .002 264.542);
  --field: oklch(96.1% .001 286.375);
  --stripe: oklch(40.5% 0 0 / .075);
  --stripe-bg: oklch(97% 0 0);
  --accent: oklch(62.6% .205 254.947);
  --accent-ink: oklch(55.6% .187 255.617);
  --accent-tint: oklch(96% .019 252.878);
  --green: oklch(60.3% .155 150.883);
  --green-tint: oklch(95.8% .017 159.118);
  --orange: oklch(68.9% .179 49.902);
  --orange-tint: oklch(96.4% .021 67.581);
  --red: oklch(62.1% .192 23.042);
  --red-tint: oklch(95.6% .017 17.462);
  --shadow-xs: 0 0 4px 0 #0000000a;
  --shadow-sm: 0 18px 47px 0 #00000008, 0 7.5px 19px 0 #00000005, 0 4px 10.5px 0 #00000005, 0 2.3px 5.8px 0 #00000003, 0 1.2px 3.1px 0 #00000003, 0 .5px 1.3px 0 #00000003;
  --shadow-md: 0 17.54px 23.39px 0 #0000000a, 0 9.4px 12.5px 0 #00000008, 0 5.25px 7px 0 #00000005, 0 2.79px 3.72px -2px #00000003, 0 1.16px 1.5px 0 #00000003;
  --shadow-lg: 0 25px 50px 0 #0000000d, 0 12px 24px 0 #0000000a, 0 6px 12px 0 #00000008, 0 3px 6px 0 #00000005, 0 1.5px 3px 0 #00000005;
  --shadow-hairline: 0 0 0 1px var(--line);
  --shadow-btn: 0 0 0 1px var(--line-strong), var(--shadow-xs);
  --shadow-card: 0 0 0 1px var(--line), var(--shadow-sm);
  --shadow-raised: 0 0 0 1px var(--line), var(--shadow-md);
  --shadow-overlay: 0 0 0 1px var(--line), var(--shadow-lg);
  --shadow-inset-field: inset 0 1px 2px oklch(0% 0 0 / .12);
  --r-chip: 6px; --r-control: 8px; --r-card: 10px; --r-window: 14px;
  --ease: cubic-bezier(.23, 1, .32, 1);
  --sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --page: oklch(20.9% .004 264.477); --canvas: oklch(23.1% .004 264.487); --surface: oklch(26% .006 271.191);
  --inset: oklch(24.3% .004 264.492); --hover: oklch(28.9% .006 271.22); --hover-2: oklch(31.8% .007 274.747);
  --ink: oklch(96.4% .002 247.839); --ink-2: oklch(73.1% .008 260.731); --ink-3: oklch(54.1% .01 264.484);
  --line: oklch(30.8% .006 258.354); --line-strong: oklch(35.6% .007 264.474); --line-soft: oklch(27.8% .006 258.354);
  --field: oklch(29.3% .006 271.223); --stripe: oklch(100% 0 0 / .055); --stripe-bg: oklch(22.6% .004 264.485);
  --accent: oklch(68% .173 253.301); --accent-ink: oklch(78.8% .113 248.33); --accent-tint: oklch(68% .173 253.301 / .16);
  --green: oklch(70.5% .154 153.814); --green-tint: oklch(70.5% .154 153.814 / .14);
  --orange: oklch(74.6% .156 55.642); --orange-tint: oklch(74.6% .156 55.642 / .14);
  --red: oklch(66.6% .18 21.433); --red-tint: oklch(66.6% .18 21.433 / .14);
  --shadow-btn: 0 0 0 1px oklch(100% 0 0 / .1), 0 1px 2px oklch(0% 0 0 / .3);
  --shadow-card: 0 0 0 1px oklch(100% 0 0 / .11), 0 1px 2px oklch(0% 0 0 / .2), 0 2px 6px oklch(0% 0 0 / .2);
  --shadow-raised: 0 0 0 1px oklch(100% 0 0 / .13), 0 2px 10px oklch(0% 0 0 / .22);
  --shadow-overlay: 0 0 0 1px oklch(100% 0 0 / .15), 0 8px 28px oklch(0% 0 0 / .34);
  --shadow-inset-field: inset 0 1px 2px oklch(0% 0 0 / .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
body {
  background-color: var(--stripe-bg);
  background-image: repeating-linear-gradient(-45deg, transparent 0, transparent 7px, var(--stripe) 7px, var(--stripe) 8px);
  background-attachment: fixed;
  color: var(--ink); font: 400 14px/1.5 var(--sans); letter-spacing: -.01em; font-feature-settings: "cv11", "ss01";
}
::selection { background: var(--accent-tint); color: var(--ink); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg.i { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
input, textarea, select, button { font: inherit; color: var(--ink); letter-spacing: inherit; }

/* --- app frame: one page column on the striped background ------------------------------------------------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; max-width: 1480px; margin: 0 auto;
  background: var(--page); box-shadow: 1px 0 0 var(--line), -1px 0 0 var(--line); }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 14px 10px; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 10px; margin-bottom: 14px; color: var(--ink); text-decoration: none;
  font: 600 14.5px var(--mono); letter-spacing: -.02em; border-radius: var(--r-control); }
.brand:hover { background: var(--hover-2); }
.brand b { color: var(--accent); }
.mark { width: 20px; height: 20px; flex: none; position: relative; background: url("/static/favicon.svg") center / contain no-repeat; }
.mark::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 2px var(--page, var(--surface)); }
.mark.ok::after { background: var(--green); } .mark.crit::after { background: var(--red); }
.nav-label { padding: 12px 10px 6px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 10px; border-radius: var(--r-control); text-decoration: none;
  color: var(--ink-2); font-size: 14px; font-weight: 500; transition: background-color .15s ease, color .15s ease; }
.nav a svg.i { color: var(--ink-3); }
.nav a:hover { background: var(--hover-2); color: var(--ink); }
.nav a[aria-current] { background: var(--hover-2); color: var(--ink); }
.nav a[aria-current] svg.i { color: var(--ink); }
.nav .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--orange-tint); color: var(--orange);
  font: 600 11.5px/20px var(--sans); text-align: center; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.side-row { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); padding: 0 6px; }
.side-foot form { margin: 0; margin-left: auto; }
.side-foot .quiet { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 99px; background: none;
  color: var(--ink-2); font-size: 13px; font-weight: 500; cursor: pointer; }
.side-foot .quiet:hover { background: var(--hover-2); color: var(--ink); }
.theme { display: inline-flex; gap: 2px; padding: 2px; border-radius: 99px; background: color-mix(in srgb, var(--line) 60%, transparent); }
.theme button { width: 28px; height: 26px; border: 0; border-radius: 99px; background: none; color: var(--ink-3); display: grid; place-items: center; cursor: pointer; }
.theme button svg.i { width: 15px; height: 15px; }
.theme button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-hairline); }

.main { min-width: 0; display: flex; flex-direction: column; }
.page-top { display: flex; align-items: flex-end; gap: 16px; padding: 28px 32px 20px; flex-wrap: wrap; border-bottom: 1px dashed var(--line); }
.page-top h1 { font: 600 22px/1.25 var(--sans); letter-spacing: -.025em; margin: 0; }
.page-top .sub { color: var(--ink-3); font-size: 13.5px; margin-top: 3px; }
.page-top .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.content { padding: 24px 32px 48px; width: 100%; max-width: 1240px; }
.content.narrow { max-width: 920px; }

/* --- primitives -------------------------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 15px; border-radius: 99px;
  border: 0; background: var(--accent); color: #fff; font-size: 13.5px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14); transition: transform .15s ease, background-color .15s ease, opacity .15s ease; }
.btn:hover { background: var(--accent-ink); }
.btn:active { transform: scale(.96); }
.btn.ink { background: var(--ink); color: var(--canvas); }
.btn.ink:hover { opacity: .9; background: var(--ink); }
.btn.secondary { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-btn); }
.btn.secondary:hover { background: var(--inset); }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: none; }
.btn.ghost:hover { background: var(--hover-2); color: var(--ink); }
.btn.danger { background: var(--surface); color: var(--red); box-shadow: var(--shadow-btn); }
.btn.danger:hover { background: var(--red-tint); }
.btn.success { background: var(--green); }
.btn.sm { height: 27px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn.sm svg.i { width: 15px; height: 15px; }
.btn.icon { width: 32px; padding: 0; }
.btn.sm.icon { width: 27px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card); }
.card-h { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.card-h h2 { font: 600 14px var(--sans); margin: 0; letter-spacing: -.01em; }
.card-h .meta { margin-left: auto; color: var(--ink-3); font-size: 13px; }
.card-b { padding: 16px; }
.stack > * + * { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rowline { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-top: 4px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.ok { background: var(--green); } .dot.warn { background: var(--orange); } .dot.crit { background: var(--red); }
/* status pill: tinted, rounded, with a leading dot for toned ones */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 500;
  background: var(--inset); color: var(--ink-2); white-space: nowrap; line-height: 1; }
.badge.ok, .badge.warn, .badge.crit, .badge.accent { padding-left: 8px; }
.badge.ok::before, .badge.warn::before, .badge.crit::before, .badge.accent::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--green-tint); color: var(--green); }
.badge.warn { background: var(--orange-tint); color: var(--orange); }
.badge.crit { background: var(--red-tint); color: var(--red); }
.badge.accent { background: var(--accent-tint); color: var(--accent-ink); }
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: 12.5px; }
code { font: 500 12px var(--mono); background: var(--inset); border-radius: var(--r-chip); padding: 2px 6px; box-shadow: var(--shadow-hairline); }
pre { margin: 10px 0 0; padding: 12px 14px; background: var(--inset); border-radius: var(--r-control); box-shadow: var(--shadow-hairline);
  font: 500 12px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; color: var(--ink-2); }
.empty { text-align: center; color: var(--ink-3); padding: 40px 16px; font-size: 13.5px; }
.empty svg.i { width: 22px; height: 22px; display: block; margin: 0 auto 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--canvas); padding: 9px 16px;
  border-radius: 99px; box-shadow: var(--shadow-overlay); font-size: 13.5px; font-weight: 500; animation: toast 4s var(--ease) forwards; pointer-events: none; }
.toast.err { background: var(--red); color: #fff; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 8px); } 6%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.input, .field input, .field textarea, .field select { width: 100%; height: 34px; padding: 0 12px; border: 0; border-radius: var(--r-control);
  background: var(--field); box-shadow: var(--shadow-inset-field), var(--shadow-hairline); color: var(--ink); }
.field textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { outline: none; box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-tint); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; color: var(--ink-2); }
.field small { display: block; color: var(--ink-3); font-size: 12.5px; margin-top: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 14px; }
.search { position: relative; }
.search svg.i { position: absolute; left: 11px; top: 9px; width: 15px; height: 15px; color: var(--ink-3); }
.search .input { padding-left: 32px; width: 230px; border-radius: 99px; }
.link { color: var(--accent-ink); font-weight: 500; text-decoration: none; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.link:hover { text-decoration: underline; }
.link svg.i { width: 14px; height: 14px; }

/* tabs (underlined) and segmented control (pill with a sliding look) */
.tabs { display: flex; gap: 4px; margin-bottom: 18px; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px; text-decoration: none; color: var(--ink-2);
  font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.tabs a:hover { background: var(--hover-2); color: var(--ink); }
.tabs a[aria-current] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-btn); }
.tabs a .n { font: 500 11.5px var(--sans); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: 99px; background: color-mix(in srgb, var(--line) 70%, transparent); flex-wrap: wrap; }
.seg a { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 11px; border-radius: 99px; text-decoration: none; color: var(--ink-3);
  font-size: 13px; font-weight: 500; white-space: nowrap; transition: color .15s ease; }
.seg a:hover { color: var(--ink-2); }
.seg a[aria-current] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-hairline); }
.seg a .n { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-3); padding: 9px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .clip { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table .act { text-align: right; white-space: nowrap; width: 1%; }
.tablewrap { overflow-x: auto; }

/* --- overview ---------------------------------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 14px 16px; text-decoration: none; display: block; transition: box-shadow .15s ease; }
.stat:hover { box-shadow: var(--shadow-raised); }
.stat .lbl { display: flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.stat .lbl svg.i { width: 15px; height: 15px; color: var(--ink-3); }
.stat .val { font: 600 26px/1.15 var(--sans); letter-spacing: -.03em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.stat .val small { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.stat .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.warn .val { color: var(--orange); } .stat.crit .val { color: var(--red); }
/* attention rows look like Beautiful UI task rows: capsule rows with a status disc */
.rows { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.att { display: flex; gap: 11px; padding: 10px 12px; align-items: flex-start; border-radius: 12px; background: var(--inset); box-shadow: var(--shadow-hairline); }
.att .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; }
.att .ic svg.i { width: 14px; height: 14px; stroke-width: 2.2; }
.att .ic.warn { background: var(--orange); color: #fff; } .att .ic.crit { background: var(--red); color: #fff; }
.att .ic.accent { background: var(--accent); color: #fff; } .att .ic.ok { background: var(--green); color: #fff; }
.att .tx { flex: 1; min-width: 0; }
.att .tx b { display: block; font-weight: 500; font-size: 13.5px; }
.att .tx span { color: var(--ink-2); font-size: 13px; }
.att .ac { display: flex; gap: 6px; flex: none; align-items: center; }
.att .ac form { margin: 0; }
.att details summary { list-style: none; margin-top: 4px; }
.att details summary::-webkit-details-marker { display: none; }
.groups .grp + .grp { border-top: 1px solid var(--line-soft); }
.grp > summary { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px; cursor: pointer; list-style: none; }
.grp > summary::-webkit-details-marker { display: none; }
.grp > summary:hover { background: var(--hover); }
.grp > summary b { font-weight: 500; }
.grp > summary .meta { margin-left: auto; color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.grp > summary .chev { width: 15px; height: 15px; color: var(--ink-3); transition: transform .3s var(--ease); }
.grp[open] > summary .chev { transform: rotate(180deg); }
.chips { list-style: none; margin: 0; padding: 2px 16px 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: var(--r-chip); background: var(--inset);
  box-shadow: var(--shadow-hairline); font-size: 12.5px; max-width: 240px; }
.chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.warn { background: var(--orange-tint); box-shadow: none; } .chip.crit { background: var(--red-tint); box-shadow: none; }
.prose { font-size: 13.5px; line-height: 1.6; }
.prose p { margin: 0 0 8px; } .prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { margin: 0 0 8px; padding-left: 18px; } .prose li + li { margin-top: 3px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; color: var(--ink-2); }
.kv:last-child { border-bottom: 0; }
.kv b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* --- chat -------------------------------------------------------------------------------------------------- */
.main:has(.chat) { height: 100vh; overflow: hidden; }
.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.thread { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 32px; }
.thread-in { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg .av { display: none; }
.msg .col { min-width: 0; max-width: 100%; }
.msg.me { justify-content: flex-end; }
.msg.me .col { max-width: 78%; }
.bubble { overflow-wrap: anywhere; }
.msg.ai .bubble { padding: 2px 0; }
.msg.me .bubble { padding: 8px 14px; border-radius: 18px; background: var(--hover-2); }
.msg .when { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.msg.me .when { text-align: right; }
.msg.typing .bubble { color: var(--ink-3); }
.composer { padding: 10px 32px 20px; }
.composer form { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; background: var(--surface);
  border-radius: 20px; padding: 10px 10px 10px 16px; box-shadow: var(--shadow-raised); }
.composer form:focus-within { box-shadow: 0 0 0 1px var(--accent), var(--shadow-raised); }
.composer textarea { flex: 1; border: 0; background: transparent; resize: none; min-height: 24px; max-height: 200px; padding: 5px 0; line-height: 1.5; outline: none; }
.composer .btn.icon { width: 32px; height: 32px; background: var(--ink); color: var(--canvas); }
.composer .btn.icon:hover { opacity: .88; }

/* --- drawer (native dialog) -------------------------------------------------------------------------------- */
dialog.drawer { margin: 8px 8px 8px auto; height: calc(100vh - 16px); max-height: none; width: min(440px, calc(100vw - 16px)); border: 0; padding: 0;
  background: var(--surface); color: var(--ink); border-radius: var(--r-window); box-shadow: var(--shadow-overlay); }
dialog.drawer::backdrop { background: oklch(0% 0 0 / .25); }
dialog.drawer[open] { animation: slide .3s var(--ease); display: flex; flex-direction: column; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer form.body { display: flex; flex-direction: column; height: 100%; margin: 0; }
.drawer-h { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 12px 0 18px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { font: 600 15px var(--sans); margin: 0; }
.drawer-h .btn { margin-left: auto; }
.drawer-b { padding: 18px; overflow-y: auto; flex: 1; }
.drawer-f { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.drawer-f .spacer { flex: 1; }

/* --- memory / journal / logs ------------------------------------------------------------------------------- */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .search { margin-left: auto; }
.typecell { width: 110px; }
.day-card + .day-card { margin-top: 12px; }
.tl { list-style: none; margin: 0; padding: 6px 16px 10px; }
.tl li { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.tl li:last-child { border-bottom: 0; }
.tl time { font: 500 12px/1.9 var(--mono); color: var(--ink-3); }

/* --- models ------------------------------------------------------------------------------------------------ */
.live-row { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 16px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.live-row:last-child { border-bottom: 0; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 0 var(--orange-tint); animation: pulse 1.4s ease-out infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--orange) 50%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce) { .pulse, .toast, dialog.drawer[open] { animation: none; } }
.mname { font-weight: 500; display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mprov { font-size: 12px; color: var(--ink-3); }
.meter { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.meter i { flex: 1; height: 5px; border-radius: 99px; background: var(--hover-2); overflow: hidden; display: block; position: relative; }
.meter i b { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 99px; }
.keybox { background: var(--orange-tint); border-radius: var(--r-control); padding: 12px 14px; margin-bottom: 4px; font-size: 13px; }
.keybox code { display: block; margin-top: 6px; word-break: break-all; background: var(--surface); }

/* --- flows list -------------------------------------------------------------------------------------------- */
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.fcard { display: block; padding: 14px 16px; text-decoration: none; transition: box-shadow .15s ease; }
.fcard:hover { box-shadow: var(--shadow-raised); }
.fcard .t { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; }
.fcard .t svg.i { color: var(--ink-3); }
.fcard .t .badge { margin-left: auto; }
.fcard .steps { display: flex; align-items: center; gap: 4px; margin-top: 12px; flex-wrap: wrap; }
.fcard .steps span { font: 500 11.5px var(--mono); height: 22px; line-height: 22px; padding: 0 7px; border-radius: var(--r-chip); background: var(--inset);
  box-shadow: var(--shadow-hairline); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.fcard .steps svg.i { width: 12px; height: 12px; color: var(--ink-3); }
.fcard .m { color: var(--ink-3); font-size: 12.5px; margin-top: 10px; }
.section-h { display: flex; align-items: baseline; gap: 8px; margin: 28px 0 12px; padding-top: 22px; border-top: 1px dashed var(--line); }
.section-h:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.section-h h2 { font: 600 14px var(--sans); margin: 0; }
.section-h .muted { font-size: 13px; }
.section-h .btn { margin-left: auto; align-self: center; }

/* --- flow editor ------------------------------------------------------------------------------------------- */
.editor { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--page); z-index: 5; }
.ed-top { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--page); }
.ed-top .back { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 99px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 13.5px; }
.ed-top .back:hover { background: var(--hover-2); color: var(--ink); }
.ed-top .name { height: 30px; width: 220px; border: 0; border-radius: var(--r-control); padding: 0 10px; font-weight: 600; font-size: 14px; background: transparent; }
.ed-top .name:hover, .ed-top .name:focus { background: var(--field); box-shadow: var(--shadow-hairline); outline: none; }
.ed-top .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.switch input { appearance: none; width: 30px; height: 18px; border-radius: 99px; background: var(--hover-2); position: relative; cursor: pointer; margin: 0;
  box-shadow: var(--shadow-inset-field); transition: background .2s var(--ease); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  transition: transform .2s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked { background: var(--green); }
.switch input:checked::after { transform: translateX(12px); }
.save-status { font-size: 12.5px; color: var(--ink-3); min-width: 90px; text-align: right; }
.save-status.dirty { color: var(--orange); } .save-status.ok { color: var(--green); } .save-status.err { color: var(--red); }
.ed-body { flex: 1; position: relative; overflow: hidden; }
.viewport { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; background-color: var(--canvas);
  background-image: radial-gradient(circle, var(--line-strong) 1px, transparent 1.2px); }
.viewport.panning { cursor: grabbing; }
.stage { position: absolute; left: 0; top: 0; width: 1px; height: 1px; transform-origin: 0 0; }
.wires { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.wire { fill: none; stroke: var(--ink-3); stroke-width: 1.6; }
.wire.temp { stroke: var(--accent); stroke-dasharray: 5 5; }
.wire.selected { stroke-width: 2.6; }
.wire.c-limit { stroke: var(--orange); } .wire.c-error, .wire.c-fail { stroke: var(--red); } .wire.c-slow { stroke: oklch(60% .17 295); }
.wire.c-empty { stroke: oklch(65% .12 220); } .wire.c-done { stroke: var(--green); } .wire.c-any { stroke: var(--ink-3); }
.elabel { position: absolute; transform: translate(-50%, -50%); border: 0; cursor: pointer; white-space: nowrap; font-size: 11.5px; font-weight: 500;
  height: 22px; padding: 0 9px; border-radius: 99px; background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow-btn); }
.elabel.c-limit { background: var(--orange-tint); color: var(--orange); } .elabel.c-error, .elabel.c-fail { background: var(--red-tint); color: var(--red); }
.elabel.c-slow { background: oklch(60% .17 295 / .14); color: oklch(55% .17 295); } .elabel.c-empty { background: oklch(65% .12 220 / .14); color: oklch(52% .12 220); }
.elabel.c-done { background: var(--green-tint); color: var(--green); }
.elabel.selected { box-shadow: 0 0 0 2px var(--accent); }
.fnode { position: absolute; width: 236px; background: var(--surface); color: var(--ink); border-radius: 12px; box-shadow: var(--shadow-raised); user-select: none; }
.fnode.selected { box-shadow: 0 0 0 2px var(--accent), var(--shadow-raised); }
.fhead { display: flex; align-items: center; gap: 7px; padding: 11px 13px 2px; cursor: grab; }
.fhead::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--accent); flex: none; }
.fnode.g-sub .fhead::before, .fnode.g-trigger .fhead::before { background: var(--orange); }
.fnode.g-server .fhead::before, .fnode.g-hub .fhead::before, .fnode.g-memory .fhead::before { background: oklch(65% .12 220); }
.fnode.g-telegram .fhead::before, .fnode.g-journal .fhead::before, .fnode.g-remember .fhead::before { background: var(--green); }
.fhead:active { cursor: grabbing; }
.fkind { font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
.ftitle { font-weight: 600; font-size: 13.5px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 13px; }
.start { margin-left: auto; font-size: 10.5px; font-weight: 600; background: var(--accent-tint); color: var(--accent-ink); padding: 2px 7px; border-radius: 99px; }
.fsub { padding: 2px 13px 11px; font-size: 12px; line-height: 1.4; color: var(--ink-3); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 14px; }
.port { position: absolute; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink-3); }
.port.in { left: -6px; } .port.out { right: -6px; cursor: crosshair; }
.port.out:hover { background: var(--accent); box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 5px var(--accent-tint); }
.dock { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 1px; padding: 6px; width: 190px; background: var(--surface);
  border-radius: var(--r-window); box-shadow: var(--shadow-overlay); z-index: 3; }
.dock .dl { font-size: 11.5px; font-weight: 500; color: var(--ink-3); padding: 8px 8px 4px; }
.dock button { display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 8px; border: 0; border-radius: var(--r-control); background: none;
  font-size: 13.5px; cursor: pointer; text-align: left; white-space: nowrap; }
.dock button:hover { background: var(--hover-2); }
.dock .sw { width: 8px; height: 8px; border-radius: 3px; background: var(--accent); flex: none; }
.dock .sw.g-trigger { background: var(--orange); } .dock .sw.g-server, .dock .sw.g-hub, .dock .sw.g-memory { background: oklch(65% .12 220); }
.dock .sw.g-telegram, .dock .sw.g-journal, .dock .sw.g-remember { background: var(--green); }
.zoom { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface);
  border-radius: 99px; box-shadow: var(--shadow-overlay); z-index: 3; }
.zoom button { width: 30px; height: 28px; border: 0; border-radius: 99px; background: none; color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.zoom button:hover { background: var(--hover-2); color: var(--ink); }
.zoom button svg.i { width: 15px; height: 15px; }
.zoom .z { font: 500 12px var(--sans); color: var(--ink-3); width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.keys { position: absolute; left: 50%; transform: translateX(-50%); bottom: 14px; color: var(--ink-3); font-size: 12px; z-index: 2; pointer-events: none; white-space: nowrap; }
.keys kbd { font: 500 11px var(--mono); background: var(--surface); border-radius: 5px; padding: 1px 5px; color: var(--ink-2); box-shadow: var(--shadow-btn); }
.inspector { position: absolute; right: 12px; top: 12px; width: 320px; max-height: calc(100% - 24px); overflow-y: auto; background: var(--surface);
  border-radius: var(--r-window); box-shadow: var(--shadow-overlay); z-index: 4; }
.inspector[hidden] { display: none; }
.ins-h { display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); }
.ins-h h3 { font: 600 14px var(--sans); margin: 0; }
.ins-h .btn { margin-left: auto; }
.ins-b { padding: 16px; }
.ins-f { display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); }
.days { display: flex; flex-wrap: wrap; gap: 5px; }
.days label { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 27px; padding: 0 9px; border-radius: 99px;
  background: var(--surface); box-shadow: var(--shadow-btn); font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--ink-2); }
.days input { display: none; }
.days label:has(input:checked) { background: var(--ink); color: var(--canvas); box-shadow: none; }
.days label.dis { opacity: .4; pointer-events: none; }
.runs-panel { position: absolute; right: 12px; bottom: 12px; width: 320px; max-height: 45%; overflow-y: auto; background: var(--surface);
  border-radius: var(--r-window); box-shadow: var(--shadow-overlay); z-index: 3; }
.runs-panel summary { height: 44px; padding: 0 14px; font-weight: 500; cursor: pointer; display: flex; gap: 8px; align-items: center; list-style: none; font-size: 13.5px; }
.runs-panel summary::-webkit-details-marker { display: none; }
.run-item { border-top: 1px solid var(--line); padding: 10px 14px; font-size: 13px; }
.run-item .rs { margin: 6px 0 0; padding-left: 18px; }
.run-item .rs li { margin-bottom: 6px; }

/* --- responsive -------------------------------------------------------------------------------------------- */
@media (max-width: 1180px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1080px) {
  .app { grid-template-columns: 60px minmax(0, 1fr); }
  .side { padding: 14px 8px; }
  .brand span:last-child, .nav a span, .nav .count, .nav-label, .who, .side-foot .quiet span { display: none; }
  .brand, .nav a { justify-content: center; padding: 0; }
  .side-row { flex-direction: column; }
  .side-foot form { margin: 0; }
  .theme { flex-direction: column; }
  .grid2, .cols2 { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .app { grid-template-columns: 1fr; box-shadow: none; }
  .side { position: fixed; z-index: 20; top: auto; bottom: 0; left: 0; right: 0; height: 58px; flex-direction: row; padding: 0 6px; align-items: center;
    border-right: 0; border-top: 1px solid var(--line); background: var(--page); }
  .brand, .side-foot { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .nav a { width: 40px; }
  .main { padding-bottom: 58px; }
  .page-top { padding: 18px 16px 14px; }
  .content { padding: 16px 16px 32px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thread { padding: 14px; } .composer { padding: 8px 10px 10px; }
  .main:has(.chat) { height: calc(100vh - 58px); }
  .search .input { width: 100%; } .toolbar .search { margin-left: 0; width: 100%; }
  .table th, .table td { padding: 10px 12px; }
  .hide-sm { display: none; }
  .inspector { left: 8px; right: 8px; width: auto; top: auto; bottom: 8px; max-height: 60%; }
  .dock { flex-direction: row; flex-wrap: wrap; width: auto; right: 8px; left: 8px; top: 8px; }
  .dock .dl, .keys { display: none; }
  .zoom { bottom: auto; top: 64px; }
  .ed-top .name { width: 120px; }
}

.mailmetin{white-space:pre-wrap;word-break:break-word;font:inherit;font-size:.9em;line-height:1.45;margin:.5rem 0;padding:.6rem .75rem;border-radius:8px;background:rgba(127,127,127,.08);border:1px solid rgba(127,127,127,.2);max-height:28rem;overflow:auto}
.mailon small.crit{color:#e5484d}
