
/* Layout: helpdesk app. Navy sidebar | ticket list | conversation | agent panel. Collapses to list/detail on phones. PLG palette. */
:root {
  --side-w: 232px;
  --bg: #f4f6f7; --surface: #ffffff; --surface-2: #f0f3f4; --line: #e2e8ea;
  --fg: #10252d; --muted: #5f747b; --faint: #8b9ba1;
  --side: #143C4B; --side-fg: #e3eef1; --side-muted: #93b4be; --side-hover: #1a4a5c; --side-active: #215a6e;
  --accent: #1C7293; --accent-ink: #ffffff; --accent-soft: #e3f1f5; --mint: #9BC4BC; --mint-soft: #e9f4f1;
  --coral: #C56B4E; --coral-soft: #f9ebe5; --good: #2e7d5b; --good-soft: #e2f2ea; --warn: #9f600e; --warn-soft: #fbf0dc;
  --bubble-in: #f0f3f4; --bubble-out: #e6f2f6; --code: #f2f5f6; --jira-soft: #e8effc; --jira-line: #b7c9f2;
  --shadow: 0 1px 2px rgba(16,37,45,.05), 0 8px 24px rgba(16,37,45,.07);
  --f-ui: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d181d; --surface: #13232a; --surface-2: #192d35; --line: #243d47; --fg: #e4eef1; --muted: #97aeb5; --faint: #6f878f;
    --side: #0a1519; --side-fg: #e3eef1; --side-muted: #86a4ad; --side-hover: #13262d; --side-active: #1a3945;
    --accent: #5ab4d4; --accent-ink: #06161c; --accent-soft: #15384a; --mint-soft: #16332f; --coral: #e38d70; --coral-soft: #3a221a;
    --good: #6cc49a; --good-soft: #14372a; --warn: #e2a54b; --warn-soft: #382a13; --bubble-in: #192d35; --bubble-out: #15384a; --code: #0f1f25; --jira-soft: #16264a; --jira-line: #2f4a8a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d181d; --surface: #13232a; --surface-2: #192d35; --line: #243d47; --fg: #e4eef1; --muted: #97aeb5; --faint: #6f878f;
  --side: #0a1519; --side-fg: #e3eef1; --side-muted: #86a4ad; --side-hover: #13262d; --side-active: #1a3945;
  --accent: #5ab4d4; --accent-ink: #06161c; --accent-soft: #15384a; --mint-soft: #16332f; --coral: #e38d70; --coral-soft: #3a221a;
  --good: #6cc49a; --good-soft: #14372a; --warn: #e2a54b; --warn-soft: #382a13; --bubble-in: #192d35; --bubble-out: #15384a; --code: #0f1f25; --jira-soft: #16264a; --jira-line: #2f4a8a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-ui); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }

/* App grid */
.app { display: grid; grid-template-columns: var(--side-w, 232px) var(--list-w, 340px) minmax(0, 1fr); height: 100%; }
.side { background: var(--side); color: var(--side-fg); display: flex; flex-direction: column; gap: 16px; padding: 16px 12px 12px; overflow: hidden; position: relative; }
.listcol { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) var(--agent-w, 360px); min-height: 0; min-width: 0; position: relative; }
.full { grid-column: 2 / -1; overflow-y: auto; min-width: 0; padding: 24px 28px 40px; }

/* Sidebar */
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
/* The DAIMI mark sits on a light plate: its gradient runs dark at the
   bottom-left and would sink into the navy sidebar unplated. */
