/* 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 { margin-bottom: 14px; font-size: 13px; }
.crumb a { display: inline-flex; align-items: center; gap: 5px; color: var(--mute); }
.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.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; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.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; 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; }
.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; }
.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; gap: 16px; min-width: 0; }
.layout .card + .card { margin-top: 0; }
/* An approval waiting on the technician is the most important thing on the page, so it moves to the top. */
.layout > .col:has(.approval) > .ai-card { order: -1; }
.t-head { padding: 18px 18px 14px; }
.t-head h1 { font-size: 21px; }
.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: 12px; padding: 0 18px 4px; }
.msg { display: flex; gap: 11px; }
.bub { flex: 1; min-width: 0; padding: 10px 13px; 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: 3px; 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: 14px 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); }
.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; }
.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 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); }

/* ---------- 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; }
.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; 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; gap: 26px; padding: 48px 56px; background: var(--accent-soft); border-right: 1px solid var(--line); }
.login-story h1 { font-size: 36px; line-height: 1.1; letter-spacing: -.02em; max-width: 14ch; text-wrap: balance; }
.login-story .brand { padding: 0; }
.login-story > p { color: var(--mute); max-width: 40ch; font-size: 15px; }
.logbox { margin-top: auto; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font: 400 12px/1.95 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; place-content: center; padding: 40px 24px; }
.login-form form { width: min(21rem, 100%); }
.login-form h2 { font-size: 22px; }
.login-form .code { font: 600 17px var(--fm); letter-spacing: .4em; }
.login-form .btn { padding: 10px; font-size: 14px; }
.login-form .brand { display: none; margin-bottom: 20px; padding: 0; }

/* ---------- 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; }
.layout > .col:has(.ai-card.asks) > .ai-card { order: -1; }

.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-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-out { padding: 2px 0 2px 2ch; color: var(--t-dim); min-width: 0; }
.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-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-keys { display: flex; gap: 3ch; flex-wrap: wrap; padding: 4px 0 0 2ch; font-weight: 600; }
.t-key:hover { color: var(--t-yellow); }
.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; } }
}
