/* Talos Desk — agent workspace & admin center. Talos Automation brand: ink rail, paper ground, teal wire.
   Fonts, brand tokens and the monogram come from /brand/brand.css (loaded first by index.html). */
:root {
  --navy: #0a0f0e; --navy-2: #161f1d; --navy-3: #1b2624;
  --ink: #0a0f0e; --ink-soft: #101716; --paper: #fafaf8; --wire: #0fa98e; --wire-deep: #0b7a67; --wire-tint: #d9f2ec;
  --accent: #0b7a67; --accent-2: #0a6b5a; --accent-soft: #d9f2ec;
  --surface: #ffffff; --bg: #fafaf8; --bg-2: #f0f2f1; --border: #e4e8e6; --border-2: #d3d9d6;
  --text: #111816; --muted: #5c6663; --faint: #8a9490;
  --ok: #0b7a67; --ok-soft: #e3f4ef; --warn: #b7791f; --warn-soft: #fbf3e2; --bad: #c43d32; --bad-soft: #fbeceb;
  --st-new: #d48a0a; --st-open: #cf4636; --st-pending: #2a7393; --st-hold: #101716; --st-solved: #5c6663; --st-closed: #c9d0cd;
  --note: #fbf6e2; --note-border: #eadb9f;
  --radius: 2px; --radius-sm: 2px; --shadow: 0 1px 2px rgba(10, 15, 14, .05); --shadow-lg: 0 18px 50px -20px rgba(10, 15, 14, .38), 0 2px 6px rgba(10, 15, 14, .06);
  --font: 'Satoshi', 'Helvetica Neue', Arial, sans-serif; --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --rail: 60px; --top: 52px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 21px; margin: 0; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: -.015em; }
