/* Naxis Assistant web surface — shared styles (login, welcome, chat, admin).
   Direction 01 "Working grid": brand steel #225479, neutrals are faint tints of
   the same hue (206°); registration-grid pattern on auth zones only (P13);
   UI corners stay 8/12px — sharpness lives in the decor plates. */
:root {
  --bg: #f5f7f9;
  --panel: #ffffff;
  --ink: #16212b;
  --ink-soft: #33424f;
  --muted: #5d6d7b;
  --faint: #8c9aa6;
  --line: #e1e6eb;
  --line-soft: #ecf0f3;
  --accent: #225479;
  --accent-deep: #1a4160;
  --accent-ink: #ffffff;
  --accent-soft: #e4ebf1;
  --accent-warm: #a85e24;      /* copper annotation ink — citations, plotted marks */
  --accent-warm-soft: #f6ead9;
  --danger: #b03a33;
  --danger-soft: #f8e9e8;
  --warn: #8f5f0e;
  --warn-soft: #f8f0dc;
  --ok: #1f6b4b;
  --ok-soft: #e6f1ea;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(22, 33, 43, .05), 0 4px 16px rgba(22, 33, 43, .06);
  --shadow-lg: 0 4px 12px rgba(22, 33, 43, .10), 0 16px 48px rgba(22, 33, 43, .14);
  --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
}
* { box-sizing: border-box; }
/* [hidden] must always win, even over components that set their own display */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.55 "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-weight: 600; margin: 0; letter-spacing: -.01em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12px; }
p { margin: 0 0 8px; }

/* -- primitives -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
  white-space: nowrap; transition: border-color .12s, background .12s, color .12s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); color: var(--accent-ink); }
.btn.danger { color: var(--danger); border-color: #ead3d1; background: var(--panel); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { filter: brightness(1.08); color: #fff; }
.btn.small { padding: 3px 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--accent-soft); border-color: transparent; }
.icon-btn {
  border: 0; background: transparent; font: inherit; font-size: 18px;
  color: var(--muted); cursor: pointer; padding: 2px 8px; border-radius: 6px;
  line-height: 1;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }

input, select, textarea {
  font: inherit; font-size: 13.5px; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-soft); border-color: var(--accent);
}
/* placeholders are examples, not values — unmistakably lighter than input text */
input::placeholder, textarea::placeholder {
  color: var(--faint); opacity: .85;
}
input[type="checkbox"], input[type="radio"] {
  width: auto; accent-color: var(--accent);
}
input[type="file"] { padding: 5px; background: transparent; border-style: dashed; }
label { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
.field { display: grid; gap: 2px; }
.hint { font-size: 11.5px; color: var(--faint); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 18px;
}
.card h3 { font-size: 14.5px; margin-bottom: 4px; }
.card > p.muted { font-size: 12.5px; margin-bottom: 10px; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.dim { background: #ebeff2; color: var(--muted); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.chip {
  display: inline-block; padding: 1px 9px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 600; margin: 1px 2px 1px 0;
}
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 6px; }
.dot.ok { background: #2e9e62; } .dot.warn { background: #d9a21b; }
.dot.err { background: #cf4a43; } .dot.dim { background: #c3ccd4; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; font-size: 13px; }
tbody tr:hover td { background: #f8fafb; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
td .sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.empty {
  color: var(--muted); text-align: center; padding: 30px 0 32px; font-size: 13px;
  background-image:
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='120'%20height='120'%3E%3Cpath%20d='M60%2054v12M54%2060h12'%20stroke='%23225479'%20stroke-opacity='.4'/%3E%3C/svg%3E"),
    linear-gradient(rgba(34, 84, 121, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 84, 121, .05) 1px, transparent 1px);
  background-size: 120px 120px, 20px 20px, 20px 20px;
  background-position: 50% 0, .5px .5px, .5px .5px;
}
.empty::before {
  content: "+"; display: block; color: var(--accent);
  font-size: 17px; line-height: 1; margin-bottom: 8px; font-weight: 400;
}
td.dir-head {
  font-family: var(--mono); font-size: 11.5px;
  font-weight: 600; color: var(--muted); background: #f2f5f7;
  padding: 5px 10px; border-bottom: 1px solid var(--line);
}

.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.grow { flex: 1; min-width: 130px; }
.count-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.count-link:hover { text-decoration: underline; }

#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 20px;
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 200;
  max-width: 72vw; font-size: 13.5px;
}
#toast.show { opacity: .97; }
#toast.error { background: var(--danger); }

/* -- modal -- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(22, 33, 43, .30);
  -webkit-backdrop-filter: blur(7px) saturate(1.04);
  backdrop-filter: blur(7px) saturate(1.04);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
/* a modal opened from within a modal stacks another overlay — only the
   bottom one carries the scrim/blur, so darkening and blur never compound */
.overlay.nested {
  background: transparent;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
/* no backdrop-filter support (older browsers): a firmer tint stands in for
   the blur that would otherwise separate the modal from the page */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .overlay { background: rgba(22, 33, 43, .52); }
}
.modal {
  background: var(--panel); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%;
  max-height: 88vh; display: flex; flex-direction: column;
  animation: modal-in .14s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(.99); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px 11px; border-bottom: 1px solid var(--line-soft);
}
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 15px 18px; overflow-y: auto; display: grid; gap: 12px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 11px 18px 15px; border-top: 1px solid var(--line-soft);
}
.copy-row {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 7px 10px;
}
.copy-text { flex: 1; word-break: break-all; font-size: 11.5px; }
.check-list {
  display: grid; gap: 4px; max-height: 200px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px;
}
/* member picker (group modal): people list under its filter box */
.mp-list { margin-top: 6px; max-height: 240px; }
.mp-list label .muted { margin-left: auto; font-size: 12px;
                        overflow: hidden; text-overflow: ellipsis;
                        white-space: nowrap; max-width: 55%; }
.check-list label {
  display: flex; align-items: center; gap: 8px; margin: 0;
  font-size: 13px; font-weight: 400; color: var(--ink); cursor: pointer;
}
.check-line {
  display: flex; align-items: center; gap: 8px; margin: 0;
  font-size: 13px; font-weight: 400; color: var(--ink); cursor: pointer;
}

/* -- guided setup (channel detail) -- */
.form-section {
  margin: 6px 0 0; padding-top: 10px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
/* checklist with progressive disclosure: done steps fold to a line, the
   current step opens with its action, later steps wait collapsed */
.steps { display: flex; flex-direction: column; }
.step { border-bottom: 1px solid var(--line-soft); }
.step:last-child { border-bottom: 0; }
.step.current { box-shadow: inset 2px 0 0 var(--accent); }
.step-head {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 6px; cursor: pointer; border-radius: 6px;
}
.step-head:hover { background: var(--bg); }
.step-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.step-mark {
  flex: 0 0 20px; width: 20px; height: 20px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.step-mark.done { background: var(--accent); color: #fff; }
.step-mark.todo { border: 1.5px solid var(--accent); color: var(--accent); }
.step-mark.info { border: 1.5px solid var(--line); color: var(--muted); }
.step-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; }
.step.done .step-title { color: var(--muted); font-weight: 500; }
.step-caret { color: var(--faint); font-size: 10px; flex: none; }
.step-body { padding: 0 6px 12px 36px; }
.step-detail { font-size: 12.5px; color: var(--muted); line-height: 1.55;
               overflow-wrap: anywhere; }
.step-action { margin-top: 8px; }

/* -- shell sidebar (admin + chat): brand top, nav middle, account bottom -- */
.side-brand { padding: 16px 14px 12px; border-bottom: 1px solid var(--line-soft); }
.side-brand .brand { font-weight: 700; font-size: 15px; letter-spacing: .01em;
                     display: flex; align-items: flex-start; gap: 8px;
                     min-width: 0; }
/* pre-JS default mark; hidden once applyBranding paints the real logo <img> */
.side-brand .brand::before {
  content: ""; width: 11px; height: 11px; flex: none; margin-top: 4px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 66%, 66% 100%, 0 100%);
}
.side-brand .brand.branded::before { display: none; }
/* for console-holders the brand is a compass back to Overview */
.brand.brand-link { cursor: pointer; transition: opacity .12s; }
.brand.brand-link:hover { opacity: .82; }
.brand.brand-link:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px;
}
.chat-side .brand.brand-link:focus-visible { outline-color: #9fc0d8; }
.brand-logo {
  width: 20px; height: 20px; flex: none; border-radius: 5px; margin-top: 1px;
  object-fit: contain; object-position: left center;
}
/* long company names wrap cleanly under the logo instead of hitting the edge */
.brand-words { min-width: 0; line-height: 1.25; }
.brand-name { overflow-wrap: anywhere; }
.brand-accent { color: var(--accent); }
/* settings logo field */
.logo-field { display: flex; align-items: flex-start; gap: 12px; }
.logo-chip { flex: none; width: 48px; height: 48px; border-radius: 10px;
             border: 1px solid var(--line); background: var(--bg);
             display: grid; place-items: center; overflow: hidden; }
.logo-preview { max-width: 100%; max-height: 100%; object-fit: contain; }
/* principal picker: people chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px;
        padding: 3px 6px 3px 9px; border-radius: 99px;
        background: var(--accent-soft); color: var(--accent); }
.chip-x { border: 0; background: none; color: inherit; cursor: pointer;
          font-size: 15px; line-height: 1; padding: 0 2px; opacity: .7; }
.chip-x:hover { opacity: 1; }
/* access preview in Edit user */
.access-preview { margin-top: 10px; padding: 10px 12px; border-radius: 8px;
                  background: var(--bg); border: 1px solid var(--line-soft); }
.access-count { font-size: 13px; font-weight: 600; }
.access-line { display: flex; align-items: center; justify-content: space-between;
               gap: 10px; flex-wrap: wrap; }

/* file-access map (Edit user → View file map) */
.am-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
           margin-bottom: 10px; }
.am-total { font-size: 13px; font-weight: 600; color: var(--muted);
            margin-right: 2px; white-space: nowrap; }
.am-total b { color: var(--accent); font-size: 15px; font-weight: 700; }
.am-seg { display: inline-flex; flex: none; border: 1px solid var(--line);
          border-radius: 8px; overflow: hidden; background: var(--panel); }
.am-seg button { border: 0; background: none; padding: 5px 10px; cursor: pointer;
                 font: inherit; font-size: 12px; font-weight: 550;
                 color: var(--muted); }
.am-seg button + button { border-left: 1px solid var(--line-soft); }
.am-seg button.on { background: var(--accent-soft); color: var(--accent); }
.am-search { flex: 1 1 130px; min-width: 110px; }
.am-search input { width: 100%; padding: 5px 10px; font-size: 12.5px; }
.am-tools { display: flex; gap: 4px; flex: none; }
.access-map { max-height: min(56vh, 540px); overflow: auto;
              border: 1px solid var(--line-soft); border-radius: 10px;
              background: var(--bg); padding: 6px; }
.am-row { display: flex; align-items: center; gap: 7px; padding: 4px 8px;
          border-radius: 7px; font-size: 13px; min-width: 0; }
.am-row.click { cursor: pointer; user-select: none; }
.am-row.click:hover { background: var(--panel); }
.am-caret { flex: none; width: 11px; text-align: center; color: var(--faint);
            font-size: 11px; line-height: 1; transition: transform .12s ease; }
.am-row.open .am-caret { transform: rotate(90deg); }
.am-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
            white-space: nowrap; }
.am-src > .am-label { font-weight: 650; }
.am-src .ch-glyph { width: 24px; height: 24px; border-radius: 6px; }
.am-src .ch-glyph img { width: 15px; height: 15px; }
.am-src .ch-glyph svg { width: 14px; height: 14px; }
.am-kids { margin-left: 19px; padding-left: 7px;
           border-left: 1px solid var(--line); }
.am-glyph { flex: none; width: 17px; height: 17px; display: grid;
            place-items: center; }
.am-glyph svg { width: 16px; height: 16px; display: block; }
.am-glyph.dir { color: #a5b1bc; }
.am-pill { flex: none; font-family: var(--mono); font-size: 10.5px;
           font-weight: 600; padding: 1px 7px; border-radius: 99px;
           background: var(--panel); border: 1px solid var(--line-soft);
           color: var(--muted); }
.am-pill.full { background: var(--ok-soft); color: var(--ok);
                border-color: transparent; }
.am-pill.none { color: var(--faint); background: none; }
.am-mark { flex: none; width: 16px; height: 16px; display: grid;
           place-items: center; }
.am-mark svg { width: 13px; height: 13px; display: block; }
.am-mark.yes { color: var(--ok); }
.am-mark.not { color: var(--danger); opacity: .75; }
.am-file.no .am-label, .am-file.no .am-glyph { opacity: .52; }
.am-empty { padding: 26px 12px; text-align: center; color: var(--muted);
            font-size: 13px; }
.am-legend { display: flex; align-items: center; gap: 10px; margin-top: 8px;
             font-size: 11.5px; color: var(--faint); flex-wrap: wrap; }
.am-leg { display: inline-flex; align-items: center; gap: 4px; }
.am-leg .am-mark { width: 14px; height: 14px; }
.am-trunc { margin-left: auto; color: var(--warn); }
/* "pinned" flag: a document whose access was set here, not by its source */
.am-flag { font-size: 9.5px; font-weight: 700; letter-spacing: .06em;
           text-transform: uppercase; color: var(--warn);
           border: 1px solid currentColor; border-radius: 4px;
           padding: 0 5px; margin-left: 7px; flex: none; }
/* per-file access editor (click a file in the map) */
.fa-status { display: flex; align-items: center; gap: 8px;
             font-size: 14px; font-weight: 650; }
.fa-status .am-mark { width: 18px; height: 18px; }
.fa-status .am-mark svg { width: 16px; height: 16px; }
.fa-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
            font-size: 12.5px; }
.powered { font-family: var(--mono); font-size: 10px; letter-spacing: .07em;
           text-transform: uppercase; color: var(--faint); }
.powered .powered-name { color: var(--muted); font-weight: 600; }
.side-context { font-family: var(--mono); font-size: 9.5px; letter-spacing: .09em;
                text-transform: uppercase; color: var(--faint); margin: 3px 0 0 19px; }
.side-switch {
  display: flex; align-items: center; gap: 9px;
  margin: 12px 12px 6px; padding: 9px 12px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 600; text-decoration: none;
  transition: background .12s, color .12s, box-shadow .12s;
}
.side-switch-ico { width: 16px; height: 16px; flex: none; }
.side-switch-label { flex: 1; }
.side-switch-arrow { width: 16px; height: 16px; flex: none; opacity: .7;
  transition: transform .12s; }
.side-switch:hover {
  background: var(--accent); color: #fff; text-decoration: none;
  box-shadow: 0 1px 3px rgba(20, 40, 60, .16);
}
.side-switch:hover .side-switch-arrow { opacity: 1; transform: translateX(2px); }

/* document reader: a title is a link; the source window NAVIGATES to the
   file's text (one window, a back arrow) — never a second modal on top */
.doc-back {
  display: inline-flex; align-items: center; gap: 7px;
  width: fit-content; align-self: start;
  border: 0; background: none; padding: 2px 4px; margin: 0 0 10px -4px;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--accent);
  cursor: pointer; border-radius: 6px;
}
.doc-back:hover { background: var(--accent-soft); }
.doc-back span { font-size: 15px; line-height: 1; }
.doc-title-link {
  border: 0; background: none; padding: 0; font: inherit; text-align: left;
  color: var(--ink); font-weight: 600; cursor: pointer;
  border-bottom: 1px solid transparent;
}
.doc-title-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.doc-read-uri { font-size: 11.5px; color: var(--muted); margin: 0 0 12px;
  word-break: break-all; }
