/* 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: inline-flex; align-items: center; 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;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 66%, 66% 100%, 0 100%);
}
.side-brand .brand.branded::before { display: none; }
.brand-logo {
  width: 20px; height: 20px; flex: none; border-radius: 5px;
  object-fit: contain; object-position: left center;
}
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.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; justify-content: space-between;
  margin: 12px 12px 4px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13px; font-weight: 550; color: var(--ink-soft); text-decoration: none;
  transition: border-color .12s, color .12s;
}
.side-switch:hover { border-color: var(--accent); color: var(--accent); text-decoration: 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);
  background: linear-gradient(180deg, #1d3b55 0%, #16324a 100%);
  color: var(--rail-ink);
  display: flex; flex-direction: column; min-height: 0;
}
.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; }
.new-conv-btn {
  width: 100%; display: flex; align-items: center; gap: 9px;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 9px;
  background: rgba(255, 255, 255, .07); color: #fff;
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 9px 12px; cursor: pointer;
}
.new-conv-btn:hover { background: rgba(255, 255, 255, .14); }
.nc-plus { font-size: 15px; 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);
}
.conv-item:hover { background: rgba(255, 255, 255, .07); }
.conv-item.active { background: rgba(255, 255, 255, .14); color: #fff; }
.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; }
.chat-side .side-foot { border-top: 1px solid var(--rail-line); }
.chat-side .side-util { color: var(--rail-ink); }
.chat-side .side-util:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.chat-side .user-menu summary { color: var(--rail-ink); }
.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);
}
.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); }
.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; }

/* 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 { font-size: 13px; opacity: .55; }
.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);
}
.help-body { display: grid; grid-template-columns: 262px 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; display: flex; }
.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 { opacity: .45; font-size: 12px; flex: none; }
.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 5px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700;
  line-height: 1.5; text-align: center;
}
/* the list of my tickets, one row per conversation */
.ticket-row {
  width: 100%; display: flex; align-items: center; gap: 10px; cursor: pointer;
  font: inherit; text-align: left; color: var(--ink); background: transparent;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; margin: 0 0 8px;
}
.ticket-row:hover { border-color: var(--accent); }
.ticket-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ticket-row-subject {
  font-weight: 600; font-size: 13px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.ticket-row-when { font-size: 11px; color: var(--muted); }
.ticket-unread {
  flex: none; padding: 2px 8px; border-radius: 999px; background: var(--accent);
  color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.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); }
/* 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 10px 0; padding-right: 26px; }
.ticket-msg--op { padding-right: 0; padding-left: 26px; }
.ticket-msg-meta { font-size: 11px; color: var(--muted); margin: 0 0 3px; }
.ticket-msg-meta b { color: var(--ink); }
.ticket-msg--op .ticket-msg-meta b { color: var(--accent); }
.ticket-msg-body {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 12px; 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); }
/* 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;
}
.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; }
@media (max-width: 720px) {
  .help-body { grid-template-columns: 1fr; }
  .help-toc { 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; }
@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; }
/* 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; }
/* 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 ============================= */
/* Four shade panels box the highlighted element; a ring outlines it; the
   explainer card sits beside it. Everything repositions live on scroll and
   resize; the page underneath is inert while the tour is open. */
.tour-shade {
  position: fixed; z-index: 620; background: rgba(22, 33, 43, .52);
  transition: all .26s cubic-bezier(.22, 1, .36, 1);
}
.tour-ring {
  position: fixed; z-index: 621; box-sizing: border-box;
  border: 2px solid var(--accent);
  box-shadow: 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);
}
.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); }
@media (prefers-reduced-motion: reduce) {
  .tour-shade, .tour-ring, .tour-pop { transition: none; }
  .setup-card::before { animation: none; }
}

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

#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); }
