/* =====================================================================
   Platform UI: banners, notifications, account, support, consent and the
   admin console (layout, KPIs, charts, list views). Uses app.css tokens.
   ===================================================================== */

/* Chart palette (validated: single-series brand blue; second series green). */
:root { --c1: #2c59e8; --c2: #0b8f63; --c1-soft: rgba(44, 89, 232, .12); --heat: 44, 89, 232; }
:root[data-theme="dark"] { --c1: #6488fa; --c2: #20a878; --c1-soft: rgba(100, 136, 250, .16); --heat: 100, 136, 250; }

.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--green); } .neg { color: var(--red); }
.nowrap { flex-wrap: nowrap; white-space: nowrap; }
.center { justify-content: center; }
.h3 { font-size: 1.08rem; font-weight: 600; }
.h4 { font-size: .95rem; font-weight: 600; margin: 0 0 8px; display: block; }
.pad-h { padding: 18px 20px 6px; margin: 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; cursor: pointer; font-size: inherit; }
.linkish:hover { text-decoration: underline; }
.danger-text { color: var(--red) !important; }
.wrap.wide { max-width: 1400px; }
.label-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.grid-2 > *, .grid-side > * { min-width: 0; }
.admin-grid { margin-bottom: 18px; align-items: start; }
.card + .card, .settings-body > .card + .card { margin-top: 0; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
h1[tabindex="-1"]:focus { outline: none; }

/* Skip link */
.skip-link { position: fixed; left: -999px; top: 8px; z-index: 200; background: var(--card); color: var(--ink); padding: 10px 14px; border-radius: 10px; box-shadow: var(--e3); }
.skip-link:focus { left: 12px; }

/* ---------- Global banners ---------- */
.banners:empty { display: none; }
.banners { position: relative; z-index: 5; margin-top: 0; } /* the top bar is sticky (in the flow), so no gap: 2.39.2 */
body.on-home .banners, body.on-auth .banners { margin-top: 0; position: fixed; left: 0; right: 0; top: calc(var(--nav-h) + env(safe-area-inset-top)); }
.banners:not(:empty) + #view .page { padding-top: 24px; }
.gbanner { display: flex; align-items: center; gap: 10px; padding: 10px max(var(--gutter), 16px); font-size: .88rem; background: var(--brand-soft); color: var(--ink); border-bottom: 1px solid var(--line); }
.gbanner span { flex: 1; }
.gbanner a, .gbanner .linkish { font-weight: 600; white-space: nowrap; }
.gbanner.warn, .gbanner.warning { background: var(--amber-soft); }
.gbanner.success { background: var(--green-soft); }
.gbanner .icon-btn { width: 32px; height: 32px; }
/* Running announcement (2.40.1): scrolls right to left inside the banner; hover or focus pauses it (so the link can be clicked). */
.gb-ticker .gb-marquee { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.gb-ticker .gb-move { display: inline-block; padding-left: 100%; animation: gb-scroll var(--gb-dur, 18s) linear infinite; will-change: transform; }
@media (hover: hover) and (pointer: fine) { .gb-ticker:hover .gb-move { animation-play-state: paused; } }
.gb-ticker:focus-within .gb-move { animation-play-state: paused; }
/* 2.45.50: moved by js/app.js (startTicker) in pixels: no CSS animation or percentage padding then. */
.gb-ticker .gb-marquee.js .gb-move { padding-left: 0; animation: none; }
@keyframes gb-scroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .gb-ticker .gb-marquee { white-space: normal; -webkit-mask-image: none; mask-image: none; } .gb-ticker .gb-move { animation: none; padding-left: 0; } }

/* ---------- Block screens (suspended, maintenance, error, 404) ---------- */
.block-screen { text-align: center; padding: 42px 26px; margin-top: 20px; }
.block-screen h1 { font-size: 1.7rem; }
.block-screen p { max-width: 520px; margin-left: auto; margin-right: auto; }
.bs-ic { width: 60px; height: 60px; border-radius: 18px; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 14px; }
.bs-ic.bad { background: var(--red-soft); color: var(--red); }
.bs-ic.ok { background: var(--green-soft); color: var(--green); }

/* ---------- Empty & error states ---------- */
.empty-state { text-align: center; padding: 38px 20px; }
.empty-state.compact { padding: 18px 10px; }
.empty-state h3 { margin: 10px 0 4px; }
.empty-state p { max-width: 420px; margin: 0 auto 14px; }
.es-ic { width: 52px; height: 52px; border-radius: 16px; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.es-ic.ok { background: var(--green-soft); color: var(--green); }
.err-state .es-ic { background: var(--red-soft); color: var(--red); }

/* ---------- Notifications bell ---------- */
.bell-wrap { position: relative; }
.bell-btn { position: relative; }
.bell-n { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--card); }
.bell-pop { position: absolute; right: -60px; top: calc(100% + 10px); width: min(380px, calc(100vw - 24px)); background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e4); z-index: 60; overflow: hidden; animation: pop .18s var(--ease-out); }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-2); font-size: .92rem; }
.bell-head .linkish { font-size: .8rem; }
.bell-list { max-height: 420px; overflow-y: auto; padding: 6px; }
.bell-list .sk-line { margin: 12px 10px; }
.bell-empty { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 24px 12px; margin: 0; }
.bell-foot { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px; border-top: 1px solid var(--line-2); font-weight: 600; font-size: .86rem; }
.note { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px; color: var(--ink); position: relative; }
.note + .note { border-top: 1px solid var(--line-2); }
.note:hover { background: var(--card-2); }
.note.unread { background: var(--brand-soft); }
.note-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--line-2); color: var(--ink-2); display: grid; place-items: center; flex: none; }
.note.unread .note-ic { background: var(--card); color: var(--brand); }
.note-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; font-size: .88rem; }
.note-t span { color: var(--ink-2); font-size: .84rem; overflow-wrap: anywhere; }
.note-t em { font-style: normal; color: var(--muted); font-size: .76rem; }
.note .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; margin-top: 6px; }
.notif-page { padding: 8px; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: #fff; font-size: .72rem; font-weight: 700; margin-left: auto; }
.drawer-links .badge { margin-left: auto; }

/* ---------- Feedback button & consent ---------- */
.feedback-fab { position: fixed; right: 18px; bottom: 18px; z-index: 40; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: var(--r-pill); padding: 10px 16px; background: var(--card); color: var(--ink); box-shadow: var(--e3), inset 0 0 0 1px var(--line); cursor: pointer; font-size: .86rem; font-weight: 600; }
.feedback-fab:hover { color: var(--brand); }
body.on-auth .feedback-fab, body.intro-on .feedback-fab { display: none; }
.consent { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 90; display: flex; justify-content: center; pointer-events: none; }
.consent-in { pointer-events: auto; max-width: 860px; width: 100%; display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--e4); padding: 14px 16px; animation: fadeUp .3s var(--ease-out); }
.consent-in p { margin: 0; font-size: .86rem; color: var(--ink-2); flex: 1; }
.consent-ic { color: var(--brand); flex: none; }
.consent-btns { display: flex; gap: 8px; flex: none; }

