/* Microtec Support — shared design system. */
@font-face { font-family: 'Cairo'; src: url('/static/shared/Cairo.ttf') format('truetype'); font-weight: 200 900; font-display: swap; }

:root {
  --brand: #2889B1; --brand-600: #1A5F80; --brand-900: #0F3F57; --brand-50: #EAF4F9; --brand-100: #D4E9F2;
  --bg: #F3F6F9; --surface: #FFFFFF; --surface-2: #F8FAFC; --line: #E2E8F0; --line-2: #EDF2F7;
  --text: #0F1F2A; --text-2: #334155; --muted: #64748B; --faint: #94A3B8;
  --green: #15803D; --green-bg: #DCFCE7; --amber: #D97706; --amber-bg: #FEF3C7; --rose: #BE123C; --rose-bg: #FFE4E6;
  --blue: #1D4ED8; --blue-bg: #DBEAFE; --violet: #6D28D9; --violet-bg: #EDE9FE; --teal: #0F766E; --teal-bg: #CCFBF1; --slate: #475569; --slate-bg: #E2E8F0;
  --note-bg: #FFF7D6; --note-text: #7A5A00; --note-line: #F2D77A;
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --sh-1: 0 1px 2px rgba(15,31,42,.06), 0 1px 1px rgba(15,31,42,.03);
  --sh-2: 0 6px 18px rgba(15,63,87,.08);
  --sh-3: 0 24px 60px rgba(15,63,87,.18);
  --font: 'Cairo', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0E161E; --surface: #15202B; --surface-2: #1B2834; --line: #26364A; --line-2: #202E3B;
  --text: #E6EDF3; --text-2: #C3CED9; --muted: #8FA1B3; --faint: #5F7183;
  --brand-50: #14303F; --brand-100: #173B4D;
  --green-bg: #0F2E1C; --amber-bg: #3A2A07; --rose-bg: #3D1420; --blue-bg: #14264A; --violet-bg: #27194A; --teal-bg: #0E2F2C; --slate-bg: #26364A;
  --note-bg: #2E2710; --note-text: #F2D77A; --note-line: #5B4A12;
  --sh-1: 0 1px 2px rgba(0,0,0,.4); --sh-2: 0 6px 18px rgba(0,0,0,.35); --sh-3: 0 24px 60px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.55; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
html[lang="en"] body { font-size: 13.5px; }
a { color: var(--brand-600); text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .55; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 16px; } h4 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0; }
kbd { font: 600 11px var(--font); background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--muted); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* layout helpers */
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 6px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.bold { font-weight: 700; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .grid3, .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }
.ic { flex-shrink: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 700; font-size: 13px; box-shadow: 0 1px 2px rgba(15,63,87,.2); transition: background .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--brand-600); }
.btn:active { transform: translateY(1px); }
.btn.dark { background: var(--brand-900); }
.btn.ghost { background: var(--surface); color: var(--text-2); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--faint); }
.btn.soft { background: var(--brand-50); color: var(--brand-600); box-shadow: none; }
.btn.soft:hover { background: var(--brand-100); }
.btn.ok { background: var(--green); }
.btn.danger { background: var(--rose); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.iconbtn { width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); transition: background .15s, color .15s; flex-shrink: 0; }
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn.active { background: var(--brand-50); color: var(--brand-600); }
.iconbtn.sm { width: 28px; height: 28px; }
.iconbtn .cnt { position: absolute; top: 2px; inset-inline-end: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--rose); color: #fff; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.iconbtn { position: relative; }