h3 { font-size: 14px; margin: 0 0 10px; font-weight: 700; }
h4 { font: 400 11px/1.4 var(--mono); margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; }
::selection { background: var(--wire); color: var(--paper); }
p { margin: 0 0 8px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
kbd { font: 11.5px var(--mono); background: var(--bg-2); border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 2px; padding: 1px 6px; margin-right: 4px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .pad { padding: 12px; }
.clamp { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ici { display: inline-flex; align-items: center; } .ic { flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---- buttons & inputs ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; text-decoration: none !important; }
.btn:hover:not(:disabled) { background: var(--bg); border-color: #b9c1bd; }
.btn:active:not(:disabled) { background: var(--bg-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.active { background: var(--accent-soft); border-color: #9fd6c9; color: var(--accent-2); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #a8342a; }
.btn-danger-ghost { color: var(--bad); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--bad-soft) !important; border-color: #efc5c0 !important; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-block { width: 100%; justify-content: center; height: 38px; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--bg-2); color: var(--text); }
.input { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: #fff; color: var(--text); font: 14px var(--font); transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
select.input { padding-right: 26px; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235c6663' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center; }
.input:hover { border-color: #b9c1bd; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11, 122, 103, .16); }
.input:disabled { background: var(--bg); color: var(--muted); }
.input.num { width: 90px; } .input.color { width: 64px; padding: 2px; }
.field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; min-width: 0; }
.field.sm { margin-bottom: 8px; }
.field-label { font-size: 12.5px; font-weight: 600; color: #2a3431; }
.field-hint { font-size: 12px; color: var(--muted); } .field-hint.ok { color: var(--ok); } .field-hint.warn { color: var(--warn); }
.check, .radio { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input, .radio input { margin: 2px 0 0; accent-color: var(--accent); width: 15px; height: 15px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { width: 34px; height: 20px; border-radius: 2px; background: #c9d0cd; position: relative; transition: background .15s; flex: none; }
.switch-dot { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 1px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-dot { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-label { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 10px; } .stack-sm { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.copy-row { display: flex; gap: 8px; align-items: center; } .copy-row .input { flex: 1; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.sm { width: 12px; height: 12px; } .spinner.light { border-color: rgba(255,255,255,.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- pills, chips ---- */
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 0; font: 400 10.5px var(--mono); text-transform: uppercase; color: #fff; letter-spacing: .1em; white-space: nowrap; }
.st-new { background: var(--st-new); } .st-open { background: var(--st-open); } .st-pending { background: var(--st-pending); } .st-hold { background: var(--st-hold); } .st-solved { background: var(--st-solved); } .st-closed { background: var(--st-closed); color: var(--text); }
.chip { display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 7px; border-radius: 2px; background: var(--bg-2); color: #46504d; font-size: 11.5px; font-weight: 500; margin-left: 6px; white-space: nowrap; }
.chip-ok { background: var(--ok-soft); color: var(--ok); } .chip-warn { background: var(--warn-soft); color: #8f5d12; }
.chip-note { background: #f6ebbd; color: #6e5300; } .chip-agent { background: var(--accent-soft); color: var(--accent-2); } .chip-chat { background: #e3eef3; color: #1f5a74; }
.prio { font-size: 12.5px; font-weight: 500; } .prio-urgent { color: var(--bad); } .prio-high { color: #c2620c; } .prio-normal { color: #2a3431; } .prio-low { color: var(--muted); }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; user-select: none; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot-online { background: var(--wire); } .dot-away { background: #d48a0a; } .dot-offline { background: #8a9490; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 2px; vertical-align: -2px; border: 1px solid rgba(0,0,0,.1); }
.ob-sent { background: var(--ok-soft); color: var(--ok); } .ob-failed { background: var(--bad-soft); color: var(--bad); } .ob-simulated { background: var(--accent-soft); color: var(--accent-2); } .ob-queued { background: var(--warn-soft); color: #8f5d12; }

/* ---- auth ---- */
.boot-splash { height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; position: relative; overflow: hidden; background-color: var(--ink); background-image: radial-gradient(rgba(250, 250, 248, .07) 1px, transparent 0); background-size: 24px 24px; isolation: isolate; }
.auth::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, rgba(15, 169, 142, .55) 18%, rgba(15, 169, 142, .55) 82%, transparent); z-index: -1; }
.auth::after { content: ''; position: absolute; left: calc(18% - 3px); top: calc(50% - 3px); width: 7px; height: 7px; border-radius: 50%; background: var(--wire); box-shadow: 0 0 0 4px rgba(15, 169, 142, .15); z-index: -1; }
.auth-card { width: 100%; max-width: 400px; background: var(--paper); border: 1px solid var(--border); border-top: 2px solid var(--wire); border-radius: 0; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .7); padding: 30px 30px 24px; }
.auth-brand { display: flex; align-items: center; margin-bottom: 22px; font-size: 20px; }
.auth-signal { color: var(--wire-deep); margin: 0 0 6px; }
.auth-product { font-weight: 700; font-size: 16px; color: var(--text); }
.auth-card h1 { font-size: 26px; letter-spacing: -.03em; margin-bottom: 6px; }
.auth-sub { color: var(--muted); margin-bottom: 16px; }
.auth-form { margin-top: 12px; }
.auth-err { background: var(--bad-soft); color: #8f2a21; border: 1px solid #efc5c0; border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 12px; font-size: 13px; }
.auth-ok { background: var(--ok-soft); color: #0b4d42; border-radius: var(--radius-sm); padding: 10px 12px; }
.auth-links { margin: 14px 0 0; text-align: center; font-size: 13px; }
.auth-foot { margin-top: 18px; color: rgba(250, 250, 248, .55); font: 400 11px var(--mono); text-transform: uppercase; letter-spacing: .14em; }
.auth-foot a { color: var(--wire); }

/* ---- shell ---- */
.shell { display: flex; height: 100vh; overflow: hidden; }
.rail { width: var(--rail); flex: none; background: var(--navy); display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 4px; }
.rail-logo { display: flex; width: 42px; height: 42px; align-items: center; justify-content: center; margin-bottom: 10px; border-radius: 0; color: var(--wire); }
.rail-logo .talos-logo { width: 26px; height: 26px; }
.rail-logo:hover { background: var(--navy-2); text-decoration: none; }
.rail-btn { width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; border-radius: 2px; color: rgba(250, 250, 248, .58); border: 0; background: none; cursor: pointer; position: relative; transition: color .15s, background .15s; }
.rail-btn:hover { background: var(--navy-2); color: var(--paper); text-decoration: none; }
.rail-btn.active { background: rgba(15, 169, 142, .12); color: var(--wire); }
.rail-btn.active::before { content: ''; position: absolute; left: -9px; top: 8px; bottom: 8px; width: 2px; border-radius: 0; background: var(--wire); }
.rail-spacer { flex: 1; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: var(--top); flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.btn-new { height: 32px; font-weight: 600; }
.tabs { flex: 1; display: flex; align-items: flex-end; gap: 2px; height: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 6px; height: 38px; max-width: 220px; min-width: 0; padding: 0 8px 0 10px; border: 1px solid transparent; border-bottom: 0; border-radius: 0; color: #46504d; font-size: 13px; white-space: nowrap; flex: none; text-decoration: none !important; position: relative; top: 1px; }
.tab:hover { background: var(--bg); color: var(--text); }
.tab.active { background: var(--bg); border-color: var(--border); color: var(--text); font-weight: 700; box-shadow: inset 0 2px 0 var(--wire-deep); }
.tab-home { padding: 0 12px; }
.tab-title { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tab-id { color: var(--faint); font-size: 11.5px; font-weight: 500; }
.tab-st { width: 8px; height: 8px; border-radius: 0; flex: none; }
.tab-upd .tab-title::after { content: ' •'; color: var(--accent); }
.tab-x { width: 20px; height: 20px; border: 0; background: none; border-radius: 2px; display: inline-flex; align-items: center; justify-content: center; color: var(--faint); cursor: pointer; flex: none; }
.tab-x:hover { background: var(--border); color: var(--text); }
.top-right { display: flex; align-items: center; gap: 8px; flex: none; }
.search { position: relative; }
.search-ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--faint); display: flex; }
.search-input { width: 240px; padding-left: 30px; height: 32px; background: var(--bg); border-color: var(--border); transition: width .15s, background .15s; }
.search-input:focus { width: 320px; background: #fff; }
.status-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 9px; border: 1px solid var(--border); background: #fff; border-radius: var(--radius-sm); cursor: pointer; font: 13px var(--font); color: var(--text); }
.status-btn:hover { background: var(--bg); }
.user-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; display: flex; }
.user-btn:focus-visible { outline-offset: 1px; }
.sse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--wire); box-shadow: 0 0 0 3px rgba(15,169,142,.18); }
.sse-dot.off { background: #d48a0a; box-shadow: 0 0 0 3px rgba(212,138,10,.15); }
#page { flex: 1; overflow: auto; position: relative; outline: none; }
.page-holder { min-height: 100%; }
.page-pad { padding: 20px 24px 40px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-head p { margin: 2px 0 0; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; } .toolbar .input { max-width: 360px; } .toolbar select.input { max-width: 180px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; margin-bottom: 8px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h3 { margin: 0; }
.form-card { margin-bottom: 14px; max-width: 980px; }
.banner { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 12px; font-size: 13.5px; }
.banner > span:not(.ici) { flex: 1; }
.banner-err { background: var(--bad-soft); border-color: #efc5c0; color: #8f2a21; }
.banner-warn { background: var(--warn-soft); border-color: #ecd9a8; color: #7a4d0d; }
.banner-info { background: var(--accent-soft); border-color: #b3e2d7; color: #0b4d42; max-width: 980px; }
.banner-ok { background: var(--ok-soft); border-color: #b3e2d7; color: #0b4d42; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ici { color: var(--faint); margin-bottom: 8px; }
.empty h3 { color: var(--text); margin: 4px 0; font-size: 15px; }

/* ---- split layout with sub nav ---- */
.split { display: flex; min-height: 100%; }
.subnav { width: 250px; flex: none; background: var(--surface); border-right: 1px solid var(--border); padding: 14px 10px; position: sticky; top: 0; align-self: flex-start; height: calc(100vh - var(--top)); overflow-y: auto; }
.subnav-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 10px; }
.subnav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: var(--radius-sm); color: #2a3431; font-size: 13.5px; text-decoration: none !important; }
.subnav-item:hover { background: var(--bg); }
.subnav-item.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 700; box-shadow: inset 2px 0 0 var(--wire-deep); }
.subnav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 6px; }
.subnav-item.active .count { color: var(--accent-2); }
.subnav-sep { height: 1px; background: var(--border); margin: 10px 8px; }
.subnav-manage { display: block; padding: 8px 10px; font-size: 12.5px; }
.subnav-group { margin-bottom: 10px; }
.subnav-group-title { font: 400 10.5px var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--faint); padding: 6px 10px 4px; }
.views-main, .admin-main { flex: 1; min-width: 0; }
.views-main { padding: 18px 22px 40px; }

/* ---- tables ---- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font: 400 10.5px var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--border); background: #f6f7f5; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th .ici { vertical-align: -2px; margin-left: 3px; }
.table td { padding: 9px 12px; border-bottom: 1px solid #eceeed; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.trow { cursor: pointer; }
.trow:hover td { background: #f3f6f4; }
.trow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.trow.selected td { background: #e9f6f2; }
.col-check { width: 36px; } .col-check input { accent-color: var(--accent); width: 15px; height: 15px; vertical-align: middle; }
.col-status { width: 84px; }
.col-subject { min-width: 260px; }
.subj { font-weight: 500; }
.compact .table td { padding: 7px 10px; }
.row-actions { text-align: right; white-space: nowrap; } .row-actions .btn { margin-left: 6px; }
.name-cell { display: inline-flex; align-items: center; gap: 8px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 2px; }
.pager-btns { display: flex; align-items: center; gap: 10px; }
.bulk-bar { border-top: 2px solid var(--wire); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px; background: var(--navy); color: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.bulk-bar strong { margin-right: 6px; font-size: 13px; }
.bulk-bar .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.bulk-bar .btn:hover:not(:disabled) { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); }
.sla-badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 2px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sla-ok { background: var(--ok-soft); color: var(--ok); } .sla-warn { background: var(--warn-soft); color: #8f5d12; } .sla-breached { background: var(--bad-soft); color: var(--bad); } .sla-done { background: var(--bg-2); color: var(--muted); } .sla-paused { background: var(--bg-2); color: #46504d; }
.seg { display: inline-flex; background: var(--bg-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; margin-bottom: 12px; }
.seg-btn { border: 0; background: none; height: 28px; padding: 0 12px; border-radius: 2px; font: 500 13px var(--font); color: #46504d; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: #fff; color: var(--text); box-shadow: inset 0 -2px 0 var(--wire-deep), var(--shadow); font-weight: 700; }
.page-head .seg { margin: 0; }
.syntax { padding: 12px; } .syntax table { width: 100%; border-collapse: collapse; font-size: 12.5px; } .syntax td { padding: 4px 6px; border-bottom: 1px solid var(--border); vertical-align: top; } .syntax h4 { margin-bottom: 8px; }

/* skeletons */
.skel-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 0; }
.skel-row { display: flex; gap: 16px; padding: 12px 14px; border-bottom: 1px solid #eceeed; } .skel-row:last-child { border: 0; }
.skel, .skel-card { display: block; height: 12px; border-radius: 2px; background: linear-gradient(90deg, #eceeed 25%, #f6f7f5 37%, #eceeed 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
.skel-card { height: 92px; border-radius: var(--radius); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---- popovers, menus, combos, tokens ---- */
.pop { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 200px; max-height: 70vh; overflow: auto; animation: popin .1s ease-out; }
@keyframes popin { from { opacity: 0; transform: translateY(-3px); } }
.menu { padding: 5px; display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 2px; font: 13.5px var(--font); color: var(--text); cursor: pointer; }
.menu-item:hover:not(:disabled), .menu-item:focus { background: var(--bg); outline: none; }
.menu-item:disabled { color: var(--faint); cursor: default; }
.menu-item.active { font-weight: 600; color: var(--accent-2); }
.menu-item.danger { color: var(--bad); }
.menu-item .ici { color: var(--muted); } .menu-item.danger .ici { color: var(--bad); }
.menu-hint { margin-left: auto; color: var(--faint); font-size: 12px; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu-head { padding: 6px 10px 8px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-item.mono { font-family: var(--mono); font-size: 12.5px; padding: 5px 10px; }
.ph-list { padding: 5px; }
.combo { position: relative; width: 100%; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 70; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 260px; overflow: auto; padding: 4px; }
.combo-item { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 2px; cursor: pointer; }
.combo-item.active, .combo-item:hover { background: var(--accent-soft); }
.combo-sub { font-size: 12px; color: var(--muted); }
.combo-empty { padding: 8px; color: var(--muted); font-size: 13px; }
.tokens { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 34px; padding: 3px 4px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: #fff; cursor: text; }
.tokens:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11, 122, 103, .16); }
.tokens .combo { flex: 1; min-width: 90px; width: auto; }
.token-in { border: 0 !important; box-shadow: none !important; height: 26px; padding: 0 4px; }
.token { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 4px 0 8px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 2px; font-size: 12.5px; max-width: 100%; }
.token-x { border: 0; background: none; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 2px; cursor: pointer; color: var(--muted); padding: 0; }
.token-x:hover { background: var(--border-2); color: var(--text); }
.multi { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); max-height: 140px; overflow: auto; background: #fff; }

/* ---- dialogs & toasts ---- */
.dlg-back { position: fixed; inset: 0; z-index: 50; background: rgba(10, 15, 14, .55); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.dlg { width: 100%; max-width: 480px; background: var(--surface); border-radius: 2px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: 84vh; animation: dlgin .14s ease-out; }
@keyframes dlgin { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.dlg-wide { max-width: 760px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.dlg-body { padding: 4px 16px 14px; overflow: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: #f6f7f5; border-radius: 0; }
.dlg-err { margin-top: 10px; background: var(--bad-soft); color: #8f2a21; border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 440px; padding: 10px 10px 10px 14px; background: var(--navy); color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toastin .18s ease-out; border-left: 3px solid var(--wire); }
.toast.t-success { border-left-color: var(--wire); } .toast.t-error { border-left-color: #e5675b; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .2s; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }
.toast-msg { flex: 1; }
.toast .btn-link { color: #5fd3bb; font-weight: 600; }
.toast-x { border: 0; background: none; color: #8a9490; cursor: pointer; display: flex; padding: 2px; border-radius: 2px; }
.toast-x:hover { color: #fff; }
.kbd-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); } .kbd-table { border-collapse: collapse; width: 100%; }
.radio-list { display: flex; flex-direction: column; gap: 6px; }
.kv { border-collapse: collapse; width: 100%; } .kv td { padding: 5px 8px; border-bottom: 1px solid var(--border); } .kv td:first-child { color: var(--muted); width: 40%; }
.macro-comment pre { white-space: pre-wrap; font: 13px/1.5 var(--font); background: var(--bg); border-radius: var(--radius-sm); padding: 10px; margin: 6px 0 0; max-height: 220px; overflow: auto; }
.plain-list { list-style: none; margin: 0; padding: 0; } .plain-list li { padding: 5px 0; display: flex; gap: 8px; align-items: center; }

/* ---- ticket page ---- */
.tpage { display: flex; flex-direction: column; height: calc(100vh - var(--top)); background: var(--bg); }
.thead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex: none; }
.thead-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.tid { color: var(--muted); font-weight: 600; font-size: 13px; flex: none; }
.subject-input { flex: 1; min-width: 0; font: 650 17px var(--font); color: var(--text); border: 1px solid transparent; border-radius: var(--radius-sm); padding: 4px 8px; background: transparent; }
.subject-input:hover:not(:disabled) { border-color: var(--border); }
.subject-input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(11, 122, 103, .16); }
.thead-side { display: flex; align-items: center; gap: 8px; flex: none; }
.viewers { display: flex; align-items: center; gap: 2px; }
.viewers-label { font-size: 12px; color: var(--muted); margin-right: 4px; }
.viewer { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wire); margin-left: 4px; }
.banner-host .banner { margin: 8px 16px 0; }
.tcols { flex: 1; display: grid; grid-template-columns: 280px minmax(0, 1fr) 300px; min-height: 0; }
.tprops { background: var(--surface); border-right: 1px solid var(--border); padding: 14px 14px 30px; overflow-y: auto; }
.prop { margin-bottom: 12px; min-width: 0; }
.prop-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 600; color: #46504d; margin-bottom: 4px; }
.prop-label .req { color: var(--bad); }
.prop-act { font-size: 12px; font-weight: 500; }
.prop-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prop-sep { height: 1px; background: var(--border); margin: 14px -14px; }
.tcenter { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.convo { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.comment { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.comment.internal { background: var(--note); border-color: var(--note-border); }
.c-main { flex: 1; min-width: 0; }
.c-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; margin-bottom: 4px; }
.c-meta .chip { margin-left: 2px; }
.c-time { color: var(--muted); font-size: 12px; margin-left: 6px; }
.c-via { display: inline-flex; align-items: center; gap: 3px; color: var(--faint); font-size: 12px; margin-left: auto; }
.rich { overflow-wrap: anywhere; }
.rich p { margin: 0 0 8px; } .rich p:last-child { margin-bottom: 0; }
.rich ul, .rich ol { margin: 4px 0 8px; padding-left: 22px; }
.rich blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--border-2); color: var(--muted); }
.rich img { max-width: 100%; }
.rich pre { white-space: pre-wrap; background: var(--bg); padding: 8px; border-radius: 2px; }
.c-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.att-img { display: block; width: 140px; height: 100px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: var(--bg); }
.att-img img { width: 100%; height: 100%; object-fit: cover; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; font-size: 12.5px; color: var(--text); text-decoration: none !important; max-width: 280px; }
.file-chip span:not(.muted) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.file-chip:hover { border-color: var(--accent); }
.audit { border-left: 2px dashed var(--border-2); margin-left: 16px; padding: 4px 0 4px 18px; font-size: 12.5px; color: #46504d; }
.audit-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 3px; }
.audit-list { margin: 0; padding-left: 16px; }
.audit-list li { margin: 2px 0; }
.audit-list s { color: var(--faint); }
.ev-src { color: var(--faint); }
.ev-err { color: var(--bad); }
.reply { flex: none; border-top: 1px solid var(--border); background: var(--surface); padding: 10px 16px 12px; }
.composer { border: 1px solid var(--border-2); border-radius: var(--radius); background: #fff; transition: border-color .12s, box-shadow .12s, background .12s; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11, 122, 103, .14); }
.composer.is-note { background: var(--note); border-color: var(--note-border); }
.composer.is-note:focus-within { border-color: #cdb25a; box-shadow: 0 0 0 3px rgba(205,178,90,.18); }
.composer.drag { border-style: dashed; border-color: var(--accent); }
.composer-modes { display: flex; gap: 2px; padding: 6px 8px 0; }
.mode-btn { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 0; border-radius: 2px; background: none; font: 500 13px var(--font); color: var(--muted); cursor: pointer; }
.mode-btn:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.mode-btn.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.mode-btn.mode-note.active { background: #f6ebbd; color: #6e5300; }
.mode-btn:disabled { opacity: .45; cursor: not-allowed; }
.composer-ta { display: block; width: 100%; min-height: 96px; max-height: 40vh; resize: vertical; border: 0; background: transparent; padding: 8px 12px; font: 14px/1.5 var(--font); color: var(--text); }
.composer-ta:focus { outline: none; }
.composer-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px; }
.composer-files:not(:empty) { padding-bottom: 6px; }
.composer-tb { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-top: 1px solid rgba(0,0,0,.06); }
.tb-btn { display: inline-flex; align-items: center; gap: 5px; height: 28px; min-width: 28px; justify-content: center; padding: 0 6px; border: 0; background: none; border-radius: 2px; color: #46504d; cursor: pointer; font: 500 12.5px var(--font); }
.tb-btn:hover { background: rgba(10,15,14,.06); color: var(--text); }
.tb-sep { width: 1px; height: 18px; background: var(--border-2); margin: 0 4px; }
.tb-hint { margin-left: auto; font-size: 11.5px; color: var(--faint); padding-right: 6px; }
.submit-host { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 10px; }
.dirty-note { font-size: 12.5px; color: var(--warn); display: inline-flex; gap: 8px; align-items: center; }
.split-btn { display: inline-flex; }
.split-btn .submit-main { border-radius: var(--radius-sm) 0 0 var(--radius-sm); height: 34px; font-weight: 600; padding: 0 16px; }
.split-btn .submit-caret { border-radius: 0; border-left: 1px solid rgba(255,255,255,.35); height: 34px; padding: 0 8px; }
.sub-new { background: var(--st-new); border-color: var(--st-new); } .sub-open { background: var(--st-open); border-color: var(--st-open); } .sub-pending { background: var(--st-pending); border-color: var(--st-pending); } .sub-hold { background: var(--st-hold); border-color: var(--st-hold); } .sub-solved { background: var(--st-solved); border-color: var(--st-solved); }
.split-btn .submit-main:hover:not(:disabled) { filter: brightness(.93); }
.closed-note { flex: none; display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--surface); border-top: 1px solid var(--border); color: var(--muted); }
.closed-note span { flex: 1; }
.macro-pop { padding: 8px; } .macro-pop .input { margin-bottom: 6px; } .macro-list { max-height: 300px; overflow: auto; }
.tctx { background: var(--surface); border-left: 1px solid var(--border); overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.ctx-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.ctx-card h4 { margin-bottom: 8px; }
.ctx-user { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.ctx-name { font-weight: 700; font-size: 14.5px; color: var(--text); }
.notes { font-size: 13px; }
.meta { display: grid; grid-template-columns: 96px 1fr; gap: 5px 8px; margin: 0 0 10px; font-size: 12.5px; }
.meta dt { color: var(--muted); } .meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.meta .chip { margin: 0 4px 2px 0; }
.org-note { font-size: 12.5px; background: var(--bg); border-radius: var(--radius-sm); padding: 6px 8px; margin-bottom: 8px; color: #46504d; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.mini-list li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mini-list a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.mini-list .pill { height: 17px; font-size: 10.5px; padding: 0 5px; }
.sla-list { display: flex; flex-direction: column; gap: 6px; }
.sla-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 600; }
.sla-name { flex: 1; font-weight: 500; }
.sla-val { font-variant-numeric: tabular-nums; }
.csat-good { color: var(--ok); font-weight: 600; } .csat-bad { color: var(--bad); font-weight: 600; }
.uf { margin-top: 6px; }
.nt .tcenter { padding: 16px 20px; gap: 12px; overflow: auto; }
.nt-head { display: flex; flex-direction: column; gap: 8px; }
.nt-head .subject-input { border-color: var(--border-2); background: #fff; font-size: 16px; padding: 8px 10px; }
.nt .composer-ta { min-height: 200px; }

/* ---- profiles ---- */
.profile { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.profile-side h4 { margin-top: 6px; }
.profile-main h3 { margin-top: 4px; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.org-badge { width: 48px; height: 48px; border-radius: 2px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.admin-box { border-top: 1px solid var(--border); padding-top: 12px; }
.form-foot { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.member-list { list-style: none; padding: 0; margin: 0 0 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.member-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #eceeed; } .member-list li:last-child { border: 0; }

/* ---- reporting ---- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-top: 2px solid var(--ink); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi-label { font: 400 10.5px var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.kpi-val { font-size: 28px; font-weight: 700; letter-spacing: -.035em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--faint); }
.kpi.warn .kpi-val { color: var(--warn); } .kpi.bad .kpi-val { color: var(--bad); }
.chart-card { margin-bottom: 14px; }
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #eceeed; } .chart .axis { fill: var(--muted); font-size: 11px; }
.chart .line-created { fill: none; stroke: var(--wire-deep); stroke-width: 2.2; stroke-linejoin: round; }
.chart .line-solved { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; stroke-dasharray: 0; }
.chart .area-created { fill: rgba(15, 169, 142, .09); }
.chart .guide { stroke: #c9d0cd; stroke-dasharray: 3 3; }
.chart .dot-created { fill: #fff; stroke: var(--accent); stroke-width: 2; } .chart .dot-solved { fill: #fff; stroke: var(--ink); stroke-width: 2; }
.chart-tip { position: absolute; pointer-events: none; background: var(--navy); color: #fff; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 12.5px; box-shadow: var(--shadow-lg); min-width: 130px; transform: translateY(-50%); }
.legend { display: flex; gap: 14px; }
.lg { display: inline-flex; align-items: center; gap: 6px; font: 400 10.5px var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.lg::before { content: ''; width: 10px; height: 3px; border-radius: 2px; }
.lg-created::before { background: var(--accent); } .lg-solved::before { background: var(--ink); }
.chart-tip .lg-created::before { background: var(--wire); } .chart-tip .lg-solved::before { background: var(--paper); }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 40px; align-items: center; gap: 10px; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; background: var(--bg-2); border-radius: 2px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 2px; min-width: 2px; }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; color: #46504d; }
.lb td, .lb th { padding: 7px 8px; }

/* ---- admin ---- */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.ov-card a { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.save-bar { max-width: 980px; margin-bottom: 16px; position: sticky; bottom: 0; z-index: 5; background: linear-gradient(transparent, var(--bg) 30%); padding-top: 10px; }
.save-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.save-right { display: flex; gap: 8px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; margin-bottom: 8px; }
.opt-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.opt-row { display: grid; grid-template-columns: 1fr 1fr auto auto auto; gap: 6px; align-items: center; }
.order-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 360px; overflow: auto; }
.order-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid #eceeed; font-size: 13.5px; }
.order-list li:last-child { border: 0; }
.order-btns { display: inline-flex; gap: 0; }
.settings-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); margin-top: 6px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting p { margin: 2px 0 0; }
.rule-cat { margin-bottom: 14px; max-width: 980px; padding: 12px 12px 6px; }
.rule-list { list-style: none; margin: 0; padding: 0; }
.rule-item { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-top: 1px solid #eceeed; }
.rule-item:first-child { border-top: 0; }
.rule-item[draggable="true"] { cursor: grab; }
.rule-item:hover { background: #f6f7f5; }
.grip { color: var(--faint); display: flex; }
.rule-pos { width: 22px; text-align: right; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.rule-title { flex: 1; color: var(--text); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-group { margin-bottom: 18px; } .rb-group:last-child { margin-bottom: 0; }
.rb-group > h3 { font-size: 15px; }
.rb-section { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.rb-head { display: flex; align-items: baseline; gap: 8px; } .rb-head h4 { text-transform: none; letter-spacing: 0; font-size: 13px; color: #2a3431; }
.rb-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.rb-row { display: grid; grid-template-columns: minmax(150px, 220px) minmax(120px, 190px) minmax(0, 1fr) 30px; gap: 6px; align-items: start; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; }
.rb-action { grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) 30px; }
.rb-val { min-width: 0; display: flex; }
.rb-val > * { flex: 1; }
.rb-op-static { display: flex; align-items: center; height: 34px; padding: 0 10px; color: var(--muted); font-size: 13px; }
.rb-hours { display: flex; align-items: center; gap: 6px; } .rb-hours .input { width: 110px; }
.rb-empty { margin: 2px 0 6px; }
.rb-add { background: #fff; }
.preview-row { display: flex; gap: 12px; align-items: flex-start; margin-top: 10px; }
.preview { flex: 1; } .preview .mini-list { margin-top: 6px; }
.sla-grid td { padding: 6px 8px; } .sla-grid th { white-space: nowrap; }
.sla-cell { display: flex; align-items: center; gap: 6px; }
.sla-cell .input { width: 80px; }
.bh { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); cursor: pointer; }
.bh input { accent-color: var(--accent); }
.week { display: flex; flex-direction: column; gap: 4px; max-width: 520px; }
.week-row { display: grid; grid-template-columns: 140px 1fr; align-items: center; min-height: 40px; padding: 2px 0; border-bottom: 1px solid #eceeed; }
.week-row.off .check span { color: var(--muted); }
.week-times { display: flex; align-items: center; gap: 8px; } .week-times .input { width: 130px; }
.hol-add { display: flex; gap: 8px; margin-top: 10px; align-items: center; } .hol-add .input { max-width: 220px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; max-width: 1180px; }
.widget-preview { background-color: #f0f2f1; background-image: radial-gradient(rgba(10, 15, 14, .07) 1px, transparent 0); background-size: 16px 16px; border: 1px solid var(--border); border-radius: var(--radius); height: 380px; position: relative; overflow: hidden; }
.wp-frame { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 14px; }
.wp-panel { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.wp-head { width: 220px; color: #fff; padding: 12px 14px; border-radius: 0; font-weight: 700; font-size: 14px; }
.wp-body { width: 220px; height: 150px; background: #fff; margin-top: -10px; border-radius: 0; padding: 12px; box-shadow: var(--shadow-lg); }
.wp-bubble { background: var(--bg-2); border-radius: 0; padding: 8px 10px; font-size: 13px; display: inline-block; }
.wp-btn { width: 50px; height: 50px; border-radius: 2px; color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); }

/* ---- responsive ---- */
@media (max-width: 1280px) { .tcols { grid-template-columns: 250px minmax(0, 1fr) 260px; } .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid3 { grid-template-columns: 1fr; } }
@media (max-width: 1000px) { .tcols { grid-template-columns: 240px minmax(0, 1fr); } .tctx { display: none; } .profile, .grid-side, .two-col { grid-template-columns: 1fr; } .subnav { width: 200px; } .search-input { width: 160px; } .search-input:focus { width: 220px; } }
@media (max-width: 720px) { .tcols { grid-template-columns: 1fr; overflow: auto; } .tprops { border-right: 0; border-bottom: 1px solid var(--border); } .subnav { display: none; } .grid2 { grid-template-columns: 1fr; } .status-label { display: none; } }

/* ---- print: conversation only ---- */
@media print {
  .rail, .topbar, .tprops, .tctx, .reply, .closed-note, .thead-side, .banner-host, #toasts { display: none !important; }
  .shell, .main, #page, .tpage, .tcols, .tcenter, .convo { display: block !important; height: auto !important; overflow: visible !important; }
  body { background: #fff; }
  .comment { box-shadow: none; break-inside: avoid; }
}

/* ---- AI assistant admin ---- */
.ai-ask-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 12px; }
.ai-preview-out:empty { display: none; }
.ai-reply { border: 1px solid var(--border); background: var(--bg); padding: 12px; margin-bottom: 10px; }
.ai-reply-head { display: flex; gap: 6px; margin-bottom: 8px; }
.ai-reply-body { white-space: pre-wrap; line-height: 1.5; }
.ai-sources ul { margin: 6px 0 0; padding-left: 18px; } .ai-sources li { margin: 2px 0; }
.ai-mini { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 6px; }
.ai-mini div { border-left: 2px solid var(--accent); padding-left: 10px; } .ai-mini b { display: block; font-size: 22px; }
@media (max-width: 700px) { .ai-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- profile photos ---- */
.avatar.has-photo { position: relative; overflow: hidden; background: var(--bg-2) !important; color: transparent; }
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.photo-editor { display: flex; align-items: center; gap: 18px; }
.photo-preview { flex: none; width: 88px; height: 88px; border-radius: 50%; box-shadow: 0 0 0 1px var(--border), 0 0 0 4px var(--surface), 0 0 0 5px var(--border); }
.photo-side { min-width: 0; }
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.photo-side p { margin: 0 0 4px; max-width: 460px; }
.profile-id { display: flex; flex-direction: column; gap: 1px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }

/* ---- live dot ---- */
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--border-2); vertical-align: middle; flex: none; }
.live-dot.sm { width: 7px; height: 7px; margin-right: 6px; vertical-align: 1px; }
.live-dot.on { background: var(--wire); box-shadow: 0 0 0 0 rgba(15, 169, 142, .5); animation: livepulse 1.8s ease-out infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(15, 169, 142, .5); } 70% { box-shadow: 0 0 0 7px rgba(15, 169, 142, 0); } 100% { box-shadow: 0 0 0 0 rgba(15, 169, 142, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot.on { animation: none; box-shadow: 0 0 0 3px rgba(15, 169, 142, .2); } }
.kpi-label .live-dot { margin-right: 7px; }

/* ---- visitors page ---- */
.vis-updated { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; }
.vis-table td.vis-live { width: 28px; padding-right: 0; text-align: center; }
.vis-who { min-width: 0; line-height: 1.3; }
.vis-who a { font-weight: 700; color: var(--text); }
.vis-page { max-width: 340px; }
.vis-page .clamp { max-width: 320px; }
.ext-link { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.ext-link:hover { color: var(--accent); }
.vis-now { color: var(--wire-deep); font-weight: 700; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.vis-table .chip { margin-left: 6px; }
.drawer { position: fixed; top: var(--top); right: 0; bottom: 0; width: 420px; max-width: 100vw; z-index: 40; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: drawerin .16s ease-out; outline: none; }
@keyframes drawerin { from { transform: translateX(16px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid var(--border); border-top: 2px solid var(--ink); }
.drawer-head h4 { margin-bottom: 6px; }
.drawer-head .vis-who { font-size: 15px; }
.drawer-body { padding: 14px 16px 20px; overflow: auto; }
.drawer-body .meta { grid-template-columns: 88px 1fr; }
.trail { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border-2); margin-left: 4px; }
.trail li { position: relative; display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 8px; padding: 6px 0 6px 14px; font-size: 13px; }
.trail li::before { content: ''; position: absolute; left: -4px; top: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border-2); }
.trail li.cur::before { background: var(--wire); border-color: var(--wire); }
.trail-time { color: var(--muted); font-size: 11px; padding-top: 2px; }
.trail-main { min-width: 0; }
.trail-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trail.compact li { grid-template-columns: 54px minmax(0, 1fr); padding: 4px 0 4px 12px; font-size: 12.5px; }
.trail.compact li::before { top: 9px; }
@media (max-width: 720px) { .drawer { width: 100vw; } }

/* ---- visitor card (ticket context) ---- */
.ctx-visit h4 { display: flex; align-items: center; gap: 4px; }
.vis-live-tag { margin-left: auto; display: inline-flex; align-items: center; text-transform: none; letter-spacing: 0; font: 500 11.5px var(--font); color: var(--wire-deep); }
.vis-trail { margin: -4px 0 10px; font-size: 12.5px; }
.vis-trail summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.vis-trail[open] summary { margin-bottom: 6px; }
.ctx-sub { font: 400 10.5px var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 2px 0 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.prev-visits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.prev-visits li { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 6px; }

/* ---- AI assistant: page greetings & feedback ---- */
.greet-card, .fb-card { margin-top: 16px; margin-bottom: 16px; max-width: 1180px; }
.greet-test { display: grid; grid-template-columns: auto minmax(0, 420px) minmax(0, 1fr); align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); margin: 6px 0 12px; }
.greet-test .field-label { margin: 0; }
.greet-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.greet-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--border); background: var(--surface); transition: border-color .12s, background .12s; }
.greet-row.hit { border-color: var(--wire); background: #f3fbf8; box-shadow: inset 2px 0 0 var(--wire); }
.greet-num { font-size: 11px; color: var(--faint); padding-top: 26px; }
.greet-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1.2fr); gap: 10px; }
.greet-fields .field { margin: 0; }
.greet-btns { display: flex; flex-direction: column; gap: 2px; padding-top: 18px; }
.greet-btns .icon-btn:disabled { opacity: .35; cursor: default; }
.greet-bad { color: var(--bad); }
@media (max-width: 1000px) { .greet-fields { grid-template-columns: 1fr; } .greet-test { grid-template-columns: 1fr; } }
.fb-summary { display: flex; align-items: center; gap: 22px; margin: 4px 0 12px; }
.fb-big b { display: block; font-size: 28px; font-weight: 700; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.fb-meter { flex: 1; max-width: 420px; }
.fb-bar { height: 8px; background: var(--bad-soft); border: 1px solid #efc5c0; overflow: hidden; }
.fb-good { display: block; height: 100%; background: var(--wire-deep); }
.fb-keys { display: flex; gap: 14px; margin-top: 6px; }
.fb-k::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: 0; }
.fb-k.good::before { background: var(--wire-deep); } .fb-k.bad::before { background: #e8a59e; }
.fb-q { font-weight: 500; max-width: 260px; }
.fb-a { max-width: 380px; }
.kpi-stars { color: var(--text); margin-top: 2px; font-weight: 500; }
