:root {
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --line: #e5e7eb;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #1e3a8a;
  --accent-2: #1d4ed8;
  --accent-soft: #e8eefc;
  --side: #0f1a33;
  --side-2: #1a2848;
  --side-ink: #d7deee;
  --side-muted: #8e9bbd;
  --side-line: #25355c;
  --side-link: #b8c7f0;
  --side-btn: #2f55c4;
  --side-btn-hover: #2848a8;
  --auth-a: #0f1a33;
  --auth-b: #1e3a8a;
  --brand-gold: #f5b942;
  --ok: #166534;      --ok-bg: #e8f6ec;
  --warn: #92400e;    --warn-bg: #fdf3dc;
  --bad: #b42318;     --bad-bg: #fdecea;
  --info: #1e3a8a;    --info-bg: #e8eefc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--accent-2); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.muted { color: var(--ink-3); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.sub { color: var(--ink-2); font-size: .93rem; margin-top: 4px; }
.boot { display: grid; place-items: center; height: 100%; color: var(--ink-3); }
.loading { padding: 28px; text-align: center; color: var(--ink-3); }
.stack { display: grid; gap: 16px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid #cfd4dc; background: #fff; color: var(--ink);
  font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 38px;
}
.btn:hover { background: #f3f4f6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(.88); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { background: #8f1b12; }
.btn.danger-text { color: var(--bad); }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: .86rem; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; cursor: pointer; border-radius: 6px; padding: 6px 8px; line-height: 1; color: inherit; }
.icon-btn:hover { background: rgba(127, 127, 127, .18); }
.icon-btn.small { padding: 4px 5px; font-size: .8rem; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-2); cursor: pointer; text-decoration: underline; font-size: inherit; }

/* forms */
.field { display: grid; gap: 5px; margin-bottom: 14px; min-width: 0; align-content: start; }
.field label { font-weight: 600; font-size: .9rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], input[type=tel], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff; min-height: 40px;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); outline-offset: 0; border-color: var(--accent-2); }
.hint { color: var(--ink-3); font-size: .84rem; }
.form-error { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 9px 12px; margin-bottom: 12px; font-size: .92rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 12px 0 4px; }
.filters .field { margin-bottom: 0; min-width: 150px; }
.filters .grow { flex: 1 1 220px; }

