/* TeleOrca app screens — the customer dashboard and the operator console share this. */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #12161b;
  --ink-2: #545b65;
  --ink-3: #8a919b;
  --line: #e5e8ec;
  --side: #0e1216;
  --side-ink: #b9c0c9;
  --side-on: #232a32;
  --blue: #2f6bff;
  --blue-soft: #e8efff;
  --ok: #1a9f5f;
  --ok-soft: #e4f6ec;
  --warn: #c77a00;
  --warn-soft: #fff3dc;
  --miss: #d93a3f;
  --miss-soft: #fdeaea;
  --ai: #6c4cf0;
  --ai-soft: #efebff;
  --r: 14px;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }

/* Shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 20px 14px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 18px; padding: 4px 10px 18px; letter-spacing: -0.02em; }
.brand-dot { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff 0 18%, transparent 19%), linear-gradient(135deg, #2f6bff, #12606b); flex: none; }
.side-org { margin: 0 4px 14px; padding: 10px 12px; border-radius: 10px; background: #171c22; display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.side-org b { color: #fff; display: block; }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #69717c; padding: 14px 10px 6px; }
.side a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.side a:hover { background: #181e24; color: #fff; }
.side a.on { background: var(--side-on); color: #fff; }
.side a .cnt { margin-left: auto; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--miss); color: #fff; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #1f252c; font-size: 12px; color: #69717c; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 28px; background: rgba(244,245,247,.86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 10px; background: #fff; border: 1px solid var(--line); color: var(--ink-3); }
.search input { border: 0; outline: 0; flex: 1; background: none; color: var(--ink); }
.top-end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.health { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); padding: 7px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: #f0a020; } .dot.miss { background: var(--miss); } .dot.ai { background: var(--ai); } .dot.off { background: #c3c8cf; }
.me { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #1f2329; color: #fff; font-weight: 600; font-size: 13px; }
.burger-app { display: none; }

.view { padding: 28px; display: none; }
.view.on { display: block; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.view-head h1 { font-size: 26px; letter-spacing: -0.02em; }
.view-head p { color: var(--ink-2); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 600; white-space: nowrap; }
.btn:hover { background: #f8f9fa; }
.btn.pri { background: #12161b; border-color: #12161b; color: #fff; }
.btn.pri:hover { background: #000; }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #eef0f3; }

/* Panels and grids */
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g-main { grid-template-columns: 1.7fr 1fr; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { font-size: 16px; }
.panel-head small { color: var(--ink-3); }
.stack > * + * { margin-top: 16px; }

.kpi small { color: var(--ink-2); font-weight: 500; display: block; }
.kpi b { display: block; font-size: 30px; letter-spacing: -0.02em; margin: 6px 0 4px; font-weight: 600; }
.kpi .delta { font-size: 12px; font-weight: 600; }
.up { color: var(--ok); } .down { color: var(--miss); }
.kpi.alert { border-color: #f6c6c7; background: linear-gradient(180deg, #fff, var(--miss-soft)); }

/* Lists and tables */
.list { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; padding-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row b { display: block; font-weight: 600; }
.row small { color: var(--ink-3); }
.av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; background: #e9edf2; color: #3a424c; position: relative; }
.av .dot { position: absolute; right: -1px; bottom: -1px; border: 2px solid #fff; width: 11px; height: 11px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 0 12px 10px; white-space: nowrap; }
td { padding: 12px; border-top: 1px solid var(--line); white-space: nowrap; }
tbody tr { cursor: default; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: #f8f9fb; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef0f3; color: var(--ink-2); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.miss { background: var(--miss-soft); color: var(--miss); }
.chip.ai { background: var(--ai-soft); color: var(--ai); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }

.tabs { display: inline-flex; gap: 4px; padding: 4px; background: #e9ecf0; border-radius: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 7px; font-weight: 600; color: var(--ink-2); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Charts */
.chart { width: 100%; height: 200px; display: block; }
.chart text { font-size: 11px; fill: var(--ink-3); font-family: var(--font); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.heat { display: grid; grid-template-columns: 34px repeat(12, 1fr); gap: 4px; font-size: 11px; color: var(--ink-3); }
.heat i { aspect-ratio: 1.6; border-radius: 4px; display: block; }
.meter { height: 8px; border-radius: 8px; background: #edf0f3; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 8px; background: var(--blue); }

/* Live queue */
.queue-card { padding: 14px; border-radius: 12px; background: #f7f8fa; }
.queue-card .qn { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 8px; }
.queue-stats { display: flex; gap: 18px; color: var(--ink-2); font-size: 13px; }
.queue-stats b { color: var(--ink); font-size: 18px; display: block; }

/* Switchboard */
.flow { display: grid; gap: 0; justify-items: center; }
.fnode { width: min(520px, 100%); padding: 16px 18px; border-radius: 14px; background: #fff; border: 1px solid var(--line); display: flex; gap: 14px; align-items: flex-start; }
.fnode .fi { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--blue-soft); color: var(--blue); }
.fnode b { display: block; margin-bottom: 2px; }
.fnode small { color: var(--ink-2); }
.fnode .btn { margin-left: auto; }
.fline { width: 2px; height: 26px; background: #cfd5dc; }
.fbranch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; max-width: 900px; }
.fbranch .fnode { width: 100%; }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.field textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: transparent; }
.toggle { position: relative; width: 40px; height: 24px; border-radius: 999px; background: #cfd5dc; border: 0; flex: none; transition: background .2s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle[aria-checked="true"] { background: var(--ok); }
.toggle[aria-checked="true"]::after { transform: translateX(16px); }
.setting { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.setting:first-child { border-top: 0; padding-top: 0; }
.setting .grow { flex: 1; }
.setting small { color: var(--ink-3); display: block; }

/* Integrations */
.int { display: flex; gap: 14px; align-items: flex-start; }
.int-logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; }
.int p { color: var(--ink-2); font-size: 13px; margin: 4px 0 12px; }

/* Drawer, dialer, toast */
.scrim { position: fixed; inset: 0; background: rgba(10,14,18,.35); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 60; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: #fff; z-index: 61; transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(0,0,0,.15); }
.drawer.on { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 18px; }
.drawer-body { padding: 24px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.x { width: 34px; height: 34px; border-radius: 8px; border: 0; background: #f0f2f5; font-size: 16px; }
.summary-box { padding: 14px 16px; border-radius: 12px; background: var(--ai-soft); margin-bottom: 18px; }
.summary-box .tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ai); margin-bottom: 6px; }
.bubble { padding: 10px 14px; border-radius: 14px; margin-bottom: 8px; max-width: 88%; }
.bubble.them { background: #f1f3f6; }
.bubble.us { background: #12161b; color: #fff; margin-left: auto; }
.player { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 18px; }
.player .wave { flex: 1; height: 28px; background: repeating-linear-gradient(90deg, #c9d3e3 0 2px, transparent 2px 5px); mask: linear-gradient(90deg, #000 35%, rgba(0,0,0,.35) 35%); -webkit-mask: linear-gradient(90deg, #000 35%, rgba(0,0,0,.35) 35%); }
.play { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #12161b; color: #fff; }

.dial-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--ok); color: #fff; display: grid; place-items: center; }
.dialer { position: fixed; right: 24px; bottom: 24px; width: 300px; background: #0e1216; color: #fff; border-radius: 22px; padding: 18px; z-index: 55; box-shadow: 0 30px 60px rgba(0,0,0,.35); transform: translateY(20px) scale(.96); opacity: 0; pointer-events: none; transition: transform .25s, opacity .25s; }
.dialer.on { transform: none; opacity: 1; pointer-events: auto; }
.dialer-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #9aa3ad; margin-bottom: 10px; }
.dialer-top select { background: #1b2128; border: 0; border-radius: 8px; padding: 4px 8px; color: #fff; }
.dial-display { height: 48px; font-size: 26px; text-align: center; letter-spacing: .04em; margin-bottom: 10px; width: 100%; background: none; border: 0; color: #fff; outline: none; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keys button { height: 52px; border-radius: 14px; border: 0; background: #1b2128; color: #fff; font-size: 20px; }
.keys button:hover { background: #262e37; }
.dial-call { width: 100%; height: 48px; margin-top: 10px; border-radius: 14px; border: 0; background: var(--ok); color: #fff; font-weight: 700; font-size: 15px; }
.dial-call.end { background: var(--miss); }
.dial-state { text-align: center; font-size: 13px; color: #9aa3ad; min-height: 18px; margin-top: 8px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #12161b; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 500; opacity: 0; transition: opacity .25s, transform .25s; z-index: 80; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.demo-note { margin: 0 28px; padding: 10px 14px; border-radius: 10px; background: var(--blue-soft); color: #23408f; font-size: 13px; }

/* Responsive */
@media (max-width: 1200px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g-main { grid-template-columns: 1fr; }
  .g3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 70; transform: translateX(-100%); transition: transform .3s; }
  body.nav-open .side { transform: none; }
  .burger-app { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
  .top { padding: 0 16px; }
  .health span.txt { display: none; }
  .view { padding: 20px 16px; }
  .demo-note { margin: 0 16px; }
  .g4, .g3, .g2 { grid-template-columns: 1fr; }
  .fbranch { grid-template-columns: 1fr; }
  .dialer { right: 12px; left: 12px; width: auto; bottom: 12px; }
}

/* Language switch — Swedish first */
.lang { display: inline-flex; padding: 3px; border-radius: 999px; background: #e9ecf0; }
.lang button { border: 0; background: none; color: var(--ink-2); font-weight: 600; font-size: 12px; padding: 5px 9px; border-radius: 999px; }
.lang button[aria-pressed="true"] { background: #12161b; color: #fff; }
.side a[href^="#"] > span:first-of-type:not(.cnt) { flex: 1; }

/* Computer phone panel */
.dial-line { font-size: 12px; color: #9aa3ad; display: flex; align-items: center; gap: 6px; margin: 0 0 6px; }
.in-call { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.in-call[hidden] { display: none; }
.in-call button { height: 40px; border-radius: 12px; border: 0; background: #1b2128; color: #fff; font-weight: 600; font-size: 13px; }
.in-call button[aria-pressed="true"] { background: #fff; color: #0e1216; }
.dial-actions { display: flex; gap: 8px; }
.dial-actions .dial-call { flex: 1; }
.dial-decline { background: var(--miss); }
.dialer[data-mode="talking"] .keys button { height: 40px; font-size: 16px; }
.dialer[data-mode="incoming"] { box-shadow: 0 0 0 3px var(--ok), 0 30px 60px rgba(0,0,0,.35); }
.dial-btn.live { box-shadow: 0 0 0 3px rgba(26,159,95,.3); }
[data-phone-status] { display: inline-flex; align-items: center; gap: 6px; }