.doc-read-body { max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.doc-read-sec { padding: 0 0 14px; }
.doc-read-crumb {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 5px;
}
.doc-read-text {
  font-size: 13.5px; line-height: 1.65; color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
}

/* the demo hides operator-only controls (data export, erasure, updates) —
   it is a showroom for chatting and reading files, nothing to administer */
body.demo-console .admin-op { display: none !important; }
/* on the demo chat, no shared conversation history and no data export (all
   visitors share one account; the guide panel fills the rail instead) */
body.demo-chat .conv-list,
body.demo-chat .conv-label,
body.demo-chat #export-link { display: none !important; }
/* With the conversation list hidden on the demo, nothing stretches to fill the
   rail, so the footer (Help · visitor · the AI disclosure) used to sit right
   under the guide panel instead of at the foot. Push it down, as it is on a
   live instance where the (flex:1) conversation list does the pushing. */
body.demo-chat .chat-side .side-foot { margin-top: auto; }

/* demo welcome + the on-page "open a file" hint */
.demo-welcome p { font-size: 14px; line-height: 1.6; color: var(--ink-soft); margin: 0 0 12px; }
.demo-welcome-lead { color: var(--ink) !important; font-weight: 600; }
.demo-welcome-steps { margin: 0; padding-left: 20px; display: grid; gap: 9px; }
.demo-welcome-steps li { font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); }
.demo-welcome-steps b { color: var(--ink); }
.demo-hint {
  display: flex; align-items: flex-start; gap: 9px;
  margin: 4px 0 16px; padding: 10px 13px;
  border: 1px solid var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: var(--radius); background: var(--accent-soft);
  font-size: 13px; line-height: 1.5; color: var(--ink);
}
.demo-hint-ico { flex: none; color: var(--accent); }
.demo-hint-ico svg { width: 16px; height: 16px; display: block; margin-top: 1px; }
/* the demo's setup card: every step done, nothing to click */
.demo-setup-done .setup-row { cursor: default; }
.demo-setup-done .setup-row:hover { background: none; }
.side-foot { border-top: 1px solid var(--line-soft); padding: 10px 12px 12px;
             display: grid; gap: 2px; }
.side-util {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: var(--radius);
  background: transparent; font: inherit; font-size: 12.5px; color: var(--ink-soft);
  cursor: pointer; text-decoration: none;
}
.side-util:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.user-menu { position: relative; }
.user-menu summary {
  display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer;
  padding: 7px 10px; border-radius: var(--radius);
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--bg); }
.user-menu summary::before {
  content: ""; width: 8px; height: 8px; flex: none; border-radius: 99px;
  background: var(--accent);
}
/* grid/flex children refuse to shrink below their content unless told —
   without this, a long name or a long translation pushes the whole footer
   past the sidebar edge */
.side-foot > * { min-width: 0; }
.who-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
            white-space: nowrap; font-family: var(--mono); font-size: 11.5px;
            color: var(--muted); }
/* two lines in the admin console: the person, then the role — long
   translations (Διαχειριστής συστήματος) wrap by design, never overflow */
.who-name .who-id { display: block; overflow: hidden; text-overflow: ellipsis;
                    color: var(--ink-soft); font-weight: 600; }
.who-name .who-role { display: block; overflow: hidden; text-overflow: ellipsis;
                      font-size: 10px; letter-spacing: .05em;
                      color: var(--faint); text-transform: uppercase; }
.user-menu summary::after { content: "\25BE"; color: var(--faint); font-size: 10px;
                            transition: transform .12s; }
.user-menu[open] summary::after { transform: rotate(180deg); }
.user-pop {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 4px; display: grid; gap: 2px;
}
.side-meta { font-size: 11.5px; color: var(--muted); padding: 6px 10px 0; }
.side-foot .disclosure { padding: 4px 10px 0; }
.side-foot .powered { padding: 8px 10px 0; }
.side-util:focus-visible, .user-menu summary:focus-visible, .side-switch:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* -- login / welcome -- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 20px; }
.login-card { width: 360px; display: grid; gap: 13px; padding: 28px; }
/* the identity block: the mark on its own line, the wordmark beneath —
   never a logo squeezed into the text baseline */
.login-card h1[data-brand] {
  display: grid; gap: 12px; justify-items: start;
  font-size: 21px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2;
}
.login-card .brand-logo {
  width: 44px; height: 44px; border-radius: 10px; object-fit: contain;
  background: var(--panel); border: 1px solid var(--line-soft);
  box-shadow: var(--shadow); padding: 5px; display: block;
}
.login-card .sub { margin-top: -4px; }
.login-form { display: grid; gap: 13px; }
.login-pass-row { display: flex; align-items: baseline;
                  justify-content: space-between; }
.login-link {
  border: 0; background: none; font: inherit; font-size: 12px;
  color: var(--accent); cursor: pointer; padding: 0;
}
.login-link:hover { text-decoration: underline; }
.login-link.center { justify-self: center; margin-top: 2px; font-size: 12.5px; }
.login-note { font-size: 12.5px; color: var(--muted); margin: 0;
              line-height: 1.55; }
.login-code {
  font-family: var(--mono); font-size: 26px; font-weight: 700;
  letter-spacing: 10px; text-align: center; padding: 10px 6px 10px 16px;
}
.login-sent { display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--line); border-left: 3px solid var(--ok);
  border-radius: var(--radius); background: #f7faf8; padding: 13px 14px; }
.login-wrap .powered { text-align: center; margin-top: 10px; }
.help-lang-note { font-size: 11.5px; color: var(--faint); margin-right: 8px; }
.login-lang { margin-top: 12px; }
.login-lang select {
  width: auto; font-size: 12px; padding: 4px 8px; color: var(--muted);
  background: transparent; border-color: transparent; cursor: pointer;
}
.login-lang select:hover { border-color: var(--line); background: var(--panel); }
.login-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.login-card .sub { color: var(--muted); margin-top: -8px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; }
.disclosure { font-size: 12px; color: var(--faint); line-height: 1.5; }

/* -- chat: a steel-blue rail (the "known" messaging shape) over a light,
      cited canvas. Rows carry avatars like Slack; assistant replies sit in
      soft cards like Teams; the identity stays Naxis. -- */
.chat-layout { display: grid; grid-template-columns: 276px 1fr; height: 100vh; }
.chat-side {
  --rail-ink: #d7e2eb;               /* text on the deep steel rail */
  --rail-soft: rgba(215, 226, 235, .62);
  --rail-line: rgba(255, 255, 255, .08);
  --rail-accent: #9fc0d8;            /* the light-steel pop that lifts the blue */
  /* a soft light glow at the crown, a deeper foot, and a faint plotted grid —
     the rail reads as a drafted panel, not one flat field of blue */
  background:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px),
    radial-gradient(135% 55% at 50% -8%, rgba(159, 192, 216, .16), transparent 62%),
    radial-gradient(110% 34% at 50% 112%, rgba(6, 16, 26, .5), transparent 72%),
    linear-gradient(180deg, #21435f 0%, #17334c 50%, #10263a 100%);
  background-size: 22px 22px, 22px 22px, auto, auto, auto;
  color: var(--rail-ink);
  display: flex; flex-direction: column; min-height: 0;
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, .22);
}
.chat-side .side-brand { border-bottom: 1px solid var(--rail-line); }
.chat-side .brand { color: #fff; }
.chat-side .brand-accent { color: #9fc0d8; }
.chat-side .side-context { color: var(--rail-soft); }
.chat-side .side-actions { padding: 12px 12px 10px; }
/* the one bright control on the rail: a solid light button, unmistakably
   THE action — everything else stays glassy so this can stand out */
.new-conv-btn {
  width: 100%; display: flex; align-items: center; gap: 9px;
  border: 1px solid rgba(255, 255, 255, .85); border-radius: 9px;
  background: linear-gradient(180deg, #ffffff, #eaf1f6);
  color: var(--accent-deep);
  font: inherit; font-size: 13px; font-weight: 650;
  padding: 9px 12px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(5, 15, 25, .38), inset 0 1px 0 #fff;
  transition: box-shadow .12s, transform .12s, background .12s;
}
.new-conv-btn:hover {
  background: #fff;
  box-shadow: 0 4px 12px rgba(5, 15, 25, .45), inset 0 1px 0 #fff;
}
.new-conv-btn:active { transform: translateY(1px); }
.nc-plus {
  display: grid; place-items: center; flex: none;
  width: 19px; height: 19px; border-radius: 6px;
  background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 700; line-height: 1;
}
.conv-label {
  padding: 10px 14px 6px; font-family: var(--mono); font-size: 9.5px;
  letter-spacing: .09em; text-transform: uppercase; color: var(--rail-soft);
}
.conv-list { overflow-y: auto; flex: 1; padding: 0 8px 8px; }
.conv-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  color: var(--rail-ink); border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.conv-item:hover { background: rgba(255, 255, 255, .06);
                   border-color: rgba(255, 255, 255, .09); }
/* the open thread gets the one bright accent on the rail — a light-steel edge,
   so the eye lands on it instead of scanning a uniform column of blue */
.conv-item.active { background: rgba(255, 255, 255, .13); color: #fff;
                    border-color: rgba(255, 255, 255, .10);
                    box-shadow: inset 2px 0 0 var(--rail-accent); }
.conv-glyph { flex: none; width: 15px; height: 15px; opacity: .55; }
.conv-glyph svg { width: 15px; height: 15px; display: block; }
.conv-item.active .conv-glyph { opacity: .9; }
.conv-text { flex: 1; min-width: 0; }
.conv-item .q { font-weight: 500; overflow: hidden; text-overflow: ellipsis;
                white-space: nowrap; font-size: 13px; }
.conv-item .meta { font-size: 11px; color: var(--rail-soft); }
.conv-del {
  flex: none; border: 0; background: none; color: var(--rail-soft);
  font-size: 15px; line-height: 1; padding: 2px 5px; border-radius: 6px;
  cursor: pointer; opacity: 0;
}
.conv-item:hover .conv-del { opacity: 1; }
.conv-del:hover { background: rgba(255, 255, 255, .14); color: #fff; }
/* the way home, mirrored from the console's "Open chat" switch — restyled
   for the dark rail and kept at the very top where a back control belongs */
.chat-side .side-switch {
  margin: 12px 12px 0;
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .18);
  color: #fff;
}
.chat-side .side-switch:hover {
  background: rgba(255, 255, 255, .16); color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.chat-side .side-switch:focus-visible { outline-color: #9fc0d8; }

/* the demo guide block that stands in for the hidden conversation list */
#demo-panel {
  margin: 14px 12px 0; padding: 13px 14px;
  border: 1px solid var(--rail-line); border-radius: 10px;
  background: rgba(255, 255, 255, .05);
}
.demo-panel-title {
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--rail-soft);
  margin-bottom: 7px;
}
.demo-panel-text {
  margin: 0 0 11px; font-size: 12.5px; line-height: 1.55;
  color: var(--rail-ink);
}
.demo-panel-btn {
  width: 100%; padding: 7px 10px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .09); color: #fff;
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.demo-panel-btn:hover { background: rgba(255, 255, 255, .16); }

.chat-side .side-foot {
  border-top: 1px solid var(--rail-line); gap: 5px;
  background: rgba(0, 0, 0, .14);         /* a quiet plinth under the utilities */
}
/* rail utilities are real buttons — a glass chip with an icon, not bare text */
.chat-side .side-util {
  color: var(--rail-ink);
  justify-content: flex-start; gap: 9px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .045);
  transition: background .12s, border-color .12s, color .12s;
}
.chat-side .side-util:hover {
  background: rgba(255, 255, 255, .11); color: #fff;
  border-color: rgba(159, 192, 216, .38);
}
.su-ico { width: 15px; height: 15px; flex: none; opacity: .75; }
.chat-side .side-util:hover .su-ico { opacity: 1; }
.ticket-bell { margin-left: auto; }
/* The account pop is a LIGHT card floating over the dark rail — so its items
   must wear the light-surface ink, not the rail's near-white (which rendered
   invisible, white-on-white), and none of the rail's glass-chip chrome. */
.chat-side .user-pop { padding: 5px; border-radius: 10px; }
.chat-side .user-pop .side-util {
  color: var(--ink-soft); border-radius: 7px; font-size: 12.5px;
  border-color: transparent; background: transparent;
}
.chat-side .user-pop .side-util:hover {
  background: var(--accent-soft); color: var(--accent);
  border-color: transparent;
}
.chat-side .user-menu summary {
  color: var(--rail-ink);
  border: 1px solid transparent; border-radius: var(--radius);
}
.chat-side .user-menu summary:hover {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .10);
}
/* the initials chip stands in for the generic presence dot on the chat rail */
.chat-side .user-menu summary::before { display: none; }
.who-ava {
  flex: none; width: 22px; height: 22px; border-radius: 7px;
  display: inline-grid; place-items: center; margin-right: 8px;
  background: linear-gradient(180deg, #a9c7dd, #7fa8c5); color: #10263a;
  font-family: inherit; font-size: 10px; font-weight: 750; letter-spacing: .02em;
}
.who-text { vertical-align: middle; }
.chat-side .who-name {
  display: flex; align-items: center; font-family: inherit;
  font-size: 12.5px; color: var(--rail-ink); font-weight: 600;
}
.chat-side .side-meta { color: var(--rail-soft); }
.chat-side .disclosure { color: rgba(215, 226, 235, .45); }
.chat-side .powered { color: rgba(215, 226, 235, .4); }
.chat-side .powered .powered-name { color: var(--rail-soft); }

.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 22px; border-bottom: 1px solid var(--line);
  background: var(--panel);
}
/* back to the console — first thing top-left of the canvas (admins only) */
.chat-back {
  flex: none; display: grid; place-items: center;
  width: 30px; height: 30px; margin-left: -6px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  transition: border-color .12s, color .12s, background .12s;
}
.chat-back svg { width: 17px; height: 17px; display: block; }
.chat-back:hover { border-color: var(--accent); color: var(--accent);
  background: var(--accent-soft); }
.chat-head-title {
  font-size: 14.5px; font-weight: 650; min-width: 0; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-head-badge {
  flex: none; font-size: 11.5px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border-radius: 99px; padding: 4px 11px;
}
.chat-scroll {
  flex: 1; overflow-y: auto; padding: 26px 22px;
  background-image:
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='120'%20height='120'%3E%3Cpath%20d='M60%2054v12M54%2060h12'%20stroke='%23225479'%20stroke-opacity='.18'/%3E%3C/svg%3E"),
    linear-gradient(rgba(34, 84, 121, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 84, 121, .03) 1px, transparent 1px);
  background-size: 120px 120px, 20px 20px, 20px 20px;
  background-position: 0 0, .5px .5px, .5px .5px;
}
.chat-inner { max-width: 820px; margin: 0 auto; display: grid; gap: 18px; }
.msg { display: flex; gap: 11px; align-items: flex-start; }
.msg-avatar {
  flex: none; width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; margin-top: 1px;
}
.msg-avatar.bot { background: var(--panel); border: 1px solid var(--line); }
.msg-avatar.bot img { width: 24px; height: 24px; object-fit: contain; }
.msg-avatar.you {
  background: var(--accent); color: var(--accent-ink);
  font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
}
.msg-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-name { font-size: 13px; font-weight: 700; }
.msg-time { font-size: 11px; color: var(--faint); }
.msg-body { display: grid; gap: 8px; justify-items: start; }
.msg .bubble {
  white-space: pre-wrap; word-wrap: break-word; font-size: 13.5px;
  line-height: 1.55; max-width: 100%;
}
.msg.user .bubble { padding: 1px 0 0; }
.msg.assistant .bubble {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px 12px 12px 12px; box-shadow: var(--shadow);
  padding: 11px 15px;
}
.citations { display: grid; gap: 6px; padding-left: 2px; }
.cite-head {
  font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--faint);
}
.cite-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cite-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px 4px 5px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--panel);
  font: inherit; font-size: 12.5px; color: var(--ink-soft);
  cursor: pointer; transition: border-color .12s, background .12s, color .12s;
  max-width: 100%;
}
.cite-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.cite-chip.static { cursor: default; }
.cite-chip.static:hover { border-color: var(--line); color: var(--ink-soft); background: var(--panel); }
/* the expand/collapse toggle that stands in for the hidden source chips —
   a quieter pill so it reads as a control, not another citation */