.mark { width: 30px; height: 30px; border-radius: 8px; background: #fff; display: grid; place-items: center; padding: 3px; flex: none; }
.mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand b { font-size: 16px; display: block; line-height: 1.1; }
.brand span { font-size: 12px; color: var(--side-muted); }
.ws { margin: 0 4px; padding: 10px 12px; border-radius: 10px; background: var(--side-hover); font-size: 13px; }
.ws small { display: block; color: var(--side-muted); font-size: 11.5px; }
/* Two short lists, the ticket views at the top and the admin entries pushed to the bottom,
   with a flexible gap between them: no section headings. */
.nav { display: flex; flex-direction: column; flex: 1 1 auto; gap: 24px; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.navlist { display: grid; gap: 2px; align-content: start; }
.navlist-admin { margin-top: auto; }
.nav button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 10px; border-radius: 8px; cursor: pointer; color: var(--side-fg); font-weight: 500; font-size: 14px; line-height: 1.3; }
.nav button:hover { background: var(--side-hover); }
.nav button[aria-current="page"] { background: var(--side-active); }
.nav button:focus-visible { outline: 2px solid var(--mint); outline-offset: -2px; }
.nav .lbltxt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .ct { margin-left: auto; font-size: 12px; color: var(--side-muted); font-variant-numeric: tabular-nums; flex: none; }
.nav .ct.hot { background: var(--coral); color: #fff; border-radius: 999px; padding: 0 7px; font-weight: 700; }
.side-foot { margin-top: auto; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
/* Agent mode and the engine line: one compact row each */
.mode { display: flex; align-items: center; gap: 8px; padding: 0 2px 0 10px; min-width: 0; }
.mode .lbl { font-size: 11.5px; color: var(--side-muted); flex: none; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--side-hover); border-radius: 8px; padding: 2px; border: 0; margin: 0; min-width: 0; flex: 1 1 auto; }
.seg button { border: 0; background: none; color: var(--side-muted); padding: 3px 4px; border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--side-fg); color: var(--side); }
.engine { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--side-muted); padding: 0 10px; min-height: 24px; min-width: 0; }
.engine span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.engine i { width: 8px; height: 8px; border-radius: 50%; background: var(--side-muted); flex: none; }
.engine.on i { background: #6cc49a; box-shadow: 0 0 0 3px rgba(108,196,154,.2); }
/* The user card under a thin rule: avatar, name, role, then the theme and sign-out buttons */
.user-row { display: flex; align-items: center; gap: 6px; padding: 10px 2px 0; margin-top: 2px; border-top: 1px solid var(--side-active); }
.user-card { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; padding-left: 2px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--side-active); color: var(--mint); font-size: 12px; font-weight: 700; letter-spacing: .02em; display: grid; place-items: center; flex: none; }
.user-text { display: grid; min-width: 0; line-height: 1.25; }
.user-name { font-size: 13px; font-weight: 700; color: var(--side-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11.5px; color: var(--side-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.sideicon { all: unset; box-sizing: border-box; cursor: pointer; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 999px; color: var(--side-muted); flex: none; }
.sideicon:hover { background: var(--side-hover); color: var(--side-fg); }
.sideicon:focus-visible { outline: 2px solid var(--mint); outline-offset: -2px; }

/* List column */
.lc-head { padding: 18px 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lc-head h1 { font-size: 19px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 13.5px; }
.btn:hover { background: var(--surface-2); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.pri:hover { filter: brightness(1.07); }
.btn.ok { background: var(--good); border-color: var(--good); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg.i { width: 16px; height: 16px; }
.chips { display: flex; gap: 6px; padding: 0 16px 12px; flex-wrap: wrap; border: 0; margin: 0; min-width: 0; }
.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 0 16px 12px; min-width: 0; }
.fsel { min-width: 0; width: 100%; font: inherit; font-size: 13px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
.fchip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.fchip[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--surface); }
.list { list-style: none; margin: 0; padding: 0 8px 12px; overflow-y: auto; flex: 1; min-height: 0; }
.li button { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 11px 10px; border-radius: 10px; cursor: pointer; position: relative; }
.li button:hover { background: var(--surface-2); }
.li button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.li.sel button { background: var(--accent-soft); }
.chan { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.chan.mail { background: var(--mint-soft); color: var(--good); }
.chan.sn { background: var(--accent-soft); color: var(--accent); }
.chan.teams { background: var(--warn-soft); color: var(--warn); }
.li-top { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.li-top .when { margin-left: auto; font-variant-numeric: tabular-nums; }
.li-sub { font-weight: 600; line-height: 1.3; margin-top: 1px; }
.li-prev { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-foot { margin-top: 6px; }
.unread { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); position: absolute; left: 3px; top: 24px; }
.empty-list { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.crit { background: var(--coral-soft); color: var(--coral); }
.pill.acc { background: var(--accent-soft); color: var(--accent); }

/* Conversation */
.convo { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.cv-head { flex-wrap: wrap; padding: 16px 24px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.cv-head h2 { font-size: 18px; }
.cv-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; }
.cv-meta .mono { font-family: var(--f-mono); font-size: 12px; }
.cv-head .grow { flex: 1 1 240px; min-width: 0; }
.back { display: none; }
.thread { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; max-width: 720px; }
.msg.out { align-self: flex-end; grid-template-columns: minmax(0, 1fr) 34px; }
.msg.out .av { order: 2; }
.av { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.av.agent { border-radius: 10px; background: var(--side); color: var(--mint); }
.bub { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 12px 14px; min-width: 0; }
.msg.out .bub { background: var(--bubble-out); border-color: transparent; border-radius: 14px 4px 14px 14px; }
.msg.out.draft .bub { background: var(--surface); border: 1.5px dashed var(--accent); }
.bub-h { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.bub-h b { color: var(--fg); font-size: 13.5px; }
.bub p { margin: 0; white-space: pre-wrap; }
.cite { display: inline-block; font-size: 10.5px; font-weight: 700; color: var(--accent); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; vertical-align: 2px; margin: 0 1px; }
.srcrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.src { font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; color: var(--muted); }
.src b { color: var(--accent); margin-right: 4px; }
.blocker { margin: 0 0 10px; padding: 10px 12px; border-left: 3px solid var(--coral); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: 13.5px; }
.blocker b { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--coral); margin-bottom: 3px; }
.bub-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ev { align-self: center; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; max-width: 100%; }
.ev svg.i { width: 14px; height: 14px; }
.card { align-self: stretch; max-width: 720px; margin-left: 44px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 8px; box-shadow: var(--shadow); }
.card.pending { border-color: var(--warn); }
.card.handover { border-left: 4px solid var(--coral); }
.card-h { display: flex; align-items: center; gap: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.card-t { font-size: 15.5px; font-weight: 700; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.card .row { display: flex; gap: 8px; flex-wrap: wrap; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; color: var(--fg); background: var(--surface-2); }
.typing { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin-left: 44px; }
.dots { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i, .spin { animation: none !important; } }

/* Welcome */
.welcome { flex: 1; overflow-y: auto; padding: 40px 32px; display: grid; align-content: start; gap: 24px; max-width: 760px; }
.welcome h2 { font-size: 26px; }
.welcome p { margin: 0; color: var(--muted); max-width: 60ch; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.kpi b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi span { font-size: 12.5px; color: var(--muted); }
.trust { font-size: 12.5px !important; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.lanes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.lane { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 4px; }
.lane .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; margin-bottom: 4px; }
.lane b { font-size: 14.5px; }
.lane span { font-size: 13px; color: var(--muted); }
@media (max-width: 700px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lanes { grid-template-columns: 1fr; } }

/* Composer */
.compose { padding: 28px; display: grid; gap: 14px; max-width: 680px; overflow-y: auto; }
.compose label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 4px; }
.compose input, .compose select, .compose textarea { width: 100%; font: inherit; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
.compose textarea { min-height: 140px; resize: vertical; }
.compose .hint { font-size: 13px; color: var(--muted); margin: 0; }
.err { color: var(--coral); font-size: 13.5px; margin: 0; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; }

/* Agent panel */
.agent { background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; min-width: 0; }
.ag-head { padding: 16px 18px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.ag-head h3 { font-size: 14.5px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); background: none; border: 0; padding: 0; }
.switch .tr { width: 30px; height: 18px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.switch .tr::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.switch[aria-checked="true"] .tr { background: var(--accent); }
.switch[aria-checked="true"] .tr::after { left: 14px; }
.steps { list-style: none; margin: 0; padding: 16px 18px 8px; display: grid; }
.st { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; padding-bottom: 18px; position: relative; }
.st::before { content: ""; position: absolute; left: 12px; top: 28px; bottom: 2px; width: 2px; background: var(--line); border-radius: 2px; }
.st:last-child::before { display: none; }
.st-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--faint); border: 2px solid var(--line); }
.st-ic svg.i { width: 14px; height: 14px; stroke-width: 2.4; }
.st.done .st-ic { background: var(--good); border-color: var(--good); color: #fff; }
.st.hold .st-ic { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.st.stop .st-ic { background: var(--coral-soft); border-color: var(--coral); color: var(--coral); }
.st.busy .st-ic { border-color: var(--accent); border-top-color: transparent; background: none; }
.spin { animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.st-t { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.st-t small { font-weight: 500; font-size: 12px; color: var(--faint); }
.st-b { font-size: 13.5px; color: var(--muted); margin-top: 2px; display: grid; gap: 8px; min-width: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; margin: 0; }
.facts dt { color: var(--faint); }
.facts dd { margin: 0; color: var(--fg); font-weight: 600; min-width: 0; }
.bar { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 5px; max-width: 140px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.checks li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; color: var(--fg); }
.checks li span:first-child { font-weight: 700; }
.checks .p { color: var(--good); } .checks .f { color: var(--coral); } .checks .h { color: var(--warn); }
.code { background: var(--code); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-family: var(--f-mono); font-size: 11.5px; line-height: 1.5; white-space: pre; overflow-x: auto; margin: 0; color: var(--fg); }
.tech-l { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 700; }
.ag-foot { padding: 4px 18px 18px; }
.ag-foot button { all: unset; cursor: pointer; font-size: 13px; color: var(--accent); font-weight: 600; }
.ag-intro { padding: 18px; display: grid; gap: 14px; font-size: 13.5px; color: var(--muted); }
.ag-intro ol { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.ag-intro b { color: var(--fg); }

/* Full views */
.full h1 { font-size: 22px; margin-bottom: 4px; }
.full .sub { color: var(--muted); margin: 0 0 18px; }
.tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; margin-bottom: 24px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--surface-2); }
td.m { font-family: var(--f-mono); font-size: 12px; white-space: nowrap; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.grid2 h3 { font-size: 15px; margin-bottom: 8px; }


/* Rules */
.rstat { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--good-soft); border: 1px solid var(--good); border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; }
.rstat b { display: block; }
.rstat span { font-size: 13px; color: var(--muted); }
.rstat.draft { background: var(--warn-soft); border-color: var(--warn); }
.rgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .rgrid { grid-template-columns: minmax(0, 1fr); } }
.rcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.rcard.wide { grid-column: 1 / -1; }
.rcard h3 { font-size: 15px; }
.rcard p { margin: 0; color: var(--muted); font-size: 13.5px; }
.rcard select, .pgrid input, .pgrid select { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); max-width: 100%; }
.rcard.publish { margin-top: 16px; border-color: var(--warn); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.pgrid label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.pgrid input, .pgrid select { width: 100%; }
.slider { display: flex; align-items: center; gap: 12px; }
.slider input { flex: 1; accent-color: var(--accent); }
.slider b { font-size: 20px; font-variant-numeric: tabular-nums; min-width: 3ch; }
.lockline, .lock { font-size: 12px; color: var(--faint); }
.cks { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.ck { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ck input { accent-color: var(--accent); width: 16px; height: 16px; }
.ck.locked { color: var(--faint); opacity: .6; }
.locks { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13.5px; }
.rcard .switch { color: var(--fg); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--surface); border-radius: 12px; padding: 10px 12px 10px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); font-size: 13.5px; z-index: 10; max-width: calc(100% - 32px); }
.toast .btn { background: var(--surface); color: var(--fg); border: 0; }

/* Responsive */
@media (max-width: 1280px) {
  .detail { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .convo { min-height: auto; }
  .thread, .welcome, .compose { overflow: visible; }
  .agent { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .ag-head { position: static; }
}
@media (max-width: 1000px) {
  .app { grid-template-columns: 76px var(--list-w, 300px) minmax(0, 1fr); }
  .brand div, .ws, .nav .lbltxt, .nav .navsub, .navgroup .chev, .mode, .user-text, .engine span { display: none; }
  .nav button { justify-content: center; position: relative; } .nav .ct { position: absolute; top: 2px; right: 6px; }
  .brand { justify-content: center; padding: 0; }
  .engine { justify-content: center; padding: 0; }
  .user-row { flex-direction: column; gap: 4px; padding: 10px 0 0; } .user-card { flex: none; padding: 0; } .user-actions { flex-direction: column; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: auto; min-height: 100%; }
  .side { flex-direction: row; align-items: center; padding: 10px 12px; gap: 8px; overflow-x: auto; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
  .nav { flex-direction: row; flex: none; gap: 8px; overflow: visible; } .navlist { display: flex; gap: 2px; } .navlist-admin { margin: 0; } .side-foot { margin: 0 0 0 auto; display: flex; gap: 4px; }
  .user-row { border: 0; padding: 0; margin: 0; flex-direction: row; } .user-actions { flex-direction: row; }
  .brand { padding: 0; }
  .listcol { border-right: 0; }
  .list { overflow: visible; }
  .app.has-sel .listcol { display: none; }
  .app:not(.has-sel) .detail { display: none; }
  .back { display: inline-flex; }
  .full { grid-column: 1; padding: 20px 16px 40px; }
  .thread, .cv-head { padding-left: 16px; padding-right: 16px; }
  .card { margin-left: 0; }
  .typing { margin-left: 0; }
  .welcome { padding: 24px 16px; }
  .compose { padding: 20px 16px; }
}

/* Live POC additions */
.chan.form { background: var(--surface-2); color: var(--fg); }
.deliv { margin-top: 8px !important; font-size: 12.5px; color: var(--muted); }
.seg2 { display: flex; gap: 8px; flex-wrap: wrap; }
.lbl2 { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.rcard input:not([type]), .rcard input[type="text"], .rcard textarea { font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); max-width: 100%; }
.note { font-size: 13px; color: var(--muted); }
.byname { color: var(--muted); }
.live-tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--coral); color: #fff; border-radius: 5px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; }
.lc-head .btn { white-space: nowrap; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 12px; }
.toolbar .btn { padding: 6px 10px; font-size: 13px; }

/* ---- sign-in (local auth mode) ---- */
/* The signed-out page. A help centre: search leads, sign-in steps aside. */
.login { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: var(--bg); }
.login::before { content: ""; position: absolute; inset: 0 0 auto; height: 420px; pointer-events: none; background: radial-gradient(900px 400px at 50% -140px, var(--accent-soft), transparent 72%); }
.login[hidden] { display: none; }

.help { position: relative; min-height: 100%; display: flex; flex-direction: column; width: min(100%, 940px); margin: 0 auto; padding: 20px 24px 40px; }
.help-narrow { max-width: 540px; }
.help-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.help .brand { padding: 0; }
.help .brand span { color: var(--muted); }
/* On the light help page the logo needs no plate behind it. */
.help .mark { width: 34px; height: 34px; background: none; padding: 0; border-radius: 0; }
.help-main { flex: 1; padding-top: clamp(32px, 9vh, 76px); }
.help-h1 { font-size: clamp(28px, 4.4vw, 40px); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 26px; text-align: center; }
.help-h2 { font-size: 22px; margin: 0 0 4px; }

.help-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px 8px 8px 14px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.help-search:focus-within { border-color: var(--accent); box-shadow: var(--shadow), 0 0 0 3px var(--accent-soft); }
.help-search-ic { display: grid; place-items: center; color: var(--faint); flex: none; }
.help-search-ic .i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.help-search input { flex: 1; min-width: 0; border: none; background: none; padding: 10px 2px; font-size: 16px; box-shadow: none; }
.help-search input:focus { outline: none; }
.help-search .btn { flex: none; padding: 10px 20px; border-radius: 10px; }

.help-sec { font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--faint); font-weight: 600; margin: 36px 0 10px; }
.qlist { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.qlist button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; text-align: left; padding: 15px 20px; background: none; border: 0; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--fg); }
.qlist button:first-child { border-top: 0; }
.qlist button:hover { background: var(--accent-soft); color: var(--accent); }
.qlist .i { width: 16px; height: 16px; flex: none; color: var(--faint); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.qlist button:hover .i { color: var(--accent); }

.help-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-top: 26px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.help-cta b { display: block; font-size: 15px; margin-bottom: 2px; }
.help-cta span { color: var(--muted); font-size: 13.5px; }

.help-out:empty { display: none; }
.answer { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); margin-top: 24px; overflow: hidden; }
.answer-body { padding: 22px 26px; line-height: 1.6; }
.answer-body p { margin: 0 0 10px; }
.answer-body p:last-child { margin-bottom: 0; }
.answer .srcrow { padding: 0 26px 18px; margin-top: 0; }
.answer-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 26px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 13.5px; color: var(--muted); }
.answer-wait { display: flex; align-items: center; gap: 12px; padding: 20px 26px; color: var(--muted); box-shadow: none; }
.answer-wait .dots { border: none; background: none; padding: 0; }

.signin-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 28px; }
.signin-card input { width: 100%; }

.help-foot { padding-top: 32px; color: var(--faint); font-size: 12.5px; text-align: center; }
.help-foot p { margin: 0; max-width: 72ch; margin-inline: auto; }

/* ---- single-column admin pages: one readable column, no ragged grid ---- */
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.stack .rcard.wide { grid-column: auto; }
.fieldrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.jobrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 260px); gap: 12px; align-items: start;
  padding: 12px 0; border-top: 1px solid var(--line); }
.jobrow:first-of-type { border-top: 0; }
.jobrow p { margin: 2px 0 0; }
@media (max-width: 720px) { .jobrow { grid-template-columns: minmax(0, 1fr); } }

/* labelled row of checkboxes that wraps instead of stacking */
.ckgroup { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line); }
.ckgroup > .lbl2 { padding-top: 2px; }
@media (max-width: 720px) { .ckgroup { grid-template-columns: minmax(0, 1fr); } }

/* prose stays readable even when a card spans a wide screen */
.rcard > p, .full > .sub { max-width: 90ch; }

/* ---- sidebar: collapse, groups, resize ---- */
.side .brand { justify-content: space-between; }
.sidetoggle { all: unset; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--side-muted); flex: none; }
.sidetoggle:hover { background: var(--side-hover); color: var(--side-fg); }
.sidetoggle:focus-visible { outline: 2px solid var(--mint); outline-offset: -2px; }

/* collapsed: icons only, everything textual hidden; the buttons keep their title as the tooltip */
.side.collapsed { padding: 16px 8px 12px; }
.side.collapsed .brandtext,
.side.collapsed .lbltxt,
.side.collapsed .navsub,
.side.collapsed .chev,
.side.collapsed .side-foot .mode,
.side.collapsed .user-text,
.side.collapsed .engine span { display: none; }
.side.collapsed .nav button { justify-content: center; padding: 10px 0; position: relative; }
.side.collapsed .ct { position: absolute; transform: translate(14px, -10px); }
.side.collapsed .engine { justify-content: center; padding: 0; }
.side.collapsed .user-row { flex-direction: column; gap: 4px; padding: 10px 0 0; }
.side.collapsed .user-card { flex: none; padding: 0; }
.side.collapsed .user-actions { flex-direction: column; }
/* The rail is a fixed 56px, but the ticket list keeps its dragged width:
   pinning it here is what made the list resizer dead while collapsed. */
.app:has(.side.collapsed) { grid-template-columns: 56px var(--list-w, 340px) minmax(0, 1fr); }

/* collapsible groups: the same row as an entry, a chevron on the right that turns when open */
.navgroup { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 10px;
  border-radius: 8px; cursor: pointer; color: var(--side-fg); font-weight: 500; font-size: 14px; line-height: 1.3; }
.navgroup:hover { background: var(--side-hover); }
.navgroup:focus-visible { outline: 2px solid var(--mint); outline-offset: -2px; }
.navgroup.has-current { color: #fff; }
.navgroup .chev { margin-left: auto; width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--side-muted); transition: transform .15s ease; }
.navgroup[aria-expanded="true"] .chev { transform: rotate(90deg); }
.navsub { display: grid; gap: 2px; margin: 2px 0 2px 18px; padding-left: 10px; border-left: 1px solid var(--side-hover); }
.navsub button { min-height: 34px; padding: 5px 10px; font-size: 13.5px; }

/* drag handle on the sidebar's right edge */
.resizer { position: absolute; top: 0; right: -3px; width: 6px; height: 100%; cursor: col-resize; z-index: 5; border: 0; padding: 0; background: none; }
/* The agent handle sits on the boundary inside .detail, which never scrolls. */
.resizer.agent-edge { right: var(--agent-w, 360px); margin-right: -3px; }
.resizer:hover, .resizer:focus-visible { background: var(--mint); opacity: .5; outline: none; }
body.resizing { cursor: col-resize; user-select: none; }
@media (prefers-reduced-motion: reduce) { .navgroup .chev { transition: none; } }

/* ---- Teams device-code sign-in ---- */
.teamsconn { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--bg); }
.teamsconn p { margin: 0 0 6px; }
.teamsconn p:last-child { margin-bottom: 0; }
.bigcode { font-family: var(--f-mono); font-size: 20px; font-weight: 700; letter-spacing: .12em;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; user-select: all; }
.devicecode { display: grid; gap: 8px; }

/* The reply editor: full bubble width, comfortable height, vertical resize only. */
.msg.editing { width: 100%; }
.msg.editing .bub { width: 100%; }
.reply-edit { width: 100%; min-height: 220px; resize: vertical; font: inherit; line-height: 1.5; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); box-sizing: border-box; }
a.src { text-decoration: none; cursor: pointer; }
a.src:hover { border-color: var(--accent); text-decoration: underline; }

/* Form controls inherit the app font everywhere; browsers default them to system/monospace. */
button, input, select, textarea { font: inherit; color: inherit; }
select { background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; }

/* The assign control in the conversation header. */
.assignbox { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.assignbox select { max-width: 230px; }
.assignbox input[type="search"] { font: inherit; padding: 6px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); width: 150px; }

/* The signed-out page: ask first, sign in second. */
.help .btn.ghost .i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 560px) {
  .help { padding: 16px 16px 32px; }
  .help-search { flex-wrap: wrap; padding: 10px 12px; }
  .help-search input { flex-basis: 100%; order: 2; }
  .help-search .btn { margin-left: auto; order: 3; }
  .answer-body, .answer-foot { padding-inline: 18px; }
  .answer .srcrow { padding-inline: 18px; }
}

/* Formatted reply text (util.js richText): real paragraphs and lists. */
.rich p { margin: 0 0 8px; white-space: normal; }
.rich p:last-child { margin-bottom: 0; }
.rich ol, .rich ul { margin: 2px 0 8px; padding-left: 22px; }
.rich li { margin: 2px 0; }
.rich a { color: var(--accent); }

/* Setup pages: one theme per page, one screen per tab. */
.ptabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 4px 0 18px; overflow-x: auto; }
.ptabs button { all: unset; box-sizing: border-box; padding: 9px 14px; font-weight: 600; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.ptabs button:hover { color: var(--fg); }
.ptabs button[aria-selected="true"] { color: var(--fg); border-color: var(--accent); }
.ptabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.tabct { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 11.5px; text-align: center; }
.h2s { font-size: 17px; margin: 16px 0 10px; }
.full details.rcard > summary { cursor: pointer; }

/* The rules draft bar: pinned to the bottom of the page while a draft exists, on every tab. */
.draftbar { position: sticky; bottom: 0; margin: 24px -28px 0; padding: 14px 28px; background: var(--surface); border-top: 2px solid var(--warn); box-shadow: 0 -6px 18px rgba(0,0,0,.06); display: grid; gap: 8px; z-index: 2; }
.draftbar input { font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
.draftbar .locks { margin-top: 6px; }
@media (max-width: 1000px) { .draftbar { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; } }

/* Help centre: platform tabs under the search, pills on answers and sources. */
.help-tabs { margin: 14px 0 0; }
.help-cover { color: var(--muted); text-align: center; font-size: 13px; margin: 8px auto 0; max-width: 60ch; }
.answer-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 18px 0; }
.srcrow .src .pill { margin-left: 8px; }
.help-doms { margin-top: 10px; }
.help-doms .fchip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }

/* Earlier runs on the thread: kept in full, read-only, a little quieter. */
.run-past, .run-now { display: contents; }
.run-past > * { opacity: .78; }
.run-past .run-h, .run-now .run-h { opacity: 1; font-weight: 600; }
.steps.past .st { opacity: .85; }

/* The basic editor (js/editor.js): a toolbar over a TipTap body, styled like the reply textarea. */
.editor-host { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.editor-host:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ed-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.ed-btn { all: unset; cursor: pointer; font-size: 12.5px; padding: 3px 8px; border-radius: 6px; color: var(--muted); }
.ed-btn:hover { background: var(--surface-2); color: var(--fg); }
.ed-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.ed-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ed-body .ProseMirror { min-height: 150px; padding: 10px 12px; outline: none; line-height: 1.5; white-space: pre-wrap; }
.ed-body .ProseMirror p { margin: 0 0 8px; }
.ed-body .ProseMirror h3 { font-size: 15px; margin: 6px 0; }
.ed-body .ProseMirror ol, .ed-body .ProseMirror ul { margin: 2px 0 8px; padding-left: 22px; }
.ed-body .ProseMirror a { color: var(--accent); }
.ed-body.is-empty { position: relative; }
.ed-body.is-empty::before { content: attr(data-placeholder); color: var(--faint); position: absolute; left: 12px; top: 10px; pointer-events: none; line-height: 1.5; }
.rich h3 { font-size: 15px; margin: 8px 0 4px; }
.rich img, .ed-body .ProseMirror img { display: block; max-width: 100%; height: auto; margin: 6px 0; border: 1px solid var(--line); border-radius: 8px; }
.ed-body .ProseMirror img.ProseMirror-selectednode { outline: 2px solid var(--accent); outline-offset: 2px; }
.rich details.article { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.rich details.article summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--accent); }
.rich details.article .rich { margin-top: 8px; }

/* The FAQ table keeps to its container: fixed columns, wrapping text, long sources broken. */
.faq-table { table-layout: fixed; }
.faq-table th:nth-child(1), .faq-table td:nth-child(1) { width: 34px; }
.faq-table th:nth-child(3), .faq-table td:nth-child(3) { width: 230px; }
.faq-table th:nth-child(4), .faq-table td:nth-child(4) { width: 120px; }
.faq-table th:nth-child(5), .faq-table td:nth-child(5) { width: 160px; }
.faq-table th:nth-child(6), .faq-table td:nth-child(6) { width: 118px; }
.faq-table th:nth-child(7), .faq-table td:nth-child(7) { width: 90px; }
.faq-table th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.faq-table tr.is-open td { background: var(--accent-soft, var(--bubble-out)); }
.linkish { all: unset; cursor: pointer; color: var(--fg); }
.linkish:hover b { text-decoration: underline; }
.linkish:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* facets above a list: segmented buttons for a few options, a select for many */
.facets { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; margin: 0 0 10px; }
.facet { display: inline-flex; align-items: center; gap: 8px; }
.facet-l { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.fseg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.fseg button { all: unset; cursor: pointer; padding: 5px 12px; font-size: 13px; color: var(--muted); }
.fseg button + button { border-left: 1px solid var(--line); }
.fseg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink, #fff); }
.fseg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fct { font-size: 11.5px; opacity: .8; margin-left: 2px; }
/* the selection line and the bulk bar */
.sel-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 8px; min-height: 34px; }
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; padding: 6px 10px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-soft, var(--bubble-out)); }
.bulk-bar .grow { flex: 1; }
.bulk-bar .btn.crit { border-color: var(--coral); color: var(--coral); }
/* a status switch */
.lswitch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.lswitch input { appearance: none; width: 32px; height: 18px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; margin: 0; }
.lswitch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); transition: left .15s; }
.lswitch input:checked { background: var(--good); }
.lswitch input:checked::after { left: 16px; }
.lswitch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* a drawer on the right for one record, over the list */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 92vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.12); z-index: 40; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-head .grow { flex: 1; }
.drawer-body { padding: 14px 16px; overflow: auto; }
.drawer-body input:not([type="checkbox"]):not([type="radio"]), .drawer-body select { font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); width: 100%; box-sizing: border-box; }
.drawer-body .ck input { width: 16px; height: 16px; padding: 0; }
.drawer-history li { margin-bottom: 8px; }
.faq-table td { overflow-wrap: anywhere; }
.faq-table .li-prev { white-space: normal; }
.faq-table .rich img { max-width: min(100%, 520px); }
.faq-edit { display: grid; gap: 8px; }
.faq-edit input { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); width: 100%; box-sizing: border-box; }