/* ---------- Auth additions ---------- */
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 16px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.google-btn { gap: 10px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; color: var(--ink-2); cursor: pointer; line-height: 1.45; }
label.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
label.check.invalid { color: var(--red); }
.auth .err, form .err { color: var(--red); font-size: .8rem; }
.err:empty { display: none; }
.pw-meter { height: 4px; border-radius: 4px; background: var(--line-2); overflow: hidden; margin-top: 2px; }
.pw-meter i { display: block; height: 100%; width: 0; background: var(--red); transition: width .25s var(--ease), background .25s; }
.pw-meter[data-s="1"] i { width: 25%; } .pw-meter[data-s="2"] i { width: 50%; background: var(--amber); }
.pw-meter[data-s="3"] i { width: 75%; background: var(--green); } .pw-meter[data-s="4"] i { width: 100%; background: var(--green); }
.code-input { letter-spacing: .3em; font-size: 1.2rem !important; text-align: center; font-variant-numeric: tabular-nums; }
.auth-simple { min-height: 100vh; display: grid; place-items: center; padding: calc(var(--nav-h) + 20px) var(--gutter) 40px; }
.auth-simple .auth-main { width: 100%; display: flex; justify-content: center; }
.auth-simple .auth-card { text-align: left; }
.auth-simple .auth-mobile-logo.show { display: block; margin-bottom: 18px; }
.auth-card .notice { margin-bottom: 14px; }
.auth-card .btn.block + .btn.block { margin-top: 10px; }
.center-block { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 0; }
.spinner.lg { width: 34px; height: 34px; border-width: 3px; }

/* ---------- Account & settings ---------- */
.settings { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--nav-h) + 20px); display: flex; flex-direction: column; gap: 2px; }
.settings-nav a, .admin-nav a, .content-pages a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; color: var(--ink-2); font-size: .9rem; font-weight: 500; min-height: 42px; }
.settings-nav a:hover, .admin-nav a:hover, .content-pages a:hover { background: var(--card); color: var(--ink); }
.settings-nav a.on, .admin-nav a.on, .content-pages a.on { background: var(--card); color: var(--brand); box-shadow: var(--e2); font-weight: 600; }
.settings-body { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; }
.switch-row > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.switch-row.disabled { opacity: .6; cursor: default; }
.switch-row .switch { border: 0; padding: 0; min-height: 0; background: none; }
.stack > .switch-row + .switch-row { margin-top: 0; }
.sessions { list-style: none; padding: 0; margin: 0; }
.sessions li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-2); }
.sessions li > div { flex: 1; min-width: 0; }
.danger-zone { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.copy-row { display: flex; gap: 8px; margin: 14px 0; }
.copy-row input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--input); border-radius: var(--r-sm); padding: 10px 12px; }
.secret-key { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; letter-spacing: .08em; background: var(--line-2); padding: 10px 12px; border-radius: 10px; margin: 8px 0; word-break: break-all; }
.steps-list { padding-left: 1.2em; } .steps-list li { margin-bottom: 12px; }
.backup-codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.backup-codes code { display: block; text-align: center; padding: 8px; font-size: .95rem; }
.timeline li b { display: block; }
.timeline li { flex-direction: column; gap: 2px; padding-left: 22px; }
.timeline li::after { content: ''; position: absolute; left: 3px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 2px var(--brand); }