.cite-more {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 99px;
  border: 1px dashed var(--line); background: transparent;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--accent);
  cursor: pointer; transition: border-color .12s, background .12s;
}
.cite-more:hover { border-color: var(--accent); background: var(--accent-soft); }
.cite-n {
  display: inline-grid; place-items: center; flex: none;
  width: 18px; height: 18px; border-radius: 99px;
  background: var(--accent-warm); color: #fff; font-size: 11px; font-weight: 700;
}
.cite-inline {
  border: 0; background: transparent; cursor: pointer; padding: 0 1px;
  font: inherit; font-size: .7em; font-weight: 700; vertical-align: super;
  color: var(--accent-warm); line-height: 0;
}
.cite-inline::before { content: "["; }
.cite-inline::after { content: "]"; }
.cite-inline:hover { text-decoration: underline; }

/* the quiet stopwatch under a fresh answer: "Answered in 0:42 · why…" */
.answer-took {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 11px; color: var(--faint); padding-left: 2px;
}
.took-sep { color: var(--line); }
.took-why {
  border: 0; background: none; padding: 0; font: inherit; font-size: 11px;
  color: var(--faint); cursor: pointer; text-decoration: underline;
  text-decoration-color: var(--line); text-underline-offset: 2px;
}
.took-why:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* reference viewer */
.ref-view { display: grid; gap: 10px; }
.ref-path { font-size: 12px; color: var(--muted); font-weight: 600; }
.ref-text {
  white-space: pre-wrap; word-wrap: break-word; font-size: 13.5px;
  line-height: 1.6; background: var(--bg); border: 1px solid var(--line);
  border-left: 3px solid var(--accent-warm); border-radius: var(--radius);
  padding: 12px 14px; max-height: 46vh; overflow-y: auto;
}
.ref-source { font-size: 12px; color: var(--faint); }

/* in-site docs (legacy simple modal, still used by helpModal fallbacks) */
.docs { display: grid; gap: 16px; }
.docs-section h4 { font-size: 14px; color: var(--ink); margin-bottom: 5px; }
.docs-section p { font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); margin: 0 0 6px; }
.docs-section ul { margin: 4px 0 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; }

/* "?" contextual help button */
.help-q {
  display: inline-grid; place-items: center; width: 16px; height: 16px;
  border-radius: 99px; border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); font-size: 10.5px; font-weight: 700; cursor: pointer;
  line-height: 1; padding: 0; vertical-align: middle; margin-left: 5px;
  transition: background .12s, color .12s, border-color .12s;
}
.help-q:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* help center */
.help-center {
  background: var(--panel); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 1120px;
  height: 90vh; display: flex; flex-direction: column;
  animation: modal-in .14s ease-out; overflow: hidden;
}
.help-head {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.help-title { font-weight: 700; font-size: 15px; flex: 1; }
.help-askbar {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.help-ask-icon { display: flex; color: var(--muted); opacity: .7; }
.help-ask-icon svg { width: 16px; height: 16px; display: block; }
.help-ask {
  flex: 1; padding: 10px 15px; border-radius: 99px; font-size: 14px;
  border: 1px solid var(--line); background: var(--panel);
}
.help-ask:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
/* minmax(0,…): a bare 1fr's min-content minimum lets a wide article push the
   column past the panel (the same trap the mobile catalogs fell into) */
.help-body { display: grid; grid-template-columns: 262px minmax(0, 1fr);
             flex: 1; min-height: 0; }
.help-toc-label {
  font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--faint); padding: 6px 11px 4px;
}
.help-toc-group {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); padding: 12px 11px 3px;
}
.help-toc-group:first-child { padding-top: 4px; }
/* inline help tip popover */
.help-tip-pop {
  position: absolute; z-index: 400; width: 260px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 12px 13px;
  animation: modal-in .12s ease-out;
}
.help-tip-text { font-size: 12.5px; line-height: 1.5; color: var(--ink); }
.help-tip-more {
  margin-top: 9px; border: 0; background: none; cursor: pointer; padding: 0;
  color: var(--accent); font-weight: 600; font-size: 12.5px;
}
.help-tip-more:hover { text-decoration: underline; }
/* the sprinkled variant — smaller, quieter, everywhere */
.help-q.mini {
  width: 13px; height: 13px; font-size: 9px; margin-left: 4px; opacity: .7;
}
.help-q.mini:hover { opacity: 1; }

/* --- the help AI: a conversation inside the help window ------------------- */
.help-center { position: relative; }
.help-ai-fab {
  position: absolute; right: 18px; bottom: 16px; z-index: 5;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px 9px 13px; border-radius: 99px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
  box-shadow: var(--shadow-lg);
}
.help-ai-fab:hover { filter: brightness(1.08); }
.help-ai-fab.open { display: none; }
.ai-glyph { display: inline-grid; width: 17px; height: 17px; flex: none; }
.ai-glyph svg { width: 100%; height: 100%; }
.help-ai-pane {
  position: absolute; right: 16px; bottom: 16px; z-index: 6;
  width: min(400px, calc(100% - 32px));
  height: min(540px, calc(100% - 110px));
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  overflow: hidden; animation: modal-in .14s ease-out;
}
.help-ai-head {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.help-ai-head .ai-glyph { color: var(--accent); width: 18px; height: 18px; }
.help-ai-title { flex: 1; display: grid; line-height: 1.25; min-width: 0; }
.help-ai-title b { font-size: 13px; }
.help-ai-title span { font-size: 11px; color: var(--muted); }
.help-ai-msgs {
  overflow-y: auto; padding: 12px; display: flex; flex-direction: column;
  gap: 8px; flex: 1; min-height: 0;
}
.ham { max-width: 94%; display: grid; gap: 2px; }
.ham.user { justify-self: end; }
.ham.user .ham-text {
  background: var(--accent); color: #fff;
  border-radius: 12px 12px 3px 12px;
}
.ham.ai .ham-text {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px 12px 12px 3px;
}
.ham-text {
  padding: 8px 11px; font-size: 13px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.ham-text.thinking { color: var(--muted); font-style: italic; }
.ham-cites { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ham-hello {
  font-size: 12.5px; color: var(--muted); line-height: 1.55;
  padding: 4px 2px 8px;
}

/* --- rendered Markdown (assistant answers: chat bubble + Help AI) --------- */
/* mdRender emits real block elements, so drop the raw-text pre-wrap. */
.bubble.md, .ham-text.md { white-space: normal; }
.md p, .md-p { margin: 0 0 .55em; }
.md > :last-child, .md-p:last-child { margin-bottom: 0; }
.md-h { font-weight: 700; line-height: 1.3; margin: .7em 0 .3em; }
.md-h:first-child { margin-top: 0; }
.md-h1 { font-size: 1.15em; }
.md-h2 { font-size: 1.08em; }
.md-h3, .md-h4 { font-size: 1em; }
.md-list { margin: .35em 0 .6em; padding-left: 1.35em; }
.md-list li { margin: .2em 0; }
.md-list li::marker { color: var(--muted); }
.md-quote {
  margin: .5em 0; padding: .1em 0 .1em .8em;
  border-left: 3px solid var(--accent); color: var(--muted);
}
.md :is(strong, b) { font-weight: 700; }
.md :is(em, i) { font-style: italic; }
.md code {
  font-family: var(--mono); font-size: .9em;
  background: var(--line-soft); padding: .08em .38em; border-radius: 4px;
}
.md-pre {
  margin: .5em 0; padding: 10px 12px; border-radius: 8px;
  background: #0f1720; color: #e8eef2; overflow-x: auto;
  font-family: var(--mono); font-size: .88em; line-height: 1.5;
}
.md-pre code { background: none; padding: 0; color: inherit; font-size: 1em; }
.md-link { color: var(--accent); text-decoration: underline; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: .8em 0; }
/* citations keep contrast on the accent-coloured user bubble too */
.ham.user .md-link, .msg.user .md-link { color: #fff; }
.help-ai-inrow {
  display: flex; gap: 8px; padding: 10px;
  border-top: 1px solid var(--line); align-items: flex-end;
}
.help-ai-input {
  flex: 1; resize: none; font: inherit; font-size: 13px; padding: 8px 10px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
  max-height: 110px;
}
.help-ai-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
/* the "ask the AI" hand-off under search results */
.help-ask-ai {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  border: 1px dashed var(--line); background: var(--panel);
  border-radius: 99px; padding: 8px 14px; font: inherit; font-size: 13px;
  font-weight: 600; color: var(--accent); cursor: pointer;
  transition: border-color .12s, background .12s;
}
.help-ask-ai:hover { border-color: var(--accent); background: var(--accent-soft); }
.help-ask-ai .ai-glyph { width: 15px; height: 15px; }
/* channel usage table on the overview */
.usage-table { font-size: 13px; }
.usage-table th { font-size: 11px; text-transform: uppercase;
                  letter-spacing: .04em; color: var(--muted); }
.usage-table td:first-child { display: flex; align-items: center; gap: 7px; }
.usage-table .ch-glyph { width: 18px; height: 18px; border-radius: 5px;
                         flex: none; }
.usage-table td, .usage-table th { padding: 7px 8px; }
.help-stack { min-height: 0; min-width: 0; display: flex; }
.help-stack > * { min-width: 0; }
.help-stack > * { flex: 1 1 auto; min-height: 0; }
.help-answers {
  overflow-y: auto; padding: 14px 22px 40px;
  display: flex; flex-direction: column; gap: 10px;
}
.help-answers-head {
  font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 4px 2px 0;
}
.help-answer {
  text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 13px 15px;
  display: grid; gap: 5px; cursor: pointer; font: inherit; color: inherit;
  transition: border-color .12s, box-shadow .12s, transform .05s;
}
.help-answer:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.help-answer:active { transform: translateY(1px); }
.ha-title { font-weight: 600; font-size: 14px; color: var(--ink); }
.ha-excerpt { font-size: 13px; line-height: 1.55; color: var(--ink-soft); }
.ha-excerpt mark { background: #fbe7a2; color: inherit; border-radius: 2px; padding: 0 1px; }
.ha-more { font-size: 12px; color: var(--accent); font-weight: 600; }
.help-empty {
  font-size: 13px; line-height: 1.6; color: var(--muted);
  padding: 12px 2px; max-width: 52ch;
}
.help-suggests { display: flex; flex-direction: column; gap: 2px; }
.help-suggest {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: var(--radius);
  padding: 9px 12px; font: inherit; font-size: 14px; color: var(--ink-soft);
  cursor: pointer;
}
.help-suggest:hover, .help-suggest.active { background: var(--accent-soft); color: var(--ink); }
.hs-icon { display: flex; flex: none; color: var(--muted); opacity: .6; }
.hs-icon svg { width: 14px; height: 14px; display: block; }
.help-toc {
  border-right: 1px solid var(--line); background: var(--bg);
  display: flex; flex-direction: column; min-height: 0;
}
/* categories scroll in here; the support button below stays put */
.help-toc-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 10px 8px; display: flex; flex-direction: column; gap: 1px;
}

/* key/value fact rows — the software-update card states plain facts */
.hair-rows { border-top: 1px solid var(--line); }
.hair-row {
  display: flex; gap: 14px; align-items: baseline; padding: 9px 0;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.hair-row b {
  flex: none; min-width: 9em; font-weight: 400; color: var(--muted);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em;
  text-transform: uppercase;
}
.hair-row span { color: var(--ink); }

/* the escape hatch: pushed to the bottom of the contents, and the only red
   control in the product — it must not read as one more article */
.help-ticket {
  flex: none; padding: 12px 11px; border-top: 1px solid var(--line);
  background: var(--bg);
}
.help-ticket-btn {
  width: 100%; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600;
  color: #fff; background: var(--danger); border: 1px solid var(--danger);
  border-radius: var(--radius); padding: 9px 12px;
}
.help-ticket-btn:hover { filter: brightness(1.08); }
.help-ticket-btn:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px; }
.help-ticket-note {
  font-size: 11px; line-height: 1.45; color: var(--muted); margin-top: 7px;
}
/* the quiet door to the threads, under the red button */
.help-ticket-mine {
  width: 100%; margin-top: 7px; cursor: pointer; font: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--ink-soft); background: transparent;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.help-ticket-mine:hover { border-color: var(--accent); color: var(--accent); }
.ticket-badge {
  display: none; min-width: 17px; padding: 1px 7px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
  line-height: 1.5; text-align: center;
  align-items: center; gap: 4px;
}
.ticket-badge .bell-glyph svg { width: 11px; height: 11px; }

/* the red ringing bell: a support reply is waiting. It rides the "Help"
   rail button (a click goes straight to My tickets) and the My-tickets
   badge inside the Help window. Deliberately LOUD — a solid red chip that
   sways, with a breathing halo: a reply from support must not be missed. */
.bell-glyph { display: inline-grid; place-items: center; }
.bell-glyph svg {
  width: 15px; height: 15px; display: block;
  transform-origin: 50% 3px;
  animation: bell-ring 2.8s ease-in-out infinite;
}
.ticket-bell {
  display: inline-grid; place-items: center; flex: none;
  width: 26px; height: 26px; border-radius: 999px; cursor: pointer;
  background: var(--danger); color: #fff;
  animation: bell-sway 2.6s ease-in-out infinite,
             bell-halo 2.6s ease-in-out infinite;
  transform-origin: 50% -30%;
}
.ticket-bell .bell-glyph svg { width: 16px; height: 16px; }
.ticket-bell:hover { filter: brightness(1.12); }
.ticket-bell:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px; }
@keyframes bell-sway {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(7deg); }
  75% { transform: rotate(-7deg); }
}
@keyframes bell-halo {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 52, 43, .45); }
  50% { box-shadow: 0 0 0 6px rgba(196, 52, 43, 0); }
}
@keyframes bell-ring {
  0%, 55%, 100% { transform: rotate(0); }
  60% { transform: rotate(13deg); }
  65% { transform: rotate(-11deg); }
  70% { transform: rotate(8deg); }
  75% { transform: rotate(-6deg); }
  80% { transform: rotate(3deg); }
  85% { transform: rotate(0); }
}
@media (prefers-reduced-motion: reduce) {
  .bell-glyph svg, .ticket-bell { animation: none; }
}
/* the explanatory dropdown (ticket kind): closed face carries the choice
   and its meaning; the open list is a listbox of word + hint rows */