/* notices, badges, toasts */
.notice { padding: 11px 14px; border-radius: 8px; margin-bottom: 12px; font-size: .93rem; background: var(--info-bg); color: var(--info); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eef0f3; color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: #1f2937; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-size: .92rem; }
.toast.ok { background: #14532d; }
.toast.error { background: #991b1b; }

/* login / signup */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, var(--auth-a) 0%, var(--auth-b) 100%); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.auth-card h1 { margin: 18px 0 4px; }
.auth-card form { margin-top: 18px; }
.auth-switch, .auth-note { margin-top: 14px; text-align: center; color: var(--ink-2); font-size: .92rem; }
.auth-note { font-size: .84rem; color: var(--ink-3); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }
.brand-mark { color: var(--brand-gold); }
.brand.big { font-size: 1.15rem; color: var(--accent); }

/* frame */
.shell { display: grid; grid-template-columns: 290px 1fr; height: 100%; }
.sidebar { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; min-height: 0; padding: 16px 12px 12px; gap: 10px; }
.sidebar .brand { color: #fff; padding: 2px 6px 6px; }
.sidebar .btn.primary { background: var(--side-btn); border-color: var(--side-btn); }
.sidebar .btn.primary:hover { background: var(--side-btn-hover); filter: none; }
.side-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 6px 8px 0; }
.chat-list { flex: 1 1 auto; overflow-y: auto; min-height: 60px; display: grid; gap: 2px; align-content: start; }
.chat-list-empty { color: var(--side-muted); font-size: .88rem; padding: 8px; }
.chat-item { display: flex; align-items: center; border-radius: 8px; padding-right: 4px; }
.chat-item:hover, .chat-item.active { background: var(--side-2); }
.chat-item.active { box-shadow: inset 3px 0 0 var(--brand-gold); }
.chat-link { flex: 1; min-width: 0; display: grid; padding: 7px 8px; color: inherit; text-decoration: none; }
.chat-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; font-size: .92rem; }
.chat-time { font-size: .74rem; color: var(--side-muted); }
.chat-item .icon-btn { visibility: hidden; color: var(--side-link); }
.chat-item:hover .icon-btn, .chat-item:focus-within .icon-btn { visibility: visible; }
.side-foot { border-top: 1px solid var(--side-line); padding-top: 10px; display: grid; gap: 8px; }
.admin-nav, .tools-nav { display: grid; gap: 2px; }
.nav-link { display: flex; justify-content: space-between; align-items: center; padding: 7px 8px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-size: .93rem; }
.nav-link:hover, .nav-link.active { background: var(--side-2); color: #fff; }
.count { background: var(--brand-gold); color: #1f1300; border-radius: 999px; padding: 0 8px; font-size: .76rem; font-weight: 700; }
.me { padding: 4px 8px 0; min-width: 0; }
.me-name { color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-email { font-size: .8rem; color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-actions { display: flex; gap: 14px; padding: 0 8px 4px; font-size: .85rem; }
.me-actions .link-btn { color: var(--side-link); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: #fff; min-height: 50px; }
.page-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; font-size: 1.2rem; }
.main-content { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.scrim { display: none; }

/* chat */
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.messages { max-width: 820px; margin: 0 auto; padding: 22px 20px 8px; display: grid; gap: 16px; }
.welcome { text-align: center; padding: 12vh 0 0; color: var(--ink-2); }
.welcome h2 { font-size: 1.5rem; color: var(--ink); margin-bottom: 8px; }
.msg-who { font-size: .76rem; font-weight: 700; color: var(--ink-3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .05em; }
.msg.user { justify-self: end; max-width: 85%; }
.msg.user .msg-who { text-align: right; }
.msg.user .msg-body { background: var(--accent); color: #fff; padding: 10px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.assistant .msg-body { background: var(--card); border: 1px solid var(--line); padding: 12px 16px; border-radius: 4px 14px 14px 14px; box-shadow: var(--shadow); overflow-wrap: anywhere; min-height: 44px; }
.msg.assistant.typing .msg-body:empty::after { content: "Thinking…"; color: var(--ink-3); }
.msg-body > :first-child { margin-top: 0; }
.msg-body > :last-child { margin-bottom: 0; }
.msg-body p, .msg-body ul, .msg-body ol, .msg-body blockquote, .msg-body pre, .msg-body .table-scroll { margin: 0 0 10px; }
.msg-body h1, .msg-body h2, .msg-body h3, .msg-body h4 { font-size: 1.02rem; margin: 14px 0 6px; }
.msg-body ul, .msg-body ol { padding-left: 22px; }
.msg-body code { background: #f1f3f5; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.msg-body pre { background: #111827; color: #e5e7eb; padding: 12px; border-radius: 8px; overflow-x: auto; }
.msg-body pre code { background: none; padding: 0; color: inherit; }
.msg-body blockquote { border-left: 3px solid #cfd4dc; padding-left: 12px; color: var(--ink-2); }
.msg-body table { border-collapse: collapse; font-size: .92rem; }
.msg-body th, .msg-body td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.msg-body th { background: #f6f7f9; }
.msg-tools { margin-top: 4px; font-size: .8rem; }
.msg-tools .link-btn { color: var(--ink-3); text-decoration: none; }
.msg-tools .link-btn:hover { text-decoration: underline; }
.composer { max-width: 820px; width: 100%; margin: 0 auto; padding: 8px 20px 14px; }
.composer-box { display: flex; align-items: flex-end; gap: 8px; background: #fff; border: 1px solid #cfd4dc; border-radius: 14px; padding: 8px; box-shadow: var(--shadow); }
.composer-box:focus-within { border-color: var(--accent-2); }
.composer-box textarea { border: 0; outline: 0 !important; resize: none; padding: 7px 8px; min-height: 38px; max-height: 220px; background: transparent; }
.composer-note { font-size: .78rem; color: var(--ink-3); text-align: center; margin-top: 7px; }
.btn.stop { border-color: var(--bad); color: var(--bad); }

/* admin pages */
.page { padding: 22px 24px 40px; max-width: 1280px; width: 100%; margin: 0 auto; }
.page-head, .card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card > h2 { margin-bottom: 4px; }
.card .sub { margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: #fff; font-size: .92rem; }
table.data th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfc; }
table.data td { padding: 9px 10px; border-bottom: 1px solid #f0f1f3; vertical-align: top; overflow-wrap: break-word; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.actions { white-space: nowrap; }
table.data td.actions .btn { margin: 0 4px 4px 0; }
table.data td.empty, .empty { text-align: center; color: var(--ink-3); padding: 26px; }
table.data tr.group td { background: #f3f5fa; border-top: 1px solid var(--line); color: var(--ink-2); }
.page > .table-scroll, .page > div > .table-scroll { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.preview { color: var(--ink-3); font-size: .84rem; margin-top: 2px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile-label { font-size: .8rem; color: var(--ink-3); font-weight: 600; }
.tile-value { font-size: 1.7rem; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile-note { font-size: .8rem; color: var(--ink-3); }

/* dialogs */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.modal-text { margin-bottom: 14px; color: var(--ink-2); }
.transcript { padding: 12px 0 0; max-width: none; }

/* phones and small tablets */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-100%); transition: transform .18s ease; z-index: 40; }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 30; }
  .menu-btn { display: inline-block; }
  .chat-item .icon-btn { visibility: visible; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .page { padding: 16px 14px 32px; }
  .topbar { padding: 8px 12px; }
  .messages { padding: 16px 12px 8px; }
  .composer { padding: 8px 12px 12px; }
  .msg.user { max-width: 94%; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* data analysis */
.mono { font-family: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace; font-size: .92em; }
.link-btn.mono { text-decoration: none; }
.link-btn.mono:hover { text-decoration: underline; }
.back-link { display: inline-block; margin-bottom: 6px; font-size: .9rem; text-decoration: none; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 16px; }
.preview-table { border: 1px solid var(--line); border-radius: 8px; max-height: 190px; }
.preview-table td, .preview-table th { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.pager .sub { margin: 0; }
.file-banner { margin: 0; }
.badge.muted { background: #eef0f3; color: var(--ink-3); }

/* charts: one series, bars from a zero baseline, quiet grid, values in text colours */
.viz-root { --series-1: #2a78d6; --grid: #e7e9ed; --axis-text: var(--ink-3); margin: 0; }
.chart figcaption { margin-bottom: 12px; }
.chart-note { color: var(--ink-3); font-size: .9rem; }
.chart-frame { display: grid; grid-template-columns: auto 1fr; gap: 8px; height: 190px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; text-align: right; font-size: .74rem; color: var(--axis-text); font-variant-numeric: tabular-nums; min-width: 28px; transform: translateY(-.5em); height: calc(100% + 1em); }
.chart-area { position: relative; min-width: 0; }
.chart-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart-grid i { display: block; height: 1px; background: var(--grid); }
.chart-plot { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.chart-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; outline-offset: -2px; }
.chart-bar { width: calc(100% - 2px); max-width: 24px; min-height: 0; background: var(--series-1); border-radius: 4px 4px 0 0; }
.chart-plot.dense .chart-bar { border-radius: 1px 1px 0 0; width: max(1px, calc(100% - 1px)); }
.chart-col:hover .chart-bar, .chart-col:focus .chart-bar { filter: brightness(1.18); }
.chart-x { display: flex; margin: 6px 0 0 36px; font-size: .74rem; color: var(--axis-text); }
.chart-x span { flex: 1 1 0; min-width: 0; text-align: center; white-space: nowrap; overflow: visible; }
.chart-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: #1f2937; color: #fff; padding: 6px 10px; border-radius: 6px; font-size: .84rem; white-space: nowrap; pointer-events: none; z-index: 3; }
.chart-tip-label { color: #cbd5e1; font-size: .78rem; }
.chart-table { margin-top: 10px; font-size: .9rem; }
.chart-table summary { cursor: pointer; color: var(--ink-2); }
.chart-table .table-scroll { max-height: 260px; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* printing an analysis (Print / save as PDF) */
@media print {
  html, body { height: auto; background: #fff; }
  .sidebar, .topbar, .scrim, .no-print, #toasts, .tabs { display: none !important; }
  .shell { display: block; height: auto; }
  .main, .main-content { display: block; overflow: visible; height: auto; }
  .page { padding: 0; max-width: none; }
  .card, .tile { box-shadow: none; break-inside: avoid; }
  .table-scroll { overflow: visible; }
  .chart-table { display: none; }
}

/* data files inside a chat */
.chat-files { border-bottom: 1px solid var(--line); background: #fff; padding: 8px 20px; }
.file-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; max-width: 820px; margin: 0 auto; }
.file-chips-label { font-size: .8rem; color: var(--ink-3); font-weight: 600; }
.file-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--accent-soft); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: .86rem; max-width: 100%; }
.file-chip a { text-decoration: none; color: var(--accent); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.file-chip-meta { color: var(--ink-3); white-space: nowrap; }
.file-chips-note { max-width: 820px; margin: 5px auto 0; font-size: .78rem; color: var(--ink-3); }
.icon-btn.attach { font-size: 1.15rem; min-height: 38px; }
.attach-head { margin: 18px 0 8px; font-size: .95rem; }
.welcome-tip { margin-top: 10px; font-size: .9rem; }
@media print { .chat-files, .composer { display: none !important; } }

/* general report */
.sheet-picker { display: flex; flex-wrap: wrap; gap: 2px 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.sheet-picker .tab { padding: 7px 10px; font-size: .86rem; }
.file-heading { font-size: .9rem; color: var(--ink-2); display: grid; gap: 2px; }

/* branding: emblem, organisation name, colour themes chosen by the administrator */
.brand { min-width: 0; }
.brand-text { display: grid; min-width: 0; line-height: 1.2; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { font-size: .74rem; font-weight: 500; color: var(--side-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; flex: none; }
.brand.big { flex-direction: column; text-align: center; gap: 10px; }
.brand.big .brand-logo { width: 84px; height: 84px; }
.brand.big .brand-name { font-size: 1.2rem; white-space: normal; }
.brand.big .brand-sub { color: var(--ink-2); font-size: .9rem; white-space: normal; }
.auth-notice { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); text-align: center; font-size: .8rem; color: var(--ink-3); }
.logo-preview { display: grid; place-items: center; width: 120px; height: 120px; border: 1px dashed #cfd4dc; border-radius: 10px; background: #fafbfc; margin-bottom: 8px; text-align: center; font-size: .82rem; padding: 6px; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
:root[data-theme="blue"]     { --accent: #1447b8; --accent-2: #1d5fe0; --accent-soft: #e6eefc; --info: #1447b8; --info-bg: #e6eefc; --side: #0b2559; --side-2: #143676; --side-line: #1f4690; --side-muted: #93a9d6; --side-link: #bcd0f7; --side-btn: #2a6cf0; --side-btn-hover: #1f58cc; --auth-a: #0b2559; --auth-b: #1447b8; }
:root[data-theme="maroon"]   { --accent: #7a1f2b; --accent-2: #a12a3a; --accent-soft: #f8e9eb; --info: #7a1f2b; --info-bg: #f8e9eb; --side: #2a0f14; --side-2: #43171f; --side-line: #5a222c; --side-muted: #c7a0a7; --side-link: #f0c6cd; --side-btn: #a12a3a; --side-btn-hover: #8a2331; --auth-a: #2a0f14; --auth-b: #7a1f2b; }
:root[data-theme="green"]    { --accent: #14532d; --accent-2: #1a7a40; --accent-soft: #e6f3ea; --info: #14532d; --info-bg: #e6f3ea; --side: #0c2416; --side-2: #143a23; --side-line: #1d4d30; --side-muted: #9bbfa8; --side-link: #c3e6cf; --side-btn: #1a7a40; --side-btn-hover: #156535; --auth-a: #0c2416; --auth-b: #14532d; }
:root[data-theme="brown"]    { --accent: #5c4520; --accent-2: #7d5f2c; --accent-soft: #f4eee1; --info: #5c4520; --info-bg: #f4eee1; --side: #2b2314; --side-2: #40341e; --side-line: #56472b; --side-muted: #c2b393; --side-link: #e8dab8; --side-btn: #7d5f2c; --side-btn-hover: #694f24; --auth-a: #2b2314; --auth-b: #5c4520; }
:root[data-theme="charcoal"] { --accent: #1f2937; --accent-2: #374151; --accent-soft: #eceef1; --info: #1f2937; --info-bg: #eceef1; --side: #111418; --side-2: #1f242b; --side-line: #2c333c; --side-muted: #9aa3ae; --side-link: #cfd6de; --side-btn: #374151; --side-btn-hover: #2b3340; --auth-a: #111418; --auth-b: #374151; }

/* ---------------------------------- splash -------------------------------- */
#splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: linear-gradient(160deg, var(--auth-a) 0%, var(--auth-b) 100%); color: #fff; opacity: 1; transition: opacity .42s ease; }
#splash.hide { opacity: 0; pointer-events: none; }
.splash-inner { display: grid; justify-items: center; gap: 10px; padding: 24px; text-align: center; animation: splash-in .6s ease both; }
.splash-emblem { width: 132px; height: 132px; display: grid; place-items: center; margin-bottom: 6px; }
.splash-emblem img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .35)); animation: splash-in .5s ease both; }
.splash-mark { font-size: 64px; color: var(--brand-gold); line-height: 1; }
.splash-name { font-size: 1.7rem; font-weight: 700; letter-spacing: .01em; min-height: 1.3em; }
.splash-sub { font-size: 1rem; color: rgba(255, 255, 255, .78); min-height: 1.3em; }
.splash-bar { width: 180px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .18); overflow: hidden; margin-top: 18px; }
.splash-bar i { display: block; width: 40%; height: 100%; border-radius: 3px; background: var(--brand-gold); animation: splash-bar 1.1s ease-in-out infinite; }
.splash-foot { margin-top: 14px; font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .55); }
@keyframes splash-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes splash-bar { 0% { transform: translateX(-110%); } 100% { transform: translateX(280%); } }
@media (prefers-reduced-motion: reduce) { #splash, .splash-inner, .splash-emblem img, .splash-bar i { animation: none; transition: none; } }
@media print { #splash { display: none; } }

/* ------------------------------ login, two panels -------------------------- */
.auth { padding: 24px 16px; }
.auth-wrap { width: 100%; max-width: 940px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 70px rgba(0, 0, 0, .38); background: #fff; }
.auth-wrap .auth-card { max-width: none; border-radius: 0; box-shadow: none; padding: 40px 38px; align-self: center; }
.auth-wrap .auth-card h1 { margin-top: 0; }
.auth-side { background: linear-gradient(170deg, var(--side-2) 0%, var(--side) 100%); color: #fff; padding: 40px 34px; display: flex; flex-direction: column; justify-content: center; gap: 30px; }
.auth-side .brand.big { color: #fff; }
.auth-side .brand.big .brand-logo { width: 112px; height: 112px; }
.auth-side .brand.big .brand-mark { font-size: 46px; }
.auth-side .brand.big .brand-name { font-size: 1.45rem; }
.auth-side .brand.big .brand-sub { color: rgba(255, 255, 255, .75); }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; }
.auth-points strong { display: block; font-size: .95rem; }
.auth-points span { font-size: .84rem; color: rgba(255, 255, 255, .72); }
.auth-point-mark { flex: none; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .14); color: var(--brand-gold) !important; display: grid; place-items: center; font-size: .78rem !important; font-weight: 700; margin-top: 2px; }
@media (max-width: 760px) {
  .auth-wrap { grid-template-columns: 1fr; max-width: 440px; }
  .auth-side { padding: 26px 24px; gap: 0; }
  .auth-points { display: none; }
  .auth-side .brand.big .brand-logo { width: 76px; height: 76px; }
  .auth-wrap .auth-card { padding: 28px 24px; }
}

/* ------------------------------- recovery key ------------------------------ */
.recovery { display: grid; gap: 12px; justify-items: start; }
.recovery .notice { margin: 0; }
.recovery-key { width: 100%; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 1.02rem; font-weight: 700; letter-spacing: .04em; line-height: 1.7; padding: 14px 16px; border: 2px dashed var(--accent); border-radius: 10px; background: var(--accent-soft); color: var(--ink); overflow-wrap: anywhere; text-align: center; user-select: all; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; }

/* ------------------------------- finishing touches ------------------------- */
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.btn { transition: background .12s ease, filter .12s ease, box-shadow .12s ease; }
.btn.primary { box-shadow: 0 1px 2px rgba(16, 24, 40, .18); }
.card, .tile { border-radius: 12px; }
.topbar { box-shadow: 0 1px 0 rgba(16, 24, 40, .03); }
.topbar .page-title { flex: 1; min-width: 0; }
.secure-pill { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); font-size: .78rem; font-weight: 600; cursor: help; white-space: nowrap; }
.me { display: flex; align-items: center; gap: 10px; }
.me-text { min-width: 0; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--side-btn); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .86rem; letter-spacing: .02em; }
.tile-value.small { font-size: 1.15rem; margin-top: 4px; }
.key-box { display: grid; gap: 6px; font-size: .93rem; }
.nav-link { transition: background .12s ease; }
::selection { background: var(--accent-soft); }
* { scrollbar-width: thin; scrollbar-color: #c5cad3 transparent; }
.sidebar * { scrollbar-color: rgba(255, 255, 255, .25) transparent; }
@media (max-width: 860px) { .secure-pill { padding: 4px 8px; } }

/* ---- hardware keys and registration keys ---- */
.hw-steps { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); font-size: .95rem; }
.hw-make { display: grid; gap: 12px; }
.hw-make .notice, .hw-make .modal-text { margin: 0; }
.hw-make-steps { display: grid; gap: 8px; }
.plain-list { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 8px; color: var(--ink-2); font-size: .93rem; }
.reg-key { font-size: .9rem; letter-spacing: .02em; text-align: left; line-height: 1.6; }
.field-extra { margin-top: 4px; }
.cell-note { color: var(--ink-3); font-size: .8rem; font-weight: 400; margin-top: 2px; }
.field textarea.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .86rem; overflow-wrap: anywhere; }
.card-head h2 .badge { vertical-align: middle; margin-left: 4px; }

/* ---- layout fixes: the app is pinned to the window, and only its own areas scroll ---- */
/* The page behind the app can no longer scroll, so the menu and the top bar always stay in place. */
.shell { position: fixed; inset: 0; height: auto; overflow: hidden; }
/* On a short window the menu scrolls inside itself, so "Change password" and "Log out" can always be reached. */
.sidebar { overflow-y: auto; overscroll-behavior: contain; }
.sidebar > * { flex-shrink: 0; }
.sidebar > .chat-list { flex: 1 1 auto; min-height: 96px; }
.main-content { position: relative; overscroll-behavior: contain; }
.messages-scroll { overscroll-behavior: contain; }
.modal-body { position: relative; overscroll-behavior: contain; }
.modal { max-height: calc(100dvh - 32px); }
/* A wide table scrolls sideways inside its own box instead of pushing the whole page wider than the window. */
.page, .stack > *, .two-col > *, .card, .tiles > *, .page-head > *, .card-head > * { min-width: 0; }
.card-head > div:first-child, .page-head > div:first-child { flex: 1 1 260px; }
.cell-note { max-width: 240px; }
/* The first column (a name) keeps a readable width; on a narrow screen the table scrolls sideways instead. */
table.data td:first-child { min-width: 132px; }
/* Tabs that do not fit can be swiped sideways; a soft fade shows there is more. */
.tabs { scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); padding-right: 24px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; white-space: nowrap; }
@media print {
  .shell { position: static; overflow: visible; }
  .main-content, .modal-body { position: static; }
}
/* Action buttons wrap onto a second line instead of being pushed out of sight to the right. */
table.data td.actions { white-space: normal; min-width: 190px; }
.cell-note { max-width: 280px; overflow-wrap: anywhere; }

/* ---- home screen: the tools a person may use ---- */
.welcome { padding: 5vh 0 12px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 22px auto 0; max-width: 820px; text-align: left; }
.tool-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); color: inherit; text-decoration: none; min-width: 0; }
a.tool-card:hover, a.tool-card:focus-visible { border-color: var(--accent-2); }
.tool-card.off { opacity: .6; box-shadow: none; }
.tool-mark { flex: none; width: 42px; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: .74rem; font-weight: 700; letter-spacing: .03em; }
.tool-text { display: grid; gap: 2px; min-width: 0; }
.tool-text strong { color: var(--ink); font-size: .98rem; }
.tool-text span { color: var(--ink-2); font-size: .86rem; line-height: 1.4; }
tr.group .btn.small { margin-left: 8px; }
.messages { grid-template-columns: minmax(0, 1fr); }
.welcome { min-width: 0; }

/* ---- cases ---- */
.doc-preview { max-height: 220px; overflow: auto; margin: 0; padding: 12px; background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: .88rem; color: var(--ink-2); }
.doc-preview.tall { max-height: 60vh; }

/* Internet records (IPDR) */
.help-text p { margin: 0 0 8px; max-width: 80ch; line-height: 1.5; }
.help-text p:last-child { margin-bottom: 0; }
.fingerprint { font-size: 12px; overflow-wrap: anywhere; }
.modal-body { min-width: 0; }
.modal-body .mono, .sub .mono { overflow-wrap: anywhere; }      /* long fingerprints must wrap on phones */
.modal { min-width: 0; }

/* Bank Investigation dashboard */
.bank-case { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.bank-case .field { flex: 1 1 260px; margin: 0; min-width: 0; }
.bank-rows { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 14px; }
.bank-rows > div { flex: 1 1 320px; min-width: 0; }
.bank-rows h2 { font-size: 1rem; margin: 0 0 4px; }
.bank-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
@media (max-width: 1180px) { .bank-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .bank-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.bank-tile { display: flex; gap: 12px; align-items: center; text-align: left; padding: 14px; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); color: inherit; font: inherit; cursor: pointer; }
.bank-tile:hover, .bank-tile:focus-visible { border-color: var(--accent-2); }
.bank-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.bank-icon.big { width: 56px; height: 56px; margin: 0 auto 10px; }
.bank-text { display: grid; gap: 2px; min-width: 0; }
.bank-text strong { color: var(--ink); font-size: .96rem; line-height: 1.3; overflow-wrap: anywhere; }
.bank-text span { color: var(--ink-2); font-size: .84rem; line-height: 1.35; }
@media (max-width: 520px) { .bank-tile { padding: 11px; gap: 9px; } .bank-icon { width: 34px; height: 34px; } .bank-text span { display: none; } }
.tool-welcome { max-width: 680px; margin: 24px auto; text-align: center; }
.tool-give { margin: 10px 0 14px; color: var(--ink-2); }
.tool-prompts { display: grid; gap: 8px; margin: 0 0 14px; }
.tool-prompt { text-align: left; padding: 11px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font: inherit; cursor: pointer; line-height: 1.4; }
.tool-prompt:hover, .tool-prompt:focus-visible { border-color: var(--accent-2); background: var(--accent-soft); }

/* Bank statement analysis */
.row-ref { display: inline-block; margin: 0 4px 2px 0; padding: 0 5px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-variant-numeric: tabular-nums; }
.indicator { border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-width: 0; }
.indicator-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.indicator .sub { margin: 4px 0 8px; }
.scroll-box { max-height: 340px; overflow: auto; }
.tool-more { text-align: left; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--card); }
.tool-more summary { cursor: pointer; font-weight: 600; }
.tool-more ol { margin: 8px 0 0; padding-left: 26px; max-height: 300px; overflow: auto; }
.tool-more li { margin: 3px 0; }
.tool-more .link-btn { text-align: left; }
.bank-tiles .tile-value { font-size: 1.2rem; line-height: 1.3; overflow-wrap: normal; }

/* Modules made by the administrator */
.module-mark { font-size: .72rem; font-weight: 700; letter-spacing: .02em; }
.bank-icon.big.module-mark { font-size: .95rem; }
.module-form textarea { width: 100%; font: inherit; }
.module-form .check { display: flex; gap: 8px; align-items: center; }
.upload-chip { background: var(--card); border: 1px solid var(--line); }
.chat-files .notice { margin-top: 8px; }

/* The screen after login: connection, session, key, workspace */
#connecting { position: fixed; inset: 0; z-index: 99; display: grid; place-items: center; overflow: auto; background: linear-gradient(160deg, var(--auth-a) 0%, var(--auth-b) 100%); color: #fff; opacity: 1; transition: opacity .4s ease; }
#connecting.hide { opacity: 0; pointer-events: none; }
.connect-inner { display: grid; justify-items: center; gap: 8px; padding: 24px 18px; text-align: center; width: min(560px, 100%); }
.connect-emblem { width: 96px; height: 96px; display: grid; place-items: center; }
.connect-emblem img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .35)); }
.connect-steps { list-style: none; margin: 16px 0 4px; padding: 0; display: grid; gap: 10px; width: 100%; text-align: left; }
.connect-step { display: flex; gap: 12px; align-items: flex-start; opacity: .45; transition: opacity .25s ease; }
.connect-step.active, .connect-step.done, .connect-step.failed { opacity: 1; }
.connect-state { flex: none; width: 20px; height: 20px; margin-top: 2px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); display: grid; place-items: center; font-size: 12px; line-height: 1; }
.connect-step.active .connect-state { border-color: rgba(255, 255, 255, .25); border-top-color: var(--brand-gold); animation: connect-spin .8s linear infinite; }
.connect-step.done .connect-state { border-color: var(--brand-gold); background: var(--brand-gold); color: #10203f; }
.connect-step.done .connect-state::before { content: '✓'; font-weight: 700; }
.connect-step.failed .connect-state { border-color: #ffb4a8; color: #ffb4a8; }
.connect-step.failed .connect-state::before { content: '!'; font-weight: 700; }
.connect-text { display: grid; gap: 1px; min-width: 0; }
.connect-text strong { font-weight: 600; }
.connect-detail { font-size: .82rem; color: rgba(255, 255, 255, .72); min-height: 1.2em; overflow-wrap: anywhere; }
.connect-bar { width: 100%; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .18); overflow: hidden; margin-top: 6px; }
.connect-bar i { display: block; width: 0; height: 100%; background: var(--brand-gold); transition: width .5s ease; }
.connect-details { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; width: 100%; margin: 12px 0 0; padding: 12px 14px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 10px; text-align: left; font-size: .84rem; opacity: 0; transition: opacity .4s ease; }
.connect-details.show { opacity: 1; }
.connect-details dt { color: rgba(255, 255, 255, .6); }
.connect-details dd { margin: 0; overflow-wrap: anywhere; }
@keyframes connect-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .connect-step.active .connect-state { animation: none; } #connecting, .connect-bar i, .connect-details { transition: none; } }

/* =====================================================================================================
   Login and signup: dark "cyber" look. Neon cyan and magenta on near-black, a grid floor, HUD corners,
   monospace labels. Readable first: text contrast is kept high and all movement stops when the visitor's
   system asks for reduced motion. The colour theme chosen under Branding still colours the application
   itself after login.
   ===================================================================================================== */
.auth, #splash, #connecting {
  --neon: #19e6ff; --neon-2: #ff2fd0; --neon-3: #b6ff3c; --cy-bg: #05070d; --cy-panel: rgba(9, 14, 28, .86); --cy-line: rgba(25, 230, 255, .28);
  --cy-ink: #e8f6ff; --cy-ink-2: #a9bdd2; --cy-ink-3: #7f93aa; --brand-gold: var(--neon);
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}
.auth, #splash, #connecting {
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(25, 230, 255, .20), transparent 62%),
    radial-gradient(820px 520px at 96% 108%, rgba(255, 47, 208, .20), transparent 60%),
    linear-gradient(rgba(25, 230, 255, .07) 1px, transparent 1px) 0 0 / 100% 44px,
    linear-gradient(90deg, rgba(25, 230, 255, .07) 1px, transparent 1px) 0 0 / 44px 100%,
    var(--cy-bg);
  color: var(--cy-ink);
}
.auth { position: relative; overflow: hidden auto; }
.auth::before {      /* a slow scan line */
  content: ''; position: absolute; left: 0; right: 0; top: -20%; height: 18%; pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(25, 230, 255, .07) 45%, rgba(25, 230, 255, .14) 50%, rgba(25, 230, 255, .07) 55%, transparent);
  animation: cy-scan 7s linear infinite;
}
.auth::after {       /* fine horizontal lines, like a monitor */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .028) 0 1px, transparent 1px 3px);
}
.auth-wrap {
  position: relative; z-index: 1; background: var(--cy-panel); border: 1px solid var(--cy-line); border-radius: 6px; overflow: visible;
  box-shadow: 0 0 0 1px rgba(255, 47, 208, .10), 0 0 44px rgba(25, 230, 255, .16), 0 30px 80px rgba(0, 0, 0, .65);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.auth-wrap::before, .auth-wrap::after {      /* HUD corner brackets */
  content: ''; position: absolute; width: 26px; height: 26px; pointer-events: none;
}
.auth-wrap::before { left: -2px; top: -2px; border-left: 3px solid var(--neon); border-top: 3px solid var(--neon); filter: drop-shadow(0 0 6px rgba(25, 230, 255, .8)); }
.auth-wrap::after { right: -2px; bottom: -2px; border-right: 3px solid var(--neon-2); border-bottom: 3px solid var(--neon-2); filter: drop-shadow(0 0 6px rgba(255, 47, 208, .8)); }

.auth-side { background: linear-gradient(165deg, rgba(25, 230, 255, .10), rgba(255, 47, 208, .07) 70%), rgba(6, 10, 20, .55); border-right: 1px solid var(--cy-line); gap: 22px; }
.auth-hud { display: flex; align-items: center; gap: 10px; font: 600 .68rem/1 var(--mono); letter-spacing: .18em; color: var(--neon); text-transform: uppercase; }
.auth-hud-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--neon), transparent); }
.auth-hud span { white-space: nowrap; }
.auth-hud-line { min-width: 12px; }
.auth-side .brand.big .brand-name { font-family: var(--mono); letter-spacing: .02em; text-transform: uppercase; color: #fff; text-shadow: 0 0 18px rgba(25, 230, 255, .55); }
.auth-side .brand.big .brand-sub { font-family: var(--mono); font-size: .8rem; letter-spacing: .06em; color: var(--cy-ink-2); }
.auth-side .brand.big .brand-mark { color: var(--neon); text-shadow: 0 0 22px rgba(25, 230, 255, .8); }
.auth-side .brand.big .brand-logo { filter: drop-shadow(0 0 16px rgba(25, 230, 255, .45)); }
.auth-status { display: flex; flex-wrap: wrap; gap: 8px; }
.auth-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border: 1px solid var(--cy-line); border-radius: 3px; background: rgba(25, 230, 255, .06); font: 500 .7rem/1.2 var(--mono); color: var(--cy-ink); letter-spacing: .03em; }
.auth-chip b { color: var(--neon); font-weight: 700; letter-spacing: .12em; }
.auth-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--neon-3); box-shadow: 0 0 8px var(--neon-3); animation: cy-pulse 1.8s ease-in-out infinite; }
.auth-chip.warn { border-color: rgba(255, 196, 0, .55); background: rgba(255, 196, 0, .08); }
.auth-chip.warn b { color: #ffc400; }
.auth-chip.warn i { background: #ffc400; box-shadow: 0 0 8px #ffc400; }
.auth-points li { padding: 10px 12px; border-left: 2px solid var(--cy-line); background: linear-gradient(90deg, rgba(25, 230, 255, .06), transparent); }
.auth-points strong { font-family: var(--mono); font-size: .86rem; letter-spacing: .04em; text-transform: uppercase; color: #fff; }
.auth-points span { color: var(--cy-ink-2); }
.auth-point-mark { border-radius: 3px; background: rgba(25, 230, 255, .12); border: 1px solid var(--cy-line); color: var(--neon) !important; }

.auth-wrap .auth-card { background: transparent; color: var(--cy-ink); }
.auth-term { display: flex; align-items: center; gap: 6px; margin: 0 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--cy-line); font: 500 .72rem/1 var(--mono); color: var(--cy-ink-3); letter-spacing: .08em; }
.auth-term i { width: 9px; height: 9px; border-radius: 50%; background: var(--neon-2); box-shadow: 0 0 8px rgba(255, 47, 208, .7); }
.auth-term i:nth-child(2) { background: #ffc400; box-shadow: 0 0 8px rgba(255, 196, 0, .7); }
.auth-term i:nth-child(3) { background: var(--neon-3); box-shadow: 0 0 8px rgba(182, 255, 60, .7); }
.auth-term span { margin-left: 6px; }
.auth-card h1 { position: relative; display: inline-block; font-family: var(--mono); font-size: 1.5rem; letter-spacing: .04em; text-transform: uppercase; color: #fff; text-shadow: 0 0 16px rgba(25, 230, 255, .55); }
.auth-card h1::after { content: '_'; margin-left: 4px; color: var(--neon); animation: cy-blink 1.1s steps(1) infinite; }
.auth-card h1::before {      /* a brief colour-split flicker every few seconds */
  content: attr(data-text); position: absolute; left: 0; top: 0; color: var(--neon-2); opacity: 0; pointer-events: none; text-shadow: none;
  clip-path: inset(0 0 55% 0); animation: cy-glitch 6s steps(1) infinite;
}
.auth-card .sub { color: var(--cy-ink-2); }
.auth .field label { font: 600 .72rem/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--neon); }
.auth .field input, .auth .field textarea, .auth .field select {
  background: rgba(3, 8, 18, .85); color: var(--cy-ink); border: 1px solid rgba(25, 230, 255, .30); border-radius: 3px; caret-color: var(--neon);
  box-shadow: inset 0 -2px 0 rgba(25, 230, 255, .25); transition: border-color .15s ease, box-shadow .15s ease;
}
.auth .field input::placeholder, .auth .field textarea::placeholder { color: var(--cy-ink-3); }
.auth .field input:focus, .auth .field textarea:focus, .auth .field select:focus { outline: none; border-color: var(--neon); box-shadow: inset 0 -2px 0 var(--neon), 0 0 0 3px rgba(25, 230, 255, .18), 0 0 22px rgba(25, 230, 255, .22); }
.auth .field input:-webkit-autofill { -webkit-text-fill-color: var(--cy-ink); box-shadow: 0 0 0 1000px #06101f inset, inset 0 -2px 0 rgba(25, 230, 255, .25); caret-color: var(--neon); }
.auth .hint { color: var(--cy-ink-3); }
.auth .btn { background: rgba(25, 230, 255, .06); color: var(--cy-ink); border: 1px solid var(--cy-line); border-radius: 3px; font-family: var(--mono); letter-spacing: .04em; }
.auth .btn:hover { border-color: var(--neon); filter: none; box-shadow: 0 0 16px rgba(25, 230, 255, .25); }
.auth .btn.primary {
  position: relative; justify-content: center; padding-top: 12px; padding-bottom: 12px; text-transform: uppercase; letter-spacing: .16em; font-weight: 700; color: #03121a; border: 0;
  background: linear-gradient(90deg, var(--neon), #7df3ff 45%, var(--neon-2) 130%); box-shadow: 0 0 22px rgba(25, 230, 255, .40), 0 0 0 1px rgba(255, 255, 255, .10) inset;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.auth .btn.primary::before { content: '›'; margin-right: 8px; font-weight: 700; }
.auth .btn.primary:hover { filter: brightness(1.08) saturate(1.1); box-shadow: 0 0 30px rgba(25, 230, 255, .6); }
.auth .btn.primary:disabled { filter: grayscale(.5) brightness(.75); box-shadow: none; }
.auth .btn:focus-visible, .auth a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.auth .form-error { background: rgba(255, 47, 110, .10); color: #ffc2d6; border: 1px solid rgba(255, 47, 110, .65); border-radius: 3px; box-shadow: 0 0 16px rgba(255, 47, 110, .18); font-family: var(--mono); font-size: .86rem; }
.auth .form-error::before { content: '! '; font-weight: 700; color: #ff5f8f; }
.auth .notice { background: rgba(25, 230, 255, .07); color: var(--cy-ink); border: 1px solid var(--cy-line); border-radius: 3px; }
.auth .notice.bad { background: rgba(255, 47, 110, .10); border-color: rgba(255, 47, 110, .6); color: #ffc2d6; }
.auth .notice.ok { background: rgba(182, 255, 60, .08); border-color: rgba(182, 255, 60, .5); color: #e4ffc0; }
.auth .notice.warn { background: rgba(255, 196, 0, .08); border-color: rgba(255, 196, 0, .5); color: #ffe9a6; }
.auth a { color: var(--neon); text-decoration: none; border-bottom: 1px dashed rgba(25, 230, 255, .5); }
.auth a:hover { color: #fff; border-bottom-color: #fff; text-shadow: 0 0 10px rgba(25, 230, 255, .8); }
.auth .auth-switch, .auth .auth-note { color: var(--cy-ink-2); }
.auth .auth-note { color: var(--cy-ink-3); }
.auth .auth-notice { border-top: 1px solid var(--cy-line); color: var(--cy-ink-3); font-family: var(--mono); letter-spacing: .04em; }
.auth .mono, .auth code { color: var(--cy-ink); }
.auth .link-btn { color: var(--neon); }

/* the opening screen and the screen after login use the same backdrop */
#splash .splash-name, #connecting .splash-name { font-family: var(--mono); letter-spacing: .04em; text-transform: uppercase; text-shadow: 0 0 18px rgba(25, 230, 255, .55); }
#splash .splash-sub, #connecting .splash-sub, #splash .splash-foot, #connecting .splash-foot { font-family: var(--mono); }
#connecting .connect-text strong { font-family: var(--mono); letter-spacing: .03em; }
#connecting .connect-details { border-color: var(--cy-line); background: rgba(9, 14, 28, .6); font-family: var(--mono); font-size: .8rem; }
#connecting .connect-details dt { color: var(--neon); }
#connecting .connect-step.done .connect-state { color: #03121a; box-shadow: 0 0 10px rgba(25, 230, 255, .6); }

@keyframes cy-scan { from { transform: translateY(0); } to { transform: translateY(700%); } }
@keyframes cy-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
@keyframes cy-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
@keyframes cy-glitch { 0%, 91%, 100% { opacity: 0; transform: none; } 92% { opacity: .9; transform: translate(-2px, 1px); } 94% { opacity: .9; transform: translate(2px, -1px); clip-path: inset(48% 0 0 0); } 96% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .auth::before, .auth-card h1::before, .auth-card h1::after, .auth-chip i { animation: none; } .auth::before { display: none; } }
@media (max-width: 760px) {
  .auth-side { border-right: 0; border-bottom: 1px solid var(--cy-line); gap: 14px; }
  .auth-side .auth-points { display: none; }
  .auth-card h1 { font-size: 1.25rem; }
  .auth-status { gap: 6px; }
  .auth-hud span:last-child { display: none; }
}


/* =====================================================================================================
   Menus with icons, the module bar at the top, the short greeting, and training by chat (all themes)
   ===================================================================================================== */
.nav-link { justify-content: flex-start; gap: 10px; padding: 5px 8px; font-size: .9rem; }
.sidebar { gap: 8px; }
.side-foot { gap: 6px; }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-ico { flex: none; display: inline-grid; place-items: center; }
.nav-ico svg { width: 18px; height: 18px; display: block; }
.tools-nav, .admin-nav { display: grid; gap: 2px; }
.top-nav { display: flex; gap: 6px; flex: none; }
.top-link { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.top-link:hover { background: var(--accent-soft); color: var(--ink); }
.top-link.active { background: var(--accent); color: #fff; }
.ai-pill { flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px; border-radius: 999px; border: 1px solid var(--accent-2); color: var(--accent); text-decoration: none; font-weight: 700; font-size: .88rem; white-space: nowrap; }
.ai-pill:hover { background: var(--accent-soft); }
@media (max-width: 1240px) { .top-nav { display: none; } }
@media (max-width: 560px) { .ai-pill-text { display: none; } .ai-pill { padding: 6px 9px; } }

.greet { display: flex; gap: 10px; align-items: flex-start; text-align: left; max-width: 620px; margin: 0 auto 14px; }
.greet-mark { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .04em; }
.greet-bubble { background: var(--card); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 10px 14px; box-shadow: var(--shadow); min-width: 0; }
.greet-bubble p { margin: 0; color: var(--ink); font-size: 1rem; overflow-wrap: anywhere; }
.greet-who { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: 2px; }
.welcome > .greet { margin-top: 0; }
.tool-about { text-align: left; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; background: var(--card); }
.tool-about summary { cursor: pointer; font-weight: 600; color: var(--ink-2); font-size: .92rem; }
.tool-about .tool-give { margin-bottom: 4px; }

.trainer-chat .train-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.trainer-chat .train-head .back-link { margin: 0; flex: 1 1 100%; }
.train-title { flex: 1 1 280px; min-width: 0; }
.train-title h1 { font-size: 1.15rem; overflow-wrap: anywhere; }
.train-title .sub { display: block; margin-top: 2px; font-size: .82rem; }
.trainer-chat > .notice { margin: 10px 20px 0; }
.train-file .msg-body { white-space: normal; }
.train-file-meta { font-size: .82rem; opacity: .85; margin-top: 2px; }
.msg.user .msg-tools { text-align: right; }
.train-progress { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.train-progress-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; }
.train-progress-head strong { min-width: 0; overflow-wrap: anywhere; }
.train-meta { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: .9rem; white-space: nowrap; }
.train-bar { height: 8px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; }
.train-bar i { display: block; width: 0; height: 100%; border-radius: 4px; background: var(--accent-2); transition: width .35s ease; }
.train-steps { list-style: none; margin: 10px 0 6px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px 12px; font-size: .88rem; color: var(--ink-3); }
.train-step { display: flex; align-items: center; gap: 7px; min-width: 0; }
.train-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; }
.train-step.active { color: var(--ink); font-weight: 600; }
.train-step.active .train-dot { border-color: var(--accent-2); border-top-color: transparent; animation: connect-spin .8s linear infinite; }
.train-step.done { color: var(--ok); }
.train-step.done .train-dot { background: currentColor; }
.train-step.stopped { color: var(--bad); font-weight: 600; }
.train-progress .btn { margin-top: 8px; }
.train-progress.failed { border-color: var(--bad); }
.train-progress.failed .train-note { color: var(--bad); }
.train-note { margin: 0; font-size: .84rem; }
@media (prefers-reduced-motion: reduce) { .train-step.active .train-dot { animation: none; } .train-bar i { transition: none; } }
@media print { .top-nav, .ai-pill { display: none !important; } }


/* ---- CDR & IPDR Investigation page ---- */
.inv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 14px; }
.inv-emblem { flex: none; width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.inv-emblem svg { width: 32px; height: 32px; }
.inv-title { flex: 1 1 320px; min-width: 0; }
.inv-title h1 { font-size: 1.6rem; }
.inv-chip { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); min-width: 0; max-width: 100%; }
.inv-chip-ico { color: var(--warn); flex: none; }
.inv-chip-label { font-size: .74rem; color: var(--ink-3); font-weight: 600; }
.inv-chip-value { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.inv-chip select { width: auto; max-width: min(260px, 52vw); min-height: 30px; padding: 2px 8px; font-weight: 700; }
.inv-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 14px; }
.inv-filter-grid .field { margin-bottom: 10px; }
.inv-filter-grid label { font-size: .82rem; }
.inv-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.inv-pair input { min-width: 0; padding-left: 6px; padding-right: 4px; }
input[type=time] { width: 100%; padding: 9px 11px; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff; min-height: 40px; }
.inv-tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.inv-tile { display: flex; align-items: center; gap: 12px; }
.inv-tile-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.inv-tile .tile-value { font-size: 1.45rem; }
.inv-panels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .inv-panels { grid-template-columns: 1fr; } }
.inv-panel { padding: 14px; }
.inv-panel .card-head { margin-bottom: 6px; }
.inv-graph { width: 100%; height: auto; display: block; }
.inv-edge { stroke: var(--ink-3); opacity: .55; }
.inv-node circle { fill: var(--accent-2); stroke: var(--card); stroke-width: 2; }
.inv-node.n1 circle { fill: #7c5cf0; }
.inv-node.n2 circle { fill: #0f9f8f; }
.inv-node.centre circle { fill: #e39a12; stroke: #ffd980; stroke-width: 3; }
.inv-node-n { fill: #fff; font-size: 11px; font-weight: 700; text-anchor: middle; }
.inv-node-label { fill: var(--ink-2); font-size: 9.5px; text-anchor: middle; font-family: ui-monospace, Consolas, monospace; }
.inv-node-label.strong { fill: var(--ink); font-weight: 700; font-size: 10.5px; }
.inv-graph-key { margin: 6px 0 4px; padding-left: 22px; columns: 2; column-gap: 26px; font-size: .8rem; color: var(--ink-2); }
.inv-graph-key li { break-inside: avoid; overflow-wrap: anywhere; }
.inv-bars { display: flex; align-items: flex-end; gap: 2px; height: 150px; border-bottom: 1px solid var(--line); }
.inv-bar { flex: 1 1 0; min-width: 1px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.inv-bar i { display: block; width: 100%; }
.inv-bar i.cd { background: var(--accent-2); border-radius: 2px 2px 0 0; }
.inv-bar i.ip { background: #19b8c8; border-radius: 2px 2px 0 0; }
.inv-bar i.ip + i.cd { border-radius: 0; }
.inv-axis { display: flex; justify-content: space-between; font-size: .72rem; color: var(--ink-3); margin-top: 4px; }
.inv-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; margin-top: 8px; color: var(--ink-2); }
.inv-legend .cd::before, .inv-legend .ip::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; background: var(--accent-2); }
.inv-legend .ip::before { background: #19b8c8; }
.inv-legend .sub { margin: 0 0 0 auto; font-size: .8rem; }
.inv-towers { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 9px; }
.inv-tower-top { display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; }
.inv-tower-top .mono { overflow-wrap: anywhere; }
.inv-tower-bar { height: 6px; border-radius: 3px; background: var(--accent-soft); margin: 3px 0 2px; overflow: hidden; }
.inv-tower-bar i { display: block; height: 100%; border-radius: 3px; background: #19b8c8; }
.inv-towers .sub { margin: 0; font-size: .78rem; }
.inv-type { font-weight: 600; }
.inv-type.in { color: var(--info); }
.inv-type.out { color: var(--ok); }
.inv-type.net { color: #8a63f0; }
.inv #inv-records .table-scroll { border: 1px solid var(--line); border-radius: 10px; }


/* =====================================================================================================
   Colour theme "tech": the dark dashboard look for the whole application (Branding > Colour theme).
   Screen only, so that printed reports stay black on white.
   ===================================================================================================== */
@media screen {
:root[data-theme="tech"] {
  color-scheme: dark;
  --ink: #e6eeff; --ink-2: #a9b9d9; --ink-3: #8a9cc0; --line: #1b2c55; --bg: #050a18; --card: #0a1329;
  --accent: #5aa9ff; --accent-2: #2f8bff; --accent-soft: rgba(47, 139, 255, .14);
  --side: #060c1d; --side-2: #10224a; --side-ink: #d5e0f7; --side-muted: #8193b8; --side-line: #16264b; --side-link: #9cc4ff; --side-btn: #1a6ee6; --side-btn-hover: #1560cc;
  --auth-a: #050a18; --auth-b: #0b2a66; --brand-gold: #19c8ff;
  --ok: #5fe39a; --ok-bg: rgba(34, 197, 94, .13); --warn: #ffd166; --warn-bg: rgba(255, 196, 0, .11); --bad: #ff9a9a; --bad-bg: rgba(255, 70, 70, .13); --info: #8cc8ff; --info-bg: rgba(47, 139, 255, .14);
  --shadow: 0 0 0 1px rgba(47, 139, 255, .05), 0 10px 28px rgba(0, 0, 0, .35);
  --glow: 0 0 0 1px rgba(47, 139, 255, .25), 0 0 22px rgba(47, 139, 255, .16);
}
:where(:root[data-theme="tech"]) body { color: var(--ink); }
:where(:root[data-theme="tech"]) .shell { background: radial-gradient(1100px 520px at 85% -12%, rgba(47, 139, 255, .13), transparent 62%), radial-gradient(700px 420px at 30% 110%, rgba(25, 200, 255, .06), transparent 60%), var(--bg); }
:where(:root[data-theme="tech"]) * { scrollbar-color: #2a3f73 transparent; }
:where(:root[data-theme="tech"]) a { color: var(--accent); }
:where(:root[data-theme="tech"]) h1 { letter-spacing: .01em; }
:where(:root[data-theme="tech"]) .page-head h1 { text-shadow: 0 0 22px rgba(47, 139, 255, .35); }

/* frame */
:where(:root[data-theme="tech"]) .sidebar { background: linear-gradient(180deg, #071127, #050b1b); border-right: 1px solid var(--side-line); }
:where(:root[data-theme="tech"]) .side-label { color: #9fb4e0; letter-spacing: .1em; }
:where(:root[data-theme="tech"]) .nav-link { border: 1px solid transparent; }
:where(:root[data-theme="tech"]) .nav-link:hover { background: rgba(47, 139, 255, .10); }
:where(:root[data-theme="tech"]) .nav-link.active { background: linear-gradient(90deg, rgba(47, 139, 255, .34), rgba(47, 139, 255, .08)); border-color: rgba(47, 139, 255, .45); box-shadow: inset 3px 0 0 #2f8bff, 0 0 18px rgba(47, 139, 255, .18); color: #fff; }
:where(:root[data-theme="tech"]) .nav-link .nav-ico { color: #7fb8ff; }
:where(:root[data-theme="tech"]) .sidebar .btn.primary { background: linear-gradient(180deg, #1f7af0, #0f55c9); border-color: #3d8bff; box-shadow: 0 0 18px rgba(47, 139, 255, .35); }
:where(:root[data-theme="tech"]) .chat-item.active { box-shadow: inset 3px 0 0 #19c8ff; }
:where(:root[data-theme="tech"]) .topbar { background: rgba(6, 12, 29, .92); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(47, 139, 255, .12); }
:where(:root[data-theme="tech"]) .top-link { border: 1px solid transparent; }
:where(:root[data-theme="tech"]) .top-link:hover { background: rgba(47, 139, 255, .10); color: #fff; }
:where(:root[data-theme="tech"]) .top-link.active { background: linear-gradient(180deg, #1f7af0, #0f55c9); border-color: #4d9bff; color: #fff; box-shadow: 0 0 18px rgba(47, 139, 255, .45); }
:where(:root[data-theme="tech"]) .ai-pill { color: #fff; border-color: #2f8bff; box-shadow: inset 0 0 14px rgba(47, 139, 255, .30), 0 0 12px rgba(47, 139, 255, .22); }
:where(:root[data-theme="tech"]) .ai-pill:hover { background: rgba(47, 139, 255, .18); }
:where(:root[data-theme="tech"]) .secure-pill { border: 1px solid rgba(95, 227, 154, .35); }

/* surfaces */
:where(:root[data-theme="tech"]) .card, :where(:root[data-theme="tech"]) .modal, :where(:root[data-theme="tech"]) .tool-card, :where(:root[data-theme="tech"]) .bank-tile, :where(:root[data-theme="tech"]) .tool-prompt, :where(:root[data-theme="tech"]) .tool-more, :where(:root[data-theme="tech"]) .tool-about, :where(:root[data-theme="tech"]) .greet-bubble, :where(:root[data-theme="tech"]) .train-progress {
  background: linear-gradient(180deg, rgba(13, 24, 52, .96), rgba(8, 15, 34, .96)); border-color: #1c3572;
}
:where(:root[data-theme="tech"]) .card { box-shadow: var(--shadow); }
:where(:root[data-theme="tech"]) .card-head h2, :where(:root[data-theme="tech"]) .card > h2 { color: #fff; }
:where(:root[data-theme="tech"]) .tool-card:hover, :where(:root[data-theme="tech"]) .bank-tile:hover, :where(:root[data-theme="tech"]) .bank-tile:focus-visible, :where(:root[data-theme="tech"]) .tool-prompt:hover, :where(:root[data-theme="tech"]) .tool-prompt:focus-visible { border-color: #2f8bff; box-shadow: var(--glow); background: linear-gradient(180deg, rgba(18, 34, 74, .98), rgba(10, 20, 46, .98)); }
:where(:root[data-theme="tech"]) .tool-mark, :where(:root[data-theme="tech"]) .bank-icon, :where(:root[data-theme="tech"]) .greet-mark { background: rgba(47, 139, 255, .16); color: #8cc8ff; box-shadow: inset 0 0 0 1px rgba(47, 139, 255, .35); }
:where(:root[data-theme="tech"]) .tile { background: linear-gradient(180deg, rgba(13, 24, 52, .96), rgba(8, 15, 34, .96)); border-color: #2a4a9a; box-shadow: inset 0 0 22px rgba(47, 139, 255, .10); }
:where(:root[data-theme="tech"]) .tile-value { color: #fff; }
:where(:root[data-theme="tech"]) .tiles > .tile:nth-child(6n+1) { border-color: rgba(139, 92, 246, .75); box-shadow: inset 0 0 24px rgba(139, 92, 246, .16); }
:where(:root[data-theme="tech"]) .tiles > .tile:nth-child(6n+2) { border-color: rgba(20, 184, 166, .75); box-shadow: inset 0 0 24px rgba(20, 184, 166, .15); }
:where(:root[data-theme="tech"]) .tiles > .tile:nth-child(6n+3) { border-color: rgba(245, 158, 11, .75); box-shadow: inset 0 0 24px rgba(245, 158, 11, .14); }
:where(:root[data-theme="tech"]) .tiles > .tile:nth-child(6n+4) { border-color: rgba(59, 130, 246, .80); box-shadow: inset 0 0 24px rgba(59, 130, 246, .16); }
:where(:root[data-theme="tech"]) .tiles > .tile:nth-child(6n+5) { border-color: rgba(34, 197, 94, .70); box-shadow: inset 0 0 24px rgba(34, 197, 94, .13); }
:where(:root[data-theme="tech"]) .tiles > .tile:nth-child(6n+6) { border-color: rgba(168, 85, 247, .75); box-shadow: inset 0 0 24px rgba(168, 85, 247, .15); }
:where(:root[data-theme="tech"]) .modal { box-shadow: 0 0 0 1px rgba(47, 139, 255, .25), 0 24px 70px rgba(0, 0, 0, .6); }

/* buttons, fields */
:where(:root[data-theme="tech"]) .btn { background: #0f1d3d; border-color: #26407d; color: var(--ink); }
:where(:root[data-theme="tech"]) .btn:hover { background: #162a57; border-color: #3a5cab; }
:where(:root[data-theme="tech"]) .btn.primary { background: linear-gradient(180deg, #1f7af0, #0f55c9); border-color: #3d8bff; color: #fff; box-shadow: 0 0 16px rgba(47, 139, 255, .30); }
:where(:root[data-theme="tech"]) .btn.primary:hover { filter: brightness(1.12); }
:where(:root[data-theme="tech"]) .btn.danger { background: #b3261e; border-color: #d2463e; color: #fff; }
:where(:root[data-theme="tech"]) .btn.danger:hover { background: #981f18; }
:where(:root[data-theme="tech"]) .btn.danger-text, :where(:root[data-theme="tech"]) .btn.stop { color: #ff9a9a; }
:where(:root[data-theme="tech"]) .link-btn { color: var(--accent); }
:where(:root[data-theme="tech"]) input[type=text], :where(:root[data-theme="tech"]) input[type=email], :where(:root[data-theme="tech"]) input[type=password], :where(:root[data-theme="tech"]) input[type=number], :where(:root[data-theme="tech"]) input[type=search], :where(:root[data-theme="tech"]) input[type=date], :where(:root[data-theme="tech"]) input[type=tel], :where(:root[data-theme="tech"]) select, :where(:root[data-theme="tech"]) textarea { background: #071025; color: var(--ink); border-color: #233a70; }
:where(:root[data-theme="tech"]) input::placeholder, :where(:root[data-theme="tech"]) textarea::placeholder { color: #7f92b8; }
:where(:root[data-theme="tech"]) input:focus-visible, :where(:root[data-theme="tech"]) select:focus-visible, :where(:root[data-theme="tech"]) textarea:focus-visible { outline-color: #4d9bff; }
:where(:root[data-theme="tech"]) .composer-box { background: #0a1430; border-color: #233a70; box-shadow: 0 0 0 1px rgba(47, 139, 255, .06), 0 8px 24px rgba(0, 0, 0, .35); }
:where(:root[data-theme="tech"]) .composer-box:focus-within { border-color: #4d9bff; box-shadow: var(--glow); }
:where(:root[data-theme="tech"]) .composer-box textarea { background: transparent; }
:where(:root[data-theme="tech"]) .logo-preview, :where(:root[data-theme="tech"]) .doc-preview { background: #071025; border-color: #233a70; color: var(--ink); }

/* tabs as buttons */
:where(:root[data-theme="tech"]) .tabs { border-bottom: 0; gap: 8px; }
:where(:root[data-theme="tech"]) .tab { border: 1px solid #1f3566; border-radius: 8px; background: rgba(13, 24, 52, .85); color: var(--ink-2); padding: 8px 16px; }
:where(:root[data-theme="tech"]) .tab:hover { color: #fff; border-color: #33539b; }
:where(:root[data-theme="tech"]) .tab.active { background: linear-gradient(180deg, #1f7af0, #0f55c9); border-color: #4d9bff; color: #fff; box-shadow: 0 0 16px rgba(47, 139, 255, .35); }

/* tables */
:where(:root[data-theme="tech"]) table.data { background: transparent; }
:where(:root[data-theme="tech"]) table.data th { background: #0d1a38; color: #b9c8e8; border-bottom: 1px solid #1f3566; }
:where(:root[data-theme="tech"]) table.data td { border-bottom-color: #14234a; }
:where(:root[data-theme="tech"]) table.data tbody tr:hover td { background: rgba(47, 139, 255, .06); }
:where(:root[data-theme="tech"]) table.data tr.group td { background: #0f1e42; }
:where(:root[data-theme="tech"]) .page > .table-scroll, :where(:root[data-theme="tech"]) .page > div > .table-scroll, :where(:root[data-theme="tech"]) .chart-table .table-scroll { border-color: #1c3572; }
:where(:root[data-theme="tech"]) .badge, :where(:root[data-theme="tech"]) .badge.muted { background: #16264b; color: var(--ink-2); }
:where(:root[data-theme="tech"]) .badge.ok { background: var(--ok-bg); color: var(--ok); }
:where(:root[data-theme="tech"]) .badge.warn { background: var(--warn-bg); color: var(--warn); }
:where(:root[data-theme="tech"]) .badge.bad { background: var(--bad-bg); color: var(--bad); }
:where(:root[data-theme="tech"]) .badge.info { background: var(--info-bg); color: var(--info); }
:where(:root[data-theme="tech"]) .notice, :where(:root[data-theme="tech"]) .form-error { border: 1px solid rgba(47, 139, 255, .30); }
:where(:root[data-theme="tech"]) .notice.ok { border-color: rgba(95, 227, 154, .35); }
:where(:root[data-theme="tech"]) .notice.warn { border-color: rgba(255, 209, 102, .35); }
:where(:root[data-theme="tech"]) .notice.bad, :where(:root[data-theme="tech"]) .form-error { border-color: rgba(255, 154, 154, .40); }

/* chat */
:where(:root[data-theme="tech"]) .msg.user .msg-body { background: linear-gradient(180deg, #1b62d6, #144fb4); color: #fff; }
:where(:root[data-theme="tech"]) .msg.assistant .msg-body { background: linear-gradient(180deg, rgba(13, 24, 52, .96), rgba(8, 15, 34, .96)); border-color: #1c3572; }
:where(:root[data-theme="tech"]) .msg-body code { background: #13224a; }
:where(:root[data-theme="tech"]) .msg-body pre { background: #030814; border: 1px solid #1b2c55; }
:where(:root[data-theme="tech"]) .msg-body th { background: #0f1d3d; }
:where(:root[data-theme="tech"]) .msg-body blockquote { border-left-color: #2a427f; }
:where(:root[data-theme="tech"]) .chat-files { background: #070f24; }
:where(:root[data-theme="tech"]) .file-chip { background: rgba(47, 139, 255, .16); }
:where(:root[data-theme="tech"]) .trainer-chat .train-head { background: rgba(8, 15, 34, .7); }

/* investigation page */
:where(:root[data-theme="tech"]) input[type=time] { background: #071025; color: var(--ink); border-color: #233a70; }
:where(:root[data-theme="tech"]) .inv-emblem { background: rgba(47, 139, 255, .14); color: #4db5ff; box-shadow: inset 0 0 0 1px rgba(47, 139, 255, .45), 0 0 26px rgba(47, 139, 255, .30); }
:where(:root[data-theme="tech"]) .inv-title h1 { text-shadow: 0 0 26px rgba(47, 139, 255, .55); }
:where(:root[data-theme="tech"]) .inv-chip { background: linear-gradient(180deg, rgba(13, 24, 52, .96), rgba(8, 15, 34, .96)); border-color: #2a4a9a; box-shadow: inset 0 0 18px rgba(47, 139, 255, .10); }
:where(:root[data-theme="tech"]) .inv-filters { border-color: #2a4a9a; box-shadow: 0 0 0 1px rgba(47, 139, 255, .12), 0 0 26px rgba(47, 139, 255, .10); }
:where(:root[data-theme="tech"]) .inv-tile-ico { background: rgba(255, 255, 255, .06); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
:where(:root[data-theme="tech"]) .inv-tile.t1 .inv-tile-ico { background: linear-gradient(180deg, #7c5cf0, #4f37c4); }
:where(:root[data-theme="tech"]) .inv-tile.t2 .inv-tile-ico { background: linear-gradient(180deg, #12b5a4, #0b7f76); }
:where(:root[data-theme="tech"]) .inv-tile.t3 .inv-tile-ico { background: linear-gradient(180deg, #f0a52a, #b8720b); }
:where(:root[data-theme="tech"]) .inv-tile.t4 .inv-tile-ico { background: linear-gradient(180deg, #2f8bff, #1456c4); }
:where(:root[data-theme="tech"]) .inv-tile.t5 .inv-tile-ico { background: linear-gradient(180deg, #22b866, #12803f); }
:where(:root[data-theme="tech"]) .inv-tile.t6 .inv-tile-ico { background: linear-gradient(180deg, #a35cf5, #6d2fc2); }
:where(:root[data-theme="tech"]) .inv-node circle { filter: drop-shadow(0 0 5px rgba(47, 139, 255, .7)); }
:where(:root[data-theme="tech"]) .inv-node.centre circle { filter: drop-shadow(0 0 9px rgba(255, 190, 60, .85)); }
:where(:root[data-theme="tech"]) .inv-edge { stroke: #7fa8e8; }
:where(:root[data-theme="tech"]) .inv-bar i.cd { background: linear-gradient(180deg, #45b6ff, #1f7af0); }
:where(:root[data-theme="tech"]) .inv-type.net { color: #b79cff; }

/* charts */
:where(:root[data-theme="tech"]) .viz-root { --series-1: #2f9bff; --grid: #1b2c55; }
:where(:root[data-theme="tech"]) .chart-tip { background: #16264b; border: 1px solid #2a427f; }
}

/* bank investigation overview, module headers on the list pages */
.module-actions { margin-bottom: 14px; }
.bank-hint { margin: 0 0 10px; }
.bank-sum { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.bank-sum .tile-value { font-size: 1.12rem; white-space: nowrap; }
.bank-sum .inv-tile > div { min-width: 0; }
.bank-tools-card .bank-tools-head { margin: 0 0 4px; }
.bank-tools-card .bank-grid { margin: 12px 0 0; }
.bank-tools-card .bank-hint { margin: 2px 0 0; }
#bank-overview { margin-bottom: 6px; }
.inv-type.deb { color: var(--bad); }
.inv-flow { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.inv-flow li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: .86rem; }
.inv-flow-arrow { color: var(--ok); font-weight: 700; }
.inv-flow-amt { margin-left: auto; }
.inv-flow .sub { flex: 1 1 100%; margin: 0; font-size: .76rem; overflow-wrap: anywhere; }
.inv #bk-records td, .inv #bk-records th { white-space: nowrap; }
.inv #bk-records .table-scroll { border: 1px solid var(--line); border-radius: 10px; }
@media screen {
:where(:root[data-theme="tech"]) .inv-tile.t7 .inv-tile-ico { background: linear-gradient(180deg, #f0524f, #b5221f); }
:where(:root[data-theme="tech"]) .tiles > .inv-tile.t7 { border-color: rgba(240, 82, 79, .75); box-shadow: inset 0 0 24px rgba(240, 82, 79, .14); }
:where(:root[data-theme="tech"]) .inv-flow li { border-color: #1c3572; background: rgba(13, 24, 52, .6); }
}

.train-chat-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.train-chat-card .sub { margin: 4px 0 0; }

/* investigation page: record cells stay on one line; the table scrolls sideways inside its frame */
.inv #inv-records td, .inv #inv-records th { white-space: nowrap; }

.up-ai { margin: -4px 0 12px; }

.train-note-msg .msg-body { border-style: dashed; }

.bank-types { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.bank-types > div:first-child { flex: 1 1 380px; min-width: 0; }
.bank-types .sub { display: block; margin: 4px 0 0; }
.bk-ai { margin-left: 6px; }



.zip-list { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.zip-list select { min-width: 220px; }

/* v14.8: CDR Analysis, IPDR Analysis and Data analysis use the investigation layout */
.inv-panel, .inv-timeline { min-width: 0; }
.inv-bars { overflow: hidden; }
.inv-legal { margin-top: 4px; max-width: 110ch; }
.inv .module-actions { margin: 0; }
.inv .card > .table-scroll, .inv .card > div > .table-scroll { margin: 0 -2px; }
.page.inv > .module-actions { margin: 12px 0 10px; }
.page.inv > .tiles { margin: 12px 0; }
.inv-legal { margin-top: 12px; }

/* things that can be pressed: tiles, graph nodes, bars, towers, transfers */
.clickable { cursor: pointer; }
.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile.clickable { transition: transform .12s ease, box-shadow .12s ease; }
.tile.clickable:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(47, 139, 255, .22), inset 0 0 24px rgba(47, 139, 255, .14); }
.inv-chip.clickable:hover { border-color: var(--accent); }
.inv-node.clickable:hover circle { stroke: #fff; stroke-width: 2; }
.inv-node.clickable:focus-visible { outline: none; }
.inv-node.clickable:focus-visible circle { stroke: #fff; stroke-width: 2.5; }
.inv-bar.clickable:hover i { filter: brightness(1.35); }
.inv-towers li.clickable, .inv-graph-key li.clickable, .inv-flow li.clickable { border-radius: 8px; }
.inv-towers li.clickable:hover, .inv-graph-key li.clickable:hover, .inv-flow li.clickable:hover { background: rgba(47, 139, 255, .12); }
.cell-pick { font: inherit; color: inherit; text-decoration: none; text-align: left; }
.cell-pick:hover { color: var(--accent); text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .tile.clickable { transition: none; } .tile.clickable:hover { transform: none; } }

/* IP check pop-up */
.ip-table { width: 100%; border-collapse: collapse; }
.ip-table th { text-align: left; font-weight: 600; color: var(--ink-3); width: 38%; padding: 7px 10px 7px 0; vertical-align: top; }
.ip-table td { padding: 7px 0; overflow-wrap: anywhere; }
.ip-table tr + tr th, .ip-table tr + tr td { border-top: 1px solid var(--line); }
.ip-h { font-size: .95rem; margin: 16px 0 8px; }
.ip-flags { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 8px; margin-bottom: 10px; }
.ip-flag { min-width: 0; }
.ip-flag-value { flex: none; }
.ip-flag { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; }
.ip-flag-name { font-weight: 600; }
.ip-flag-value { font-weight: 700; font-size: .85rem; padding: 2px 9px; border-radius: 999px; }
.ip-flag.yes { border-color: rgba(240, 82, 79, .7); }
.ip-flag.yes .ip-flag-value { background: rgba(240, 82, 79, .18); color: #d92d2a; }
.ip-flag.no .ip-flag-value { background: rgba(34, 197, 94, .16); color: #15803d; }
.ip-flag.na .ip-flag-value { background: rgba(127, 127, 127, .16); color: var(--ink-3); }
:where(:root[data-theme="tech"]) .ip-flag { background: rgba(8, 15, 34, .7); border-color: #233a70; }
:where(:root[data-theme="tech"]) .ip-flag.yes .ip-flag-value { color: #ff8a87; }
:where(:root[data-theme="tech"]) .ip-flag.no .ip-flag-value { color: #5fe39a; }
.modal-foot { flex-wrap: wrap; }
.modal-foot .btn { max-width: 100%; white-space: normal; }

/* tower reference database */
.tower-history { margin: 0; padding-left: 18px; }
.tower-history li + li { margin-top: 4px; }
.tower-one + .tower-one { margin-top: 14px; }
.ref-maps { white-space: nowrap; }
.ref-steps { margin: 0; padding-left: 20px; }
.ref-steps li + li { margin-top: 6px; }
.from-ref { font-style: italic; }
.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }

/* links between the files of a case */
.link-sect { margin-top: 18px; }
.link-sect h3 { font-size: 1rem; margin: 0 0 2px; }
.link-sect > .sub { margin: 0 0 8px; }
.link-chips { display: flex; flex-wrap: wrap; gap: 6px; }
td.link-chips { display: table-cell; }
td.link-chips .link-chip { margin: 2px 6px 2px 0; }
.link-chip { border: 1px solid var(--line); background: transparent; color: inherit; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: .85rem; cursor: pointer; text-align: left; }
.link-chip:hover { border-color: var(--accent); }
.link-tiles { margin-bottom: 4px; }
:where(:root[data-theme="tech"]) .link-chip { background: rgba(8, 15, 34, .7); border-color: #233a70; }

/* v15.2: file pages in the investigation look; towers with their address */
.file-head { justify-content: flex-start; align-items: center; }
.file-head .file-title { flex: 1 1 320px; min-width: 0; }
.file-head .file-title h1 { overflow-wrap: anywhere; }
:where(:root[data-theme="tech"]) .file-head h1 { text-shadow: 0 0 26px rgba(47, 139, 255, .55); }
.fileview .back-link { display: inline-block; margin-bottom: 8px; }
.file-panels { margin: 0; }
.tower-td .tower-addr { max-width: 340px; white-space: normal; }
.tower-addr:empty { display: none; }
@media print { .inv-panels { grid-template-columns: 1fr; } }
.inv-tile > div { min-width: 0; }
.inv-tile .tile-label, .inv-tile .tile-value, .inv-tile .tile-note { overflow-wrap: anywhere; }

/* quick access links */
.ql-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.ql-url { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.ql-url code { background: rgba(0,0,0,.06); padding: 6px 10px; border-radius: 8px; overflow-wrap: anywhere; }
:where(:root[data-theme="tech"]) .ql-url code { background: rgba(8,15,34,.8); border: 1px solid #233a70; }
tr.muted-row { opacity: .6; }

/* subscriber lookup: the name and address on record, under a mobile number (subscriber.js) */
.sub-note:empty { display: none; }
.sub-note { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", Arial, sans-serif; font-weight: 400; letter-spacing: 0; text-transform: none; }
.sub-note.cell-note { max-width: 300px; white-space: normal; text-align: left; line-height: 1.3; }
.sub-note .sub-name { font-family: inherit; font-size: .8rem; font-weight: 600; color: var(--ink-2); text-decoration: none; text-align: left; }
.sub-note .sub-name:hover, .sub-note .sub-ask:hover { text-decoration: underline; }
.sub-note .sub-label { font-size: .76rem; color: var(--ink-3); }
.sub-note .sub-addr { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: .76rem; color: var(--ink-3); overflow-wrap: anywhere; }
.sub-note.brief .sub-addr { display: none; }
.sub-note.inline { margin-left: 8px; }
.sub-note.inline .sub-name { font-size: inherit; }
.sub-note.inline .sub-addr { display: inline; margin-left: 8px; font-size: inherit; }
.sub-note .sub-ask { font-family: inherit; font-size: .74rem; color: var(--ink-3); text-decoration: none; }
.inv-graph-key .sub-note { margin: 0 0 4px; }
@media print {
  .sub-note .sub-name { color: #000; }
  .sub-note .sub-addr { display: block; overflow: visible; color: #333; }
  .sub-note.brief .sub-addr { display: none; }
}

/* IPDR intelligence (ipintel.js) */
.intel-bars li .sub { overflow-wrap: anywhere; }
.intel-matrix th.mono { font-size: .74rem; max-width: 150px; overflow-wrap: anywhere; white-space: normal; }
.intel-matrix td.num { text-align: center; }
.intel-report-sec h2 { font-size: 1.02rem; margin: 0 0 10px; }
.intel-notes { min-height: 70px; border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; }
@media print { .intel-report .card { break-inside: auto; } .intel-notes { border: 1px solid #999; } }

/* IPDR file: the earlier call-record style report, folded away under the IPDR reports */
.ipdr-old-report > summary { cursor: pointer; font-weight: 600; padding: 2px 0; }
.ipdr-old-report[open] > summary { margin-bottom: 12px; }
.ipdr-old-report > div > .card { box-shadow: none; border: 0; padding: 0; background: none; }
#ipdr-prev-books { margin: 4px 0 8px; }