/* forms */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; font-weight: 700; color: var(--text-2); }
.input { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 0 11px; height: 40px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.input input, .input select { border: 0; outline: 0; flex: 1 1 auto; min-width: 0; background: transparent; height: 100%; }
.input select { cursor: pointer; }
.input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(40,137,177,.16); }
.input.sm { height: 34px; border-radius: 8px; }
.input .ic { color: var(--faint); }
textarea.ta { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-height: 90px; resize: vertical; background: var(--surface); outline: 0; line-height: 1.5; }
textarea.ta:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(40,137,177,.16); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.switch { position: relative; width: 38px; height: 22px; border-radius: 11px; background: var(--line); transition: background .15s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: var(--sh-1); }
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(16px); }
html[dir="rtl"] .switch.on::after { transform: translateX(-16px); }
.help-text { font-size: 11.5px; color: var(--muted); }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 16px; }
.card.flat { box-shadow: none; }
.card.pad0 { padding: 0; overflow: hidden; }
.card-title { font-size: 13px; font-weight: 800; color: var(--text-2); margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-section { padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.panel-section:last-child { border-bottom: 0; }
.panel-section h4 { margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 12.5px; }
.kv .k { color: var(--muted); white-space: nowrap; }
.kv .v { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* chips, avatars, dots */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 9px; white-space: nowrap; line-height: 18px; background: var(--slate-bg); color: var(--slate); }
.chip.open, .chip.in_review, .chip.blue { background: var(--blue-bg); color: var(--blue); }
.chip.pending_customer, .chip.amber, .chip.snoozed { background: var(--amber-bg); color: var(--amber); }
.chip.resolved, .chip.closed, .chip.green { background: var(--green-bg); color: var(--green); }
.chip.brand { background: var(--brand-50); color: var(--brand-600); }
.chip.rose, .chip.urgent { background: var(--rose-bg); color: var(--rose); }
.chip.violet { background: var(--violet-bg); color: var(--violet); }
.chip.teal { background: var(--teal-bg); color: var(--teal); }
.chip.high { background: var(--amber-bg); color: var(--amber); }
.chip.outline { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.chip.dotted::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip .x { cursor: pointer; opacity: .6; } .chip .x:hover { opacity: 1; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-600); color: #fff; font-weight: 800; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; text-transform: uppercase; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; }
.avatar.lg { width: 48px; height: 48px; font-size: 17px; }
.avatar.soft { background: var(--brand-50); color: var(--brand-600); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-inline-start: -8px; }
.avatar-stack .avatar:first-child { margin-inline-start: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); flex-shrink: 0; }
.dot.on, .dot.available { background: #22C55E; } .dot.busy { background: var(--amber); } .dot.away { background: var(--faint); }
.pres { position: relative; }
.pres .dot { position: absolute; bottom: 0; inset-inline-end: 0; border: 2px solid var(--surface); width: 10px; height: 10px; }
.stars { display: inline-flex; gap: 1px; }
.num { font-variant-numeric: tabular-nums; }

/* feedback */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--brand-900); color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: 13px; z-index: 120; box-shadow: var(--sh-3); max-width: 90vw; animation: rise .2s ease-out; }
.toast.bad { background: var(--rose); }
.toast.warn { background: var(--amber); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 28px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; font-size: 13px; }
.empty .ic { color: var(--faint); margin-bottom: 8px; }
.credit { text-align: center; font-size: 10.5px; color: var(--faint); padding: 6px; letter-spacing: .02em; }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; }
.banner.info { background: var(--brand-50); color: var(--brand-600); }
.banner.warn { background: var(--amber-bg); color: var(--amber); }
.banner.bad { background: var(--rose-bg); color: var(--rose); }
.banner.ok { background: var(--green-bg); color: var(--green); }

/* modal & menus */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,31,42,.5); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 580px; max-height: 92vh; overflow: auto; box-shadow: var(--sh-3); display: flex; flex-direction: column; animation: pop .18s ease-out; }
.modal.lg { max-width: 820px; } .modal.xl { max-width: 1040px; } .modal.sm { max-width: 420px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 10px; }
.modal-head h3 { color: var(--brand-900); }
.modal-body { padding: 6px 20px 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid var(--line-2); }
.popmenu { position: fixed; z-index: 110; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-3); padding: 6px; display: flex; flex-direction: column; animation: pop .12s ease-out; }
.popmenu .item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--text); }
.popmenu .item:hover { background: var(--surface-2); }
.popmenu .item.danger { color: var(--rose); }
.popmenu .item kbd { margin-inline-start: auto; }
.popmenu .sep { height: 1px; background: var(--line-2); margin: 4px 0; }
.palette-backdrop { align-items: flex-start; padding-top: 12vh; }
.palette { width: 100%; max-width: 560px; background: var(--surface); border-radius: 16px; box-shadow: var(--sh-3); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); color: var(--faint); }
.palette-input input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--text); }
.palette-list { max-height: 50vh; overflow: auto; padding: 6px; }
.palette-list .item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; padding: 9px 12px; border-radius: 10px; color: var(--text); }
.palette-list .item.active { background: var(--brand-50); color: var(--brand-600); }

/* tables */
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl th { text-align: start; padding: 9px 12px; font-weight: 700; color: var(--muted); font-size: 11px; background: var(--surface-2); white-space: nowrap; border-bottom: 1px solid var(--line-2); }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr.click { cursor: pointer; }
table.tbl tr.click:hover td { background: var(--surface-2); }
table.tbl tr.dim td { color: var(--muted); }
.tbl-wrap { overflow: auto; }