.nice-select-wrap { position: relative; }
.nice-select {
  width: 100%; display: flex; align-items: center; gap: 10px;
  font: inherit; text-align: left; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; cursor: pointer;
  transition: border-color .12s;
}
.nice-select:hover, .nice-select[aria-expanded="true"] { border-color: var(--accent); }
.nice-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.nice-select-face { flex: 1; min-width: 0; display: flex; align-items: baseline;
  gap: 9px; }
.nice-select-face b { font-weight: 640; white-space: nowrap; }
.nice-select-hint { color: var(--muted); font-size: 12px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.nice-select-caret { flex: none; color: var(--muted); }
.nice-select-caret svg { width: 15px; height: 15px; display: block;
  transition: transform .15s; }
.nice-select[aria-expanded="true"] .nice-select-caret svg { transform: rotate(180deg); }
.nice-select-menu {
  position: absolute; z-index: 40; top: calc(100% + 5px); left: 0; right: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 5px; display: grid; gap: 2px;
}
.nice-select-row {
  display: flex; align-items: baseline; gap: 9px; width: 100%;
  font: inherit; text-align: left; color: var(--ink); background: none;
  border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer;
}
.nice-select-row b { font-weight: 620; white-space: nowrap; }
.nice-select-row:hover, .nice-select-row:focus-visible {
  background: var(--bg-tint, rgba(34, 84, 121, .07)); outline: none;
}
.nice-select-row[aria-selected="true"] { background: var(--accent-soft, rgba(34, 84, 121, .12)); }

/* the list of my tickets, one row per conversation */
.ticket-row {
  width: 100%; display: flex; align-items: center; gap: 11px; cursor: pointer;
  font: inherit; text-align: left; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 13px; margin: 0 0 8px;
  transition: border-color .12s, box-shadow .12s;
}
.ticket-row:hover { border-color: var(--accent); box-shadow: var(--shadow); }
/* a waiting reply announces itself the same red as the bell */
.ticket-row.has-new { border-left: 3px solid var(--danger); padding-left: 11px; }
.ticket-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ticket-row-subject {
  font-weight: 600; font-size: 13px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.ticket-row-meta {
  font-size: 11px; color: var(--muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.ticket-row-right {
  flex: none; display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px;
}
.ticket-row-when { font-size: 11px; color: var(--muted); }
.ticket-unread {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; background: var(--danger);
  color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.ticket-unread .bell-glyph svg { width: 11px; height: 11px; }
.ticket-status {
  flex: none; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap;
}
.ticket-status--open { color: var(--accent); border-color: var(--accent); }
.ticket-status--in_progress { color: var(--warn); border-color: var(--warn); }
.ticket-status--resolved { color: var(--ok); border-color: var(--ok); }
/* per-state list marks: the ring / half disc / check / dash before each row */
.ticket-mark { flex: none; display: grid; place-items: center; }
.ticket-mark svg { width: 19px; height: 19px; display: block; }
.ticket-mark--open { color: var(--accent); }
.ticket-mark--in_progress { color: var(--warn); }
.ticket-mark--resolved { color: var(--ok); }
.ticket-mark--closed { color: var(--faint); }
/* the ledger above the list: how many stand in each state */
.ticket-sum {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin: 0 0 12px; font-size: 12px; color: var(--muted);
}
.ticket-sum-item { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.ticket-sum-item i { width: 8px; height: 8px; border-radius: 99px; background: var(--faint); }
.ticket-sum--open i { background: var(--accent); }
.ticket-sum--in_progress i { background: var(--warn); }
.ticket-sum--resolved i { background: var(--ok); }
.ticket-sum-note { margin-left: auto; color: var(--faint); font-size: 11.5px; }
/* first visit: an honest empty state with the one useful action */
.ticket-empty {
  display: grid; justify-items: center; gap: 6px; text-align: center;
  padding: 44px 20px 48px; border: 1px dashed var(--line);
  border-radius: var(--radius-lg); background: var(--bg);
}
.ticket-empty-glyph { color: var(--faint); }
.ticket-empty-glyph svg { width: 34px; height: 34px; display: block; }
.ticket-empty-title { font-size: 14.5px; font-weight: 650; margin-top: 4px; }
.ticket-empty-sub {
  max-width: 380px; margin: 0 0 10px; font-size: 12.5px; line-height: 1.55;
  color: var(--muted);
}
/* severity: one tight list — a row per level, its meaning beside the word.
   The whole choice reads at a glance and costs four slim rows, not a card
   wall; the picked row wears the accent edge like the rest of the product. */
.sev-list {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); overflow: hidden;
}
.sev-row {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 8px 12px; margin: 0; border-bottom: 1px solid var(--line-soft);
  font-weight: 400; transition: background .12s, box-shadow .12s;
}
.sev-row:last-child { border-bottom: 0; }
.sev-row:hover { background: var(--bg); }
.sev-row.on { background: var(--accent-soft); box-shadow: inset 2.5px 0 0 var(--accent); }
.sev-row input { flex: none; margin: 0; }
.sev-row:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.sev-word {
  flex: none; min-width: 84px; display: inline-flex; align-items: center;
  gap: 7px; font-size: 13px; font-weight: 650; color: var(--ink);
}
.sev-word i, .sev-chip i { width: 8px; height: 8px; border-radius: 99px;
  background: var(--faint); flex: none; }
.sev-row--low i { background: var(--faint); }
.sev-row--normal i { background: var(--accent); }
.sev-row--high i { background: var(--warn); }
.sev-row--critical i { background: var(--danger); }
.sev-hint { flex: 1; min-width: 0; font-size: 12px; line-height: 1.4;
  color: var(--muted); }
.sev-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px;
  border-radius: 999px; border: 1px solid var(--line); font-size: 11px;
  font-weight: 600; color: var(--muted); white-space: nowrap;
}
.sev-chip--low i { background: var(--faint); }
.sev-chip--normal i { background: var(--accent); }
.sev-chip--high i { background: var(--warn); }
.sev-chip--critical i { background: var(--danger); }
/* the form: fields on the left, the two content cards on the right */
.ticket-form-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 22px;
  align-items: start;
}
.ticket-form-main { min-width: 0; display: grid; gap: 12px; }
.ticket-form-aside { display: grid; gap: 12px; }
.ticket-aside-card {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--bg); padding: 13px 15px;
}
.ticket-aside-title {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 8px;
}
.ticket-aside-steps, .ticket-aside-list {
  margin: 0; padding-left: 17px; display: grid; gap: 7px;
  font-size: 12.5px; line-height: 1.5; color: var(--ink-soft);
}
.ticket-aside-steps li::marker { color: var(--accent); font-weight: 700; }
.ticket-aside-list { list-style: none; padding-left: 2px; }
.ticket-aside-list li { padding-left: 15px; position: relative; }
.ticket-aside-list li::before {
  content: ""; position: absolute; left: 0; top: .52em;
  width: 7px; height: 7px; border: 1.5px solid var(--accent);
  border-radius: 2px; opacity: .75;
}
@media (max-width: 900px) {
  .ticket-form-grid { grid-template-columns: 1fr; }
}
/* the ticket's passport under the thread title */
.ticket-thread-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: -4px 0 14px; font-size: 12px; color: var(--muted);
}
.ticket-thread-meta .mono { font-weight: 700; color: var(--ink-soft); }
.tmeta-sep { color: var(--line); }
/* the conversation: our replies get the brand edge, yours stay plain */
.ticket-head-row { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.ticket-thread { margin: 0 0 14px; max-height: 46vh; overflow-y: auto; }
.ticket-msg { margin: 0 0 12px 0; padding-right: 26px; }
.ticket-msg--op { padding-right: 0; padding-left: 26px; }
.ticket-msg-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted); margin: 0 0 4px;
}
.ticket-msg-meta b { color: var(--ink); }
.ticket-msg--op .ticket-msg-meta b { color: var(--accent); }
.ticket-ava {
  flex: none; width: 20px; height: 20px; border-radius: 6px;
  display: inline-grid; place-items: center;
  background: var(--line-soft); color: var(--muted);
}
.ticket-ava svg { width: 12px; height: 12px; display: block; }
.ticket-ava.op {
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
}
.ticket-msg-body {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 13px; font-size: 13px;
  line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.ticket-msg--op .ticket-msg-body { border-left: 3px solid var(--accent); background: var(--accent-soft); }
/* "no replies yet" — a waiting line, not a dead end */
.ticket-await {
  display: flex; align-items: center; gap: 9px; margin: 2px 0 0;
  padding: 9px 12px; border: 1px dashed var(--line); border-radius: var(--radius);
  font-size: 12.5px; color: var(--muted); background: var(--panel);
}
.ticket-await-dot {
  flex: none; width: 8px; height: 8px; border-radius: 99px;
  background: var(--accent); animation: walk-pulse 1.6s ease-in-out infinite;
}
/* the "a technician will log into your server" warning */
.ticket-warn {
  background: var(--danger-soft); border-left: 3px solid var(--danger);
  border-radius: 6px; padding: 9px 11px; font-size: 12.5px; line-height: 1.5;
  color: var(--ink-soft); margin-bottom: 12px;
}
/* ---- ticket screens: full-window views inside the Help panel ---- */
.tscreen { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 26px 26px; }
.tscreen-head {
  display: flex; align-items: center; gap: 10px;
  max-width: 760px; margin: 0 auto 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line-soft);
}
.tscreen-back { font-size: 18px; flex: none; }
.tscreen-title {
  flex: 1; margin: 0; font-size: 16.5px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.tscreen-actions { flex: none; display: flex; align-items: center; gap: 8px; }
.tscreen-body { max-width: 760px; margin: 0 auto; }
.tscreen-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.tscreen .ticket-thread { max-height: none; overflow: visible; }
/* server-access consent: an explicit, revocable grant */
.ticket-consent {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin: 4px 0 14px;
}
.ticket-consent-row {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink);
}
.ticket-consent-row input[type="checkbox"] { flex: none; margin: 0; }
.ticket-consent-note { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.ticket-consent-creds { margin-top: 12px; }
.help-toc a {
  padding: 7px 11px; border-radius: var(--radius); font-size: 13px;
  color: var(--ink-soft); text-decoration: none; line-height: 1.35;
}
.help-toc a:hover { background: var(--line-soft); text-decoration: none; }
.help-toc a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.help-content { overflow-y: auto; padding: 6px 26px 40px; scroll-behavior: smooth; }
.help-section { padding: 18px 0 4px; border-bottom: 1px solid var(--line-soft); border-radius: 8px; }
.help-section:last-child { border-bottom: 0; }
.help-section h3 { font-size: 17px; margin: 0 0 8px; }
.help-section .doc-h { font-size: 13.5px; color: var(--ink); margin: 14px 0 4px; }
.help-section p { font-size: 13.5px; line-height: 1.65; color: var(--ink-soft); margin: 0 0 8px; }
.doc-steps, .doc-list { margin: 4px 0 10px; padding-left: 20px; font-size: 13.5px; line-height: 1.6; }
.doc-steps li, .doc-list li { margin: 5px 0; color: var(--ink-soft); }
.doc-steps li { padding-left: 4px; }
.doc-note {
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 9px 12px; margin: 6px 0 12px;
  font-size: 13px; line-height: 1.55; color: var(--ink-soft);
}
.doc-fields { margin: 4px 0 12px; display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
.doc-fields dt { font-weight: 600; font-size: 13px; color: var(--ink); }
.doc-fields dd { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-soft); }
@keyframes help-flash { from { background: var(--warn-soft); } to { background: transparent; } }
.help-flash { animation: help-flash 1.6s ease-out; }

/* Topics chip + backdrop exist only on phones; the drawer treatment itself
   lives in the shared 820px mobile block with the app's other drawers —
   the old 720px "display:none the TOC" rule deleted the navigation AND the
   support buttons that lived inside it. */
.help-toc-toggle { display: none; }
.help-toc-backdrop { display: none; }
.composer { border-top: 1px solid var(--line); background: var(--panel);
            padding: 12px 22px 14px; }
.composer-box {
  max-width: 820px; margin: 0 auto;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  transition: border-color .12s, box-shadow .12s;
}
.composer-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.composer textarea {
  display: block; width: 100%; resize: none; border: 0; background: none;
  min-height: 42px; max-height: 150px; padding: 11px 14px 4px;
  font-size: 13.5px; line-height: 1.5;
}
.composer textarea:focus { outline: none; }
.composer-bar {
  display: flex; align-items: center; gap: 10px; padding: 4px 8px 8px 14px;
}
.composer-hint { flex: 1; font-size: 11px; color: var(--faint); }
.send-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; border-radius: 9px; background: var(--accent);
  color: var(--accent-ink); font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 15px; cursor: pointer;
}
.send-btn:hover { filter: brightness(1.12); }
.send-btn:disabled { opacity: .55; cursor: default; }
.send-btn svg { width: 13px; height: 13px; display: block; }
.thinking { color: var(--muted); font-style: italic; }
.bubble.thinking { animation: chat-think 1.6s ease-in-out infinite; }
/* the little proof-of-life line under "Retrieving and answering…" */
.thinking-sub {
  font-size: 11px; font-style: normal; color: var(--faint);
  font-variant-numeric: tabular-nums; margin-top: 2px; min-height: 15px;
}
@keyframes chat-think { 50% { opacity: .55; } }
.msg.assistant .bubble.notice {
  background: var(--warn-soft); border-color: #e9dcc0; color: var(--warn);
  box-shadow: none; font-size: 13px;
}
/* first-run canvas */
.chat-empty {
  text-align: center; padding: 9vh 20px 20px; display: grid; gap: 10px;
  justify-items: center;
}
.chat-empty-logo { width: 58px; height: 58px; object-fit: contain;
                   filter: drop-shadow(0 2px 6px rgba(22, 50, 74, .18)); }