/* Support */
.support-grid { align-items: start; }
.ticket { padding: 0; margin-bottom: 12px; }
.ticket summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; list-style: none; }
.ticket summary::-webkit-details-marker { display: none; }
.ticket[open] summary { border-bottom: 1px solid var(--line-2); }
.thread { list-style: none; padding: 0 18px; margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.card > .thread { padding: 0; }
.thread li { max-width: 88%; padding: 10px 14px; border-radius: 14px; background: var(--line-2); }
.thread li p { margin: 4px 0 0; font-size: .9rem; overflow-wrap: anywhere; }
.thread li.staff { background: var(--brand-soft); align-self: flex-start; }
.thread li.me { align-self: flex-end; }
.reply { display: flex; gap: 8px; padding: 0 18px 16px; align-items: flex-end; }
.reply textarea, .note-form textarea { flex: 1; border: 1px solid var(--line); background: var(--input); border-radius: var(--r-sm); padding: 10px 12px; resize: vertical; min-height: 44px; }
.stars { color: var(--amber); letter-spacing: 1px; }

/* ---------- Admin console layout ---------- */
.admin-page { padding-top: calc(var(--nav-h) + 26px); }
.admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.admin-nav { position: sticky; top: calc(var(--nav-h) + 20px); max-height: calc(100vh - var(--nav-h) - 40px); overflow-y: auto; scrollbar-width: thin; }
/* Admin console menu (2.40.3, restyled 2.40.6): a soft grey panel with depth: a top-to-bottom shade, a faint brand-blue
   glow at the top and teal at the bottom (like the main sidebar), a gentle lift, and the open page as a white pill with
   a blue-to-teal accent bar. No patterns. Desktop only; phones keep the scrolling row. */
:root { --an-ov-a: rgba(44, 89, 232, .22); --an-ov-b: rgba(16, 185, 160, .2); --an-sheen: rgba(255, 255, 255, .55); --an-sheen-2: rgba(255, 255, 255, .18); --an-hair: rgba(255, 255, 255, .22); --an-bg: #d1d6df; --an-top: #eceff5; --an-bottom: #dde2eb; --an-line: rgba(15, 23, 42, .08); --an-glow-a: rgba(44, 89, 232, .28); --an-glow-b: rgba(16, 185, 160, .26); --an-hi: rgba(255, 255, 255, .75); --an-hover: rgba(255, 255, 255, .6); }
:root[data-theme="dark"] { --an-ov-a: rgba(99, 132, 255, .18); --an-ov-b: rgba(45, 212, 191, .14); --an-sheen: rgba(255, 255, 255, .07); --an-sheen-2: rgba(255, 255, 255, .03); --an-hair: rgba(255, 255, 255, .025); --an-bg: #0e1118; --an-top: #171d2a; --an-bottom: #10141d; --an-line: rgba(255, 255, 255, .07); --an-glow-a: rgba(99, 132, 255, .38); --an-glow-b: rgba(45, 212, 191, .28); --an-hi: rgba(255, 255, 255, .06); --an-hover: rgba(255, 255, 255, .06); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --an-ov-a: rgba(99, 132, 255, .18); --an-ov-b: rgba(45, 212, 191, .14); --an-sheen: rgba(255, 255, 255, .07); --an-sheen-2: rgba(255, 255, 255, .03); --an-hair: rgba(255, 255, 255, .025); --an-bg: #0e1118; --an-top: #171d2a; --an-bottom: #10141d; --an-line: rgba(255, 255, 255, .07); --an-glow-a: rgba(99, 132, 255, .38); --an-glow-b: rgba(45, 212, 191, .28); --an-hi: rgba(255, 255, 255, .06); --an-hover: rgba(255, 255, 255, .06); } }
@media (min-width: 961px) {
  /* 2.45.24: a smooth satin finish on the darker grey: a soft diagonal sheen (lighter at the top-left) over very fine,
     barely visible diagonal hairlines, like brushed silk. CSS gradients only; no border; sub-menus sit on it. */
  .admin-nav { padding: 16px 10px 14px; border-radius: 20px; border: 0; background-color: var(--an-bg);
    /* 2.45.28: the colour overlay on top (brand-blue glow at the top, teal at the bottom), as in 2.45.12. */
    background-image: radial-gradient(180% 70% at 0% 0%, var(--an-ov-a), transparent 72%), radial-gradient(170% 60% at 100% 100%, var(--an-ov-b), transparent 70%),
      linear-gradient(135deg, var(--an-sheen) 0%, transparent 45%, transparent 70%, var(--an-sheen-2) 100%),
      repeating-linear-gradient(135deg, var(--an-hair) 0 1px, transparent 1px 7px);
    box-shadow: inset 0 1px 0 var(--an-hi), 0 18px 40px -26px rgba(15, 23, 42, .45); }
  /* 2.45.14: the "Owner · Admin console" header is a near-black band across the top of the menu, light text on it. */
  .admin-nav .admin-who { margin: -16px -10px 14px; padding: 14px 20px; background: #111317; border: 0; border-radius: 20px 20px 0 0; }
  .admin-nav .admin-who .muted { color: #e2e8f0; font-weight: 600; }
  .admin-nav .admin-who .chip { background: rgba(255, 255, 255, .12); color: #fff; }
  body.admin-side .admin-nav .admin-who { margin: -18px -12px 14px; padding: 16px 24px; border-radius: 0; }
  .admin-nav .an-label { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px; font-size: .66rem; letter-spacing: .14em; color: var(--muted); }
  .admin-nav .an-label::after { content: ""; flex: 1; height: 1px; background: var(--an-line); }
  .admin-nav .an-group + .an-group { margin-top: 18px; }
  .admin-nav a { position: relative; transition: background .15s ease, color .15s ease, box-shadow .15s ease; }
  .admin-nav a:hover { background: var(--an-hover); }
  .admin-nav a.on { background: var(--card); box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 6px 16px -10px rgba(15, 23, 42, .35); }
  .admin-nav > .an-group > a.on::before, .admin-nav a.an-sub.on::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--brand), #10b9a0); }
  .admin-nav .an-subs-in { background: transparent; border: 0; }
}
/* 2.45.10: on desktop the admin menu is a full-height panel against the left edge, from under the top bar to the
   bottom of the screen (like the customer sidebar), scrolling on its own; the admin pages sit to its right. */
@media (min-width: 961px) {
  body.admin-side .admin-nav { position: fixed; z-index: 20; left: 0; top: var(--nav-h); bottom: 0; width: 236px; max-height: none;
    padding: 18px 12px 16px; border-radius: 0; border: 0; box-shadow: none; overflow-y: auto; }
  body.admin-side .admin-layout { grid-template-columns: minmax(0, 1fr); }
  body.admin-side .admin-page, body.admin-side .banners { padding-left: 236px; }
}
@media (prefers-reduced-motion: reduce) { .admin-nav a { transition: none; } }
.admin-who { display: flex; align-items: center; gap: 8px; padding: 0 12px 12px; }
.an-group + .an-group { margin-top: 14px; }
/* Sub-menus (2.39.4): a soft card that slides open and shut under its parent. */
.an-subs { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .22s ease, opacity .18s ease, margin .22s ease; margin: 2px 0 6px 12px; opacity: 1; }
.an-subs.closed { grid-template-rows: 0fr; opacity: 0; margin-top: 0; margin-bottom: 0; }
.an-subs-in { overflow: hidden; min-height: 0; display: grid; gap: 2px; padding: 0 6px; border-radius: 12px; background: color-mix(in srgb, var(--brand) 5%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 12%, var(--line)); }
.an-subs:not(.closed) .an-subs-in { padding: 6px; }
.admin-nav a.an-sub { min-height: 34px; padding: 7px 10px; font-size: .86rem; border-radius: 9px; }
.admin-nav a.an-sub:hover { background: color-mix(in srgb, var(--brand) 9%, transparent); }
.admin-nav a.an-sub.on { background: var(--card); box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 4px 12px -6px rgba(15, 23, 42, .25); color: var(--brand); font-weight: 600; }
.admin-nav a.an-parent { user-select: none; }
.admin-nav .an-caret { margin-left: auto; opacity: .55; transition: transform .22s ease; flex: none; }
.admin-nav a.an-parent[aria-expanded="false"] .an-caret { transform: rotate(-90deg); }
@media (prefers-reduced-motion: reduce) { .an-subs, .admin-nav .an-caret { transition: none; } }
/* Library sub-tabs (2.39.4) */
.lib-subtabs { display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 16px; border-radius: 14px; background: color-mix(in srgb, var(--brand) 6%, var(--card)); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.lib-subtabs button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border: 0; border-radius: 10px; background: none; color: var(--ink-2, var(--ink)); font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s; }
.lib-subtabs button:hover { color: var(--ink); }
.lib-subtabs button.on { background: var(--card); color: var(--brand); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 4px 12px -6px rgba(15, 23, 42, .3); }
.lib-subtabs button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.an-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; padding: 0 12px 6px; }
.admin-main { min-width: 0; }
.admin-main > .card, .admin-main > section { margin-bottom: 18px; }
.admin-head { align-items: flex-end; margin-bottom: 20px; }
.admin-head h1 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 4px; }
.admin-head .muted { max-width: 720px; }
.head-actions { align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 500; margin-bottom: 10px; }
.role-owner { background: var(--purple-soft); color: var(--purple); }
.role-admin { background: var(--brand-soft); color: var(--brand); }
.role-support { background: var(--sky-soft); color: var(--sky); }
.menu-wrap { position: relative; }
.menu-pop.right { right: 0; left: auto; top: calc(100% + 6px); z-index: 30; }
.admin-tabs { margin-bottom: 16px; }
.tab-panel { overflow: hidden; }
.tab-panel > .tbl-wrap, .tab-panel > p { margin: 0; }
.tab-panel > p.muted { padding: 18px 20px; }
.seg { display: inline-flex; background: var(--line-2); border-radius: var(--r-pill); padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; min-height: 34px; border-radius: var(--r-pill); font-size: .82rem; color: var(--muted); cursor: pointer; font-weight: 500; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--e1); }
.health-strip { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r); font-size: .85rem; margin-bottom: 18px; background: var(--green-soft); color: var(--ink-2); }
.health-strip.bad { background: var(--red-soft); }
.health-strip > .ic { color: var(--green); } .health-strip.bad > .ic { color: var(--red); }
.health-strip span { flex: 1; }
.health-strip a { font-weight: 600; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpis.sm { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: 14px 0 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; position: relative; min-width: 0; }
.kpi-ic { position: absolute; top: 14px; right: 14px; color: var(--muted); opacity: .7; }
.kpi-l { color: var(--muted); font-size: .8rem; font-weight: 500; padding-right: 26px; }
.kpi-v { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere; }
.kpi-h { color: var(--muted); font-size: .76rem; }
.kpi-d { display: inline-flex; align-items: center; gap: 2px; font-size: .78rem; font-weight: 600; }
.kpi-d.up { color: var(--green); } .kpi-d.down { color: var(--red); } .kpi-d.flat { color: var(--muted); font-weight: 500; }

/* Charts */
.chart-card .card-head { margin-bottom: 8px; }
.chart { margin: 0; outline: none; }
.chart:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; border-radius: 8px; }
.ch-plot { position: relative; margin-left: 46px; margin-top: 12px; }
.ch-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ch-grid { position: absolute; inset: 0; pointer-events: none; }
.ch-grid span { position: absolute; left: -46px; width: calc(100% + 46px); transform: translateY(-50%); font-size: .7rem; color: var(--muted); display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.ch-grid span::after { content: ''; flex: 1; border-top: 1px dashed var(--line); margin-left: 46px; position: absolute; left: 0; right: 0; }
.ch-grid span { padding-right: 0; }
.ch-area { fill: var(--c1-soft); }
.ch-line { fill: none; stroke: var(--c1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); opacity: .5; pointer-events: none; }
.ch-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--c1); box-shadow: 0 0 0 2px var(--card); transform: translate(-50%, -50%); pointer-events: none; }
.ch-tip { position: absolute; transform: translate(-50%, calc(-100% - 10px)); background: var(--ink); color: var(--card); font-size: .76rem; padding: 6px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none; z-index: 3; display: flex; flex-direction: column; box-shadow: var(--e3); }
.ch-tip b { font-weight: 600; }
.ch-x { position: relative; height: 22px; margin-left: 46px; margin-top: 6px; }
.ch-x span { position: absolute; transform: translateX(-50%); font-size: .7rem; color: var(--muted); white-space: nowrap; }
.ch-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.ch-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; min-width: 0; }
.ch-bar i { display: block; width: 100%; background: var(--c1); border-radius: 4px 4px 0 0; min-height: 0; transition: opacity .15s; }
.ch-bars:hover .ch-bar i { opacity: .55; }
.ch-bars .ch-bar.on i, .ch-bars:hover .ch-bar:hover i { opacity: 1; }
.ch-table { margin-top: 10px; font-size: .82rem; }
.ch-table summary { cursor: pointer; color: var(--brand); font-weight: 500; }
.ch-table .tbl-wrap { max-height: 260px; overflow: auto; margin-top: 8px; }
.hbars { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.hb-l { display: flex; justify-content: space-between; gap: 12px; font-size: .86rem; margin-bottom: 5px; }
.hb-l b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb-t { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.hb-t i { display: block; height: 100%; background: var(--c1); border-radius: 0 4px 4px 0; }
.kv-inline { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: .84rem; color: var(--ink-2); margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.cohort td.heat { background: rgba(var(--heat), calc(var(--h) / 100 * .85 + .04)); color: var(--ink); font-weight: 600; }
.cohort td.heat[style*="--h:6"], .cohort td.heat[style*="--h:7"], .cohort td.heat[style*="--h:8"], .cohort td.heat[style*="--h:9"], .cohort td.heat[style*="--h:100"] { color: #fff; }
.cohort th[scope=row] { white-space: nowrap; font-weight: 500; color: var(--ink); text-transform: none; letter-spacing: 0; font-size: .84rem; }

/* Attention & feed */
.attention { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.attention a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); color: var(--ink); }
.attention a:hover { border-color: var(--brand); }
.attention b { font-size: 1.2rem; min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.attention a > span { flex: 1; display: flex; flex-direction: column; }
.attention .tone-bad b { color: var(--red); } .attention .tone-warn b { color: var(--amber); } .attention .tone-info b { color: var(--brand); }
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line-2); font-size: .86rem; }
.feed li:first-child { border-top: 0; }
.feed .note-ic { width: 28px; height: 28px; border-radius: 8px; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 0; }
.kv-grid.one { grid-template-columns: 1fr; }
.kv-grid dt { color: var(--muted); font-size: .78rem; }
.kv-grid dd { margin: 2px 0 0; font-size: .9rem; overflow-wrap: anywhere; }

/* List views */
.lv-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.lv-search { position: relative; flex: 1 1 260px; max-width: 420px; display: flex; align-items: center; }
.lv-search .ic { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.lv-search input { width: 100%; border: 1px solid var(--line); background: var(--input); border-radius: var(--r-pill); padding: 9px 14px 9px 38px; min-height: 42px; }
.lv-filter select, select.sm { border: 1px solid var(--line); background: var(--input); border-radius: var(--r-pill); padding: 8px 12px; min-height: 42px; font-size: .86rem; }
.lv-spacer { flex: 1; }
.lv-summary { margin-bottom: 10px; min-height: 22px; }
/* Bulk selection and Sort by (2.40.0) */
.lv-selbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: .88rem; transition: background .15s, border-color .15s; }
.lv-selbar.on { background: color-mix(in srgb, var(--brand) 7%, var(--card)); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.lv-selcount { font-weight: 600; }
.lv-selbar:not(.on) .lv-selcount { font-weight: 400; color: var(--muted); }
.lv-selpick { display: inline-flex; gap: 12px; flex-wrap: wrap; }
.lv-selactions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.lv-check { width: 36px; padding-right: 0 !important; }
.lv-check label { display: inline-flex; padding: 4px; cursor: pointer; }
.lv-check input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.lv-table tr.lv-picked td { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.lv-sort select { min-width: 210px; }
.count-chips { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sum-row { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: baseline; font-size: .92rem; }
.lv-body { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.lv-body > .empty-state, .lv-body > .err-state { background: var(--card); }
.lv-loading { opacity: .55; transition: opacity .2s; pointer-events: none; }
.tbl-wrap { overflow-x: auto; }
.lv-table td, .lv-table th { padding-left: 14px; padding-right: 14px; }
.lv-row { cursor: pointer; }
.lv-row a { color: inherit; }
.lv-row td:first-child a { color: var(--ink); }
.th-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.th-sort .ic { opacity: .35; }
.th-sort.on { color: var(--ink); }
.th-sort.on .ic { opacity: 1; }
table.tbl th.num { text-align: right; }
.lv-pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 14px; }
.lv-pager:empty { display: none; }
.who-cell { display: flex; gap: 10px; align-items: center; }
.who-cell > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.avatar.sm { width: 32px; height: 32px; font-size: .74rem; box-shadow: none; cursor: default; }
code.act { background: none; padding: 0; color: var(--ink); font-weight: 600; }
.card.pad-0 .tbl-wrap table.tbl th:first-child, .card.pad-0 .tbl-wrap table.tbl td:first-child { padding-left: 20px; }
.card.pad-0 > p.muted.small { padding: 16px 20px; margin: 0; }

/* Detail pages */
.notes { list-style: none; padding: 0; margin: 12px 0 0; }
.notes li { padding: 10px 12px; background: var(--amber-soft); border-radius: 12px; margin-bottom: 8px; }
.notes p { margin: 0 0 4px; font-size: .88rem; }
.note-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.note-form textarea { width: 100%; }
.brief { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 20px; margin: 0; }
.brief dt { color: var(--muted); font-size: .76rem; text-transform: capitalize; }
.brief dd { margin: 2px 0 0; font-size: .88rem; white-space: pre-line; overflow-wrap: anywhere; max-height: 160px; overflow: auto; }
.files li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-2); }
.files li a:first-of-type { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.icon-btn.sm { width: 32px; height: 32px; }
.err-groups { list-style: none; padding: 0; margin: 0; }
.err-groups li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line-2); }
.err-groups li b { font-weight: 500; font-size: .88rem; overflow-wrap: anywhere; }
.run-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 3px; background: var(--green); }
.run-dot.bad { background: var(--red); }
.staff-list { list-style: none; padding: 0 20px 10px; margin: 0; }
.staff-list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line-2); }
.staff-list li > div { flex: 1; min-width: 180px; }
.perm-matrix th[scope=row] { text-transform: none; letter-spacing: 0; font-size: .86rem; color: var(--ink); font-weight: 500; white-space: normal; }
.perm-matrix thead th { vertical-align: bottom; white-space: normal; min-width: 120px; }
.perm-matrix .yes { color: var(--green); } .perm-matrix .no { color: var(--muted); }
/* Editing roles and temporary access (2.40.0) */
.perm-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.perm-check { display: inline-flex; justify-content: center; cursor: pointer; padding: 4px; }
.perm-check input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.grant-list { list-style: none; padding: 0; margin: 0 0 14px; }
.grant-list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line-2); }
.grant-list li > div { flex: 1; min-width: 200px; }
.grant-form { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding-top: 12px; border-top: 1px solid var(--line-2); }
.grant-form .field { margin: 0; min-width: 160px; }
.grant-form .field.grow { flex: 1; min-width: 200px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.card.tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; cursor: pointer; padding: 16px; font: inherit; color: var(--ink); }
.card.tpl:hover { border-color: var(--brand); }
.card.tpl .ic { color: var(--brand); }
.mail-frame { width: 100%; height: min(70vh, 640px); border: 1px solid var(--line); border-radius: 12px; background: #fff; }
/* Template editing, message templates, saved lists (2.40.0) */
.card.tpl { cursor: default; }
.tpl-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.tpl-edit .mail-frame { height: min(62vh, 560px); }
@media (max-width: 900px) { .tpl-edit { grid-template-columns: minmax(0, 1fr); } }
.msg-tpls, .saved-lists { list-style: none; padding: 0; margin: 0; }
.msg-tpls li, .saved-lists li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line-2); }
.msg-tpls li > div, .saved-lists li > div:first-child { flex: 1; min-width: 220px; }
.msg-preview .note { margin-top: 6px; border: 1px solid var(--line); border-radius: 12px; }
.modal.wide { max-width: 760px; }
.card.soft { background: var(--card-2); box-shadow: none; }
.content-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.content-pages { display: flex; flex-direction: column; gap: 2px; }
.content-pages a > span { display: flex; flex-direction: column; }
.cl-item { margin-bottom: 12px; }
.keys-group { border: 0; padding: 0; margin: 0; }
.keys-group legend { font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.sticky-save { position: sticky; bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px 10px 18px; box-shadow: var(--e3); z-index: 5; }
details summary { cursor: pointer; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .admin-layout, .settings, .content-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .admin-nav, .settings-nav, .content-pages { position: static; max-height: none; flex-direction: row; overflow-x: auto; display: flex; gap: 4px; padding-bottom: 4px; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); }
  .admin-nav::-webkit-scrollbar, .settings-nav::-webkit-scrollbar { display: none; }
  .an-group { display: flex; gap: 4px; }
  .an-subs, .an-subs-in { display: contents; }
  .an-subs.closed { display: none; }
  .admin-nav .an-caret { display: none; }
  .an-group + .an-group { margin-top: 0; }
  .an-label, .admin-who { display: none; }
  .admin-nav a, .settings-nav a, .content-pages a { white-space: nowrap; flex: none; }
  .content-pages a > span .tiny { display: none; }
  .grid-2, .grid-side { grid-template-columns: minmax(0, 1fr); }
  .bell-pop { position: fixed; left: 12px; right: 12px; top: calc(var(--nav-h) + 6px + env(safe-area-inset-top)); width: auto; }
}
@media (max-width: 760px) {
  .feedback-fab { bottom: calc(80px + env(safe-area-inset-bottom)); right: 12px; padding: 10px; }
  .feedback-fab span { display: none; }
  .consent { bottom: calc(76px + env(safe-area-inset-bottom)); }
  body:not(.authed) .consent { bottom: 12px; }
  .consent-in { flex-direction: column; align-items: stretch; }
  .consent-ic { display: none; }
  .consent-btns .btn { flex: 1; }
  .admin-head { align-items: flex-start; }
  .head-actions { width: 100%; }
  .kpi-v { font-size: 1.3rem; }
  .ch-plot, .ch-x { margin-left: 38px; }
  .ch-grid span { left: -38px; }
  .lv-search { max-width: none; }
  .lv-spacer { display: none; }
  .kv-grid { grid-template-columns: minmax(0, 1fr); }
  .lv-body { border: 0; background: none; border-radius: 0; overflow: visible; }
  .lv-body > .tbl-wrap { overflow: visible; }
  .thread li { max-width: 100%; }
  .reply, .note-form, .copy-row { flex-direction: column; align-items: stretch; }
  .sticky-save { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .perm-matrix thead th .tiny { display: none; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-ic { display: none; }
  .kpi-l { padding-right: 0; }
  .backup-codes { grid-template-columns: 1fr; }
  .gbanner { font-size: .82rem; }
}
@media (forced-colors: active) {
  .ch-line { stroke: CanvasText; } .ch-bar i, .hb-t i { background: CanvasText; } .bell-n { outline: 1px solid; }
}
@media print {
  .topbar, .mobile-nav, .feedback-fab, .consent, .banners, .admin-nav { display: none !important; }
}
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: inherit; }

/* Job picker: "Describe it" */
.describe-app { display: flex; flex-direction: column; gap: 12px; margin-bottom: 26px; border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.describe-app textarea { width: 100%; border: 1px solid var(--line); background: var(--input); border-radius: var(--r-sm); padding: 12px; font: inherit; resize: vertical; }
.describe-app textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.describe-app .upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.describe-app .upload { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; color: var(--brand); font-weight: 500; font-size: .88rem; }
.picks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.picks li { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card-2); }
.picks li.best { border-color: var(--green); background: var(--green-soft); }
.picks .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-head { margin: 0 0 12px; }
@media (max-width: 640px) { .picks li { flex-wrap: wrap; } .picks li .btn { width: 100%; } }
.credits-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-radius: var(--r-lg); background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line)); margin-bottom: 18px; flex-wrap: wrap; }
.credits-cta b { color: var(--ink); }

