/* Carta Desk technician console. Light, technical, built for scanning a queue.
   Everything derives from the tokens below; a reseller's accent colour is set on :root by app.js and the soft and
   line tints follow it. No inline style anywhere (the CSP forbids it). */

@font-face { font-family: "IBM Plex Sans"; src: url(/console/fonts/ibm-plex-sans.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/console/fonts/ibm-plex-mono-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/console/fonts/ibm-plex-mono-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/console/fonts/ibm-plex-mono-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #EDF1F4;
  --surface: #FFFFFF;
  --surface2: #F5F8FA;
  --ink: #0B2239;
  --mute: #52677B;
  --faint: #8596A6;
  --line: #D3DCE4;
  --line2: #E4EAEF;
  --accent: #0A86A0;
  --accent-ink: #FFFFFF;
  --accent-strong: color-mix(in srgb, var(--accent) 80%, #000);
  --accent-soft: color-mix(in srgb, var(--accent) 9%, #fff);
  --accent-line: color-mix(in srgb, var(--accent) 30%, #fff);
  --blue: #1F5FBF; --amber: #96590A; --violet: #6847B5; --green: #11765A; --red: #B8322A; --gray: #5A6674;
  --warn-bg: #FFF7E6; --warn-line: #E8B65A;
  --fb: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fm: "IBM Plex Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  --r: 6px;
  --rs: 4px;
  --shadow: 0 1px 0 var(--line);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--fb); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code, pre, kbd { font-family: var(--fm); }
code { font-size: 12.5px; background: var(--surface2); border: 1px solid var(--line2); padding: 0 5px; border-radius: 3px; word-break: break-all; }
pre { font-size: 12px; line-height: 1.55; background: var(--surface2); border: 1px solid var(--line2); border-radius: var(--rs); padding: 9px 11px; margin: 6px 0 0; overflow: auto; max-height: 18rem; white-space: pre-wrap; word-break: break-word; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
[hidden] { display: none !important; }
.sub { color: var(--mute); font-size: 13px; }
.mono { font-family: var(--fm); }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 18px 12px; background: #F7F9FB; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 600; font-size: 16px; }
.mark { width: 28px; height: 28px; flex: none; border-radius: 3px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 600 14px var(--fm); }
.brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .sec { font: 500 10.5px var(--fm); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 12px 10px 5px; }
.nav .sec:first-child { padding-top: 0; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: var(--rs); color: var(--mute); font-weight: 500; }
.nav a:hover { color: var(--ink); background: #EEF2F5; text-decoration: none; }
.nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.nav a[aria-current="page"] .ic { color: var(--accent); }
.nav .count { margin-left: auto; font: 600 11px var(--fm); padding: 0 6px; border-radius: 3px; background: var(--accent); color: var(--accent-ink); }
.me { margin-top: auto; display: grid; gap: 8px; padding: 10px 8px 0; border-top: 1px solid var(--line); }
.me-id { display: flex; gap: 10px; align-items: center; min-width: 0; }
.me-id div { min-width: 0; line-height: 1.3; } .me-id b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-id small { font: 500 10.5px var(--fm); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.me-actions { display: flex; gap: 6px; }
.main { min-width: 0; padding: 26px 36px 56px; }
.main > * { max-width: 1480px; margin-inline: auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { color: var(--mute); margin-top: 3px; }
.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-bottom: 16px; font-size: 14px; }
.crumb a, .crumb .here { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--mute); text-decoration: none; }
.crumb a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
.crumb a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.crumb .here { color: var(--ink); font-weight: 600; }
.crumb .sep { flex: none; width: 5px; height: 5px; margin: 0 2px 0 0; border-top: 1.5px solid var(--faint); border-right: 1.5px solid var(--faint); transform: rotate(45deg); }
.crumb .ic { width: 14px; height: 14px; }
.ticker { display: flex; gap: 6px 22px; flex-wrap: wrap; margin-block: -6px 16px; font: 500 11.5px var(--fm); letter-spacing: .04em; text-transform: uppercase; color: var(--mute); }
.ticker b { color: var(--ink); font-weight: 600; } .ticker .ok { color: var(--green); } .ticker .bad { color: var(--red); } .ticker .warn { color: var(--amber); }
.banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 16px; border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--rs); font-size: 13px; }
.banner.bad { border-color: #E8B4AF; background: #FCEEEC; color: var(--red); font-weight: 500; }
.banner.warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--amber); font-weight: 500; }
.ic { width: 17px; height: 17px; flex: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 500 13px/1.2 var(--fb); padding: 7px 13px; border-radius: var(--rs); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--faint); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn .ic { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent-strong); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn.danger { color: var(--red); } .btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.link { border: 0; background: none; padding: 0; color: var(--accent-strong); }
.icon-btn { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: var(--rs); background: none; color: var(--mute); cursor: pointer; }
.icon-btn:hover { background: var(--surface2); color: var(--ink); } .icon-btn .ic { width: 16px; height: 16px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--rs); padding: 7px 10px; width: 100%; min-height: 34px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
textarea { min-height: 86px; resize: vertical; }
input[type="checkbox"] { width: 15px; height: 15px; min-height: 0; accent-color: var(--accent); }
input[type="search"] { padding-left: 32px; }
.fld { display: grid; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--mute); }
.fld > span { font: 500 11px var(--fm); letter-spacing: .08em; text-transform: uppercase; }
.fld .hint { font: 400 12.5px var(--fb); letter-spacing: 0; text-transform: none; color: var(--faint); }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--mute); }
.form { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.grow > * { flex: 1 1 11rem; width: auto; }
.grow { flex: 1; min-width: 11rem; }
.search-box { position: relative; flex: 1 1 22rem; }
.search-box .ic { position: absolute; left: 10px; top: 50%; translate: 0 -50%; color: var(--faint); width: 15px; height: 15px; pointer-events: none; }
.search-box kbd { position: absolute; right: 8px; top: 50%; translate: 0 -50%; font: 500 11px var(--fm); color: var(--faint); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; background: var(--surface2); pointer-events: none; }
.alert { padding: 8px 12px; border-radius: var(--rs); font-size: 13px; }
.alert.warn { color: var(--ink); background: var(--warn-bg); border: 1px solid var(--warn-line); }
.alert.err { color: var(--red); background: #FCEEEC; border: 1px solid #EBC4C0; }

/* ---------- tags ---------- */
.tag { --c: var(--gray); display: inline-flex; align-items: center; gap: 5px; font: 600 10.5px/1.5 var(--fm); letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border-radius: 3px; color: var(--c); background: color-mix(in srgb, var(--c) 8%, #fff); border: 1px solid color-mix(in srgb, var(--c) 36%, #fff); white-space: nowrap; }
.tag .ic { width: 11px; height: 11px; }
.c-blue { --c: var(--blue); } .c-amber { --c: var(--amber); } .c-violet { --c: var(--violet); } .c-green { --c: var(--green); } .c-red { --c: var(--red); } .c-gray { --c: var(--gray); } .c-accent { --c: var(--accent-strong); }
.chip { display: inline-flex; align-items: center; font: 500 11px/1.5 var(--fm); padding: 0 6px; border-radius: 3px; color: var(--mute); background: var(--surface2); border: 1px solid var(--line2); }
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line); margin-right: 7px; flex: none; }
.dot.on { background: #1FA463; box-shadow: 0 0 0 3px #DCF3E6; }
.av { width: 26px; height: 26px; flex: none; border-radius: 3px; display: grid; place-items: center; font: 600 10.5px var(--fm); background: hsl(var(--h, 200) 45% 90%); color: hsl(var(--h, 200) 55% 24%); }
.av.big { width: 38px; height: 38px; font-size: 13px; }
.av.ai { background: var(--accent-soft); color: var(--accent-strong); } .av.ai .ic { width: 15px; height: 15px; }
.av.none { background: none; border: 1px dashed var(--line); color: var(--faint); }
.who-cell { display: flex; gap: 8px; align-items: center; min-width: 0; white-space: nowrap; }

/* ---------- tabs, cards, tables ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { display: inline-flex; gap: 7px; align-items: center; font: 500 13px var(--fb); padding: 5px 11px; border-radius: var(--rs); border: 1px solid transparent; background: none; color: var(--mute); cursor: pointer; }
.tab:hover { color: var(--ink); background: #E3E9EE; }
.tab b { font: 500 11.5px var(--fm); color: var(--faint); font-variant-numeric: tabular-nums; }
.tab[aria-pressed="true"] { background: var(--ink); color: #fff; } .tab[aria-pressed="true"] b { color: #B7C5D3; }
/* A binder: labelled tabs along the top of one panel, like the tab strip of a drawing sheet. The chosen tab is the sheet's own colour. */
.binder { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.binder-tabs { display: flex; background: var(--surface2); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.binder-tab { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; padding: 13px 20px 12px; margin-bottom: -1px; background: none; cursor: pointer;
  border: 0; border-top: 2px solid transparent; border-bottom: 1px solid transparent; border-right: 1px solid var(--line2);
  font: 600 11.5px var(--fm); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.binder-tab:hover { color: var(--ink); background: #EAF0F4; }
.binder-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.binder-tab[aria-pressed="true"] { background: var(--surface); color: var(--ink); border-top-color: var(--accent); border-bottom-color: var(--surface); }
.binder-tab .n { font: 500 11px var(--fm); letter-spacing: 0; padding: 1px 7px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: var(--mute); font-variant-numeric: tabular-nums; }
.binder-tab .n.zero { color: var(--faint); }
.binder-tab[aria-pressed="true"] .n { color: var(--accent-strong); border-color: var(--accent-line); background: var(--accent-soft); }
.binder-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line2); }
.binder-bar .search-box { flex: 1 1 18rem; max-width: 34rem; }
.binder-bar .end { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.binder-body > .card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.binder-body > .card:last-child { border-bottom: 0; }
.binder-body > .card > .card-h { border-radius: 0; }
.binder .pager { border-radius: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.props { padding: 4px 16px 8px; }
.prop { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line2); }
.prop:first-child { border-top: 0; }
.prop > label, .prop > span:first-child { font: 500 10.5px var(--fm); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.prop select, .prop input { min-height: 32px; padding: 5px 8px; font-size: 13px; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface2); border-bottom: 1px solid var(--line); border-radius: var(--r) var(--r) 0 0; min-height: 42px; }
.card-h h2 { font: 600 11.5px var(--fm); letter-spacing: .1em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.card-h h2 .ic { width: 15px; height: 15px; color: var(--accent); }
.card-b { padding: 16px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font: 500 10.5px var(--fm); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); padding: 9px 14px; background: var(--surface2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-top: 1px solid var(--line2); vertical-align: middle; }
.tbl tbody tr:first-child td { border-top: 0; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface2); }
.tbl .ref { font: 500 12px var(--fm); color: var(--accent-strong); white-space: nowrap; }
.tbl .subject { font-weight: 500; font-size: 14px; color: var(--ink); }
.tbl .meta { display: flex; gap: 6px 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; color: var(--mute); font-size: 12.5px; }
.tbl .up { color: var(--mute); font: 400 12px var(--fm); text-align: right; white-space: nowrap; }
.tbl .due-over { color: var(--red); font-weight: 600; }
.tbl.plain th, .tbl.plain td { padding: 9px 14px; }
.card .tbl th:first-child, .card .tbl td:first-child { padding-left: 16px; }
/* A row's buttons: the column takes only their width, at the right edge. */
.prompt-body { max-width: 40rem; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tbl td.acts { width: 1%; } .tbl td.acts .row { justify-content: flex-end; flex-wrap: nowrap; }
.empty { padding: 36px 20px; text-align: center; color: var(--mute); }
.empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 3px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface2); border-radius: 0 0 var(--r) var(--r); font: 400 12px var(--fm); color: var(--mute); }
.loading { padding: 28px; text-align: center; font: 500 12px var(--fm); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar select, .toolbar input[type="month"] { width: auto; min-width: 10rem; flex: 0 1 12rem; }
.card-b .toolbar { margin-bottom: 0; }
.toolbar .grow { flex: 1 1 20rem; width: auto; }
select.narrow { max-width: 16rem; }
.tbl th.up { font: 500 10.5px var(--fm); }

/* ---------- ticket ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.layout > .col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.layout .card + .card { margin-top: 0; }
/* The ticket's AI panel: one card, a tab for each place it works. Something waiting on the technician outlines it and dots its tab. */
.ai-panel .card-h { gap: 12px; flex-wrap: wrap; }
.ai-panel.asks { box-shadow: 0 0 0 2px var(--warn-line); }
.segs { display: inline-flex; border: 1px solid var(--line); border-radius: var(--rs); overflow: hidden; }
.seg { appearance: none; border: 0; background: var(--surface); color: var(--mute); padding: 5px 12px; font: inherit; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg + .seg { border-left: 1px solid var(--line); }
.seg.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg:not(.on):hover { background: var(--surface2); color: var(--ink); }
.seg-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.ai-tab-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px 0; }
.t-head { padding: 18px 18px 14px; }
.t-head h1 { font-size: 21px; }
.t-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.t-title .btn { flex: none; }
textarea.close-mail { min-height: 180px; }
.t-meta { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; color: var(--mute); font-size: 13px; }
.t-meta .ref { font: 500 12px var(--fm); color: var(--accent-strong); }
.thread { display: grid; gap: 16px; padding: 16px 18px 4px; }
.msg { display: flex; gap: 12px; }
.bub { flex: 1; min-width: 0; padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--rs); background: var(--surface); }
.msg.internal .bub { background: #FFFAEC; border-color: #EDE0B2; }
.msg.agent_summary .bub { background: var(--accent-soft); border-color: var(--accent-line); }
.msg.email_out .bub { border-color: var(--accent-line); }
.bub .by { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 7px; font-size: 12.5px; color: var(--mute); }
.bub .by b { color: var(--ink); font-weight: 600; }
.bub .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.sysline { display: flex; gap: 8px; align-items: center; padding-left: 4px; color: var(--mute); font-size: 12.5px; }
.sysline::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--faint); margin-left: 9px; margin-right: 9px; }
.composer { margin: 18px 18px 18px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.composer .rich-box, .composer .rich-box:focus-within { border: 0; border-radius: 0; box-shadow: none; }
.composer .rich-edit { height: 10rem; min-height: 5.5rem; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.composer .foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--surface); font-size: 12.5px; color: var(--mute); }
.time-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto auto; gap: 12px; align-items: baseline; padding: 8px 16px; border-top: 1px solid var(--line2); font-size: 13px; }
.time-row:first-of-type { border-top: 0; }
.time-row .d { font: 400 12px var(--fm); color: var(--mute); } .time-row .m { font: 500 12.5px var(--fm); white-space: nowrap; }
.time-add { display: grid; grid-template-columns: 9rem minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface2); border-radius: 0 0 var(--r) var(--r); }
/* In the ticket's narrow side column: how long and Log time on one line, what was done under them. */
.layout > .col + .col .time-add { grid-template-columns: minmax(0, 1fr) auto; }
.layout > .col + .col .time-add > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
.layout > .col + .col .time-row { grid-template-columns: 72px minmax(0, 1fr) auto auto; gap: 8px; padding: 8px 12px; }

/* ---------- formatted text ---------- */
.rich h2, .rich h3 { line-height: 1.3; font-weight: 600; margin: 8px 0 3px; }
.rich h2 { font-size: 21px; } .rich h3 { font-size: 17px; }
.rich > :first-child { margin-top: 0; }
.rich ul, .rich ol { margin: 3px 0; padding-left: 24px; }
.rich .line { white-space: pre-wrap; min-height: 1.5em; }
.bub .body .rich { white-space: normal; }
.bub .body .ai-text { white-space: normal; }
.ai-text > :first-child { margin-top: 0; } .ai-text > :last-child { margin-bottom: 0; }
.ai-text p { margin: 0 0 9px; line-height: 1.55; }
.ai-text h4 { margin: 14px 0 5px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.ai-text ol { margin: 0 0 9px; padding-left: 22px; display: grid; gap: 7px; }
.ai-text code { font: 12px var(--fm); background: var(--surface2); border: 1px solid var(--line2); border-radius: 4px; padding: 0 4px; word-break: normal; overflow-wrap: break-word; }
.ai-text ul { margin: 0 0 9px; padding-left: 20px; display: grid; gap: 7px; }
.ai-text li { line-height: 1.5; padding-left: 2px; }
.rich-box { border: 1px solid var(--line); border-radius: var(--rs); overflow: hidden; background: var(--surface); }
.rich-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.rich-bar { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; padding: 5px 6px; background: var(--surface2); border-bottom: 1px solid var(--line); }
.rich-bar select { width: auto; min-height: 28px; padding: 2px 6px; margin-right: 6px; font-size: 13px; }
.rich-bar .icon-btn { font: 400 14px var(--fb); color: var(--ink); }
.rich-bar .icon-btn b { font-weight: 700; }
.rich-bar .icon-btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
.rich-gap { width: 1px; height: 18px; margin: 0 6px; background: var(--line); }
.rich-edit { height: clamp(14rem, 44vh, 44rem); min-height: 8rem; overflow: auto; resize: vertical; padding: 10px 12px; font: 400 14px/1.5 var(--fb); color: var(--ink); overflow-wrap: anywhere; }
.rich-edit:focus-visible { outline: 0; }
.rich-edit[contenteditable="false"] { opacity: .6; }
.rich-edit.is-empty::before { content: attr(data-placeholder); display: block; height: 0; color: var(--faint); pointer-events: none; }

/* ---------- AI repair ---------- */
.ai-body { padding: 14px 16px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }

/* ---------- dialog ---------- */
dialog { padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); width: min(32rem, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); box-shadow: 0 24px 60px -20px rgba(11, 34, 57, .45); }
dialog.wide { width: min(44rem, calc(100vw - 2rem)); }
dialog.large { width: min(62rem, calc(100vw - 2rem)); }
dialog::backdrop { background: rgba(11, 34, 57, .38); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 3rem); }
.dlg-h { display: flex; justify-content: space-between; align-items: center; padding: 11px 12px 11px 18px; background: var(--surface2); border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; }
.dlg-h h2 { font: 600 12px var(--fm); letter-spacing: .1em; text-transform: uppercase; }
.dlg-b { padding: 18px; display: grid; gap: 14px; overflow: auto; }
.dlg-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface2); border-radius: 0 0 8px 8px; }
.secret { font: 500 14px var(--fm); letter-spacing: .08em; }
.mailitem { border: 1px solid var(--line2); border-radius: var(--rs); padding: 10px 12px; }