.chat-empty-title { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.chat-empty-sub { max-width: 480px; font-size: 13px; line-height: 1.6;
                  color: var(--muted); }

/* -- admin -- */
.admin-layout { display: grid; grid-template-columns: 240px 1fr; height: 100vh; }
.admin-side {
  border-right: 1px solid var(--line); background: var(--panel);
  display: flex; flex-direction: column; min-height: 0;
}
.admin-nav {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 6px 10px 14px; display: flex; flex-direction: column; gap: 1px;
}
.admin-nav .nav-label {
  font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--faint); padding: 12px 12px 5px;
}
.admin-nav button {
  display: flex; align-items: center; gap: 10px;
  text-align: left; padding: 8px 12px; border: 0; background: transparent;
  border-radius: var(--radius); font: inherit; font-size: 13.5px;
  color: var(--ink-soft); cursor: pointer;
}
.admin-nav button svg { width: 16px; height: 16px; flex: none; opacity: .75; }
.admin-nav button:hover { background: var(--bg); }
.admin-nav button.active {
  background: var(--accent-soft); color: var(--accent-deep); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}
.admin-nav button.active svg { opacity: 1; }
/* the working grid on the canvas: data panels stay solid white on top of it;
   two faint oblique slices give the ground its sharp-shape depth */
.admin-main {
  overflow-y: auto; padding: 24px;
  background-image:
    linear-gradient(105deg, transparent 62%, rgba(34, 84, 121, .045) 62%, rgba(34, 84, 121, .045) 70%, transparent 70%),
    linear-gradient(105deg, transparent 71.5%, rgba(208, 133, 66, .055) 71.5%, rgba(208, 133, 66, .055) 74%, transparent 74%),
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='120'%20height='120'%3E%3Cpath%20d='M60%2054v12M54%2060h12'%20stroke='%23225479'%20stroke-opacity='.26'/%3E%3C/svg%3E"),
    linear-gradient(rgba(34, 84, 121, .065) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 84, 121, .065) 1px, transparent 1px),
    linear-gradient(rgba(34, 84, 121, .034) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 84, 121, .034) 1px, transparent 1px);
  background-size: auto, auto, 120px 120px, 120px 120px, 120px 120px, 20px 20px, 20px 20px;
  background-position: 0 0, 0 0, 0 0, 60.5px 60.5px, 60.5px 60.5px, .5px .5px, .5px .5px;
}
.admin-main section { max-width: 1100px; margin: 0 auto; display: none; }
.admin-main section.visible { display: block; }
.section-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
                padding: 4px 0 14px; border-bottom: 1px solid var(--line-soft);
                margin-bottom: 12px; }
.section-head h2 { font-size: 19px; }
.section-head h2::before { content: "+"; color: var(--accent); font-weight: 400; margin-right: 9px; }
.section-head .spacer { flex: 1; }
/* a second block within a section (Groups lives under Users) */
.section-head.sub-head { margin-top: 30px; padding-bottom: 10px; }
.section-head.sub-head h3 { font-size: 16px; margin: 0; }
.section-head.sub-head h3::before { content: "+"; color: var(--accent);
                                    font-weight: 400; margin-right: 9px; }
.section-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; max-width: 760px; }

/* overview */
.health-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
            gap: 12px; margin-bottom: 16px; }
.health.sys.click { cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.health.sys.click:hover { border-color: var(--accent); }
.sys-open { float: right; color: var(--faint); font-size: 12px; }
.health.sys.click:hover .sys-open { color: var(--accent); }
/* most active users */
.top-users { display: grid; gap: 4px; }
.tu-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px;
          border-radius: 8px; }