/* tabs & segmented */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { padding: 9px 12px; font-weight: 700; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button.active { color: var(--brand-600); border-color: var(--brand); }
.tabs button .cnt { background: var(--slate-bg); color: var(--slate); border-radius: 999px; font-size: 10.5px; padding: 0 6px; min-width: 18px; text-align: center; }
.tabs button.active .cnt { background: var(--brand-50); color: var(--brand-600); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg button { padding: 4px 10px; border-radius: 7px; font-size: 12px; font-weight: 700; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills button { border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface); }
.pills button.active { background: var(--brand-50); color: var(--brand-600); border-color: var(--brand-100); }

/* messages */
.msgs { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 78%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg .body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bubble { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; border-start-start-radius: 4px; padding: 9px 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; box-shadow: var(--sh-1); }
.msg.me .bubble { background: var(--brand); border-color: var(--brand); color: #fff; border-radius: 16px; border-start-end-radius: 4px; }
.msg.me .bubble a { color: #fff; text-decoration: underline; }
.msg.sys { align-self: center; max-width: 92%; }
.msg.sys .bubble { background: var(--surface-2); border: 0; color: var(--muted); font-size: 12px; border-radius: 999px; padding: 4px 14px; text-align: center; box-shadow: none; }
.msg.note .bubble { background: var(--note-bg); color: var(--note-text); border: 1px dashed var(--note-line); }
.msg .meta { font-size: 10.5px; color: var(--faint); padding: 0 6px; display: flex; align-items: center; gap: 4px; }
.msg.me .meta { justify-content: flex-end; }
.att img { max-width: 260px; max-height: 220px; border-radius: 12px; display: block; border: 1px solid var(--line-2); }
.att .file { display: inline-flex; align-items: center; gap: 8px; background: var(--brand-50); color: var(--brand-600); border-radius: 12px; padding: 8px 12px; font-size: 12px; font-weight: 700; }
.msg.me .att .file { background: rgba(255,255,255,.18); color: #fff; }
.att audio { max-width: 260px; height: 36px; }
.day-sep { align-self: center; font-size: 11px; color: var(--faint); background: var(--surface-2); border-radius: 999px; padding: 2px 10px; }
.composer { display: flex; align-items: flex-end; gap: 6px; border: 1px solid var(--line); border-radius: 14px; padding: 6px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(40,137,177,.14); }
.composer.note { border-color: var(--note-line); background: var(--note-bg); }
.composer textarea { flex: 1 1 auto; border: 0; outline: 0; background: transparent; resize: none; min-height: 24px; max-height: 160px; padding: 6px 8px; line-height: 1.5; font-size: 13.5px; }
.composer .iconbtn { color: var(--muted); }
.typing { font-size: 11px; color: var(--faint); min-height: 16px; padding: 0 18px 4px; }
.card-msg { background: var(--surface); border: 1px solid var(--brand-100); border-radius: 14px; padding: 12px 14px; max-width: 420px; box-shadow: var(--sh-2); display: flex; flex-direction: column; gap: 8px; }
.card-msg .ttl { font-weight: 800; color: var(--brand-900); display: flex; align-items: center; gap: 8px; }

/* timeline */
.tl { display: flex; flex-direction: column; }
.tl .step { display: flex; gap: 12px; }
.tl .rail { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.tl .node { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; background: var(--surface); border: 2px solid var(--line); }
.tl .node.done { background: var(--green); border-color: var(--green); }
.tl .node.current { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px rgba(40,137,177,.18); }
.tl .line { width: 2px; flex: 1 1 auto; background: var(--line); min-height: 24px; }
.tl .line.done { background: var(--green); }
.tl .tbody { padding-bottom: 14px; min-width: 0; }
.tl .ttl { font-weight: 700; font-size: 13px; }
.tl .ttl.current { color: var(--brand-600); font-weight: 800; }
.tl .ttl.todo { color: var(--faint); }

/* progress bar (customer ticket) */
.progress { display: flex; gap: 4px; }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.progress span.done { background: var(--green); }
.progress span.current { background: var(--brand); }

/* stage pipe (staff ticket) */
.pipe { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
.pipe .st { flex: 1 1 0; min-width: 96px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; position: relative; border: 1px solid transparent; }
.pipe .st b { font-size: 12px; color: var(--text-2); }
.pipe .st.done { background: var(--green-bg); color: var(--green); } .pipe .st.done b { color: var(--green); }
.pipe .st.current { background: var(--brand-50); border-color: var(--brand-100); } .pipe .st.current b { color: var(--brand-600); }
.pipe .st.late { background: var(--rose-bg); } .pipe .st.late b { color: var(--rose); }

/* stats */
.stat { background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--sh-1); }
.stat .l { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.stat .n { font-size: 26px; font-weight: 800; color: var(--brand-900); font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .n.sm { font-size: 20px; }
.stat .s { font-size: 11px; color: var(--faint); }
.stat .delta { font-size: 11px; font-weight: 700; } .stat .delta.up { color: var(--green); } .stat .delta.down { color: var(--rose); }
.stat.rose .n { color: var(--rose); } .stat.green .n { color: var(--green); } .stat.amber .n { color: var(--amber); }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line-2); stroke-width: 1; }
.chart .axis { font-size: 9.5px; fill: var(--faint); font-family: var(--font); }
.chart .bar:hover, .chart .dot:hover { opacity: .8; }
.donut-center { font-size: 18px; font-weight: 800; fill: var(--brand-900); font-family: var(--font); }
.sankey { width: 100%; height: auto; }
.sankey .ribbon:hover { opacity: .45; }
.sankey-label { font-size: 10.5px; fill: var(--text-2); font-family: var(--font); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11.5px; color: var(--muted); }
.legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--c); margin-inline-end: 6px; vertical-align: middle; }
.heatmap { display: grid; gap: 3px; align-items: center; }
.heatmap .hm-label { font-size: 10.5px; color: var(--muted); padding-inline-end: 6px; }
.heatmap .hm-cell { height: 14px; border-radius: 3px; background: var(--brand); }
.hbar { display: grid; grid-template-columns: minmax(80px, 160px) 1fr auto; gap: 6px 10px; align-items: center; font-size: 12px; }
.hbar .track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--brand); border-radius: 5px; }
.hbar .v { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 28px; text-align: end; }

/* app shell (staff) */
.shell { display: grid; grid-template-columns: 60px 1fr; height: 100vh; overflow: hidden; }
.rail { background: var(--brand-900); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; }
.rail .logo { width: 40px; height: 40px; border-radius: 12px; background: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; overflow: hidden; }
.rail .logo img { width: 30px; height: 30px; object-fit: contain; }
.rail a { position: relative; width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.62); transition: background .15s, color .15s; }
.rail a:hover { background: rgba(255,255,255,.08); color: #fff; }
.rail a.active { background: rgba(255,255,255,.14); color: #fff; }
.rail a .cnt { position: absolute; top: 4px; inset-inline-end: 4px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.rail .spacer { flex: 1; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { height: 54px; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.topbar h1 { font-size: 16px; color: var(--brand-900); }
.topbar .me { display: flex; align-items: center; gap: 8px; }
.content { flex: 1; min-height: 0; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.tooltip { position: relative; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(1200px 500px at 50% -10%, var(--brand-100), transparent 60%), var(--bg); }
.login-box { width: 100%; max-width: 400px; background: var(--surface); border-radius: 22px; box-shadow: var(--sh-3); padding: 30px 28px 18px; display: flex; flex-direction: column; gap: 14px; }
.login-box img.logo { width: 110px; height: auto; margin: 0 auto 2px; display: block; }
.login-box h1 { text-align: center; font-size: 19px; color: var(--brand-900); }
.login-box .sub { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: -8px; }
.login-box .err { color: var(--rose); font-size: 12.5px; min-height: 18px; text-align: center; font-weight: 600; }
.lang-toggle { position: fixed; top: 14px; inset-inline-end: 14px; z-index: 5; }

/* notifications drawer */
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: 360px; max-width: 95vw; background: var(--surface); box-shadow: var(--sh-3); z-index: 90; display: flex; flex-direction: column; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer .head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.drawer .list { flex: 1; overflow: auto; }
.drawer .item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.drawer .item.unread { background: var(--brand-50); }
.drawer .item:hover { background: var(--surface-2); }

/* call overlay */
.call-box { position: fixed; bottom: 18px; inset-inline-end: 18px; width: 340px; max-width: 94vw; background: var(--brand-900); color: #fff; border-radius: 18px; box-shadow: var(--sh-3); z-index: 95; overflow: hidden; display: flex; flex-direction: column; }
.call-box.wide { width: 560px; }
.call-box .head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.call-box video { width: 100%; background: #000; max-height: 340px; display: block; }
.call-box .controls { display: flex; justify-content: center; gap: 10px; padding: 12px; }
.call-box .controls button { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.call-box .controls button.end { background: var(--rose); }
.call-box .controls button.ok { background: var(--green); }
.call-box .pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* list items */
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.li:hover { border-color: var(--brand-100); box-shadow: var(--sh-2); }
.li.unread { border-inline-start: 3px solid var(--brand); }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }

/* misc */
.sep { height: 1px; background: var(--line-2); }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; background: var(--surface-2); border-radius: 6px; padding: 2px 6px; direction: ltr; display: inline-block; }
.prose { line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.prose h3 { margin: 12px 0 4px; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; } ::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