/* ---------- AI workforce ---------- */
.ai-sec .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.ai-sec .grow { flex: 1 1 220px; min-width: 0; }
.ai-sec .card + .card, .ai-sec .card + .grid2, .ai-sec .grid2 + .card, .ai-sec .ai-panel > .card + .card { margin-top: 16px; }
.ai-sec .grid2 > .card + .card { margin-top: 0; }
.ai-note { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.ai-av { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); font-size: 1.05rem; flex: none; }
.ai-title { display: flex; align-items: center; gap: 10px; }
.ai-title .ai-av { width: 42px; height: 42px; font-size: 1.3rem; }
.ai-name { display: flex; gap: 10px; align-items: center; color: inherit; min-width: 0; }
.ai-name > span { display: flex; flex-direction: column; min-width: 0; }
.ai-sum { display: block; max-width: 42ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-pin { color: var(--muted); } .ai-pin.on { color: var(--amber); } .ai-pin.on svg { fill: currentColor; }
.ai-num { width: 88px; }
.ai-flow { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.ai-ov { margin-top: 16px; }
.ai-conc { margin: 16px 0; }
.ai-tl { margin-bottom: 0; }
.ai-tpl-grid, .ai-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.ai-tpl { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--card); }
.ai-tpl p { margin: 0; flex: 1; }
.ai-kcard { display: flex; flex-direction: column; gap: 6px; color: inherit; transition: box-shadow .15s, transform .15s; }
.ai-kcard:hover { box-shadow: var(--e3); transform: translateY(-1px); }
.ai-kic { color: var(--brand); }
.ai-rows { display: grid; gap: 8px; }
.ai-row3, .ai-row4 { display: grid; gap: 8px; align-items: center; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr) auto; margin-bottom: 8px; }
.ai-row4 { grid-template-columns: minmax(0, 1fr) 130px minmax(0, 1.6fr) auto auto; }
.ai-tool, .ai-step, .ai-case { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-top: 12px; background: var(--card-2, var(--card)); }
.ai-tool-head, .ai-step-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.ai-tool-head select { flex: 1 1 240px; }
.ai-step-head input[data-s="name"] { flex: 1 1 180px; }
.ai-step-head select { flex: 0 1 240px; }
.ai-id { width: 90px; }
.ai-step-n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: .78rem; font-weight: 700; flex: none; }
.ai-step-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 12px; }
.ai-modes { margin-top: 6px; } .ai-modes summary, .ai-step details summary { cursor: pointer; color: var(--brand); margin: 4px 0 8px; }
.ai-savebar { position: sticky; bottom: 72px; z-index: 30; margin-top: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); box-shadow: var(--e4); border-radius: var(--r-lg); padding: 10px 14px; font-size: .9rem; }
.ai-savebar input { flex: 1 1 200px; min-width: 0; }
.ai-savebar[hidden] { display: none; }
.ai-pre { background: var(--card-2, var(--line-2)); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font-size: .78rem; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; margin: 6px 0 10px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ai-chat .ai-msgs { max-height: 460px; min-height: 180px; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 2px 12px; }
.ai-msg { display: flex; flex-direction: column; gap: 4px; max-width: 82%; }
.ai-msg.user { align-self: flex-end; align-items: flex-end; }
.ai-bubble { padding: 10px 14px; border-radius: 16px; background: var(--line-2); font-size: .92rem; line-height: 1.45; }
.ai-msg.user .ai-bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.agent .ai-bubble { border-bottom-left-radius: 4px; }
.ai-msg .icon-btn.on { background: var(--brand-soft); }
.ai-compose { display: flex; gap: 10px; align-items: flex-end; border-top: 1px solid var(--line-2); padding-top: 12px; }
.ai-compose textarea { flex: 1; resize: vertical; }
.ai-canvas-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background-color: var(--card-2, var(--card));
  background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 20px 20px; max-height: 560px; }