/* Shared data tables (js/data_table.js): a filter box, sortable columns and pages above every list. */
.tbl-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.tbl-filter { flex: 1 1 220px; max-width: 360px; font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
.tbl-count { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.pager { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.pager .pg { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.pager .btn { padding: 4px 9px; }
.pager select { font: inherit; font-size: 12.5px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--fg); }
th.sortable .sort-ind { display: inline-block; width: 12px; margin-left: 4px; font-size: 9px; color: var(--accent); }
.list-bar { padding: 0 16px 8px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.list-bar .tbl-bar { margin: 0; flex: 1 1 100%; }
.list-bar .tbl-filter { max-width: none; }
.list-bar .tbl-sort { font: inherit; font-size: 12.5px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
.faq-table select { width: 100%; max-width: 100%; }

/* Knowledge, FAQs: the toolbar above the list, and the Write / Generate panels (form left, field guide right). */
.faq-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 0 0 12px; }
.faq-panel { margin-bottom: 16px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 20px; }
.faq-panel > div { min-width: 0; }
.faq-panel h3 { margin-bottom: 6px; }
.field-guide { border-left: 1px solid var(--line); padding-left: 18px; font-size: 13px; color: var(--muted); }
.field-guide h4 { font-size: 13px; color: var(--fg); margin: 0 0 8px; }
.field-guide dl { margin: 0; display: grid; gap: 8px; }
.field-guide dt { font-weight: 600; color: var(--fg); }
.field-guide dd { margin: 2px 0 0; line-height: 1.45; }
.field-guide i { font-style: italic; color: var(--fg); }
.choice { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start; padding: 6px 0; cursor: pointer; }
.choice input { accent-color: var(--accent); width: 16px; height: 16px; margin-top: 2px; }
@media (max-width: 900px) { .faq-panel { grid-template-columns: 1fr; } .field-guide { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; } }

/* Agent rules, Triage: the support line selector, the table of request types (a line's own rows have
   the accent edge, a type that is off is dimmed), the two panels and the suggestion list. */
.triage-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.triage-layout .rcard { gap: 12px; }
.triage-layout .field-guide { position: sticky; top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.triage-pick .fseg { flex-wrap: wrap; }
.triage-pick .fseg button small { font-weight: 400; opacity: .8; }
.triage-table td { vertical-align: middle; }
.triage-table select { width: auto; max-width: 100%; }
.triage-table tr.tr-own td:first-child { border-left: 3px solid var(--accent); }
.triage-table tr.na td { opacity: .55; }
.triage-table tr.na td:first-child, .triage-table tr.na td:nth-child(4) { opacity: 1; }
.triage-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.triage-table .tier-sel { font-size: 12px; padding: 2px 6px; }
.triage-table tr.na .tier-sel { opacity: 1; }
/* Users: a person's tiers as pills that toggle; Tiers tab: one row per level. */
.tierpills { display: flex; flex-wrap: wrap; gap: 4px; }
.tierpills .pill { cursor: pointer; border: 0; font: inherit; font-size: 11.5px; font-weight: 700; }
.tierpills .pill.dim { opacity: .45; }
.tierpills .pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tier-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 2fr); gap: 10px; align-items: end; }
.tier-row .tier-no { font-weight: 700; color: var(--muted); padding-bottom: 8px; }
.tier-row input { width: 100%; box-sizing: border-box; }
@media (max-width: 700px) { .tier-row { grid-template-columns: 28px minmax(0, 1fr); } .tier-row > div:last-child { grid-column: 2; } }
.tr-eg { color: var(--muted); font-size: 12.5px; max-width: 280px; }
.triage-panel { border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 0; }
.triage-panel input[type="text"], .triage-panel select { width: 100%; max-width: 100%; margin-bottom: 8px; }
.triage-panel .field-guide { position: static; }
.sugg { display: grid; gap: 8px; }
.sug { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; align-items: start; cursor: pointer; }
.sug input[type="checkbox"] { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--accent); }
.sug b, .sug .lock { display: block; }
.sug input[type="text"] { width: 100%; margin-top: 6px; margin-bottom: 0; }
@media (max-width: 1000px) { .triage-layout { grid-template-columns: minmax(0, 1fr); } .triage-layout .field-guide { position: static; } .tr-eg { display: none; } .triage-table th:nth-child(3) { display: none; } }

/* FAQ review statuses: the review banner above the list, the action rows and inline confirmations in the
   drawer, the numbered questions of the generator and the About box under a chosen source. */
.faq-banner { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--warn); border-radius: 10px; background: var(--warn-soft); color: var(--fg); }
.faq-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.btn.crit { border-color: var(--coral); color: var(--coral); }
.confirm { display: grid; gap: 8px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--warn); border-radius: 10px; background: var(--warn-soft); color: var(--fg); }
.confirm .row { display: flex; flex-wrap: wrap; gap: 8px; }
.eg { background: var(--accent-soft); border-radius: 9px; padding: 10px 12px; margin-top: 8px; font-size: 13px; color: var(--fg); }
.eg b { color: var(--accent); }
.linkbtn { all: unset; cursor: pointer; color: var(--accent); font-weight: 600; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.q { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.q > div { min-width: 0; }
.q > i { font-style: normal; width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-2); color: var(--fg); font-weight: 700; font-size: 12px; }
.q .qt { display: block; font-weight: 600; margin-bottom: 6px; }
.q .choice .note { display: block; margin-top: 2px; }
.q .choice select { max-width: 100%; }

/* The version beside the product name, in the sidebar and the help centre header, and the What's new page. */
.brandtext .version { font-variant-numeric: tabular-nums; opacity: .8; }
.releases { display: grid; gap: 12px; max-width: 860px; }
.release h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.release ul { margin: 4px 0 0; padding-left: 20px; color: var(--fg); font-size: 13.5px; line-height: 1.5; }
.release li { margin: 3px 0; }

/* Dashboard: KPI tiles coloured against their target, and the inline SVG charts. */
.dkpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 0 0 18px; }
.dkpi { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.dkpi.good { border-left-color: var(--good); }
.dkpi.warn { border-left-color: var(--warn); }
.dkpi.crit { border-left-color: var(--coral); }
.dkpi-l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.dkpi-v { font-size: 26px; font-weight: 700; letter-spacing: -.01em; margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.dkpi-f { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.dkpi-h { font-weight: 700; }
.dkpi.good .dkpi-h { color: var(--good); }
.dkpi.warn .dkpi-h { color: var(--warn); }
.dkpi.crit .dkpi-h { color: var(--coral); }
.h3s { font-size: 14px; margin: 14px 0 6px; }
.chart { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.chart svg { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-tick { font-size: 11px; fill: var(--muted); font-family: var(--f-ui); }
.ch-bar rect:first-child { fill: var(--accent); }
.ch-bar:hover rect:first-child { fill: var(--fg); }
.ch-hit { fill: transparent; }
.ch-tip { position: absolute; pointer-events: none; background: var(--fg); color: var(--surface); font-size: 12px; padding: 6px 8px; border-radius: 8px; white-space: nowrap; box-shadow: var(--shadow); }
.rate { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.jfiles { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.jfile { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; }
.jfile > span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.av.jira { background: #0052cc; color: #fff; }
.msg.jira .bub { background: var(--jira-soft); border: 1px solid var(--jira-line); border-left: 3px solid #0052cc; }
.msg.jira.out .bub { border-radius: 14px 4px 14px 14px; }
.doc-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.doc-pane, .doc-chunks { min-width: 0; }
.doc-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.doc-chunk { white-space: pre-wrap; margin-top: 6px; }
@media (max-width: 1100px) { .doc-view { grid-template-columns: minmax(0, 1fr); } .doc-frame { height: 60vh; } }
.composer { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.composer.tabbed { gap: 0; }
.ctabs { display: flex; gap: 4px; align-items: flex-end; padding: 0 10px; }
.ctabs button { all: unset; box-sizing: border-box; padding: 8px 16px; font-weight: 600; font-size: 13.5px; color: var(--muted); background: var(--bubble-in); border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.ctabs button:hover { color: var(--fg); }
.ctabs button[aria-selected="true"] { color: var(--fg); background: var(--surface); position: relative; z-index: 1; padding-bottom: 9px; }
.ctabs button[data-ptab="jira"][aria-selected="true"] { background: var(--jira-soft); border-color: var(--jira-line); }
.ctabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cpanel { display: flex; flex-direction: column; gap: 8px; }
.tabbed .cpanel { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--surface); }
.jira-box { background: var(--jira-soft); border-color: var(--jira-line); }
.jira-box .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.jira-box select { flex: 1 1 240px; min-width: 0; } /* a long issue summary never widens the box past the thread */
/* help centre: the way back from an answer, and the folded list of every article */
.help-back { margin-bottom: 10px; }
.help-all { margin-top: 18px; }
.help-all .help-sec { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 24px; }
.help-articles details { border-top: 1px solid var(--line); }
.help-articles details:first-child { border-top: 0; }
.help-articles summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 20px; cursor: pointer; font-size: 14.5px; list-style: none; }
.help-articles summary::-webkit-details-marker { display: none; }
.help-articles summary:hover { background: var(--accent-soft); color: var(--accent); }
.help-articles .rich { padding: 4px 20px 16px; font-size: 14px; }
/* the "How this POC works" pane hidden: the home pane takes the whole width */
.detail.no-agent { grid-template-columns: minmax(0, 1fr); }
.detail.no-agent .agent, .detail.no-agent .resizer.agent-edge { display: none; }
.intro-show { justify-self: start; margin-top: 4px; }