.tu-row:hover { background: var(--bg); }
.avatar { flex: none; width: 28px; height: 28px; border-radius: 8px;
          display: inline-grid; place-items: center;
          background: var(--accent-soft); color: var(--accent);
          font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.tu-id { flex: 1; min-width: 0; }
.tu-name { font-size: 13px; font-weight: 600; overflow: hidden;
           text-overflow: ellipsis; white-space: nowrap; }
.tu-meta { font-size: 11.5px; color: var(--faint); }
.tu-bar { flex: 0 0 90px; height: 5px; border-radius: 3px;
          background: var(--line-soft); overflow: hidden; }
.tu-bar span { display: block; height: 100%; border-radius: 3px;
               background: var(--accent); }
.tu-n { flex: none; min-width: 22px; text-align: right;
        font-family: var(--mono); font-size: 12px; font-weight: 600; }
/* setup checklist */
.setup-list { display: grid; gap: 2px; }
.setup-sum { font-size: 12px; font-weight: 600; color: var(--muted);
             margin-bottom: 6px; }
.setup-row { display: flex; align-items: center; gap: 10px; padding: 7px 6px;
             border-radius: 8px; cursor: pointer; font-size: 13px; }
.setup-row:hover { background: var(--bg); }
.setup-row.done { color: var(--muted); }
.setup-go { font-size: 12px; color: var(--accent); font-weight: 600; }
/* security & privacy: measured facts, not decorative lights */
.sec-card { display: flex; flex-direction: column; }
.sec-head { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.sec-head h3 { margin: 0; }
.sec-facts { display: grid; gap: 7px; flex: 1; }
.sec-fact { font-size: 12.5px; line-height: 1.5; color: var(--ink-soft);
            padding-left: 12px; position: relative; }
.sec-fact::before { content: ""; position: absolute; left: 0; top: 7px;
                    width: 4px; height: 4px; border-radius: 2px;
                    background: var(--line); }
#sec-cards { margin-top: 14px; }
#sec-cards .sec-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.sec-advisories { display: grid; gap: 6px; margin-top: 10px; }

/* settings sub-tabs */
.seg-tabs { display: inline-flex; border: 1px solid var(--line);
            border-radius: 9px; overflow: hidden; background: var(--panel); }
.seg-tabs button { border: 0; background: none; padding: 7px 14px;
                   font: inherit; font-size: 13px; font-weight: 550;
                   color: var(--muted); cursor: pointer; }
.seg-tabs button + button { border-left: 1px solid var(--line-soft); }
.seg-tabs button.on { background: var(--accent-soft); color: var(--accent); }
.settings-tab { display: none; }
.settings-tab.visible { display: block; }
/* plan & usage — the client's own view of where they stand on their plan */
.plan-card { max-width: 620px; }
.plan-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.plan-badge {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 99px;
  font-size: 13px; font-weight: 650; letter-spacing: .01em;
  color: var(--accent); background: var(--accent-soft);
}
.plan-badge.none { color: var(--muted); background: var(--bg);
                   border: 1px solid var(--line); }
.plan-note { margin: 2px 0 4px; font-size: 12.5px; }
.usage-meters { display: grid; gap: 16px; margin-top: 12px; }
.usage-meter { display: grid; gap: 7px; }
.usage-meter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.usage-meter-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.usage-meter-head { font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
                    font-variant-numeric: tabular-nums; }
.usage-bar { height: 8px; border-radius: 99px; background: var(--line-soft);
             overflow: hidden; }
.usage-bar-fill { display: block; height: 100%; border-radius: 99px;
                  background: var(--accent); min-width: 3px;
                  transition: width .5s cubic-bezier(.22, 1, .36, 1); }
.usage-bar-fill.near { background: var(--warn); }
.usage-bar-fill.over { background: var(--danger); }
.usage-meter-sub { font-size: 11.5px; color: var(--muted); }
/* groups manager (modal off the Users page) */
.group-list { display: grid; gap: 6px; max-height: 52vh; overflow-y: auto; }
.group-row { display: flex; align-items: center; gap: 10px;
             padding: 10px 12px; border: 1px solid var(--line-soft);
             border-radius: 10px; background: var(--bg); }
.group-row-head { display: flex; align-items: center; gap: 8px; }
.group-count { font-size: 12px; color: var(--muted); }
.group-row .sub { margin-top: 2px; }
.health {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 13px 15px;
}
.health .h-label { font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin-bottom: 5px; }
.health .h-value { font-size: 13.5px; font-weight: 600; }
.health .h-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.attention { border-left: 3px solid var(--warn); margin-bottom: 14px; }
.attention h3 { color: var(--warn); }
.ch-warns { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.ch-warn { background: var(--warn-soft); border: 1px solid #e9dcc0; color: var(--warn);
  border-radius: var(--radius); padding: 9px 12px; font-size: 12.5px; line-height: 1.45; }
.attention ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.attention li { margin: 3px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 940px) { .grid-2 { grid-template-columns: 1fr; } }

pre.block {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; overflow-x: auto; font-size: 12px; margin: 8px 0 0;
  white-space: pre-wrap; word-break: break-word;
  font-family: Consolas, "Cascadia Mono", monospace;
}
.form-grid { display: grid; gap: 12px; }
.form-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

/* -- direction 01: registration grid + decor plates (auth zone = 100%, P13) -- */
/* 20px fine grid, 120px majors, steel crosshair marks at major intersections,
   sparse plotted cells. isolation traps the plates between pattern and card. */
.login-wrap {
  isolation: isolate; overflow: hidden;
  background-image:
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='120'%20height='120'%3E%3Cpath%20d='M60%2054v12M54%2060h12'%20stroke='%23225479'%20stroke-opacity='.45'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='480'%20height='480'%3E%3Crect%20x='140'%20y='60'%20width='20'%20height='20'%20fill='%23225479'%20fill-opacity='.10'/%3E%3Crect%20x='380'%20y='200'%20width='20'%20height='20'%20fill='%23D08542'%20fill-opacity='.16'/%3E%3Crect%20x='60'%20y='340'%20width='20'%20height='20'%20fill='%23225479'%20fill-opacity='.10'/%3E%3Crect%20x='280.5'%20y='420.5'%20width='19'%20height='19'%20fill='none'%20stroke='%23225479'%20stroke-opacity='.22'/%3E%3C/svg%3E"),
    linear-gradient(rgba(34, 84, 121, .10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 84, 121, .10) 1px, transparent 1px),
    linear-gradient(rgba(34, 84, 121, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 84, 121, .055) 1px, transparent 1px);
  background-size: 120px 120px, 480px 480px, 120px 120px, 120px 120px, 20px 20px, 20px 20px;
  background-position: 0 0, 0 0, 60.5px 60.5px, 60.5px 60.5px, .5px .5px, .5px .5px;
}
/* two tall oblique slices behind everything on the auth stage */
.login-wrap { position: relative; }
.login-wrap::before, .login-wrap::after { content: ""; position: absolute; z-index: -2; }
.login-wrap::before {
  left: 16%; top: -8%; bottom: -8%; width: 42px;
  background: var(--accent); opacity: .10; transform: skewX(-18deg);
}
.login-wrap::after {
  right: 20%; top: -8%; bottom: -8%; width: 90px;
  background: rgba(208, 133, 66, .08);
  transform: skewX(-18deg);
}
/* card stays static (no transform/opacity: a stacking context would pull the
   z:-1 plates above its background); only the plates and footer animate */
.login-card { position: relative; box-shadow: var(--shadow-lg); }
.login-card::before, .login-card::after { content: ""; position: absolute; z-index: -1; }
.login-card::before {
  left: -26px; top: -26px; width: 190px; height: 130px;
  background: var(--accent);
  animation: plate-left .55s cubic-bezier(.22, 1, .36, 1) .05s backwards;
}
.login-card::after {
  right: -32px; bottom: -28px; width: 210px; height: 140px;
  border: 1px solid rgba(208, 133, 66, .85);
  animation: plate-up .55s cubic-bezier(.22, 1, .36, 1) .15s backwards;
}
.login-wrap .powered { animation: plate-up .55s cubic-bezier(.22, 1, .36, 1) .3s backwards; }
@keyframes plate-left { from { opacity: 0; transform: translateX(-18px); } }
@keyframes plate-up   { from { opacity: 0; transform: translateY(14px); } }

/* visible keyboard focus (P7) */
.btn:focus-visible, .icon-btn:focus-visible, .help-q:focus-visible,
.admin-nav button:focus-visible, .cite-chip:focus-visible,
.help-suggest:focus-visible, .help-answer:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* -- overview status banner: the verdict first, utilities at its edge -- */
.ov-status {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 13px 16px; margin-bottom: 14px;
}
.ov-status.ok { border-left: 3px solid var(--ok); }
.ov-status.warn { border-left: 3px solid var(--warn); }
.ov-status .ov-line { display: flex; align-items: center; gap: 10px; flex: 1;
                      min-width: 260px; flex-wrap: wrap; }
.ov-status b { font-size: 14px; }
.ov-status .ov-meta { font-family: var(--mono); font-size: 11px;
                      letter-spacing: .03em; color: var(--faint); }
.ov-status .ov-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.attn-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px;
            border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.attn-row:last-child { border-bottom: 0; }
.attn-row .grow { flex: 1; }

/* -- row overflow menu ("⋯") -- */
.menu-btn { font-weight: 700; letter-spacing: .05em; }
.menu-pop {
  position: fixed; z-index: 300; min-width: 176px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 4px; display: grid; gap: 2px;
}
.menu-item {
  text-align: left; border: 0; background: transparent; border-radius: 6px;
  padding: 7px 10px; font: inherit; font-size: 12.5px; color: var(--ink-soft);
  cursor: pointer;
}
.menu-item:hover { background: var(--bg); color: var(--ink); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }

/* -- table filter in section heads -- */
.table-filter { width: 190px; font-size: 12.5px; padding: 6px 10px; }

/* -- designed empty states -- */
.empty-inner { display: grid; justify-items: center; gap: 8px; padding: 4px 0 6px; }
.empty-inner b { font-size: 13.5px; color: var(--ink); }
.empty-inner p { max-width: 54ch; margin: 0; line-height: 1.55; }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
                 margin-top: 4px; }

/* -- settings: one save for the whole page, dirty state visible -- */
.save-bar {
  position: sticky; bottom: 14px; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 10px 16px; margin-top: 16px;
}
.save-bar .spacer { flex: 1; }
.save-bar .dirty { color: var(--warn); font-weight: 600; }

/* -- channel cards: the integration, its logo, and both signals at a glance -- */
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
           gap: 12px; }
.ch-card {
  text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 14px;
  font: inherit; color: inherit; cursor: pointer; display: grid; gap: 12px;
  transition: border-color .12s, box-shadow .12s, transform .05s;
}
.ch-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.ch-card:active { transform: translateY(1px); }
.ch-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ch-card.off { opacity: .55; }
.ch-card-top { display: flex; gap: 11px; align-items: center; min-width: 0; }
.ch-glyph {
  width: 40px; height: 40px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
}
.ch-glyph svg { width: 22px; height: 22px; display: block; }
/* the "Other — request it" card: an ask, not an integration — dashed, muted */
.ch-card--other { border-style: dashed; box-shadow: none; }
.ch-card--other .ch-glyph { border: 1px dashed var(--line); color: var(--muted); }
.ch-card--other:hover { border-color: var(--accent); border-style: dashed; }
/* official logo files sit on a white tile with a hairline, not a colour fill */
.ch-glyph.logo { background: #fff; border: 1px solid var(--line); }
.ch-glyph.logo img { width: 24px; height: 24px; display: block; object-fit: contain; }
.ch-id { min-width: 0; flex: 1; }
.ch-name { font-size: 14px; font-weight: 650; color: var(--ink);
           overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-kind { font-size: 12px; color: var(--muted); }
.ch-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-top: 1px solid var(--line-soft); padding-top: 10px; font-size: 12.5px;
}
.ch-sig { display: flex; align-items: center; color: var(--ink-soft); font-weight: 550; }
.ch-people { font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em;
             color: var(--faint); }
.grid-empty {
  grid-column: 1 / -1; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 30px 20px; text-align: center; color: var(--muted); font-size: 13px;
}

/* catalog structure: configured instances, then every available platform */
.grid-label {
  grid-column: 1 / -1; font-family: var(--mono); font-size: 10px;
  font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); padding: 14px 2px 0;
}
.ch-desc { font-size: 12px; color: var(--muted); line-height: 1.45;
           display: -webkit-box; -webkit-line-clamp: 2;
           -webkit-box-orient: vertical; overflow: hidden; }
.ch-card.avail { box-shadow: none; }
.ch-card.avail .ch-glyph { opacity: .9; }
.ch-setup { color: var(--accent); font-weight: 600; font-size: 12px; flex: none; }

/* integration detail: hero + setup progress */
.ch-hero { display: flex; gap: 12px; align-items: center;
           padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.ch-hero .badge { flex: none; }
.ch-hero .icon-btn { flex: none; }
.src-meta {
  display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 10px 2px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 11px; letter-spacing: .03em;
  color: var(--muted);
}
.src-meta .src-warn { color: var(--danger); font-weight: 600; }
.err-note {
  background: var(--danger-soft); border-left: 3px solid var(--danger);
  border-radius: var(--radius); padding: 9px 12px; margin-top: 10px;
  font-size: 12.5px; line-height: 1.5; color: var(--danger);
  overflow-wrap: anywhere;
}

/* user ↔ channel identity rows (edit/add user dialogs) */
.ident-row { display: flex; gap: 10px; align-items: flex-start; }
.ident-row .ch-glyph { width: 28px; height: 28px; border-radius: 6px; }
.ident-row .ch-glyph img { width: 17px; height: 17px; }
.ident-row .ch-glyph svg { width: 16px; height: 16px; }
.ident-info { flex: 1; min-width: 0; }
.ident-name { font-size: 12.5px; font-weight: 600; }
.ident-name .ident-kind { color: var(--faint); font-weight: 400; font-size: 11.5px; }
.ident-add { display: flex; gap: 6px; margin-top: 4px; }
.ident-add input { flex: 1; font-size: 12.5px; padding: 5px 9px; }
.ident-cur { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center;
             margin-top: 4px; }
.ch-inline-btn { padding: 2px 9px; flex: none; }

/* collapsible form sections — optional groups closed until needed */
.form-fold { border: 1px solid var(--line); border-radius: var(--radius); }
.form-fold summary {
  list-style: none; cursor: pointer; padding: 9px 12px;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between;
}
.form-fold summary::-webkit-details-marker { display: none; }
.form-fold summary::after { content: "\25B8"; color: var(--faint); }
.form-fold[open] summary::after { content: "\25BE"; }
.form-fold summary:hover { color: var(--ink); }
.form-fold summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.form-fold .fold-body { padding: 8px 12px 12px; display: grid; gap: 12px;
                        border-top: 1px solid var(--line-soft); }
.ch-progress { display: flex; align-items: center; gap: 10px; margin: 2px 0 4px; }
.ch-progress-bar { flex: 1; height: 6px; background: var(--accent-soft);
                   border-radius: 99px; overflow: hidden; }
.ch-progress-bar i { display: block; height: 100%; background: var(--accent);
                     transition: width .3s ease; }
.ch-progress-label { font-family: var(--mono); font-size: 10.5px;
                     letter-spacing: .05em; color: var(--muted); flex: none; }

/* -- raw payloads behind a disclosure -- */
details.raw summary { cursor: pointer; font-size: 12px; color: var(--muted);
                      user-select: none; }
details.raw summary:hover { color: var(--ink); }
details.raw[open] summary { margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  .login-card::before, .login-card::after, .login-wrap .powered { animation: none; }
  .modal, .help-center, .help-flash { animation: none; }
  .btn, .cite-chip, .help-answer, .help-q, #toast { transition: none; }
}

/* ============================= first-run setup ============================= */
/* Same working-grid language as the console; the auth-zone registration grid
   carries the stage (P13), the card stays a solid instrument panel. */
.setup-shell { display: grid; grid-template-columns: 250px 1fr; height: 100vh; }
.setup-rail {
  border-right: 1px solid var(--line); background: var(--panel);
  display: flex; flex-direction: column; min-height: 0;
}
.setup-steps { flex: 1; overflow-y: auto; padding: 10px; display: flex;
               flex-direction: column; gap: 2px; }
.setup-step {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 9px 12px; border: 0; background: transparent; font: inherit;
  font-size: 13.5px; color: var(--ink-soft); border-radius: var(--radius);
  cursor: pointer;
}
.setup-step:disabled { color: var(--faint); cursor: default; }
.setup-step:not(:disabled):hover { background: var(--bg); }
.setup-step.current {
  background: var(--accent-soft); color: var(--accent-deep); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}
.setup-step-n {
  width: 21px; height: 21px; border-radius: 99px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  border: 1px solid var(--line); color: var(--muted); background: var(--panel);
}
.setup-step.current .setup-step-n { border-color: var(--accent);
  color: var(--accent-ink); background: var(--accent); }
.setup-step.done .setup-step-n { border-color: var(--ok);
  color: var(--ok); background: var(--ok-soft); }
.setup-rail-foot { border-top: 1px solid var(--line-soft); padding: 10px 12px 12px; }
.setup-rail-foot .powered { padding: 8px 10px 0; }

.setup-main { display: flex; flex-direction: column; min-height: 0;
  isolation: isolate; position: relative; overflow: hidden;
  background-image:
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='120'%20height='120'%3E%3Cpath%20d='M60%2054v12M54%2060h12'%20stroke='%23225479'%20stroke-opacity='.45'/%3E%3C/svg%3E"),
    linear-gradient(rgba(34, 84, 121, .10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 84, 121, .10) 1px, transparent 1px),
    linear-gradient(rgba(34, 84, 121, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 84, 121, .055) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 120px 120px, 20px 20px, 20px 20px;
  background-position: 0 0, 60.5px 60.5px, 60.5px 60.5px, .5px .5px, .5px .5px;
}
.setup-main::before { content: ""; position: absolute; z-index: -1;
  left: 12%; top: -8%; bottom: -8%; width: 42px;
  background: var(--accent); opacity: .07; transform: skewX(-18deg); }
.setup-main::after { content: ""; position: absolute; z-index: -1;
  right: 14%; top: -8%; bottom: -8%; width: 90px;
  background: rgba(208, 133, 66, .06); transform: skewX(-18deg); }
.setup-scroll { flex: 1; overflow-y: auto; padding: 34px 34px 20px; }
.setup-card {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 28px 30px 30px; max-width: 880px; margin: 0 auto;
  display: grid; gap: 14px; align-content: start;
  min-height: 470px;    /* steps swap without the footer jumping around */
}
.setup-card::before { content: ""; position: absolute; z-index: -1;
  left: -22px; top: -22px; width: 170px; height: 110px; background: var(--accent);
  animation: plate-left .55s cubic-bezier(.22, 1, .36, 1) .05s backwards; }
.setup-head h1 { font-size: 21px; letter-spacing: -.015em; }
.setup-sub { color: var(--muted); font-size: 13.5px; margin: 6px 0 0;
             max-width: 60ch; }
.setup-bar {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--line); background: var(--panel);
  padding: 12px 34px;
}
.setup-bar-progress { font-family: var(--mono); font-size: 11px;
  letter-spacing: .05em; color: var(--faint); }

.setup-note-ai {
  border: 1px solid var(--accent-soft); border-left: 3px solid var(--accent);
  background: #f6f9fb; border-radius: var(--radius); padding: 11px 14px;
  font-size: 13px; color: var(--ink-soft); max-width: 66ch;
}
.setup-later {
  display: flex; gap: 9px; align-items: baseline; font-size: 12.5px;
  color: var(--muted); max-width: 70ch;
}
.setup-later-mark {
  flex: none; width: 15px; height: 15px; border-radius: 99px; text-align: center;
  font-family: var(--mono); font-size: 10px; font-weight: 700; line-height: 15px;
  background: var(--accent-soft); color: var(--accent); transform: translateY(2px);
}
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
             gap: 10px; margin: 4px 0 2px; }
.lang-card {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--panel); font: inherit; cursor: pointer;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.lang-card:hover { border-color: var(--accent); }
.lang-card.on { border-color: var(--accent); background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent); }
.lang-flag { flex: none; width: 27px; height: 18px; border-radius: 3px;
  overflow: hidden; box-shadow: 0 0 0 1px rgba(22, 33, 43, .14),
  0 1px 2px rgba(22, 33, 43, .10); }