/* ---------- login ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.login-story { display: flex; flex-direction: column; justify-content: center; gap: clamp(20px, 3vh, 32px); padding: clamp(32px, 6vw, 96px) max(clamp(32px, 6vw, 96px), calc((100% - 36rem) / 2)); background: var(--accent-soft); border-right: 1px solid var(--line); }
.login-story .brand { padding: 0; font-size: 16px; }
.login-story h1 { font-size: clamp(34px, 3.4vw, 56px); line-height: 1.08; letter-spacing: -.02em; max-width: 12ch; text-wrap: balance; }
.login-story > p { color: var(--mute); max-width: 42ch; font-size: clamp(15px, 1.1vw, 18px); line-height: 1.6; }
.logbox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; font: 400 13px/2 var(--fm); color: var(--mute); }
.logbox b { color: var(--ink); font-weight: 500; } .logbox em { font-style: normal; color: var(--accent-strong); }
.login-form { display: grid; grid-template-columns: minmax(0, 26rem); justify-content: center; align-content: center; padding: 40px 24px; }
.login-form form { gap: 20px; }
.login-form h2 { font-size: 28px; }
.login-form .sub { font-size: 15px; }
.login-form .fld > span { text-transform: none; letter-spacing: 0; font: 600 14px var(--fb); color: var(--ink); }
.login-form input { min-height: 44px; padding: 8px 48px 8px 14px; font-size: 16px; }
.login-form .code { font: 600 17px var(--fm); letter-spacing: .4em; }
.login-form .qr { justify-self: start; border: 1px solid var(--line); border-radius: 8px; image-rendering: pixelated; }
.login-form .btn { min-height: 44px; padding: 10px; font-size: 16px; }
.login-form .brand { display: none; margin-bottom: 20px; padding: 0; }
.login-form .card-b { display: grid; gap: 12px; padding: 22px 24px; font-size: 15px; line-height: 1.55; }
.login-form .card-b .banner { margin: 0; justify-self: start; }
.login-form .card-b .sub { color: var(--mute); }

/* ---------- small screens ---------- */
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; } .nav .sec { display: none; }
  .me { margin: 0 0 0 auto; border: 0; padding: 0; grid-auto-flow: column; align-items: center; } .me-id div { display: none; }
  .main { padding: 18px 14px 40px; }
  .layout { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; } .login-story { display: none; } .login-form .brand { display: flex; }
  .time-row, .time-add { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: no-preference) { .btn, .tab, .nav a { transition: background-color .12s, border-color .12s, color .12s; } }

