/* Avenlur Support — the brand's warm paper and birch, with Avenlur orange saved for what needs action.
   Sidebar: birch. Queue: paper. Ticket: white conversation, birch for our side, orange only for "act on this". */
:root {
  --paper: #fcf8f6; --panel: #ffffff; --birch: #f4ece4; --birch-2: #ebe0d5; --line: #ebe2da; --line-strong: #d9ccc0;
  --ink: #222222; --ink-2: #5e544d; --ink-3: #8f847b;
  --orange: #f25000; --orange-ink: #ffffff; --orange-soft: #fde9dd; --orange-text: #c24000;
  --sage: #3f7a5a; --sage-soft: #e3efe7; --sky: #2f63a8; --sky-soft: #e4ecf7; --honey: #8a6410; --honey-soft: #f7edd2;
  --note: #fff7de; --note-line: #ecd9a2; --danger: #b3261e; --danger-soft: #fbe5e3;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-s: 6px; --r: 10px; --r-l: 14px; --side: 216px; --list: 360px; --ctx: 304px;
  --shadow: 0 1px 2px rgba(60, 40, 25, .06), 0 4px 14px rgba(60, 40, 25, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1a1512; --panel: #221c18; --birch: #2a221d; --birch-2: #352b24; --line: #352c26; --line-strong: #4a3e35;
    --ink: #f1ebe5; --ink-2: #c3b7ad; --ink-3: #94887e;
    --orange: #ff7438; --orange-ink: #1f0e04; --orange-soft: #3d2215; --orange-text: #ff9a6b;
    --sage: #86c4a0; --sage-soft: #1f3328; --sky: #94b8ee; --sky-soft: #1e2a3c; --honey: #e6c36a; --honey-soft: #362d17;
    --note: #2f2919; --note-line: #4f4527; --danger: #f2a39d; --danger-soft: #3b2120;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.2);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--orange-text); }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.mono { font-variant-numeric: tabular-nums; font-size: 13px; }
.muted { color: var(--ink-3); }
[hidden] { display: none !important; }

/* ---------- Frame ---------- */
.shell { display: grid; grid-template-columns: var(--side) var(--list) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.shell.wide { grid-template-columns: var(--side) minmax(0, 1fr); }

.side { background: var(--birch); overflow-x: hidden; display: flex; flex-direction: column; min-height: 0; padding: 18px 12px 14px; gap: 2px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 8px 20px; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--orange); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 14px; height: 14px; }
.brand-word { font-weight: 700; font-size: 19px; letter-spacing: -.02em; line-height: 1; }
.brand-word small { display: block; font-weight: 500; font-size: 12px; color: var(--ink-3); letter-spacing: 0; margin-top: 3px; }
.nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--birch-2); color: var(--ink); }
.nav a.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.nav .n { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.nav .n.hot { background: var(--orange); color: var(--orange-ink); border-radius: 99px; padding: 0 7px; font-weight: 700; }
.nav-gap { height: 18px; }
.nav-quiet a { font-size: 13.5px; }
.side-foot { margin-top: auto; padding-top: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.me .btn { padding: 5px 6px; color: var(--ink-3); }
.sendnote { display: grid; gap: 2px; font-size: 12.5px; color: var(--honey); background: var(--honey-soft); border-radius: 8px; padding: 8px 10px; text-decoration: none; line-height: 1.4; }
.sendnote b { font-weight: 700; }
.me { display: flex; align-items: center; gap: 9px; padding: 0 4px; }
.me .who { min-width: 0; flex: 1; font-size: 12.5px; line-height: 1.3; }
.me .who div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; background: var(--birch-2); color: var(--ink-2); }
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.avatar.us { background: var(--orange); color: var(--orange-ink); }

/* ---------- Queue ---------- */
.list { background: var(--paper); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 18px 16px 12px; display: grid; gap: 12px; }
.list-head h1 { font-size: 20px; letter-spacing: -.01em; margin: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.list-head h1 .count { font-size: 13px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 33px !important; background: var(--panel) !important; border-color: var(--line) !important; border-radius: 9px !important; }
.rows { overflow-y: auto; flex: 1; padding: 0 8px 16px; display: grid; gap: 2px; align-content: start; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 1px 8px; padding: 10px 12px 11px; border-radius: var(--r); cursor: pointer; text-decoration: none; color: inherit; position: relative; align-items: center; }
.row:hover { background: var(--birch); }
.row.on { background: var(--panel); box-shadow: var(--shadow), inset 0 0 0 1px var(--line); }
.row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.dot.s-new { background: var(--sky); } .dot.s-open { background: var(--sage); } .dot.s-waiting { background: var(--honey); }
.dot.s-approval { background: var(--orange); } .dot.s-resolved { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.row .who { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row.unread .who { font-weight: 700; }
.row .age { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .age.late { color: var(--orange-text); font-weight: 700; }
.row .subj, .row .prev, .row .meta { grid-column: 2 / -1; min-width: 0; }
.row .subj { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.row .prev { color: var(--ink-3); font-size: 12.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .meta { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.row .meta:empty { display: none; }
.row.high::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--orange); }
.empty { padding: 56px 24px; text-align: center; color: var(--ink-3); display: grid; gap: 6px; justify-items: center; }
.empty b { color: var(--ink-2); font-size: 15px; }

/* ---------- Chips & controls ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 0 8px; border-radius: 99px; background: var(--birch); color: var(--ink-2); line-height: 20px; white-space: nowrap; }
.st-new { background: var(--sky-soft); color: var(--sky); } .st-open { background: var(--sage-soft); color: var(--sage); }
.st-waiting { background: var(--honey-soft); color: var(--honey); } .st-approval { background: var(--orange-soft); color: var(--orange-text); }
.st-resolved { background: var(--birch); color: var(--ink-3); }
.chip.ai { background: var(--orange-soft); color: var(--orange-text); }
.chip.ch-amazon { background: #fdf0d8; color: #8a5300; } .chip.ch-walmart { background: #e1ecfb; color: #1d4f9c; } .chip.ch-phone, .chip.ch-chat { background: var(--sage-soft); color: var(--sage); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.ch-amazon { background: #3a2c14; color: #f0c072; } :root:not([data-theme="light"]) .chip.ch-walmart { background: #1d2a40; color: #9cc0f5; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--panel); border-radius: 8px; padding: 7px 13px; cursor: pointer; font-weight: 600; font-size: 13px; text-decoration: none; color: var(--ink); white-space: nowrap; line-height: 1.2; }
.btn:hover { background: var(--birch); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--orange-ink); }
.btn.primary:hover { filter: brightness(1.06); background: var(--orange); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--birch); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
input[type=text], input[type=email], input[type=number], input[type=search], input[type=time], select, textarea {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: 8px; padding: 8px 11px; width: 100%; min-width: 0;
}
select { cursor: pointer; }
textarea { resize: vertical; line-height: 1.55; }
label.f { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
label.f span.hint { font-weight: 400; color: var(--ink-3); }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
input[type=checkbox] { accent-color: var(--orange); width: 15px; height: 15px; }

/* ---------- Ticket ---------- */
.main { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--panel); }
.tk { display: grid; grid-template-columns: minmax(0, 1fr) var(--ctx); min-height: 0; flex: 1; }
.tk-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tk-scroll { overflow-y: auto; flex: 1; min-height: 0; }
.tk-head { padding: 18px 28px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; background: var(--panel); }
.tk-top { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.tk-who { display: flex; gap: 12px; align-items: center; min-width: 0; flex: 1 1 320px; }
.tk-who h1 { font-size: 21px; letter-spacing: -.015em; margin: 0; line-height: 1.2; }
.tk-who .subj { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; overflow-wrap: anywhere; }
.tk-who .subj .muted { white-space: nowrap; }
.tk-controls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tk-controls select { width: auto; padding: 5px 28px 5px 10px; font-size: 13px; font-weight: 600; border-radius: 8px; }
.star { font-size: 16px; padding: 4px 9px; color: var(--ink-3); }
.star.on { color: var(--orange); border-color: var(--orange); background: var(--orange-soft); }
.tags { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.tags .chip button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font-size: 13px; line-height: 1; }
.tags input { width: 90px; padding: 1px 9px; font-size: 12px; border-radius: 99px; border-style: dashed; background: transparent; }
.back { display: none; }

/* The AI brief: what's going on and what to do next, pinned above the conversation. */
.brief { flex: none; margin: 14px 28px 0; border-radius: var(--r-l); background: var(--birch); padding: 14px 18px 14px; display: grid; gap: 8px; position: relative; }
.brief-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-3); }
.brief-h b { color: var(--ink); font-size: 13.5px; display: inline-flex; gap: 7px; align-items: center; }
.brief-h b::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--orange); transform: rotate(45deg); }
.brief p { margin: 0; line-height: 1.55; max-width: 82ch; }
.brief:not(.full) .next { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.brief:not(.full) .what { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.brief { max-height: 40vh; overflow-y: auto; }
.brief .next { border-top: 1px solid var(--birch-2); padding-top: 8px; }
.brief .next b { font-weight: 700; }
.brief details summary { cursor: pointer; font-size: 12.5px; color: var(--ink-3); list-style: none; }
.brief details summary::-webkit-details-marker { display: none; }
.brief details[open] summary { margin-bottom: 6px; }
.brief .old { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; border-top: 1px dashed var(--birch-2); padding-top: 6px; margin-top: 6px; }

.thread { padding: 20px 28px 24px; display: grid; gap: 16px; align-content: start; }
.msg { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; max-width: 760px; min-width: 0; }
.msg .avatar { width: 32px; height: 32px; margin-top: 2px; }
.bubble { border: 1px solid var(--line); background: var(--panel); border-radius: 4px var(--r-l) var(--r-l) var(--r-l); padding: 12px 16px 13px; min-width: 0; line-height: 1.6; }
.msg.out { margin-left: auto; grid-template-columns: minmax(0, 1fr) 32px; }
.msg.out .avatar { order: 2; }
.msg.out .bubble { background: var(--birch); border-color: transparent; border-radius: var(--r-l) 4px var(--r-l) var(--r-l); }
.msg.note .bubble { background: var(--note); border-color: var(--note-line); border-style: dashed; }
.msg.note .avatar { background: var(--note); color: var(--honey); }
.msg-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; flex-wrap: wrap; }
.msg-h b { color: var(--ink); font-weight: 700; font-size: 13.5px; }
.msg-b { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.call .bubble { border-left: 3px solid var(--sage); }
.msg.call.missed .bubble { border-left-color: var(--orange); }
.msg .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.atts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.atts a { font-size: 12.5px; border: 1px solid var(--line-strong); border-radius: 7px; padding: 3px 9px; text-decoration: none; background: var(--panel); color: var(--ink-2); }
.atts a:hover { border-color: var(--orange); color: var(--orange-text); }
.sendflag { font-size: 12px; font-weight: 600; margin-top: 8px; }
.sendflag.held { color: var(--honey); } .sendflag.failed { color: var(--danger); }
.sysline { justify-self: center; font-size: 12.5px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.sysline::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }

.divider { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.divider button { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 3px 12px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.divider button:hover { border-color: var(--orange); color: var(--orange-text); }
.msg.earlier .bubble { background: var(--paper); }
.msg.earlier.out .bubble { background: var(--birch); }

/* Reply area stays at the bottom of the ticket */
.dock { border-top: 1px solid var(--line); background: var(--panel); padding: 10px 28px 12px; display: grid; gap: 8px; flex: none; max-height: 62%; overflow-y: auto; }
.card { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 8px; background: var(--panel); }
.card.appr { border-color: var(--orange); background: var(--orange-soft); }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; font-size: 13.5px; }
.card .actions, .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.draftbar { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; background: var(--orange-soft); border-radius: var(--r); padding: 5px 6px 5px 14px; }
.draftbar .what { font-size: 13px; color: var(--ink-2); min-width: 0; flex: 1 1 240px; }
.draftbar .what b { color: var(--orange-text); }
.draft-body { white-space: pre-wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font-size: 13.5px; max-height: 300px; overflow-y: auto; overflow-wrap: anywhere; line-height: 1.6; }
.composer { display: grid; gap: 8px; border: 1px solid var(--line-strong); border-radius: var(--r-l); padding: 6px 8px 8px; background: var(--panel); }
.composer:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.composer textarea { border: 0; padding: 6px 6px; background: transparent; min-height: 44px; height: 44px; resize: none; }
.composer:focus-within textarea, .composer.filled textarea { height: 140px; resize: vertical; }
.composer textarea:focus-visible { outline: none; }
.composer.note-mode { background: var(--note); border-color: var(--note-line); }
.composer-bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.composer-bar select { width: auto; max-width: 220px; padding: 4px 26px 4px 9px; font-size: 12.5px; border-color: var(--line); }
.tabs { display: flex; gap: 2px; }
.tabs button { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--ink-3); cursor: pointer; }
.tabs button.on { background: var(--birch); color: var(--ink); }
.composer.note-mode .tabs button.on { background: var(--note-line); }
.warn { color: var(--danger); font-size: 12.5px; font-weight: 600; }
.hint-k { font-size: 12px; color: var(--ink-3); }

/* Context column */
.tk-side { border-left: 1px solid var(--line); background: var(--paper); overflow-y: auto; padding: 20px 18px; display: grid; gap: 22px; align-content: start; min-width: 0; }
.tk-side h3 { font-size: 13px; font-weight: 700; color: var(--ink); margin: 0 0 8px; }
.cust { display: flex; gap: 11px; align-items: center; }
.cust .kv { min-width: 0; }
.kv { display: grid; gap: 1px; font-size: 13px; overflow-wrap: anywhere; }
.kv b { font-size: 14.5px; }
.order { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 13px; display: grid; gap: 6px; font-size: 13px; background: var(--panel); }
.order-h { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 14px; }
.item { display: grid; gap: 1px; padding-top: 7px; border-top: 1px solid var(--line); }
.drop { color: var(--orange-text); font-weight: 700; }
.order-num { font-weight: 600; }
.log { font-size: 12.5px; color: var(--ink-3); display: grid; gap: 6px; }
.log div { display: grid; }
.tk-side details summary { cursor: pointer; font-weight: 700; font-size: 13px; list-style: none; display: flex; justify-content: space-between; }
.tk-side details summary::after { content: "Show"; font-weight: 500; color: var(--ink-3); font-size: 12.5px; }
.tk-side details[open] summary::after { content: "Hide"; }
.tk-side details[open] summary { margin-bottom: 8px; }
.history a { display: grid; gap: 2px; text-decoration: none; color: var(--ink); padding: 8px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; }
.history a:hover { border-color: var(--line-strong); }

/* ---------- Settings & reports ---------- */
.page { overflow-y: auto; padding: 28px clamp(16px, 4vw, 48px) 64px; background: var(--paper); flex: 1; }
.page > h1 { font-size: 24px; letter-spacing: -.015em; margin: 0 0 4px; }
.page h2 { font-size: 16px; margin: 0; }
.section { display: grid; gap: 14px; padding: 22px 24px; margin-top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); max-width: 860px; }
.section p { margin: 0; color: var(--ink-2); max-width: 68ch; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 12.5px; color: var(--ink-3); font-weight: 600; padding: 6px 12px 6px 0; }
table.t td { border-top: 1px solid var(--line); padding: 9px 12px 9px 0; vertical-align: middle; }
.switch { justify-self: start; display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; }
.switch button { border: 0; background: var(--panel); padding: 7px 14px; cursor: pointer; font-weight: 600; }
.switch button.on { background: var(--sage); color: #fff; }
.switch button.on.off { background: var(--honey); color: #fff; }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days label { border: 1px solid var(--line-strong); border-radius: 7px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.days input { display: none; }
.days label:has(input:checked) { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tpl { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 8px; background: var(--paper); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; max-width: 860px; margin-top: 16px; }
.stat { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-l); padding: 16px 18px; }
.stat .n { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 150px; padding-top: 10px; border-bottom: 1px solid var(--line-strong); }
.bars div { flex: 1; background: var(--orange); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }
.bars div:hover { opacity: 1; }
.bars-x { display: flex; gap: 5px; font-size: 11px; color: var(--ink-3); }
.bars-x span { flex: 1; text-align: center; font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: 130px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.hbar i { display: block; height: 10px; background: var(--ink-2); border-radius: 5px; }

/* ---------- Sign-in ---------- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--birch); }
.signin-card { background: var(--panel); border-radius: 18px; padding: 40px 34px; width: min(400px, 100%); display: grid; gap: 18px; text-align: center; box-shadow: var(--shadow); }
.signin-card .brand { justify-content: center; padding: 0; }
.signin-card .err { color: var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 8px 12px; font-size: 13px; }

#toast { position: fixed; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 13px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }

/* ---------- Smaller screens ---------- */
@media (max-width: 1280px) { :root { --list: 320px; --ctx: 280px; } }
@media (max-width: 1120px) {
  .tk { display: block; overflow-y: auto; }
  .tk-scroll { flex: none; overflow: visible; }
  .dock { max-height: none; overflow: visible; }
  .tk-side { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .shell, .shell.wide { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .side.open { display: flex; position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; box-shadow: 0 0 0 100vw rgba(30, 20, 10, .4); }
  .shell.has-ticket .list { display: none; }
  .shell:not(.has-ticket) .main.ticket-main { display: none; }
  .back, .menu-btn { display: inline-flex; }
  .tk-head, .thread, .dock { padding-left: 16px; padding-right: 16px; }
  .brief { margin: 14px 16px 0; }
  .msg { grid-template-columns: minmax(0, 1fr); } .msg.out { grid-template-columns: minmax(0, 1fr); } .msg .avatar { display: none; }
}
@media (min-width: 901px) { .menu-btn { display: none; } }
@media (prefers-reduced-motion: no-preference) {
  .row, .nav a, .btn, .composer { transition: background-color .12s, box-shadow .12s, border-color .12s; }
}
.tk-scroll { position: relative; }
.card.todo { border-color: var(--line-strong); background: var(--paper); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13.5px; line-height: 1.5; }

/* AI draft shown in the conversation */
.proposal { justify-self: end; width: min(100%, 760px); border: 1.5px dashed var(--orange); border-radius: var(--r-l); background: var(--panel); padding: 14px 18px 16px; display: grid; gap: 10px; scroll-margin-top: 12px; }
.proposal-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); }
.proposal-h b { color: var(--orange-text); font-size: 13.5px; }
.proposal .msg-b { line-height: 1.6; }
.revs { display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 8px; }
.rev { font-size: 13px; color: var(--ink-2); }
.rev .muted { display: block; font-size: 12.5px; }
.rev.answer { background: var(--birch); border-radius: 8px; padding: 8px 10px; }
.revise { display: flex; gap: 8px; }
.revise input { flex: 1; }
@media (max-width: 600px) { .revise { flex-direction: column; } }
.thread-cards { display: grid; gap: 10px; justify-self: end; width: min(100%, 760px); }

/* Queue filters */
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filters select { width: auto; flex: 1 1 0; min-width: 0; max-width: 100%; padding: 5px 24px 5px 9px; font-size: 12.5px; font-weight: 600; border-color: var(--line); background-color: var(--panel); border-radius: 8px; color: var(--ink-2); }
.filters select#flt-category { flex: 2 1 100%; }
.filters select.on { border-color: var(--orange); color: var(--orange-text); background-color: var(--orange-soft); }
.chip.type { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink-2); }
