/* Helpdesk — messaging-style UI on Bootstrap 5.3. --brand is set per company in the layouts. */
:root {
    --brand: #4f46e5;
    --brand-soft: color-mix(in srgb, var(--brand) 12%, transparent);
    --brand-ink: color-mix(in srgb, var(--brand) 80%, #000);
    --bg: #f4f6fb;
    --panel: #ffffff;
    --line: #e6e9f2;
    --muted: #6b7489;
    --ink: #121826;
    --bubble-in: #ffffff;
    --bubble-note: #fff8e1;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
}
[data-bs-theme="dark"] {
    --bg: #0f1320;
    --panel: #161b2b;
    --line: #262d42;
    --muted: #8b93a7;
    --ink: #e6e9f2;
    --bubble-in: #1e2438;
    --bubble-note: #3a3320;
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; font-size: .925rem; }
a { color: var(--brand); }
.btn-brand { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-color: #fff; --bs-btn-hover-bg: var(--brand-ink); --bs-btn-hover-border-color: var(--brand-ink); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--brand-ink); --bs-btn-active-color: #fff; --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); border: 0; }
.btn-soft:hover { background: color-mix(in srgb, var(--brand) 20%, transparent); color: var(--brand-ink); }
[data-bs-theme="dark"] .btn-soft { color: #c7c9ff; }
.text-muted, .muted { color: var(--muted) !important; }
.form-control, .form-select { border-color: var(--line); border-radius: 10px; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem var(--brand-soft); }
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--panel); }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; background: color-mix(in srgb, var(--c, #64748b) 14%, transparent); color: color-mix(in srgb, var(--c, #64748b) 85%, var(--ink)); }
.pill .dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--c, #64748b); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .8rem; flex: none; background: var(--c, var(--brand)); letter-spacing: .02em; }
.avatar.sm { width: 26px; height: 26px; font-size: .66rem; }
.avatar.lg { width: 48px; height: 48px; font-size: 1rem; }
.kbd { font-family: ui-monospace, Consolas, monospace; font-size: .75rem; padding: .05rem .35rem; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.empty i { font-size: 2.6rem; display: block; margin-bottom: .6rem; opacity: .55; }

/* ---------------------------------------------------------------- toasts */
.toast-stack { position: fixed; right: 1rem; bottom: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; max-width: min(380px, calc(100vw - 2rem)); }
.toast-item { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--brand)); border-radius: 12px; padding: .7rem .9rem; box-shadow: var(--shadow-lg); display: flex; gap: .6rem; align-items: flex-start; animation: toast-in .2s ease-out; }
.toast-item.out { animation: toast-out .25s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ---------------------------------------------------------------- portal (requesters) */
.portal { min-height: 100%; display: flex; flex-direction: column; background: radial-gradient(1200px 400px at 50% -100px, var(--brand-soft), transparent), var(--bg); }
.portal-top { display: flex; align-items: center; justify-content: space-between; padding: .9rem clamp(1rem, 4vw, 2.5rem); }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand img { height: 34px; max-width: 160px; object-fit: contain; }
.brand .mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; line-height: 1; }
.portal-main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 0 1rem 2rem; }
.portal-foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }
.hero { text-align: center; padding: 1.5rem 0 1.25rem; }
.hero h1 { font-weight: 800; font-size: clamp(1.5rem, 3.5vw, 2.1rem); letter-spacing: -.02em; }
.hero p { color: var(--muted); max-width: 560px; margin: .4rem auto 0; }
.steps { display: flex; justify-content: center; gap: .5rem; margin: .5rem 0 1.25rem; font-size: .8rem; color: var(--muted); }
.steps span { display: inline-flex; align-items: center; gap: .35rem; }
.steps b { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--line); color: var(--muted); font-size: .72rem; }
.steps .on b { background: var(--brand); color: #fff; }
.steps .on { color: var(--ink); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; }
.tile { all: unset; box-sizing: border-box; cursor: pointer; background: var(--panel); border: 1.5px solid var(--line); border-radius: 16px; padding: 1.1rem; display: flex; flex-direction: column; gap: .55rem; transition: transform .12s, border-color .12s, box-shadow .12s; }
.tile:hover, .tile:focus-visible { transform: translateY(-2px); border-color: var(--c); box-shadow: var(--shadow-lg); }
.tile .ic { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.tile b { font-size: 1rem; }
.tile small { color: var(--muted); line-height: 1.35; }
.form-card { padding: clamp(1rem, 3vw, 1.75rem); }
.chosen { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border-radius: 12px; background: color-mix(in srgb, var(--c) 9%, transparent); margin-bottom: 1rem; }
.chosen .ic { font-size: 1.3rem; color: var(--c); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { all: unset; cursor: pointer; padding: .35rem .8rem; border-radius: 999px; border: 1.5px solid var(--line); font-size: .85rem; background: var(--panel); }
.chip:hover { border-color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.urgency { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; }
.urgency label { cursor: pointer; border: 1.5px solid var(--line); border-radius: 12px; padding: .55rem .7rem; display: flex; gap: .55rem; align-items: flex-start; }
.urgency input { margin-top: .25rem; accent-color: var(--c); }
.urgency label:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, transparent); }
.urgency small { color: var(--muted); display: block; line-height: 1.25; }
.drop { border: 1.5px dashed var(--line); border-radius: 12px; padding: .9rem; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .12s, background .12s; }
.drop.over, .drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.file-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.file-chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .2rem .5rem; font-size: .8rem; }
.file-chip button { all: unset; cursor: pointer; color: var(--muted); }
.recent a { display: flex; align-items: center; gap: .7rem; padding: .7rem .9rem; border-radius: 12px; color: inherit; text-decoration: none; border: 1px solid var(--line); background: var(--panel); }
.recent a:hover { border-color: var(--brand); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------------------------------------------------------------- chat (shared by requester page and inbox) */
.chat { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chat-head { display: flex; align-items: center; gap: .8rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel); }
.chat-head .title { min-width: 0; flex: 1; }
.chat-head .title b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .title small { color: var(--muted); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 1rem clamp(.75rem, 3vw, 1.5rem); background: var(--bg); scroll-behavior: smooth; }
.day-sep { text-align: center; margin: 1rem 0 .6rem; }
.day-sep span { font-size: .72rem; font-weight: 600; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: .15rem .65rem; }
.msg { display: flex; gap: .55rem; margin: .35rem 0; align-items: flex-end; max-width: 100%; }
.msg .avatar { visibility: visible; }
.msg.cont .avatar { visibility: hidden; }
.msg .stack { display: flex; flex-direction: column; max-width: min(78%, 640px); min-width: 0; }
.msg .who { font-size: .72rem; color: var(--muted); margin: 0 .5rem .15rem; }
.msg.cont .who { display: none; }
.bubble { padding: .55rem .8rem; border-radius: 18px; background: var(--bubble-in); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; box-shadow: 0 1px 1px rgba(0, 0, 0, .03); }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .stack { align-items: flex-end; }
.msg.mine .bubble { background: var(--brand); color: #fff; border-color: transparent; border-bottom-right-radius: 6px; }
.msg:not(.mine) .bubble { border-bottom-left-radius: 6px; }
.msg.note .bubble { background: var(--bubble-note); color: var(--ink); border: 1px dashed #e0b84c; }
.msg.note .who::before { content: "\F4D5"; font-family: bootstrap-icons; margin-right: .25rem; color: #c58a00; }
.bubble a { color: inherit; text-decoration: underline; }
.meta { font-size: .68rem; color: var(--muted); margin: .15rem .5rem 0; display: flex; gap: .3rem; align-items: center; }
.meta .seen { color: var(--brand); }
.sys { text-align: center; margin: .7rem auto; max-width: 560px; font-size: .8rem; color: var(--muted); }
.sys span { display: inline-block; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .35rem .8rem; line-height: 1.4; }
.att { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.att img { max-width: 220px; max-height: 180px; border-radius: 12px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.att a.file { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .6rem; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: .8rem; }
.msg.mine .att a.file { background: rgba(255, 255, 255, .15); color: #fff; border-color: rgba(255, 255, 255, .3); }
.typing { font-size: .78rem; color: var(--muted); padding: 0 1.25rem .35rem; height: 1.3rem; background: var(--bg); }
.typing .dots span { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); margin-right: 2px; animation: blink 1.2s infinite; }
.typing .dots span:nth-child(2) { animation-delay: .2s; }
.typing .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { border-top: 1px solid var(--line); background: var(--panel); padding: .6rem .75rem; }
.composer .box { display: flex; align-items: flex-end; gap: .4rem; background: var(--bg); border: 1.5px solid var(--line); border-radius: 22px; padding: .3rem .35rem .3rem .6rem; transition: border-color .12s; }
.composer .box:focus-within { border-color: var(--brand); }
.composer.note-mode .box { background: var(--bubble-note); border-color: #e0b84c; }
.composer textarea { flex: 1; border: 0; background: transparent; resize: none; outline: none; max-height: 180px; min-height: 24px; padding: .35rem 0; color: var(--ink); line-height: 1.4; }
.icon-btn { all: unset; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; font-size: 1.1rem; }
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }
.icon-btn.send { background: var(--brand); color: #fff; }
.icon-btn.send:hover { background: var(--brand-ink); color: #fff; }
.icon-btn:disabled, .icon-btn.disabled { opacity: .45; pointer-events: none; }
.banner { display: flex; align-items: center; gap: .6rem; padding: .55rem 1rem; font-size: .85rem; border-bottom: 1px solid var(--line); }
.banner.remote { background: color-mix(in srgb, #0891b2 12%, var(--panel)); color: color-mix(in srgb, #0891b2 75%, var(--ink)); }
.banner.resolved { background: color-mix(in srgb, #16a34a 10%, var(--panel)); }
.banner.closed { background: var(--bg); color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); animation: pulse 1.5s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
.stars { display: inline-flex; gap: .2rem; font-size: 1.6rem; }
.stars button { all: unset; cursor: pointer; color: #cbd5e1; transition: transform .1s; }
.stars button.on { color: #f59e0b; }
.stars button:hover { transform: scale(1.15); }

/* requester tracking page */
.track-wrap { height: 100dvh; display: flex; flex-direction: column; }
.track-shell { flex: 1; min-height: 0; display: flex; width: 100%; max-width: 1100px; margin: 0 auto; gap: 1rem; padding: 0 1rem 1rem; }
.track-shell .chat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.track-side { width: 300px; flex: none; overflow-y: auto; }
.side-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .8rem; }
.side-card h6 { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .6rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem .8rem; font-size: .84rem; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
@media (max-width: 860px) {
    .track-side { display: none; }
    .track-side.show { display: block; position: fixed; inset: 0; z-index: 1050; width: auto; background: rgba(0, 0, 0, .35); padding: 1rem; }
    .track-side.show > div { max-width: 420px; margin-left: auto; }
    .track-shell { padding: 0; }
    .track-shell .chat { border-radius: 0; border-left: 0; border-right: 0; }
}

/* ---------------------------------------------------------------- staff app shell */
.app { display: flex; height: 100dvh; overflow: hidden; }
.rail { width: 68px; flex: none; background: #11162a; display: flex; flex-direction: column; align-items: center; padding: .7rem 0; gap: .3rem; }
.rail .logo { width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; margin-bottom: .8rem; overflow: hidden; }
.rail .logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.rail a, .rail button { all: unset; cursor: pointer; position: relative; width: 46px; height: 46px; border-radius: 12px; color: #9aa3bd; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.rail a:hover, .rail button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.rail a.active { background: var(--brand); color: #fff; }
.rail .badge-dot { position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: #ef4444; color: #fff; font-size: .62rem; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #11162a; }
.rail .spacer { flex: 1; }
.rail .tip { position: absolute; left: 56px; background: #11162a; color: #fff; font-size: .75rem; padding: .25rem .55rem; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .1s; z-index: 10; }
.rail a:hover .tip, .rail button:hover .tip { opacity: 1; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.page { flex: 1; overflow-y: auto; padding: 1.25rem clamp(1rem, 3vw, 2rem) 2rem; }
.page-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; }
.page-head h1 { font-size: 1.35rem; font-weight: 750; margin: 0; letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--muted); font-size: .85rem; }
.subnav { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; }
.subnav a { padding: .4rem .8rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .84rem; display: inline-flex; gap: .4rem; align-items: center; }
.subnav a:hover { background: var(--panel); color: var(--ink); }
.subnav a.active { background: var(--brand); color: #fff; }
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { border-color: var(--line); padding: .6rem .75rem; vertical-align: middle; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; background: var(--bg); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--brand-soft); }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; vertical-align: middle; background: var(--c); }

/* ---------------------------------------------------------------- inbox (3 panes) */
.inbox { display: flex; flex: 1; min-height: 0; }
.views { width: 220px; flex: none; border-right: 1px solid var(--line); background: var(--panel); padding: 1rem .6rem; overflow-y: auto; }
.views h6 { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 0 .6rem; margin: 1rem 0 .4rem; }
.views a { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: 9px; color: var(--ink); text-decoration: none; font-weight: 550; font-size: .86rem; }
.views a i { color: var(--muted); width: 1.1rem; text-align: center; }
.views a:hover { background: var(--bg); }
.views a.active { background: var(--brand-soft); color: var(--brand-ink); }
.views a.active i { color: var(--brand); }
[data-bs-theme="dark"] .views a.active { color: #c7c9ff; }
.views .count { margin-left: auto; font-size: .72rem; color: var(--muted); font-weight: 600; }
.views .count.hot { background: #ef4444; color: #fff; border-radius: 999px; padding: 0 .45rem; }
.list-pane { width: 370px; flex: none; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--panel); min-height: 0; }
.list-tools { padding: .75rem; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .5rem; }
.search { position: relative; }
.search i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 2.1rem; border-radius: 999px; background: var(--bg); }
.list { flex: 1; overflow-y: auto; }
.row-item { display: flex; gap: .7rem; padding: .75rem .85rem; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; text-decoration: none; color: inherit; }
.row-item:hover { background: var(--bg); }
.row-item.active { background: var(--brand-soft); }
.row-item.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.row-item .body { flex: 1; min-width: 0; }
.row-item .l1 { display: flex; align-items: baseline; gap: .4rem; }
.row-item .l1 b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.row-item.unread .l1 b, .row-item.unread .subj { font-weight: 750; }
.row-item .time { font-size: .72rem; color: var(--muted); flex: none; }
.row-item.unread .time { color: var(--brand); font-weight: 700; }
.row-item .subj { font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .prev { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .l3 { display: flex; gap: .3rem; margin-top: .35rem; flex-wrap: wrap; align-items: center; }
.row-item .unread-badge { background: var(--brand); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; min-width: 19px; height: 19px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.row-item.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--brand) 22%, transparent); } }
.sla { font-size: .7rem; font-weight: 650; display: inline-flex; align-items: center; gap: .2rem; }
.sla.ok { color: #16a34a; }
.sla.warn { color: #d97706; }
.sla.bad { color: #dc2626; }
.conv-pane { flex: 1; min-width: 0; display: flex; min-height: 0; }
.conv-pane .chat { border-right: 1px solid var(--line); }
.details { width: 330px; flex: none; overflow-y: auto; background: var(--panel); }
.details section { padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.details h6 { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: .6rem; display: flex; align-items: center; justify-content: space-between; }
.details .form-select-sm, .details .form-control-sm { border-radius: 8px; }
.field { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: .5rem; margin-bottom: .45rem; font-size: .84rem; }
.field > span { color: var(--muted); }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .8rem; }
.timeline li { position: relative; padding: 0 0 .7rem 1.1rem; border-left: 2px solid var(--line); margin-left: .3rem; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: .3rem; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); }
.timeline li:last-child { border-left-color: transparent; }
.timeline small { color: var(--muted); display: block; }
.asset-card { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .75rem; display: flex; gap: .6rem; align-items: flex-start; background: var(--bg); }
.asset-card i { font-size: 1.3rem; color: var(--brand); }
.asset-pick { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.asset-pick button { all: unset; box-sizing: border-box; cursor: pointer; display: block; width: 100%; padding: .5rem .7rem; border-bottom: 1px solid var(--line); font-size: .82rem; }
.asset-pick button:hover { background: var(--brand-soft); }
.asset-pick button:last-child { border-bottom: 0; }
.canned-menu { position: absolute; bottom: 100%; left: .75rem; right: .75rem; max-height: 260px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); margin-bottom: .4rem; z-index: 5; }
.canned-menu button { all: unset; box-sizing: border-box; cursor: pointer; display: block; width: 100%; padding: .55rem .8rem; border-bottom: 1px solid var(--line); }
.canned-menu button:hover, .canned-menu button.sel { background: var(--brand-soft); }
.canned-menu small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-toggle { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 3px; gap: 2px; }
.mode-toggle button { all: unset; cursor: pointer; padding: .2rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 650; color: var(--muted); }
.mode-toggle button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.mode-toggle button.on.note { background: #fde68a; color: #7a5300; }
.conv-empty { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; color: var(--muted); background: var(--bg); text-align: center; padding: 2rem; }
.conv-empty i { font-size: 3.2rem; opacity: .4; }
.back-btn { display: none; }
@media (max-width: 1400px) { .details { width: 290px; } .list-pane { width: 330px; } }
@media (max-width: 1200px) {
    .views { display: none; }
    .details { display: none; position: fixed; right: 0; top: 0; bottom: 0; z-index: 1040; box-shadow: var(--shadow-lg); width: 340px; }
    .details.show { display: block; }
}
@media (max-width: 860px) {
    .rail { position: fixed; bottom: 0; left: 0; right: 0; width: auto; height: 58px; flex-direction: row; justify-content: space-around; padding: 0 .4rem; z-index: 1030; }
    .rail .logo, .rail .spacer, .rail .tip { display: none; }
    .main { padding-bottom: 58px; }
    .list-pane { width: 100%; border-right: 0; }
    .conv-pane { display: none; }
    .inbox.open .list-pane { display: none; }
    .inbox.open .conv-pane { display: flex; }
    .back-btn { display: inline-flex; }
}

/* ---------------------------------------------------------------- dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
a.kpi:hover { border-color: var(--brand); }
.kpi .lbl { font-size: .76rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: .35rem; }
.kpi .val { font-size: 1.65rem; font-weight: 780; letter-spacing: -.02em; line-height: 1.2; margin-top: .25rem; }
.kpi .sub { font-size: .74rem; color: var(--muted); }
.kpi.warn .val { color: #d97706; }
.kpi.bad .val { color: #dc2626; }
.kpi.good .val { color: #16a34a; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: .8rem; margin-bottom: .8rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-bottom: .8rem; }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.card-pad { padding: 1rem 1.1rem; }
.card h5 { font-size: .92rem; font-weight: 700; margin-bottom: .8rem; display: flex; align-items: center; justify-content: space-between; }
.bars { display: flex; flex-direction: column; gap: .5rem; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 140px) 1fr 40px; gap: .6rem; align-items: center; font-size: .82rem; }
.bar-row .track { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 999px; background: var(--c, var(--brand)); }
.bar-row .n { text-align: right; font-weight: 650; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid line { stroke: var(--line); }
.chart text { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 1rem; font-size: .78rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.gauge { display: flex; align-items: center; gap: .9rem; }
.gauge .ring { --p: 0; width: 74px; height: 74px; border-radius: 50%; background: conic-gradient(var(--c, var(--brand)) calc(var(--p) * 1%), var(--bg) 0); display: flex; align-items: center; justify-content: center; flex: none; }
.gauge .ring span { width: 56px; height: 56px; border-radius: 50%; background: var(--panel); display: flex; align-items: center; justify-content: center; font-weight: 750; font-size: .9rem; }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; align-items: end; height: 70px; }
.hours div { background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.feed { list-style: none; padding: 0; margin: 0; font-size: .82rem; }
.feed li { display: flex; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border: 0; }
.feed i { color: var(--brand); }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: radial-gradient(900px 400px at 50% -80px, var(--brand-soft), transparent), var(--bg); }
.auth .card { width: 100%; max-width: 410px; padding: 2rem; }
.sig-pad { width: 100%; height: 150px; border: 1.5px dashed var(--line); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.sig-img { max-height: 80px; max-width: 100%; background: #fff; border-radius: 8px; padding: .25rem; border: 1px solid var(--line); }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .8); z-index: 3000; display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 2rem; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