/* The AI's work is a terminal, the same screen as the cjb program: the one dark thing in the console, on purpose. */
.ai-page { max-width: 1480px; height: calc(100dvh - 82px); min-height: 420px; display: flex; flex-direction: column; }
.ai-page .crumb { margin-bottom: 8px; }
.ai-head { margin-bottom: 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 6px 18px; flex-wrap: wrap; }
.ai-head h1 { margin: 0; font-size: 18px; line-height: 1.3; }
.ai-head .t-meta { margin-top: 0; }
.ai-head .t-meta .dot { margin-right: 6px; }

.term {
  --t-bg: #0A1118; --t-fg: #DCE5EC; --t-dim: #8A9BAA;
  --t-green: #56D39A; --t-red: #FF8A80; --t-yellow: #E9BC5A;
  --t-accent: color-mix(in srgb, var(--accent) 45%, #E8FBFF);
  color-scheme: dark;
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column;
  background: var(--t-bg); color: var(--t-fg); border: 1px solid #000; border-radius: var(--rs);
  font: 400 13px/1.55 var(--fm); font-variant-ligatures: none;
}
.term:focus-within { border-color: var(--t-accent); }
.term b { font-weight: 600; }
.term pre { margin: 0; padding: 0; background: none; border: 0; border-radius: 0; font: inherit; max-height: none; overflow: visible; white-space: pre-wrap; overflow-wrap: anywhere; }
.term button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.term button:disabled { opacity: .45; cursor: default; }
.term :focus-visible { outline: 1px solid var(--t-accent); outline-offset: 1px; }
.term ::selection { background: color-mix(in srgb, var(--t-accent) 40%, transparent); }
.t-dim { color: var(--t-dim); } .t-green { color: var(--t-green); } .t-red { color: var(--t-red); } .t-yellow { color: var(--t-yellow); } .t-accent { color: var(--t-accent); }
/* As in a terminal, the prompt follows the last line and the empty part is below it, until the screen fills and the log scrolls. */
.t-log { flex: 0 1 auto; min-height: 0; overflow: auto; padding: 12px 14px 4px; display: flex; flex-direction: column; gap: 10px; }
.t-runs { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.t-run { min-width: 0; }
.t-run.open + .t-run, .t-run + .t-run.open { margin-top: 8px; }
.t-row { display: flex; gap: 1ch; width: 100%; min-width: 0; align-items: baseline; }
.t-mark { flex: none; width: 1ch; }
.t-grow { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.t-clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--t-dim); }
.t-clip b { font-weight: 400; }
.t-when { flex: none; max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.t-fold:hover, .t-row.t-head:hover { background: #121C26; }
.t-body { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; min-width: 0; }
.t-say { white-space: pre-wrap; overflow-wrap: anywhere; }
.t-pre { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--t-fg); }
.t-link:hover:not(:disabled) { color: var(--t-fg); text-decoration: underline; text-underline-offset: 2px; }
.t-end { display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.t-cursor { display: inline-block; width: .6em; height: 1.05em; margin-left: 1px; vertical-align: text-bottom; background: var(--t-accent); }
.t-jump { position: absolute; right: 18px; top: 10px; padding: 1px 8px !important; background: var(--t-accent) !important; color: var(--t-bg) !important; font-weight: 500 !important; border-radius: 2px !important; }
.t-dock { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 6px 14px 12px; min-width: 0; }
.t-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-prompt { display: flex; gap: 1ch; align-items: baseline; }
.t-prompt textarea { flex: 1; width: auto; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; color: var(--t-fg); font: inherit; resize: none; field-sizing: content; max-height: 12.4em; caret-color: var(--t-accent); }
.t-prompt textarea:focus-visible { outline: 0; }
.t-prompt textarea::placeholder { color: var(--t-dim); }
.t-printed { max-height: 40vh !important; overflow: auto !important; padding-bottom: 8px !important; }
.t-foot { display: flex; gap: 4px 2.5ch; flex-wrap: wrap; align-items: baseline; padding-top: 6px; font-size: 12px; }
.t-where { margin-left: auto; }
.t-saved { display: flex; flex-direction: column; gap: 1px; max-height: 40vh; overflow: auto; padding-bottom: 6px; }
.term .t-saved-row { display: flex; gap: 1ch; padding: 1px 2ch; min-width: 0; white-space: nowrap; }
.term .t-saved-row:hover, .term .t-saved-row:focus-visible { background: #121C26; }
.t-saved-row > span { flex: none; }
.t-saved-row > .t-saved-body { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.t-code { display: flex; gap: 1ch; align-items: baseline; flex-wrap: wrap; padding-top: 6px; font-size: 12px; }
.t-code input { width: 9ch; min-height: 0; padding: 1px 4px; background: none; color: var(--t-fg); border: 1px solid var(--t-dim); border-radius: 2px; font: inherit; }
.t-ask { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; margin: 0 -10px 2px; background: #1C1608; border-left: 2px solid var(--t-yellow); }
.t-ask:focus { outline: none; }
.t-keys { display: flex; gap: 3ch; flex-wrap: wrap; padding: 6px 0 0 2ch; }
/* A key as a TUI draws one: the key in inverse video, then what it does. */
.t-key kbd { display: inline-block; min-width: 3ch; margin-right: 1ch; padding: 0 .6ch; font: inherit; font-weight: 600; line-height: 1.35; text-align: center; box-shadow: none; border: 0; color: var(--t-bg); background: var(--t-dim); border-radius: 2px; }
.t-key.yes kbd { background: var(--t-green); } .t-key.no kbd { background: var(--t-red); }
.t-key:hover { color: #fff; } .t-key:hover kbd { filter: brightness(1.15); }
.t-ask > .t-out { margin-bottom: 2px; }
.t-notes { display: flex; flex-direction: column; padding-left: 2ch; }
.t-why { display: flex; gap: 0; align-items: baseline; padding-top: 4px; white-space: pre; }
.t-why input { flex: 1; width: auto; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; color: var(--t-fg); font: inherit; caret-color: var(--t-accent); }
.t-why input:focus-visible { outline: 0; }
.term.compact { flex: none; }
.term.compact .t-log { max-height: 30rem; }
@media (max-width: 980px) { .ai-page { height: auto; min-height: calc(100dvh - 58px); } .t-when { max-width: 45%; } }
@media (prefers-reduced-motion: no-preference) {
  .t-cursor { animation: t-blink 1s steps(1) infinite; }
  @keyframes t-blink { 50% { opacity: 0; } }
}
.attn { list-style: none; margin: 0; padding: 10px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(24rem, 1fr)); gap: 6px 28px; border-bottom: 1px solid var(--line, #e5e5e5); }

/* Health over time (history.js). Series colours are a validated categorical set in fixed order; text never wears them. */
.hist { padding: 12px 16px; border-top: 1px solid var(--line2); }
.card-h + .hist { border-top: 0; }
.hist-chart { position: relative; }
.hist-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; font-size: 13px; }
.hist-legend { display: flex; gap: 12px; margin-left: auto; color: var(--mute); font-size: 12px; }
.hist-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hist-chart svg { display: block; overflow: visible; outline: none; }
.hist-chart svg:focus-visible { box-shadow: 0 0 0 2px var(--accent-line); border-radius: var(--rs); }
.hist-chart .grid { stroke: var(--line2); stroke-width: 1; }
.hist-chart .cross { stroke: var(--faint); stroke-width: 1; }
.hist-chart .tick { fill: var(--mute); font: 11px var(--fm); font-variant-numeric: tabular-nums; }
.hist-chart .end { fill: var(--ink); font-size: 12px; }
.hist-chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.hist-chart .dot { stroke: var(--surface); stroke-width: 2; }
.hist-chart .s1 { --c: #2a78d6; } .hist-chart .s2 { --c: #eb6834; } .hist-chart .s3 { --c: #1baf7a; } .hist-chart .s4 { --c: #eda100; }
.hist-chart .line { stroke: var(--c); } .hist-chart .dot { fill: var(--c); }
.hist-chart .key { display: inline-block; width: 12px; height: 2px; border-radius: 1px; background: var(--c); vertical-align: middle; margin-right: 6px; }
.hist-tip { position: absolute; top: 28px; min-width: 150px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--rs); box-shadow: 0 2px 8px rgb(11 34 57 / 12%); font-size: 13px; pointer-events: none; display: flex; flex-direction: column; gap: 3px; }
.hist details { margin-top: 6px; }
.hist details summary { cursor: pointer; }
.hist-table { margin-top: 6px; }
.hist .hist-table td, .hist .hist-table th { padding: 5px 10px; font-variant-numeric: tabular-nums; }

/* ---------- billing ---------- */
.alert.ok { color: var(--green); background: #EAF6F1; border: 1px solid #BFE0D3; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat > span { font: 500 10.5px var(--fm); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.stat > b { font-size: 22px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat > b.t-red { color: var(--red); }
.stat > small { color: var(--mute); font-size: 12px; }
.hist-chart .bar { fill: var(--c); }
.hist-chart .hit { fill: transparent; }
.hist-chart .hit:hover { fill: rgb(11 34 57 / 4%); }
.tbl tfoot td { border-top: 1px solid var(--line); padding: 11px 14px; }
.line-acts { display: inline-flex; gap: 14px; }
.banner .btn.sm { margin-left: 8px; }
/* The invoice preview: the customer's view, drawn plainly. */
.pv { border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; background: var(--surface); display: grid; gap: 14px; margin-top: 10px; }
.pv-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pv-co { font-size: 18px; }
.pv-t { display: flex; flex-direction: column; align-items: flex-end; color: var(--mute); font-size: 13px; }
.pv-t b { color: var(--ink); font-size: 16px; }
.pv-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.pv-meta > div { display: flex; flex-direction: column; gap: 1px; }
.pv-meta span { font: 500 10.5px var(--fm); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.pv-meta small { color: var(--mute); }
.pv-due { font-size: 20px; font-weight: 600; }
.pv-memo { color: var(--mute); white-space: pre-wrap; }
.pv-tot { display: grid; gap: 4px; justify-self: end; min-width: min(280px, 100%); }
.pv-tot > div { display: flex; justify-content: space-between; gap: 16px; }
.pv-tot small { color: var(--mute); }
.pv-pay { justify-self: start; }
.tbl.inbox td { vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
.tbl.inbox td.nowrap { position: relative; padding-left: 30px; }
.inbox .dot-unread { position: absolute; left: 14px; top: 22px; width: 7px; height: 7px; border-radius: 50%; }
.inbox tr.unread .dot-unread { background: var(--accent); }
.inbox tr.unread .inbox-body a { font-weight: 500; }
.tbl.inbox td.up { font-size: 13px; padding-top: 14px; }
.tbl.inbox td.inbox-act { width: 1%; white-space: nowrap; text-align: right; padding-top: 9px; }
.inbox-act .btn { border-color: transparent; background: none; color: var(--accent-strong); }
.inbox-act .btn:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent-line); }
.inbox-body { width: 100%; max-width: 0; }
.inbox-ref { font-size: 12.5px; color: var(--mute); margin-bottom: 2px; }
.inbox-ref b { font: 500 11.5px var(--fm); color: var(--ink); }
.inbox-body a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); line-height: 1.5; }
.inbox tr.read .inbox-body a { color: var(--mute); }
.inbox-body a:hover { color: var(--accent); }
.inbox-body a.cmd { font: 12.5px/1.5 var(--fm); overflow-wrap: anywhere; }

/* ---------- ticket files and Ask AI (assist.js) ---------- */
.files-card.over { box-shadow: 0 0 0 2px var(--accent); }
.files-card > .file-grid, .files-card > p, .files-card > .alert { margin: 0; padding: 12px; }
.files-card > .file-grid + p { padding-top: 0; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.file-grid.small { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); margin-bottom: 6px; }
.file-tile { display: grid; gap: 2px; min-width: 0; font-size: 12px; }
.file-tile a { display: grid; gap: 4px; color: var(--ink); text-decoration: none; min-width: 0; }
.file-tile img, .file-ext { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--line2); border-radius: var(--rs); background: var(--surface2); }
.file-ext { display: grid; place-items: center; font: 600 12px var(--fm); color: var(--mute); text-transform: uppercase; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-tile .btn.link { justify-self: start; padding: 0; }
.ask-card .banner { margin-bottom: 10px; }
.cloud-bar { padding: 10px 12px 0; }
.cloud-bar .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.ask-password { display: grid; gap: 6px; margin: 0 12px 10px; padding: 8px 10px; border: 1px solid var(--warn-line); background: var(--warn-bg); border-radius: var(--rs); overflow-wrap: anywhere; }
.ask-password code { font-size: 14px; font-weight: 600; user-select: all; }
.ask-password .row { display: flex; gap: 6px; }
.ask-card .quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.cloud-setup .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0 4px; }
.cloud-setup input.sm { flex: 0 1 20rem; min-height: 28px; padding: 3px 8px; font-size: 12.5px; }

/* A computer's page: tiles of what matters, then the detail grouped across the page. */
.tiles { margin-bottom: 16px; }
.stat > b.t-green { color: var(--green); } .stat > b.t-amber { color: var(--amber); }
.meter { height: 4px; margin: 7px 0 3px; background: var(--line2); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.meter.warn i { background: var(--amber); } .meter.bad i { background: var(--red); }
.kv-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(30rem, 1fr)); }
.kv-group + .kv-group { border-left: 1px solid var(--line2); }
.kv-group h3, .more > summary { font: 600 10.5px var(--fm); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); margin: 0; padding: 12px 16px 8px; }
.kv { margin: 0; }
.kv-row { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 12px; padding: 8px 16px; border-top: 1px solid var(--line2); }
.kv-row dt { color: var(--mute); font-size: 13px; } .kv-row dd { margin: 0; overflow-wrap: anywhere; }
.more { border-top: 1px solid var(--line); }
.more > summary { cursor: pointer; padding: 12px 16px; } .more > summary .sub { text-transform: none; letter-spacing: 0; font-family: var(--fb); font-size: 12.5px; margin-left: 8px; }
.more[open] > summary { border-bottom: 1px solid var(--line2); }
.binder-body > .attn { border-bottom: 1px solid var(--line2); }
@media (max-width: 900px) { .kv-group + .kv-group { border-left: 0; border-top: 1px solid var(--line2); } }

.kv-groups.lower { border-top: 1px solid var(--line); }
.kv-group h3 .count { margin-left: 8px; font: 500 11px var(--fm); letter-spacing: 0; text-transform: none; color: var(--faint); }
.ip { line-height: 1.6; } .ip.dim { color: var(--mute); font-size: 12.5px; }
.fold { margin-top: 4px; }
.fold > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; color: var(--accent-strong); font-size: 12.5px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .12s; }
.fold[open] > summary::before { transform: rotate(45deg); }
.fold.pad { margin: 0; padding: 4px 16px 14px; }
.people { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 10px; } .fold .people { padding: 8px 0 0; }
.people .chip { font-family: var(--fm); font-size: 12px; } .people.dim .chip { color: var(--mute); background: var(--surface2); }

.hist.split { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 24px; padding: 16px; align-items: start; }
.hist.split + .hist.split { border-top: 1px solid var(--line); }
.hist-side { border: 1px solid var(--line2); border-radius: var(--rs); max-height: 15rem; overflow: auto; }
.hist-side .tbl th { position: sticky; top: 0; }
.hist-side .tbl.plain th, .hist-side .tbl.plain td { padding: 6px 12px; }
.hist-side .tbl td:nth-child(n+2), .hist-side .tbl th:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.hist-sum { margin-left: auto; color: var(--mute); font-size: 12.5px; } .hist-sum b { color: var(--ink); }
.hist-chart .pt { fill: var(--surface); stroke: var(--c); stroke-width: 1.75; }
@media (max-width: 900px) { .hist.split { grid-template-columns: 1fr; } }

.kv-row dd .meter { max-width: 16rem; margin: 5px 0 0; }
.kv-row dd b { font-weight: 500; } .warn-t b { color: var(--amber); } .bad-t b { color: var(--red); font-weight: 600; }

/* The ticket queue at size. */
.binder-bar.wrap { flex-wrap: wrap; }
.binder-bar select { width: auto; min-width: 9rem; flex: 0 1 11rem; }
.binder-note { display: flex; gap: 12px; align-items: center; padding: 8px 16px; background: var(--accent-soft); border-bottom: 1px solid var(--accent-line); font-size: 13px; color: var(--accent-strong); }
.binder-tab .n.hot { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, #fff); background: color-mix(in srgb, var(--red) 7%, #fff); }
.binder-tab[aria-pressed="true"] .n.hot { color: var(--red); }
.tbl.dense td { padding: 8px 14px; }
.tbl.dense th { padding: 8px 14px; }
.pager .row { display: flex; align-items: center; gap: 8px; }
.pager .per { display: inline-flex; align-items: center; gap: 8px; margin-right: 10px; } .pager .per select { min-width: 4.5rem; width: auto; padding-block: 2px; }

/* The AI is the point of the product, so it sits right under the request and is marked as the main panel. */
.ai-panel { border-top: 2px solid var(--accent); }
.ai-panel > .card-h { background: var(--accent-soft); border-bottom-color: var(--accent-line); }
.ai-panel > .card-h h2 { color: var(--accent-strong); }

.t-tools-bar { text-align: right; } .t-think { margin: 0; }
.t-think .t-say { padding-left: 2ch; border-left: 1px solid var(--t-dim); margin-left: .5ch; }

/* The ticket's head: what state it is in, then where it came from, quietly. */
.t-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 6px; color: var(--mute); font-size: 13px; }
.t-sub .ref { font: 500 12px var(--fm); color: var(--accent-strong); }
.t-sub > * + *::before { content: "·"; margin-right: 8px; color: var(--faint); }
.t-sub a { display: inline-flex; align-items: center; gap: 6px; }
.t-sub .dot { margin: 0; }
.t-request { margin: 0 18px 16px; padding: 10px 14px; background: var(--surface2); border-left: 3px solid var(--line); border-radius: 0 var(--rs) var(--rs) 0; }
.t-request .by { color: var(--mute); font-size: 12.5px; margin-bottom: 3px; } .t-request .by b { color: var(--ink); font-weight: 600; }
.t-request .body { white-space: pre-wrap; overflow-wrap: anywhere; }

/* The details panel: a field is its label over its control, two to a row where they are short. */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 16px; }
.pf { display: grid; gap: 4px; min-width: 0; } .pf.wide { grid-column: 1 / -1; }
.pf > label { font: 500 10.5px var(--fm); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.pf select, .pf input { min-height: 34px; padding: 5px 8px; font-size: 13px; width: 100%; }
.props-foot { padding: 8px 16px 12px; border-top: 1px solid var(--line2); }

/* The AI's terminal: its words as formatted text, commands as a shell shows them, and a status line. */
.term .ai-text { color: var(--t-fg); font: inherit; max-width: 104ch; }
.term .ai-text p { margin: 0 0 .7em; line-height: 1.6; }
.term .ai-text h4 { margin: 1em 0 .35em; font: 600 1em var(--fm); color: var(--t-accent); }
.term .ai-text h4::before { content: "## "; color: var(--t-dim); font-weight: 400; }
.term .ai-text ul, .term .ai-text ol { margin: 0 0 .7em; padding-left: 2ch; gap: .25em; list-style: none; counter-reset: li; }
.term .ai-text ul > li::before { content: "•"; color: var(--t-accent); font-weight: 700; font-size: 1.25em; line-height: 1; margin-left: -2ch; margin-right: 1ch; }
.term .ai-text ol > li { counter-increment: li; } .term .ai-text ol > li::before { content: counter(li) "."; color: var(--t-accent); margin-left: -2.4ch; margin-right: 1ch; }
.term .ai-text li { line-height: 1.55; padding-left: 0; }
.term .ai-text code { font: inherit; color: #BFE9F2; background: #14212C; border: 1px solid #243545; border-radius: 3px; padding: 0 .35em; }
.term .ai-text strong, .term .ai-text b { color: #fff; }
.t-md { min-width: 0; } .t-indent { padding-left: 2ch; } .t-md-inline .ai-text { display: inline; } .t-md-inline .ai-text p { display: inline; margin: 0; }
.t-dollar { color: var(--t-green); }
.t-out { position: relative; min-width: 0; margin: 3px 0 4px 2ch; padding: 4px 0 4px 1.5ch; color: var(--t-dim); border-left: 2px solid #22303D; background: #0D1620; border-radius: 0 3px 3px 0; }
.t-out.bad { border-left-color: var(--t-red); }
.t-out pre { color: #C5D0DA; }
.t-out-bar { display: flex; justify-content: space-between; align-items: baseline; padding-right: 1ch; font-size: 12px; }
/* Copy sits on the first line instead of taking one, and shows while the output is pointed at or has the focus. */
.term .t-copy { position: absolute; top: 3px; right: 1ch; padding: 0 .5ch; font-size: 12px; background: #0D1620; opacity: 0; }
.t-out:hover > .t-copy, .t-copy:focus-visible { opacity: 1; }
@media (hover: none) { .term .t-copy { opacity: 1; } }
.t-source { font-size: 12px; }
.a-k { color: #6B7A88; } .a-r { color: var(--t-red); } .a-g { color: var(--t-green); } .a-y { color: var(--t-yellow); } .a-b { font-weight: 600; }
.a-c { color: #6FD3E8; } .a-m { color: #D9A0F0; } .a-w { color: #F2F6F9; } .a-d { color: var(--t-dim); }
.t-run + .t-run { margin-top: 12px; padding-top: 10px; border-top: 1px solid #1F2C38; }
.t-runno { flex: none; font-size: 12px; }
.t-foot { border-top: 1px solid #1B2733; margin-top: 4px; }
.t-prompt textarea { caret-shape: block; }
.term.compact.tall .t-log { max-height: 78vh; }
.ai-tab-head .row { display: flex; gap: 8px; align-items: center; }

.ai-text .lead { color: var(--accent-strong); font-variant-numeric: tabular-nums; } .term .ai-text .lead { color: var(--t-accent); }

/* The menu folded to icons. */
.app { transition: grid-template-columns .15s ease; }
.nav-fold { margin-top: auto; display: flex; align-items: center; gap: 11px; padding: 7px 10px; border: 0; border-radius: var(--rs); background: none; color: var(--faint); font: 500 13px var(--fb); cursor: pointer; text-align: left; }
.nav-fold:hover { color: var(--ink); background: #EEF2F5; } .nav-fold:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.nav-fold + .me { margin-top: 0; }
.app.folded .nav-fold { justify-content: center; width: 40px; padding: 9px 0; }
.app.folded { grid-template-columns: 60px minmax(0, 1fr); }
.app.folded .side { padding-inline: 8px; align-items: center; }
.app.folded .brand { flex-direction: column; gap: 8px; padding: 0; }
.app.folded .lbl, .app.folded .nav .sec { display: none; }
.app.folded .nav { align-items: center; width: 100%; } .app.folded .nav::before { content: none; }
.app.folded .nav a { position: relative; justify-content: center; width: 40px; padding: 9px 0; }
.app.folded .nav .count { position: absolute; top: 2px; right: 0; margin: 0; font-size: 10px; padding: 0 4px; }
.app.folded .me { padding: 10px 0 0; justify-items: center; width: 100%; }
.app.folded .me-actions { flex-direction: column; } .app.folded .me-actions .btn { padding-inline: 8px; }
.app.folded .nav .sec + a { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .app { transition: none; } }
.app.folded .nav .sec:not(:first-child) { display: block; width: 24px; height: 1px; padding: 0; margin: 8px 0; background: var(--line); font-size: 0; overflow: hidden; }

/* Dropping files on the terminal. */
.term.over { outline: 2px dashed var(--t-accent); outline-offset: -6px; }
.term.over::after { content: "Drop to attach to this ticket"; position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: rgb(10 17 24 / 88%); color: var(--t-accent); font-weight: 600; pointer-events: none; border-radius: var(--rs); }
.t-upload { padding: 0 14px; font-size: 12px; display: flex; gap: 2ch; }

/* A computer's activity. */
.tbl td.cmd { max-width: 34rem; } .tbl td.cmd code { font: 12.5px var(--fm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tbl .clip { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl tr.cmd-open td { background: var(--surface2); border-top: 0; padding-top: 4px; }
.cmd-full, .cmd-out { margin: 6px 0 0; max-height: 14rem; }
.cmd-full { background: var(--surface); }
.rng { display: inline-flex; align-items: center; gap: 6px; font: 500 10.5px var(--fm); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.rng input { width: auto; min-height: 34px; font: 13px var(--fb); letter-spacing: 0; text-transform: none; }
.tbl td .tool { font: 500 12.5px var(--fm); }
.ctool { display: inline-flex; align-items: flex-start; gap: 8px; } .ctool .ic { width: 16px; height: 16px; margin-top: 2px; color: var(--accent); flex: none; }
.ctool-note { margin: 6px 0 0; max-width: 70ch; line-height: 1.5; }
.tbl td .found { color: var(--ink); font-size: 12.5px; }
.found-box { display: inline-block; margin: 8px 0 2px; padding: 6px 12px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--rs); color: var(--ink); font-weight: 500; }
.found-box .sub { font: 600 10.5px var(--fm); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-strong); margin-right: 6px; }
.raw { margin-top: 8px; } .raw > summary { cursor: pointer; color: var(--accent-strong); font-size: 12.5px; }
.tbl td .f-clear { color: var(--green); } .tbl td .f-warn { color: var(--amber); font-weight: 600; } .tbl td .f-bad { color: var(--red); font-weight: 600; }
.found-box.f-clear { background: color-mix(in srgb, var(--green) 7%, #fff); border-color: color-mix(in srgb, var(--green) 30%, #fff); }
.found-box.f-clear .sub { color: var(--green); }
.found-box.f-warn { background: var(--warn-bg); border-color: var(--warn-line); } .found-box.f-warn .sub { color: var(--amber); }
.found-box.f-bad { background: color-mix(in srgb, var(--red) 7%, #fff); border-color: color-mix(in srgb, var(--red) 35%, #fff); } .found-box.f-bad .sub { color: var(--red); }
.tbl tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--amber); } .tbl tr.row-bad td:first-child { box-shadow: inset 3px 0 0 var(--red); }

/* A command as a shell shows it. */
.cli { --c-bg: #0A1118; --c-fg: #DCE5EC; --c-dim: #8A9BAA; margin-top: 8px; background: var(--c-bg); color: var(--c-fg); border-radius: var(--rs); border: 1px solid #000; font: 12.5px/1.55 var(--fm); overflow: hidden; }
.cli-bar { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 4px 12px; background: #101A24; color: var(--c-dim); font-size: 11.5px; border-bottom: 1px solid #1B2733; }
.cli-bar .btn { background: none; border-color: #2A3948; color: var(--c-dim); font-size: 11.5px; padding: 1px 8px; min-height: 0; } .cli-bar .btn:hover { color: #fff; border-color: #4A5C6E; }
.cli pre { margin: 0; background: none; border: 0; border-radius: 0; max-height: none; color: inherit; font: inherit; padding: 8px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cli-cmd { color: #fff; font-weight: 500; } .ps { color: #56D39A; font-weight: 600; user-select: none; }
.cli-out { color: #C5D0DA; border-top: 1px solid #16212C !important; max-height: 22rem !important; overflow: auto !important; }
.cli-note { padding: 0 12px 6px; color: var(--c-dim); font-size: 12px; } .cli-note a { color: #6FD3E8; }
.cli-end { padding: 5px 12px 7px; border-top: 1px solid #16212C; font-size: 12px; color: var(--c-dim); }
.cli-end.ok { color: #56D39A; } .cli-end.bad { color: #FF8A80; } .cli-end.warn { color: #E9BC5A; }
.cli-inline { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; background: #0A1118; color: #DCE5EC; border: 1px solid #000; border-radius: 3px; padding: 3px 8px; font: 12.5px/1.5 var(--fm); }
.tbl td.cmd code.cli-inline { display: -webkit-box; font: 12.5px/1.5 var(--fm); background: #0A1118; border: 1px solid #000; color: #DCE5EC; }
.cli a { text-decoration: underline; }
.finished { font: 500 11.5px var(--fm); letter-spacing: .04em; color: var(--mute); margin-bottom: 10px; }
.finished.ok { color: var(--green); } .finished.warn { color: var(--amber); } .finished.bad { color: var(--red); }
.cloud-setup .kv-row dd > * + * { margin-top: 6px; } .cloud-setup .kv-row dd .row { margin: 0; }

/* Link a computer: two steps side by side, numbered like a checklist on a drawing. The 1px gap over a line-coloured
   background draws the divider, so it is right whether the steps sit side by side or wrap onto two rows. */
/* The dialog's content edge to edge: the steps meet the header and the sides, and each later part is divided by a line. */
.link-pc { display: grid; margin: -18px; }
.link-pc > .alert { margin: 14px 20px 0; }
.link-pc > .alert:last-child { margin-bottom: 18px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1px; background: var(--line); }
/* minmax(0, 1fr), not the default auto column: an input's intrinsic width (its 20-character size) would otherwise set the
   column's minimum and push the button out of the step. */
.step { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; gap: 6px; padding: 18px 20px 20px; background: var(--surface); }
.step-n { font: 600 11px var(--fm); letter-spacing: .12em; color: var(--accent-strong); display: inline-flex; align-items: center; gap: 8px; }
.step-n::after { content: ""; width: 28px; height: 1px; background: var(--accent-line); }
.step-t { font: 600 15px var(--fb); color: var(--ink); }
.step .sub { margin-bottom: 6px; align-self: start; }
.step .toolbar { flex-wrap: nowrap; align-items: stretch; }
.step .toolbar .grow { flex: 1 1 0; min-width: 0; }
.step .toolbar .btn { flex: none; min-height: 40px; }
/* The installer's address in full, wrapping where it must, since it is what the technician sends. */
.step-link { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 6px 6px 12px; border: 1px dashed var(--line); border-radius: var(--rs); background: var(--surface2); }
.step-link a { flex: 1; min-width: 0; font: 12.5px/1.45 var(--fm); color: var(--ink); overflow-wrap: anywhere; }
.step-link .btn { flex: none; }
input.code { font: 600 18px var(--fm); letter-spacing: .14em; min-height: 40px; }
input.code::placeholder { font-weight: 400; letter-spacing: .14em; color: var(--faint); }
/* What Find computer found: a third step under the first two, full width, with the person to link it to and the button. */
.step-found { grid-template-rows: none; border-top: 1px solid var(--line); background: var(--surface2); }
.link-pc > .alert + .step-found { margin-top: 14px; }
.step-found .step-t .sub { font-weight: 400; font-size: 13px; }
.step-found .toolbar { flex-wrap: wrap; }