.lang-flag svg { display: block; width: 100%; height: 100%; }
.lang-id { display: grid; gap: 1px; min-width: 0; flex: 1; }
.lang-native { font-size: 14.5px; font-weight: 600; }
.lang-card.on .lang-native { color: var(--accent-deep); }
.lang-code { font-family: var(--mono); font-size: 10px; letter-spacing: .09em;
             color: var(--faint); }
.lang-card.on .lang-code { color: var(--accent); }
.lang-check { flex: none; width: 20px; height: 20px; border-radius: 99px;
  background: var(--accent); color: var(--accent-ink); font-size: 11px;
  font-weight: 700; display: inline-flex; align-items: center;
  justify-content: center; }

.setup-done-box {
  display: flex; gap: 12px; align-items: center;
  border: 1px solid var(--line); border-left: 3px solid var(--ok);
  border-radius: var(--radius); background: #f7faf8; padding: 12px 14px;
  font-size: 13px;
}
.setup-connected { display: grid; gap: 6px; }
.setup-src-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); padding: 9px 12px;
}
.setup-user-row {
  position: relative; display: grid; gap: 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; padding-right: 84px; background: #fbfcfd;
}
.setup-row-x { position: absolute; top: 9px; right: 9px; }
.setup-gpick-row { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.setup-gpick { display: inline-flex; align-items: center; gap: 6px;
  font-weight: 400; margin: 0; color: var(--ink); font-size: 12.5px; }
.setup-summary { display: grid; gap: 2px; border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 14px 16px; background: var(--panel); }
.setup-sum-row { display: flex; align-items: center; gap: 11px;
  padding: 7px 2px; font-size: 13.5px; border-bottom: 1px solid var(--line-soft); }
.setup-sum-row:last-child { border-bottom: 0; }

@media (max-width: 860px) {
  .setup-shell { grid-template-columns: 1fr; }
  .setup-rail { display: none; }
  .setup-scroll { padding: 18px 14px 12px; }
  .setup-bar { padding: 10px 14px; }
}

/* ============================= guided tour ============================= */
/* The RING is the whole spotlight: its border outlines the target and its
   giant box-shadow is the page-darkening veil — so the bright hole has the
   ring's own rounded corners, exactly (the old four-panel dim left square
   corners poking out past the rounding). The four .tour-shade panels are
   invisible click-guards tiling around the hole; they snap while the ring
   glides, so what is clickable is always the truth. */
.tour-shade {
  position: fixed; z-index: 620; background: transparent;
  /* gestures on the veil are forwarded to the page by the engine —
     the browser must not try to pan anything itself */
  touch-action: none;
}
.tour-ring {
  --tour-dim: rgba(22, 33, 43, .52);
  position: fixed; z-index: 621; box-sizing: border-box;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 200vmax var(--tour-dim),
              inset 0 0 0 2px rgba(255, 255, 255, .9),
              0 10px 34px rgba(22, 33, 43, .30);
  transition: all .26s cubic-bezier(.22, 1, .36, 1);
  touch-action: none;
}
/* no-target steps: the ring collapses to a point and the veil is total */
.tour-ring.veil { border-width: 0; }
/* while the page scrolls the spotlight tracks 1:1 — no rubber-banding */
.tour-ring.no-anim, .tour-pop.no-anim { transition: none !important; }
.tour-pop {
  position: fixed; z-index: 622; width: 336px; max-width: calc(100vw - 24px);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 15px 17px 12px; outline: none;
  transition: top .26s cubic-bezier(.22, 1, .36, 1),
              left .26s cubic-bezier(.22, 1, .36, 1);
}
.tour-pop::before { /* brand plate, same voice as the auth cards */
  content: ""; position: absolute; left: -1px; top: -1px; width: 44px; height: 5px;
  background: var(--accent); border-radius: 3px 0 0 0;
}
.tour-kicker { display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 6px; }
.tour-count { color: var(--faint); font-weight: 600; letter-spacing: .06em;
  text-transform: none; }
.tour-title { font-size: 15px; font-weight: 600; margin-bottom: 5px; }
.tour-body { font-size: 13px; color: var(--ink-soft); line-height: 1.55; }
.tour-bar { height: 3px; border-radius: 2px; background: var(--line-soft);
  margin: 12px 0 10px; overflow: hidden; }
.tour-bar i { display: block; height: 100%; background: var(--accent);
  border-radius: 2px; transition: width .26s cubic-bezier(.22, 1, .36, 1); }
.tour-foot { display: flex; align-items: center; gap: 8px; }
.tour-skip { border: 0; background: none; font: inherit; font-size: 12px;
  color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px;
  margin-left: -6px; }
.tour-skip:hover { background: var(--line-soft); color: var(--ink); }

/* The demo walkthrough rides the tour's look, but the ring is a DOOR, not
   glass: clicks pass through to the spotlit control, and the ring breathes
   to say "this one". Movement: the RING (carrying the veil) and the card
   glide slowly so the visitor sees where they are being taken — the guard
   shades still snap, so a click that lands in the hole is always meant. */
.tour-ring.walk {
  transition: all .65s cubic-bezier(.22, 1, .36, 1);
}
.tour-pop.walk {
  transition: top .65s cubic-bezier(.22, 1, .36, 1),
              left .65s cubic-bezier(.22, 1, .36, 1);
}
.tour-ring.walk {
  pointer-events: none;
  animation: walk-breathe 1.6s ease-in-out infinite;
}
/* "open" steps lift the veil entirely — the visitor may click anywhere */
.tour-ring.walk.open-step { --tour-dim: transparent; }
/* the breathe pulse must carry the veil shadow too, or the dim would blink */
@keyframes walk-breathe {
  0%, 100% { box-shadow: 0 0 0 200vmax var(--tour-dim, rgba(22, 33, 43, .52)),
                         inset 0 0 0 2px rgba(255, 255, 255, .9),
                         0 10px 34px rgba(22, 33, 43, .30),
                         0 0 0 0 rgba(34, 84, 121, .45); }
  50%      { box-shadow: 0 0 0 200vmax var(--tour-dim, rgba(22, 33, 43, .52)),
                         inset 0 0 0 2px rgba(255, 255, 255, .9),
                         0 10px 34px rgba(22, 33, 43, .30),
                         0 0 0 9px rgba(34, 84, 121, 0); }
}
.walk-hint {
  display: flex; align-items: center; gap: 8px;
  margin-top: 11px; padding: 7px 10px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 600;
}
.walk-dot {
  flex: none; width: 8px; height: 8px; border-radius: 99px;
  background: var(--accent);
  animation: walk-pulse 1.2s ease-in-out infinite;
}
@keyframes walk-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(.55); opacity: .55; }
}
.tour-pop.walk .tour-foot { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  .tour-shade, .tour-ring, .tour-pop { transition: none; }
  .tour-ring.walk, .walk-dot { animation: none; }
  .setup-card::before { animation: none; }
}

/* -- demo showroom ---------------------------------------------------------- */

/* the demo's login page grows a real door — the form below it is for
   real deployments, and the shared demo account has no password at all */
.demo-door {
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); background: var(--accent-soft);
  padding: 14px 16px; margin: 0 0 18px; text-align: center;
}
.demo-door-lead { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.demo-door-btn { display: inline-block; text-decoration: none; }
.demo-door-btn:hover { text-decoration: none; }
.demo-door-note { margin: 10px 0 0; font-size: 12px; color: var(--muted); }

#demo-ribbon {
  height: 34px; display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 0 14px; background: var(--accent); color: #fff;
  font-size: 12.5px; letter-spacing: .01em; position: relative; z-index: 60;
}
#demo-ribbon .demo-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #7fd4a8;
  box-shadow: 0 0 0 3px rgba(127, 212, 168, .25); flex: none;
}
#demo-ribbon a { color: #fff; font-weight: 600; text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .45); padding-bottom: 1px; }
#demo-ribbon a:hover { border-bottom-color: #fff; text-decoration: none; }
@media (max-width: 720px) { #demo-ribbon span:nth-child(2) { display: none; } }

body.demo-on .chat-layout,
body.demo-on .admin-layout,
body.demo-on .setup-shell { height: calc(100vh - 34px); }

.demo-suggest { margin-top: 26px; max-width: 660px; }
.demo-suggest-head {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--accent-warm);
  margin-bottom: 10px;
}
.demo-suggest-chips { display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; }
.suggest-chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft);
  border-radius: var(--radius); padding: 7px 12px; font: inherit;
  font-size: 12.5px; cursor: pointer; text-align: left;
  transition: border-color .12s, background .12s, color .12s;
}
.suggest-chip:hover { border-color: var(--accent); color: var(--accent);
  background: var(--accent-soft); }

/* -- a user's detail window (phones open it from the Users table) -- */
.udetail { display: grid; gap: 10px; }
.udetail-row { display: grid; grid-template-columns: 92px minmax(0, 1fr);
               gap: 10px; align-items: baseline; }
.udetail-label { font-size: 11px; font-weight: 700; letter-spacing: .05em;
                 text-transform: uppercase; color: var(--muted); }
.udetail-val { min-width: 0; overflow-wrap: anywhere; font-size: 13.5px; }
.udetail-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.udetail-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px;
                   padding-top: 12px; border-top: 1px solid var(--line-soft); }

/* ========================== mobile & tablet ========================== */
/* Everything below is width-gated: the desktop view is untouched by design.
   Small screens get the glass treatment — translucent, blurred surfaces
   floating over the working grid — the sidebars become off-canvas drawers,
   and a floating glass bar along the foot (Menu · Overview · Chat · Account)
   is the way around. */

/* the drawer chrome and the bottom bar exist only on small screens */
.rail-backdrop, #mnav, .side-close { display: none; }

/* ---- tablets: breathing room only, no re-layout ---- */
@media (max-width: 1024px) {
  .admin-main { padding: 20px 18px; }
  .chat-scroll { padding: 22px 16px; }
  .tscreen { padding: 14px 18px 24px; }
  .help-content { padding: 6px 18px 36px; }
}