.ai-canvas { display: block; touch-action: none; user-select: none; }
.ai-node { cursor: grab; }
.ai-node rect { fill: var(--card); stroke: var(--line); stroke-width: 1.5; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .08)); }
.ai-node.on rect { stroke: var(--brand); stroke-width: 2.5; }
.ai-node.from rect { stroke: var(--amber); stroke-dasharray: 5 4; stroke-width: 2.5; }
.ai-node:focus-visible { outline: none; } .ai-node:focus-visible rect { stroke: var(--brand); stroke-width: 3; }
.ai-node.t-trigger rect { fill: var(--green-soft); } .ai-node.t-end rect { fill: var(--brand-soft); } .ai-node.t-condition rect { fill: var(--amber-soft); }
.ai-node-ic { color: var(--brand); }
.ai-nt { font-size: 13px; font-weight: 600; fill: var(--ink); }
.ai-ns { font-size: 11px; fill: var(--muted); }
.ai-edge .ln { fill: none; stroke: var(--muted); stroke-width: 2; }
.ai-edge.ai .ln { stroke-dasharray: 6 5; stroke: var(--c1); }
.ai-edge.on .ln { stroke: var(--brand); stroke-width: 3; }
.ai-edge .hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; }
.ai-arrow { fill: var(--muted); }
.ai-elabel { font-size: 11px; fill: var(--ink-2); font-weight: 600; paint-order: stroke; stroke: var(--card); stroke-width: 4px; }
.ai-inspector { border-color: var(--brand); }
.ai-trace { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.ai-tstep { position: relative; padding: 4px 0 4px 12px; }
.ai-tstep summary { cursor: pointer; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .9rem; }
.ai-tdot { position: absolute; left: -21px; top: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--card); }
.s-error .ai-tdot, .s-rejected .ai-tdot { background: var(--red); } .s-waiting .ai-tdot { background: var(--amber); } .s-skipped .ai-tdot, .s-simulated .ai-tdot { background: var(--muted); }
.ai-appr { border-left: 4px solid var(--amber); }
.ai-hits { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 10px; } .ai-hits p { margin: 4px 0 0; }
.ai-meter { height: 8px; border-radius: 6px; background: var(--line-2); overflow: hidden; width: 120px; }
.ai-meter span { display: block; height: 100%; background: var(--green); } .ai-meter .warn { background: var(--amber); } .ai-meter .over { background: var(--red); }
.ai-sec .tbl .switch { border: 0; padding: 0; min-height: 0; background: none; }
.ai-sec .tbl .switch span { display: none; }
@media (max-width: 760px) {
  .ai-sec .grid3, .ai-row3, .ai-row4 { grid-template-columns: minmax(0, 1fr); }
  .ai-msg { max-width: 94%; }
}
/* AI builder controls outside .field (rows, step headers, toolbars) share the standard input look, a little denser. */
.ai-sec input:not([type]), .ai-sec input[type=number], .ai-sec select, .ai-sec textarea {
  width: 100%; border: 1px solid var(--line); background: var(--input); color: var(--ink); border-radius: var(--r-sm); padding: 9px 12px; min-height: 40px; font-size: .92rem; font-family: inherit; }
