/* Saabaan Support — "Sky Desk". Flag blue #4189DD, sky #2F6FBD, depth #1A4C8C. */
@font-face { font-family: 'Jakarta'; font-weight: 400; font-display: swap; src: url(/fonts/jakarta-400.ttf) format('truetype'); }
@font-face { font-family: 'Jakarta'; font-weight: 500; font-display: swap; src: url(/fonts/jakarta-500.ttf) format('truetype'); }
@font-face { font-family: 'Jakarta'; font-weight: 600; font-display: swap; src: url(/fonts/jakarta-600.ttf) format('truetype'); }
@font-face { font-family: 'Jakarta'; font-weight: 700; font-display: swap; src: url(/fonts/jakarta-700.ttf) format('truetype'); }
@font-face { font-family: 'Jakarta'; font-weight: 800; font-display: swap; src: url(/fonts/jakarta-800.ttf) format('truetype'); }
@font-face { font-family: 'Mono'; font-weight: 500; font-display: swap; src: url(/fonts/mono-500.ttf) format('truetype'); }

:root {
  --bg: #F5F8FC; --panel: #fff; --line: #E6ECF4; --line2: #F0F3F7; --ink: #141414; --ink2: #4A5568; --mute: #6B7A90; --mute2: #8A97AA;
  --flag: #4189DD; --sky: #2F6FBD; --depth: #1A4C8C; --soft: #EAF2FF; --soft2: #F4F9FF;
  --green: #0E7C66; --green-bg: #E6F4F0; --red: #B42318; --red-bg: #FDEDEC; --red2: #E5484D; --amber: #B45309; --amber-bg: #FFF4E5;
  --r: 14px; --shadow: 0 1px 2px rgba(20,40,80,.06), 0 8px 24px rgba(20,40,80,.06);
  --rail: 72px; --top: 64px; --listw: 360px; --cardw: 320px; --tabs: 0px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* Feel like an app, not a web page: no pinch/double-tap zoom, no sideways drift, no rubber-band bounce, no grey tap flash. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { overflow-x: hidden; overscroll-behavior: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body { position: relative; width: 100%; max-width: 100vw; }
button, .rail, .tabs, .chips, .item, .seg, .tag, .qp, .pres, .acc-row, .tog, .lh, .page-h, .kpi { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
img { -webkit-user-drag: none; }
.app { overflow: hidden; overscroll-behavior: none; }
.msgs, .list, .tab.page, .card { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.gate-card, .gate-card * { min-width: 0; }
.wide-seg button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
body { font: 14px/1.45 'Jakarta', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: 'Mono', ui-monospace, monospace; }
.muted { color: var(--mute); } .small { font-size: 12.5px; } .err { color: var(--red); min-height: 1em; margin: 6px 0 0; font-size: 13px; }

/* ---------- buttons ---------- */
.btn { height: 38px; border-radius: 11px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 13.5px; border: 1px solid #DCE5F0; background: #fff; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: #C3D3E8; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn.primary { background: var(--sky); border-color: var(--sky); color: #fff; }
.btn.primary:hover { background: var(--depth); }
.btn.go { background: var(--green); border-color: var(--green); color: #fff; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink2); }
.btn.decline { background: var(--red2); border-color: var(--red2); color: #fff; }
.btn.wide { width: 100%; height: 46px; font-size: 15px; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon { width: 38px; height: 38px; border-radius: 11px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--ink2); }
.icon:hover { background: var(--bg); }
:focus-visible { outline: 2px solid var(--flag); outline-offset: 2px; }

.av { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; font-weight: 700; font-size: 14px; flex: none; background: var(--soft); color: var(--depth); }
.av.sm { width: 26px; height: 26px; font-size: 11px; } .av.big { width: 72px; height: 72px; font-size: 26px; } .av.xl { width: 96px; height: 96px; font-size: 34px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #98A2B3; flex: none; }
.dot.on { background: #12B76A; } .dot.call { background: #F79009; }

/* ---------- sign in / invite ---------- */
.gate { min-height: 100%; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); background: radial-gradient(1200px 600px at 10% -10%, #DCEBFF 0, transparent 60%), var(--bg); }
.gate-card { width: min(420px, 100%); background: #fff; border-radius: 22px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.gate-logo { height: 30px; align-self: flex-start; }
.gate h1 { font-size: 22px; margin: 4px 0 6px; letter-spacing: -.01em; }
.gate label, .stack label, .inline-form label, .dlg label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--ink2); }
.gate input, .stack input, .stack textarea, .inline-form input, .inline-form select, .dlg input, .dlg select, #tplRow input, .dates input {
  height: 44px; border: 1.5px solid #DCE5F0; border-radius: 12px; padding: 0 12px; background: #fff; font-weight: 500; }
.stack textarea { height: auto; padding: 10px 12px; resize: vertical; }
.gate input:focus, .stack input:focus, .inline-form input:focus, textarea:focus { border-color: var(--flag); outline: none; }
.qr { display: grid; place-items: center; background: var(--soft2); border-radius: 16px; padding: 14px; }
.qr img { width: 200px; height: 200px; image-rendering: pixelated; }

/* ---------- app frame ---------- */
.app { position: fixed; inset: 0; display: grid; grid-template-columns: var(--rail) 1fr; grid-template-rows: var(--top) 1fr; }
.rail { grid-row: 1 / 3; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 8px; }
.rail-logo { border: 0; width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--depth), var(--flag)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; margin-bottom: 12px; }
.rail button { position: relative; width: 46px; height: 46px; border-radius: 12px; border: 0; background: transparent; color: var(--mute); display: grid; place-items: center; }
.rail button svg { width: 22px; height: 22px; }
.rail button.on { background: var(--soft); color: var(--sky); }
.rail button:hover:not(.on) { background: var(--bg); }
.bdg { position: absolute; top: 5px; right: 5px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--red2); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }
.rail-gap { flex: 1; }
.rail-me { width: 38px; height: 38px; font-size: 13px; background: var(--depth); color: #fff; }

.top { grid-column: 2; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 20px; min-width: 0; }
.wm { height: 22px; flex: none; }
.search { flex: 0 1 320px; height: 40px; border-radius: 12px; background: #F2F5F9; display: flex; align-items: center; gap: 10px; padding: 0 12px; color: var(--mute2); }
.search input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; color: var(--ink); }
.pills { display: flex; gap: 8px; min-width: 0; overflow: hidden; }
.qp { height: 34px; border-radius: 17px; padding: 0 13px; display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; border: 0; white-space: nowrap; }
.qp.red { background: var(--red-bg); color: var(--red); } .qp.amber { background: var(--amber-bg); color: var(--amber); } .qp.blue { background: var(--soft); color: var(--depth); }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me-name { font-weight: 600; color: var(--ink2); font-size: 13px; white-space: nowrap; border: 0; background: transparent; padding: 6px 8px; border-radius: 9px; }
.me-name:hover { background: var(--bg); }
.rail .rail-logo, .rail .rail-logo:hover:not(.on) { width: 40px; height: 40px; background: linear-gradient(135deg, var(--depth), var(--flag)); color: #fff; font-weight: 800; font-size: 18px; margin-bottom: 12px; }
.rail .rail-me-b, .rail .rail-me-b:hover:not(.on), .rail .rail-me-b.on { width: auto; height: auto; background: transparent; }
.rail-me-b { border: 0; background: transparent; padding: 0; border-radius: 50%; } .rail-me-b.on .rail-me { box-shadow: 0 0 0 3px var(--soft), 0 0 0 5px var(--flag); }
.pres { height: 34px; border-radius: 17px; border: 1px solid #CFE0F5; background: #F4F9FF; display: inline-flex; align-items: center; gap: 8px; padding: 0 13px 0 11px; font-weight: 700; font-size: 12.5px; color: var(--green); white-space: nowrap; }
.pres .dot { background: #12B76A; }
.pres.away { color: var(--mute); background: #F2F4F7; border-color: #E4E7EC; } .pres.away .dot { background: #98A2B3; }
.pres.big { height: 46px; font-size: 15px; padding: 0 18px; }

.tab { grid-column: 2; min-height: 0; }
.page { overflow: auto; padding: 22px 26px 40px; }
.page-h { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 16px; }
.page-h h2 { font-size: 22px; margin: 0; letter-spacing: -.01em; } .page-h p { margin: 0; flex-basis: 100%; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; margin-bottom: 14px; }
.panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--mute2); margin: 0 0 12px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }

/* ---------- chats: list ---------- */
.panes { display: grid; grid-template-columns: var(--listw) minmax(0, 1fr) var(--cardw); min-height: 0; }
.list-col { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.lh { padding: 16px 18px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lh h2 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
.route { font-size: 11.5px; font-weight: 700; color: var(--sky); background: var(--soft2); border: 1px solid #DCE8F7; border-radius: 9px; padding: 4px 9px; white-space: nowrap; }
.alert { margin: 0 14px 10px; border-radius: 14px; background: linear-gradient(135deg, #FFF4E5, #FFE7C2); border: 1px solid #FBD38D; color: #7A3E04; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.alert b { display: block; font-size: 13px; } .alert small { font-size: 12px; opacity: .85; } .alert > div { flex: 1; min-width: 0; }
.chips { display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; }
.chips button { height: 30px; border-radius: 15px; padding: 0 12px; font-size: 12.5px; font-weight: 600; border: 0; background: #F2F5F9; color: var(--ink2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.chips button.on { background: var(--ink); color: #fff; }
.chips i { font-style: normal; font-size: 10.5px; font-weight: 800; border-radius: 9px; padding: 0 6px; background: rgba(0,0,0,.08); }
.chips i:empty { display: none; } .chips i.red { background: var(--red2); color: #fff; }
.list { flex: 1; overflow: auto; }
.item { display: flex; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line2); position: relative; cursor: pointer; }
.item:hover { background: #FAFCFF; }
.item.on { background: var(--soft2); }
.item.on::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--sky); }
.item .t { flex: 1; min-width: 0; }
.item .n { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 14.5px; }
.item .n span { font-weight: 500; font-size: 12px; color: var(--mute2); white-space: nowrap; }
.item .p { font-size: 13px; color: #5B6878; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.item .p svg { width: 13px; height: 13px; }
.item .m { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.unread { position: absolute; right: 16px; bottom: 14px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--sky); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; padding: 0 6px; }
.tag { height: 22px; border-radius: 6px; padding: 0 8px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; background: #F2F5F9; color: var(--ink2); }
.tag.amber { background: var(--amber-bg); color: var(--amber); } .tag.red { background: var(--red-bg); color: var(--red); } .tag.green { background: var(--green-bg); color: var(--green); } .tag.blue { background: var(--soft); color: var(--depth); }
.tag .av.sm { width: 16px; height: 16px; font-size: 8px; }
.list .empty-l { padding: 40px 20px; text-align: center; color: var(--mute2); }

/* ---------- chats: thread ---------- */
.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.chat .empty { margin: auto; text-align: center; color: var(--mute2); } .chat .empty svg { width: 42px; height: 42px; opacity: .5; }
.chat-in { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.chat-head { min-height: 68px; background: #fff; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 18px; }
.chat-head .who { min-width: 0; flex: 1 1 200px; } .chat-head .who b { font-size: 16px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who small { color: var(--mute2); font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win { font-weight: 700; color: var(--green); } .win.closed { color: var(--red); }
.acts { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.back { display: none; }
.msgs { flex: 1; overflow: auto; padding: 20px 26px; display: flex; flex-direction: column; gap: 10px; }
.m { max-width: min(62%, 560px); padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; position: relative; }
.m.in { background: #fff; border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 6px; }
.m.out { background: var(--sky); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.m.note { background: #FFFBEB; border: 1px solid #FDE68A; align-self: flex-end; border-bottom-right-radius: 6px; }
.m.unsup { font-style: italic; color: var(--mute); }
.m.system { align-self: center; background: #EEF3F9; color: #5B6878; font-size: 12px; padding: 5px 12px; border-radius: 10px; max-width: 90%; text-align: center; }
.m .meta { display: block; text-align: right; font-size: 11px; opacity: .72; margin-top: 4px; }
.m img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; }
.m audio { display: block; width: 260px; max-width: 100%; height: 40px; }
.m.out audio { filter: invert(1) hue-rotate(180deg) brightness(1.3); }
.vn-k { font-size: 11px; font-weight: 700; opacity: .8; display: flex; align-items: center; gap: 5px; margin-bottom: 4px; } .vn-k svg { width: 13px; height: 13px; }
.day { align-self: center; font-size: 11.5px; font-weight: 700; color: var(--mute2); margin: 6px 0; }

.composer { background: #fff; border-top: 1px solid var(--line); padding: 10px 18px 12px; position: relative; }
.qr-chips { display: flex; gap: 8px; margin-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.qr-chips button { height: 28px; border-radius: 14px; border: 1px solid #DCE5F0; padding: 0 12px; font-size: 12px; font-weight: 600; color: var(--sky); background: #F7FAFE; white-space: nowrap; }
.composer .row { display: flex; align-items: flex-end; gap: 8px; border: 1.5px solid #CFE0F5; border-radius: 16px; padding: 6px 6px 6px 8px; }
.composer .row:focus-within { border-color: var(--flag); }
.composer textarea { flex: 1; border: 0; outline: none; resize: none; min-height: 38px; max-height: 160px; padding: 9px 4px; line-height: 1.4; background: transparent; }
.note-tog { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border-radius: 10px; background: #F2F5F9; font-size: 12.5px; font-weight: 700; color: var(--ink2); cursor: pointer; }
.note-tog input { margin: 0; accent-color: var(--amber); }
.note-on .row { border-color: #FBD38D; background: #FFFDF5; }
.send { color: var(--sky); }
.mic { width: 42px; height: 42px; border-radius: 13px; border: 0; background: var(--sky); color: #fff; display: grid; place-items: center; }
.mic:hover { background: var(--depth); }
.tpl { border: 1.5px solid #FBD38D; background: #FFFDF5; border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.tpl-top { display: flex; gap: 6px; } .tpl select { flex: 1; height: 40px; border: 1.5px solid #E8D9B5; border-radius: 11px; padding: 0 10px; background: #fff; font-weight: 600; }
.tpl-vars { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px; } .tpl-vars:empty { display: none; }
.tpl-vars input { height: 38px; border: 1.5px solid #E8D9B5; border-radius: 10px; padding: 0 10px; background: #fff; }
.tpl-prev { margin: 0; font-size: 13px; color: var(--ink2); background: #fff; border: 1px dashed #E8D9B5; border-radius: 10px; padding: 8px 10px; white-space: pre-wrap; } .tpl-prev:empty { display: none; }
.tpl .btn { align-self: flex-end; }
.ord.old { opacity: .7; } .ord-more { border: 0; background: none; color: var(--sky); font-weight: 700; font-size: 12.5px; padding: 4px 0; }
.foot { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--mute2); margin-top: 6px; } .foot .err { margin: 0; }
.slash { position: absolute; left: 18px; right: 18px; bottom: calc(100% - 4px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); max-height: 260px; overflow: auto; padding: 6px; z-index: 5; }
.slash button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 9px; }
.slash button:hover, .slash button.on { background: var(--soft2); }
.slash b { color: var(--sky); margin-right: 8px; } .slash span { color: var(--ink2); font-size: 13px; }
.rec { display: flex; align-items: center; gap: 12px; background: #FFF5F5; border: 1.5px solid #FAC5C3; border-radius: 16px; padding: 8px 8px 8px 14px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #F04438; box-shadow: 0 0 0 6px rgba(240,68,56,.15); animation: blink 1s infinite; }
.rec .mono { color: #D92D20; font-weight: 700; }
.rec-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 26px; overflow: hidden; }
.rec-wave i { display: block; width: 3px; border-radius: 2px; background: #F97066; flex: none; }
@keyframes blink { 50% { opacity: .35; } }

/* ---------- chats: customer card ---------- */
.card { background: #fff; border-left: 1px solid var(--line); overflow: auto; padding: 20px; position: relative; }
.card-x { display: none; position: absolute; top: 10px; right: 10px; }
.card .ch { display: flex; align-items: center; gap: 12px; }
.card .ch b { font-size: 17px; display: block; } .card .ch small { color: var(--mute2); font-size: 12.5px; }
.card h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--mute2); margin: 20px 0 8px; }
.card .row-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ord { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.ord b { display: block; } .ord span { color: var(--green); font-weight: 700; } .ord small { color: var(--mute2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; } .kv dt { color: var(--mute2); } .kv dd { margin: 0; font-weight: 600; }
.team-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13.5px; }
.team-row small { margin-left: auto; color: var(--mute2); font-size: 12px; white-space: nowrap; }
.label-in { width: 100%; height: 36px; border: 1px dashed #CBD5E1; border-radius: 10px; padding: 0 10px; margin-top: 8px; font-size: 13px; }
.stars { color: #F5A524; letter-spacing: 1px; }

/* ---------- calls / team pages ---------- */
.cq { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line2); }
.cq:first-child { border-top: 0; }
.cq .pos { width: 26px; height: 26px; border-radius: 8px; background: #F2F5F9; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--mute); flex: none; }
.cq .t { flex: 1; min-width: 0; } .cq .t b { display: block; } .cq .t small { color: var(--mute); }
.tm { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line2); }
.tm:first-child { border-top: 0; }
.tm .t b { display: block; } .tm .t small { color: var(--mute); }
.tm input { width: 64px; height: 34px; border: 1px solid #DCE5F0; border-radius: 9px; padding: 0 8px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; } .inline-form > * { flex: 1 1 160px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.radio { flex-direction: row !important; align-items: flex-start; gap: 10px !important; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--flag); background: var(--soft2); }
.radio small { display: block; font-weight: 500; color: var(--mute); margin-top: 2px; } .radio b { color: var(--ink); }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; }
.inv-out { margin-top: 12px; background: var(--soft2); border: 1px solid #DCE8F7; border-radius: 12px; padding: 10px 12px; }
.copy { display: flex; gap: 8px; } .copy input { flex: 1; height: 34px; border: 1px solid #DCE5F0; border-radius: 9px; padding: 0 10px; font-size: 12px; }
.rp { padding: 8px 0; border-top: 1px solid var(--line2); font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.rp:first-child { border-top: 0; } .rp b { color: var(--sky); white-space: nowrap; } .rp span { flex: 1; color: var(--ink2); } .rp button { flex: none; }
.me-panel { max-width: 420px; margin: 20px auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.me-panel h2 { margin: 6px 0 0; } .me-panel p { margin: 0; }

/* ---------- language ---------- */
.gate-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lang-sw { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--soft); }
.lang-sw button { border: 0; background: transparent; height: 28px; padding: 0 10px; border-radius: 8px; font-weight: 700; font-size: 12.5px; color: var(--mute); }
.lang-sw button.on { background: #fff; color: var(--sky); box-shadow: 0 1px 2px rgba(20,40,80,.1); }

/* ---------- shifts ---------- */
.shift-b.on { background: var(--green-bg); border-color: #BFE3D8; color: var(--green); }
.day-k { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0 12px; }
.day-k div { background: var(--soft2); border-radius: 12px; padding: 8px 10px; } .day-k b { display: block; font-size: 18px; } .day-k small { color: var(--mute); font-size: 11.5px; }
.handover { background: var(--amber-bg); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
#sdNote, #sdWhere { border: 1px solid #DCE5F0; border-radius: 11px; padding: 8px 10px; font: inherit; }
/* swipe a chat (phones): right = take, left = solve */
.item { touch-action: pan-y; overflow: hidden; }
.item > :not(.sw) { transform: translateX(var(--dx, 0px)); transition: transform .15s ease; }
.item.swiping > :not(.sw) { transition: none; }
.item .sw { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; padding: 0 16px; font-weight: 800; font-size: 13px; color: #fff; opacity: 0; pointer-events: none; }
.item .sw.l { left: 0; background: var(--green); } .item .sw.r { right: 0; background: var(--sky); }
.m.pending { opacity: .7; } .m.pending .meta { color: var(--amber); }
.lite-media { border: 1px dashed #C9D6E8; border-radius: 10px; background: transparent; padding: 8px 12px; font-weight: 700; color: var(--sky); }

/* ---------- my account ---------- */
.or { display: flex; align-items: center; gap: 10px; color: var(--mute2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.pk-btn { gap: 10px; } .pk-btn svg { width: 22px; height: 22px; color: var(--sky); }
.pk { display: flex; align-items: center; gap: 10px; padding: 8px 0 8px 12px; font-size: 13px; border-left: 3px solid var(--soft); margin: 0 0 6px; }
.pk div { flex: 1; min-width: 0; } .pk small { display: block; color: var(--mute); }
.wide-seg { display: grid; grid-template-columns: 1fr 1fr; } .wide-seg button { height: 34px; }
.wide-sm { height: 40px; width: 100%; }
.acc { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; max-width: 1180px; }
.acc .panel { margin: 0; }
.acc-me { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.acc-me .acc-f { align-self: stretch; text-align: left; }
.acc-id h3 { margin: 4px 0 0; font-size: 20px; text-transform: none; letter-spacing: -.01em; color: var(--ink); } .acc-id p { margin: 0; }
.acc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line2); }
.acc-row:first-of-type { border-top: 0; }
.acc-row b { display: block; } .acc-row small { color: var(--mute); }
.acc-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.acc-f { padding: 4px 0 12px; }
.acc-f select { height: 42px; border: 1px solid #DCE5F0; border-radius: 11px; padding: 0 10px; background: #fff; }
.tog { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line2); cursor: pointer; }
.tog:first-of-type { border-top: 0; }
.tog input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--sky); flex: none; }
.tog b { display: block; } .tog small { color: var(--mute); }
.sess { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line2); font-size: 13px; }
.sess:first-child { border-top: 0; } .sess div { flex: 1; min-width: 0; } .sess small { display: block; color: var(--mute); }
.sess .now { color: var(--green); font-weight: 700; font-size: 12px; }
.hist { display: flex; gap: 10px; padding: 7px 0; font-size: 12.5px; border-top: 1px solid var(--line2); }
.hist:first-child { border-top: 0; } .hist .ok, .hist .no { white-space: nowrap; font-weight: 700; } .hist .ok { color: var(--green); } .hist .no { color: var(--red); } .hist span:last-child { margin-left: auto; color: var(--mute); white-space: nowrap; }
.kbd { display: inline-block; padding: 0 5px; border: 1px solid var(--line); border-radius: 6px; }
.update-bar { position: fixed; left: 50%; bottom: calc(var(--tabs) + 16px); transform: translateX(-50%); z-index: 45; background: var(--depth); color: #fff; border-radius: 14px; padding: 8px 8px 8px 14px; display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 13px; box-shadow: var(--shadow); }

/* ---------- reports ---------- */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--soft); }
.seg button { height: 30px; border-radius: 9px; padding: 0 12px; border: 0; background: transparent; font-weight: 700; font-size: 12.5px; color: var(--mute); }
.seg button.on { background: var(--ink); color: #fff; }
.dates { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--mute); } .dates input { height: 36px; }
.gap { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.kpi small { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.kpi b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.kpi em { font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--green); } .kpi em.warn { color: var(--amber); } .kpi em.bad { color: var(--red); }
.rep-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.rep-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: right; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); padding: 0 8px 8px; white-space: nowrap; }
.tbl td { text-align: right; padding: 10px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl .nm { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.bar { height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; margin-top: 4px; min-width: 70px; } .bar i { display: block; height: 100%; background: var(--sky); }
.good { color: var(--green); font-weight: 700; } .warn { color: var(--amber); font-weight: 700; } .bad { color: var(--red); font-weight: 700; }
.lb { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; }
.lb .rk { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--soft); color: var(--sky); }
.lb .rk.first { background: var(--sky); color: #fff; } .lb b:last-child { margin-left: auto; }
.hm { display: grid; grid-template-columns: 34px repeat(16, 1fr); gap: 3px; font-size: 10px; font-weight: 700; color: var(--mute); }
.hm i { height: 16px; border-radius: 3px; display: block; background: #EEF3F9; }
.hm span { text-align: center; }
.rating { font-size: 12.5px; padding: 8px 10px; border-radius: 10px; background: var(--soft2); margin-bottom: 6px; display: flex; gap: 8px; }
.kv2 { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; } .kv2 b { text-align: right; }

/* ---------- calls overlay ---------- */
.ring { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(10, 25, 50, .55); backdrop-filter: blur(6px); padding: 16px; }
.ring-card { width: min(380px, 100%); border-radius: 28px; padding: 30px 24px 26px; text-align: center; color: #fff; background: linear-gradient(180deg, #123A6E 0%, var(--depth) 45%, #0B2140 100%); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.pulse { width: 132px; height: 132px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: rgba(255,255,255,.08); box-shadow: 0 0 0 16px rgba(255,255,255,.05), 0 0 0 34px rgba(255,255,255,.03); animation: pulse 1.6s infinite; }
.pulse .av { background: #fff; color: var(--depth); }
@keyframes pulse { 50% { box-shadow: 0 0 0 22px rgba(255,255,255,.06), 0 0 0 44px rgba(255,255,255,.02); } }
.ring-k { margin: 22px 0 0; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; opacity: .8; }
.ring-who { font-size: 26px; font-weight: 800; margin: 6px 0 0; }
.ring-t { opacity: .85; margin: 6px 0 0; font-size: 14px; }
.ring-ctx { margin: 16px 0 0; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); border-radius: 14px; padding: 10px 12px; font-size: 13px; }
.ring-ctx:empty { display: none; }
.ring-acts { display: flex; justify-content: space-around; margin-top: 26px; }
.round { border: 0; background: transparent; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.round svg { width: 64px; height: 64px; padding: 18px; border-radius: 50%; stroke-width: 2.2; }
.round.decline svg { background: #F04438; } .round.answer svg { background: #12B76A; }
.callbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 12px; background: #0B2140; color: #fff; border-radius: 18px; padding: 10px 12px 10px 16px; box-shadow: 0 16px 40px rgba(0,0,0,.25); max-width: calc(100% - 24px); }
.callbar .btn { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.1); color: #fff; } .callbar .btn.decline { background: #F04438; border-color: #F04438; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #12B76A; box-shadow: 0 0 0 5px rgba(18,183,106,.2); }
.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow); max-width: calc(100% - 24px); }
.dlg { border: 0; border-radius: 20px; padding: 22px; width: min(420px, calc(100% - 24px)); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.dlg::backdrop { background: rgba(10, 25, 50, .45); }
.dlg h3 { margin: 0 0 14px; } .dlg form { display: flex; flex-direction: column; gap: 12px; } .dlg-acts { display: flex; justify-content: flex-end; gap: 8px; }

.tabs { display: none; }
body:not(.admin) .admin-only { display: none !important; }

/* ---------- tablet: card becomes a drawer ---------- */
@media (max-width: 1240px) {
  :root { --listw: 320px; }
  .panes { grid-template-columns: var(--listw) minmax(0, 1fr); }
  .card { position: fixed; right: 0; top: 0; bottom: 0; width: min(360px, 92vw); z-index: 30; box-shadow: -20px 0 50px rgba(20,40,80,.15); transform: translateX(105%); transition: transform .2s ease, visibility 0s .2s; visibility: hidden; }
  .panes.card-on .card { transform: none; visibility: visible; transition: transform .2s ease; }
  .card-x { display: grid; }
  .pills .qp.blue { display: none; }
  .rep-grid { grid-template-columns: 1fr; } .rep-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  /* chat actions always fit one row: text buttons share the width, icon buttons stay square */
  .acts { gap: 6px; flex: 1 1 100%; flex-wrap: nowrap; overflow: hidden; justify-content: stretch; padding: 0; margin: 0; }
  .acts > * { min-height: 38px; height: 38px; }
  .acts > .btn { flex: 1 1 0; min-width: 0; padding: 0 6px; font-size: 13px; overflow: hidden; white-space: nowrap; }
  .acts > #bCall, .acts > #bAssign, .acts > #bCard { flex: 0 0 40px; width: 40px; padding: 0; }
  .acts > [hidden] { display: none !important; }
  .search { display: none; } .me-name { display: none; }
  .acts .btn span { display: none; } .acts .btn { padding: 0 10px; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ---------- phone: bottom tabs, one pane at a time ---------- */
@media (max-width: 720px) {
  :root { --rail: 0px; --top: 56px; --tabs: 72px; }
  .btn { min-height: 42px; } .btn.sm { min-height: 38px; } .icon { width: 44px; height: 44px; }
  .chips button { min-height: 36px; } .item { min-height: 72px; }
  .shift-b { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--top) minmax(0, 1fr) var(--tabs); }
  .rail { display: none; }
  .top, .tab { grid-column: 1; }
  .top { padding: 0 14px; gap: 10px; }
  .wm { height: 19px; }
  .pills { display: none; } .me { min-width: 0; } .me .pres { height: 30px; font-size: 12px; max-width: 58vw; overflow: hidden; text-overflow: ellipsis; } #signOut { display: none; }
  .lh .route { display: none; }
  .panes { grid-template-columns: minmax(0, 1fr); position: relative; overflow: hidden; }
  .list-col { border-right: 0; }
  .chat { position: absolute; inset: 0; transform: translateX(100%); transition: transform .2s ease, visibility 0s .2s; z-index: 10; visibility: hidden; }
  .panes.chat-on .chat { transform: none; visibility: visible; transition: transform .2s ease; }
  .back { display: inline-grid; }
  .chat-head { padding: 8px 10px; gap: 8px; }
  .chat-head .av { width: 34px; height: 34px; font-size: 12px; }
  .chat-head .who { flex: 1 1 0; } 
  .msgs { padding: 14px 12px; } .m { max-width: 86%; }
  .composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .note-tog span { display: none; }
  .page { padding: 16px 14px 28px; }
  .tabs { display: flex; grid-row: 3; grid-column: 1; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); justify-content: space-around; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
  .tabs button { position: relative; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--mute2); min-width: 56px; }
  .tabs button svg { width: 24px; height: 24px; }
  .tabs button.on { color: var(--sky); }
  .tabs i { position: absolute; top: -3px; right: 10px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--red2); color: #fff; font-size: 10px; font-style: normal; display: grid; place-items: center; padding: 0 4px; }
  .rep-3 { grid-template-columns: 1fr; }
  .callbar { bottom: calc(var(--tabs) + 10px); }
  .tm { grid-template-columns: auto minmax(0, 1fr) auto; } .tm .cap, .tm .rm { grid-column: 2 / 4; justify-self: start; }
}

@media print {
  .rail, .top, .tabs, #repRange, .dates, #repCsv, #repPrint, .callbar, .toast { display: none !important; }
  .app { position: static; display: block; } .tab[data-tab]:not([data-tab="reports"]) { display: none !important; }
  .page { overflow: visible; padding: 0; } body { background: #fff; }
  .panel, .kpi { break-inside: avoid; }
}

/* iPhone zooms into any field whose text is smaller than 16px: keep every field at 16px on touch screens. */
@media (pointer: coarse), (max-width: 1024px) {
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px !important; }
}
@media (max-width: 380px) {
  .gate-card { padding: 20px 16px; border-radius: 18px; }
  .chat-head { padding: 8px 10px; gap: 6px 8px; }
  .chat-head .who small .win { display: none; }
  .top { padding: 0 10px; }
}

/* phones held sideways: little height, so give it all to the conversation */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --top: 48px; }
  .alert, .lh .route, .foot, #qr { display: none !important; }
  .lh { padding-top: 6px; padding-bottom: 6px; } .lh h2 { font-size: 16px; }
  .chat-head { min-height: 0; padding: 6px 12px; }
  .chat-head .av { width: 30px; height: 30px; font-size: 11px; }
  .acts .btn, .acts .icon { height: 32px; min-height: 32px; }
  .composer { padding-top: 6px; padding-bottom: 6px; }
}