/* ---- phones and small tablets: drawers, glass, touch targets ---- */
@media (max-width: 820px) {
  /* ---- the bottom bar: one floating glass pill, four ways to go.
     Menu opens the drawer, Overview/Chat switch surfaces, Account opens
     the drawer straight onto the account menu. It ducks away while
     scrolling down or typing (body.mnav-away) and returns on the way up.
     z-index 90: beneath every overlay and the drawer's backdrop, above
     the page — a veil or a modal always wins. ---- */
  #mnav {
    position: fixed; z-index: 90; left: 0; right: 0;
    bottom: calc(10px + env(safe-area-inset-bottom));
    margin: 0 auto; width: min(430px, calc(100vw - 28px));
    display: flex; align-items: stretch; padding: 5px;
    border: 1px solid rgba(255, 255, 255, .62); border-radius: 20px;
    background: rgba(255, 255, 255, .6);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
    box-shadow: 0 12px 34px rgba(22, 33, 43, .22), 0 2px 8px rgba(22, 33, 43, .1);
    transition: transform .28s cubic-bezier(.22, 1, .36, 1), opacity .22s;
  }
  body.mnav-away #mnav {
    transform: translateY(calc(100% + 18px));
    opacity: 0; pointer-events: none;
  }
  .mnav-btn {
    flex: 1 1 0; min-width: 0; display: grid; justify-items: center; gap: 2px;
    padding: 7px 4px 5px; border: 0; border-radius: 15px;
    background: transparent; color: var(--muted);
    font: inherit; cursor: pointer;
  }
  .mnav-btn[hidden] { display: none; }
  .mnav-btn:active { background: rgba(34, 84, 121, .08); }
  .mnav-btn.on { color: var(--accent); }
  .mnav-ico svg { width: 22px; height: 22px; display: block; }
  .mnav-label {
    font-size: 9.5px; font-weight: 600; letter-spacing: .02em; max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

  .rail-backdrop {
    display: block; position: fixed; inset: 0; z-index: 575;
    background: rgba(14, 26, 38, .38);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0; pointer-events: none; transition: opacity .24s ease;
  }
  body.rail-open .rail-backdrop { opacity: 1; pointer-events: auto; }

  /* dynamic-viewport heights: the URL bar must never eat the composer */
  .chat-layout, .admin-layout { height: 100dvh; }
  body.demo-on .chat-layout,
  body.demo-on .admin-layout { height: calc(100dvh - 34px); }

  /* ---- chat: the steel rail becomes a glass drawer ---- */
  .chat-layout { grid-template-columns: 1fr; }
  .chat-side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 580;
    width: min(81vw, 330px);
    transform: translateX(-108%);
    transition: transform .3s cubic-bezier(.22, 1, .36, 1);
    box-shadow: 24px 0 60px rgba(4, 12, 20, .45);
    /* translucent steel: the page shows through the frost */
    background:
      linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px),
      radial-gradient(135% 55% at 50% -8%, rgba(159, 192, 216, .18), transparent 62%),
      linear-gradient(168deg, rgba(31, 63, 90, .88) 0%, rgba(21, 46, 68, .9) 50%, rgba(13, 31, 47, .93) 100%);
    background-size: 22px 22px, 22px 22px, auto, auto;
    -webkit-backdrop-filter: blur(22px) saturate(1.25);
    backdrop-filter: blur(22px) saturate(1.25);
  }
  body.rail-open .chat-side { transform: none; }
  body.demo-on .chat-side { top: 34px; }

  /* the drawer's own way shut: an × on the brand row */
  .side-close {
    display: grid; place-items: center; position: absolute;
    top: 12px; right: 10px; width: 34px; height: 34px;
    border: 1px solid var(--line); border-radius: 10px;
    background: transparent; color: var(--muted); cursor: pointer; padding: 0;
  }
  .side-close svg { width: 16px; height: 16px; display: block; }
  .side-close:active { background: var(--bg); }
  .side-brand { position: relative; padding-right: 54px; }
  .chat-side .side-close {
    border-color: rgba(255, 255, 255, .16); color: var(--rail-ink);
    background: rgba(255, 255, 255, .05);
  }
  .chat-side .side-close:active { background: rgba(255, 255, 255, .12); }

  /* the header floats as glass over the scrolling messages */
  .chat-main { position: relative; }
  .chat-head {
    position: absolute; top: 0; left: 0; right: 0; z-index: 8;
    padding: 12px 14px;
    background: rgba(255, 255, 255, .66);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    backdrop-filter: blur(16px) saturate(1.3);
    border-bottom: 1px solid rgba(255, 255, 255, .55);
    box-shadow: 0 1px 14px rgba(22, 33, 43, .07);
  }
  .chat-head-badge { display: none; }
  .chat-scroll { padding: 64px 12px 18px; }
  .chat-inner { gap: 14px; }
  .msg-avatar { width: 30px; height: 30px; border-radius: 8px; }
  .msg-avatar.bot img { width: 21px; height: 21px; }
  .msg.assistant .bubble { padding: 10px 13px; }
  .chat-empty { padding: 6vh 8px 12px; }
  .composer {
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .7);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    backdrop-filter: blur(16px) saturate(1.3);
    border-top: 1px solid rgba(255, 255, 255, .55);
    /* room for the bottom bar; when it ducks away the composer takes the foot */
    margin-bottom: 62px;
    transition: margin-bottom .28s cubic-bezier(.22, 1, .36, 1);
  }
  body.mnav-away .composer { margin-bottom: 0; }
  .composer-hint { display: none; }   /* Enter-to-send is a keyboard hint */
  .composer-bar { justify-content: flex-end; }

  /* ---- admin: the console sidebar becomes a white glass drawer ---- */
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 580;
    width: min(81vw, 320px);
    transform: translateX(-108%);
    transition: transform .3s cubic-bezier(.22, 1, .36, 1);
    background: rgba(255, 255, 255, .78);
    -webkit-backdrop-filter: blur(24px) saturate(1.25);
    backdrop-filter: blur(24px) saturate(1.25);
    border-right: 1px solid rgba(255, 255, 255, .65);
    box-shadow: 24px 0 60px rgba(22, 33, 43, .26);
  }
  body.rail-open .admin-side { transform: none; }
  body.demo-on .admin-side { top: 34px; }
  .admin-main { padding: 16px 14px calc(88px + env(safe-area-inset-bottom)); }
  .section-head h2 { font-size: 17px; }
  .section-head { row-gap: 8px; }
  .table-filter { flex: 1 1 150px; min-width: 130px; }
  /* the settings tab strip takes its own full-width line and scrolls
     sideways — as a squeezed flex item its min-content width overflowed the
     head and simply CLIPPED (no min-width:0), which read as "cut off" */
  .section-head .seg-tabs {
    order: 9; flex: 1 1 100%; min-width: 0; display: flex; max-width: none;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain; scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .seg-tabs::-webkit-scrollbar { display: none; }
  .seg-tabs button { white-space: nowrap; flex: none; scroll-snap-align: start;
                     padding: 9px 14px; }
  /* the save bar and toasts float clear of the bottom bar */
  .save-bar { bottom: 78px; }

  /* touch targets on both rails */
  .admin-nav button { padding: 11px 12px; font-size: 14px; }
  .side-util { padding: 10px 11px; }
  .user-menu summary { padding: 10px 11px; }
  .conv-item { padding: 10px 11px; }

  /* wide data stays readable: the card scrolls sideways, the page never */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 620px; }

  /* ---- Users on a phone: who and how to reach them — nothing else. The
     row itself opens a window with the rest (role, groups, status, actions);
     the › chevron says so. No sideways table. ---- */
  #user-table { min-width: 0; }
  #user-table th:nth-child(n+3), #user-table td:nth-child(n+3) { display: none; }
  #user-table tbody tr { cursor: pointer; }
  #user-table td { overflow-wrap: anywhere; }
  #user-table td:nth-child(2) { position: relative; padding-right: 26px; }
  #user-table tbody td:nth-child(2)::after {
    content: "\203A"; position: absolute; right: 9px; top: calc(50% - 10px);
    color: var(--faint); font-size: 17px; line-height: 1;
  }

  /* ---- Background activity on a phone: what ran and when. The status
     column is desktop detail — a failed run already explains itself in the
     activity cell. ---- */
  #job-table { min-width: 0; }
  #job-table th:nth-child(2), #job-table td:nth-child(2) { display: none; }
  #job-table td { overflow-wrap: anywhere; }
  #job-table td:last-child { white-space: nowrap; }

  .card { padding: 14px; }
  .grid-2 { gap: 12px; }

  /* overlays and floating cards: deeper frost on phones */
  .overlay {
    padding: 12px;
    background: rgba(18, 30, 42, .42);
    -webkit-backdrop-filter: blur(12px) saturate(1.1);
    backdrop-filter: blur(12px) saturate(1.1);
  }
  .modal { max-height: 92dvh; }
  /* ---- Help centre, phone-sized: one column, the TOC as an in-panel glass
     drawer behind a Topics chip (same grammar as the app's rail drawers),
     and the AI pane as a full-width bottom sheet. ---- */
  .help-center { height: 96dvh; }
  .help-head { padding: 11px 12px; gap: 8px; }
  .help-askbar { padding: 9px 12px; }
  .help-body { grid-template-columns: minmax(0, 1fr); }
  .help-toc-toggle {
    display: inline-flex; align-items: center; flex: none;
    font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink);
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 999px; padding: 5px 12px; cursor: pointer;
  }
  .help-toc-toggle[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
  .help-lang-note { display: none; }        /* no room; the AI answers anyway */
  .help-toc {
    position: absolute; z-index: 30; top: 0; bottom: 0; left: 0;
    width: min(310px, 86%); border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, .88);
    -webkit-backdrop-filter: blur(14px) saturate(1.15);
    backdrop-filter: blur(14px) saturate(1.15);
    transform: translateX(-108%); transition: transform .2s ease;
    padding-top: 6px;
  }
  .help-center.toc-open .help-toc { transform: none; box-shadow: var(--shadow-lg); }
  .help-toc-backdrop {
    position: absolute; z-index: 29; inset: 0; display: none;
    background: rgba(18, 30, 42, .28);
  }
  .help-center.toc-open .help-toc-backdrop { display: block; }
  .help-content { padding: 6px 16px 34px; }
  /* the AI pane: a bottom sheet, not a floating desktop card */
  .help-ai-pane {
    right: 8px; left: 8px; bottom: 8px; width: auto;
    height: min(560px, calc(100% - 74px));
  }
  .help-ai-fab { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .tscreen { padding: 12px 14px 24px; }
  .ticket-sum-note { display: none; }
  .ticket-row-right { gap: 3px; }
  #toast {
    max-width: calc(100vw - 28px);
    bottom: calc(78px + env(safe-area-inset-bottom));  /* above the bottom bar */
    background: rgba(22, 33, 43, .86);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  /* form controls at 16px: iOS stops zooming the page into every field */
  input, select, textarea { font-size: 16px; }
  .login-card { width: 100%; max-width: 380px; padding: 22px; }

  /* ---- the guides on phones: the card is a glass sheet pinned to the edge
     OPPOSITE the target (tourSheetSide flips .sheet-top when the spotlight
     is in the lower half — the setup checklist, the rail's Help/account
     rows, a modal's Close button must never sit UNDER the card). The
     !important pins beat the engine's inline top/left; the engines nudge
     the page instead (tourLiftAbove) and forward veil gestures so
     scrolling always works. Touching the page ghosts the card (.peek) so
     what it explains is always visible. */
  .tour-pop, .tour-pop.walk {
    top: auto !important; left: 10px !important;
    right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto; max-width: none; max-height: 44dvh; overflow-y: auto;
    border-radius: 14px;
    background: rgba(255, 255, 255, .9);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    backdrop-filter: blur(18px) saturate(1.3);
    box-shadow: 0 -10px 44px rgba(22, 33, 43, .30);
    transition: opacity .18s;      /* pinned — only the peek fades */
  }
  .tour-pop.sheet-top, .tour-pop.walk.sheet-top {
    top: calc(10px + env(safe-area-inset-top)) !important;
    bottom: auto;
    box-shadow: 0 10px 44px rgba(22, 33, 43, .30);
  }
  body.demo-on .tour-pop.sheet-top { top: 46px !important; }  /* clear the ribbon */
  .tour-pop.peek { opacity: .12; pointer-events: none; }

  /* ---- fit, don't bleed: no page zoom, no sideways window drag ---- */
  html, body { overflow-x: hidden; overscroll-behavior-x: none; }
  body, body * { touch-action: pan-x pan-y; }   /* pinch/double-tap zoom off */
  .tour-shade, .tour-ring { touch-action: none; }  /* the veil forwards its own */
  /* a vertical scroller with overflow-x unset COMPUTES to auto — one too-wide
     child and the whole pane pans sideways. Width overflow may only ever
     scroll inside .table-wrap, never the pane or the window. */
  .admin-main, .chat-scroll, .modal-body, .tscreen, .help-content {
    overflow-x: hidden;
  }

  /* ---- the source window's document list fits the screen: Document +
     Updated only (status/chunks/access are desktop detail), titles and
     URIs wrap instead of forcing a sideways table ---- */
  .doc-table table { min-width: 0; }
  .doc-table .col-status, .doc-table .col-chunks, .doc-table .col-access {
    display: none;
  }
  .doc-table th, .doc-table td { padding: 8px 6px; }
  .doc-table .doc-title-link { white-space: normal; overflow-wrap: anywhere; }
  .doc-table td .sub { white-space: normal; overflow-wrap: anywhere; }
  .doc-table .col-updated { white-space: nowrap; }

  /* ---- catalogs as square tiles, three to a row — and every tile the SAME
     tile: the glyph sits at a fixed spot, the name box always reserves two
     lines (a one-line name doesn't float the logo lower), and the foot is
     pinned to the bottom edge as a single status line. minmax(0,…) matters:
     a bare 1fr's auto MINIMUM is the card's min-content width, so one long
     unbreakable name pushed its whole column past the viewport (clipped
     off-screen right by the page's overflow-x:hidden). ---- */
  .ch-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ch-card {
    display: flex; flex-direction: column; align-items: center;
    justify-content: flex-start; text-align: center;
    aspect-ratio: 1 / 1; padding: 12px 6px 9px; gap: 0;
    min-width: 0; overflow: hidden;
  }
  .ch-card .ch-card-top { flex: none; flex-direction: column; gap: 8px;
    align-items: center; min-width: 0; width: 100%; }
  .ch-card .ch-id { flex: none; width: 100%; min-width: 0; }
  .ch-card .ch-name {
    white-space: normal; font-size: 11.5px; line-height: 1.22;
    height: 2.44em;              /* two lines, always — one fixed grid for all */
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; overflow-wrap: anywhere;
  }
  /* prose, counters, inline chips and CTAs are desktop furniture — a tile
     carries logo, name and one status line, nothing else wraps around */
  .ch-card .ch-kind, .ch-card .ch-desc, .ch-card .ch-people,
  .ch-card .ch-setup, .ch-card .ch-inline-btn,
  .ch-card .ch-card-top .badge { display: none; }
  .ch-card .ch-glyph { width: 42px; height: 42px; }
  .ch-card .ch-glyph.logo img { width: 25px; height: 25px; }
  /* the source window's hero row (glyph · name · badge · menu) wraps rather
     than setting the modal's width past the phone */
  .ch-hero { flex-wrap: wrap; }
  .ch-hero .ch-id { min-width: 140px; }
  .ch-card-foot {
    margin-top: auto; border-top: 0; padding-top: 0; justify-content: center;
    font-size: 10px; gap: 5px; width: 100%; min-width: 0; flex: none;
  }
  .ch-card-foot .ch-sig { min-width: 0; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; gap: 5px; }
  .ch-card-foot .badge { font-size: 9.5px; padding: 1px 7px; max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* ---- "Try asking" as a sideways shelf, not a tall list: fixed-width
     cards in one snapping row, the next one peeking in from the edge so the
     scroll invites itself. width:100% matters — .chat-empty centers its grid
     items shrink-to-fit, and an unconstrained scroller takes its max-content
     width and shoves the whole empty state off the viewport. ---- */
  .demo-suggest { width: 100%; max-width: 100%; min-width: 0; }
  .demo-suggest-chips {
    max-width: 100%;
    flex-wrap: nowrap; justify-content: flex-start;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain; scroll-snap-type: x proximity;
    margin: 0; padding: 2px 2px 10px;
    scrollbar-width: none;
  }
  .demo-suggest-chips::-webkit-scrollbar { display: none; }
  .demo-suggest-chips .suggest-chip {
    flex: 0 0 auto; width: min(72vw, 300px); white-space: normal;
    scroll-snap-align: center; padding: 10px 13px; font-size: 13px;
    line-height: 1.45;
  }

  /* ---- glass, visibly: frosted surfaces on everything that floats ---- */
  .modal {
    background: rgba(255, 255, 255, .84);
    -webkit-backdrop-filter: blur(22px) saturate(1.35);
    backdrop-filter: blur(22px) saturate(1.35);
    border: 1px solid rgba(255, 255, 255, .62);
  }
  .help-center {
    background: rgba(255, 255, 255, .88);
    -webkit-backdrop-filter: blur(22px) saturate(1.35);
    backdrop-filter: blur(22px) saturate(1.35);
  }
  .user-pop, .menu-pop {
    background: rgba(255, 255, 255, .78);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    backdrop-filter: blur(18px) saturate(1.3);
    border-color: rgba(255, 255, 255, .65);
  }
  .admin-side {
    background: rgba(255, 255, 255, .64);
    -webkit-backdrop-filter: blur(28px) saturate(1.3);
    backdrop-filter: blur(28px) saturate(1.3);
  }
  .chat-side {
    background:
      linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px),
      radial-gradient(135% 55% at 50% -8%, rgba(159, 192, 216, .18), transparent 62%),
      linear-gradient(168deg, rgba(31, 63, 90, .74) 0%, rgba(21, 46, 68, .78) 50%, rgba(13, 31, 47, .84) 100%);
    background-size: 22px 22px, 22px 22px, auto, auto;
    -webkit-backdrop-filter: blur(26px) saturate(1.3);
    backdrop-filter: blur(26px) saturate(1.3);
  }
}