.ai-sec textarea { resize: vertical; line-height: 1.5; }
.ai-sec textarea.mono, .ai-sec input.mono { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
.ai-sec input:focus, .ai-sec select:focus, .ai-sec textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.ai-sec .field { margin-bottom: 12px; }
.ai-sec .ai-num { width: 96px; }
.ai-sec .lv-bar select, .ai-sec .head-actions select { width: auto; }
.ai-sec .ai-step-head input[data-s="name"], .ai-sec .ai-tool-head select { width: auto; }
.ai-sec .ai-id { width: 96px; flex: none; }
.ai-sec .ai-row3 > input, .ai-sec .ai-row3 > select { width: 100%; }
.ai-sec td.num { white-space: nowrap; }
.ai-sec td .ai-num { width: 76px; display: inline-block; margin-right: 4px; }
.ai-sec > .card, .ai-sec > .grid2, .ai-sec > .notice, .ai-sec > .kv-grid { margin-top: 16px; }
.ai-sec .ai-step-head input.ai-id { width: 110px; flex: none; }
.ai-sec .ai-step-head input[data-s="name"] { flex: 1 1 200px; width: auto; }
.ai-sec .ai-step-head select { flex: 0 1 260px; width: auto; }
.ai-sec .ai-tool-head select { flex: 1 1 260px; width: auto; }
.ai-sec input.ai-num { width: 96px; }
.ai-sec select[data-newstep] { width: auto; flex: 0 1 320px; }

/* Customer satisfaction (job ratings) */
.stars-txt { color: #f5a524; letter-spacing: 1px; white-space: nowrap; }
.stars-txt .off { color: var(--line, #d0d5dd); }
.stars-txt.low { color: #e5484d; }
.satisfaction { margin-top: 20px; }
.satisfaction .tbl-wrap { margin-top: 12px; }
.sat-top { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.sat-score { display: flex; flex-direction: column; align-items: center; min-width: 110px; }
.sat-score b { font-size: 2.4rem; line-height: 1; }
.sat-score > span { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.sat-bars { list-style: none; padding: 0; margin: 0; flex: 1; min-width: 220px; display: grid; gap: 6px; }
.sat-bars li { display: grid; grid-template-columns: 34px 1fr 40px; gap: 10px; align-items: center; font-size: .85rem; }
.sat-bar { height: 8px; border-radius: 4px; background: var(--soft, rgba(127,127,127,.15)); overflow: hidden; }
.sat-bar i { display: block; height: 100%; border-radius: 4px; background: #f5a524; }
@media (min-width: 961px) { body.admin-side .topbar .nav { display: none; } } /* 2.45.25: like customer pages with the sidebar */
/* 2.45.28: with a left menu (customer sidebar or admin console), banners run the full width above it, staying under
   the top bar as the page scrolls, and the menu starts below them (--banners-h, set by paintBanners). The running
   announcement used to start after the menu, so its text vanished a quarter of the way across the screen. */
@media (min-width: 961px) {
  body.has-side .banners, body.admin-side .banners { padding-left: 0; position: sticky; top: var(--nav-h); z-index: 21; }
  body.has-side .app-side, body.admin-side .admin-nav { top: calc(var(--nav-h) + var(--banners-h, 0px)); }
}
