:root {
  --bg: #f1f4f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #172033;
  --ink-2: #5a6579;
  --ink-3: #8b95a7;
  --line: #e4e9f2;
  --line-2: #eef2f8;
  --brand: #1f6feb;
  --brand-2: #0ea5a4;
  --brand-soft: #e9f1ff;
  --green: #12a150;
  --green-soft: #e8f8ee;
  --amber: #e08a00;
  --amber-soft: #fff5e2;
  --red: #e5484d;
  --red-soft: #ffeced;
  --violet: #7c5cfc;
  --violet-soft: #f0ecff;
  --rail: #0c1929;
  --rail-2: #122337;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(20, 32, 55, 0.07);
  --shadow-lg: 0 28px 70px rgba(9, 19, 35, 0.22);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
svg { width: 20px; height: 20px; flex: none; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfd7e5; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  background: #f6f8fc;
}

.login-brand {
  position: relative;
  overflow: hidden;
  padding: 54px 64px;
  display: flex;
  flex-direction: column;
  color: #fff;
  background:
    radial-gradient(900px 520px at 85% 15%, rgba(31, 111, 235, 0.38), transparent 62%),
    radial-gradient(700px 500px at 5% 90%, rgba(14, 165, 164, 0.28), transparent 65%),
    linear-gradient(150deg, #071421 0%, #0b2038 55%, #0a1b2e 100%);
}

.login-brand-top { display: flex; align-items: center; gap: 14px; position: relative; z-index: 2; }
.login-brand-name { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(145deg, #2b7cf6, #0ea5a4);
  color: #fff; box-shadow: 0 8px 22px rgba(31, 111, 235, 0.35);
}
.logo-mark.big { width: 48px; height: 48px; border-radius: 15px; }
.logo-mark svg { width: 24px; height: 24px; }

.login-copy { position: relative; z-index: 2; margin: auto 0; max-width: 560px; }
.login-kicker {
  display: inline-block; font-size: 11px; letter-spacing: 3.2px; font-weight: 700;
  color: #7fc6ff; padding: 7px 12px; border: 1px solid rgba(127, 198, 255, 0.28);
  border-radius: 999px; background: rgba(127, 198, 255, 0.07); margin-bottom: 26px;
}
.login-copy h1 { font-size: clamp(38px, 4.4vw, 58px); line-height: 1.16; margin: 0 0 22px; letter-spacing: 1px; font-weight: 700; }
.login-copy p { font-size: 16px; line-height: 1.85; color: #b7c7db; margin: 0 0 34px; max-width: 480px; }
.login-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.login-points li { display: flex; align-items: center; gap: 12px; color: #d9e5f4; font-size: 14px; }
.tick {
  width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(18, 161, 80, 0.18); color: #4ee08b; flex: none;
}
.tick svg { width: 14px; height: 14px; }
.login-foot { position: relative; z-index: 2; color: #7d90a9; font-size: 12.5px; letter-spacing: 0.3px; }
.login-orbit { position: absolute; border-radius: 50%; border: 1px solid rgba(120, 190, 255, 0.12); pointer-events: none; }
.orbit-a { width: 560px; height: 560px; right: -220px; top: -160px; }
.orbit-b { width: 820px; height: 820px; right: -360px; top: -290px; border-color: rgba(14, 165, 164, 0.09); }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.login-form { width: min(390px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 38px 36px; box-shadow: var(--shadow); }
.login-title { font-size: 26px; font-weight: 700; margin-bottom: 8px; letter-spacing: 0.5px; }
.login-sub { margin: 0 0 30px; color: var(--ink-2); font-size: 13.5px; }
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.field input {
  width: 100%; height: 46px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface-2); padding: 0 14px; outline: none; transition: 0.18s;
}
.field input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.1); }
.login-submit { height: 46px; margin-top: 6px; }
.login-error { min-height: 20px; margin-top: 12px; font-size: 12.5px; color: var(--red); }
.login-hint { display: flex; align-items: center; gap: 6px; margin-top: 20px; font-size: 12px; color: var(--ink-3); }
.login-hint svg { width: 14px; height: 14px; }

/* ---------- app shell ---------- */
.app { min-height: 100vh; }

.rail {
  position: fixed; inset: 0 auto 0 0; width: 216px; z-index: 80;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--rail) 0%, #0a1727 100%);
  color: #cbd6e6; padding: 22px 14px 18px;
}
.rail-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 26px; }
.rail-brand .logo-mark { width: 38px; height: 38px; border-radius: 12px; }
.rail-brand .logo-mark svg { width: 21px; height: 21px; }
.rail-brand-text { font-size: 17px; font-weight: 700; color: #fff; letter-spacing: 0.8px; white-space: nowrap; }
.rail-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  height: 46px; padding: 0 13px; border-radius: 11px; border: 0;
  background: transparent; color: #94a6bd; font-size: 14px; font-weight: 500;
  transition: 0.16s; text-align: left; white-space: nowrap;
}
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { color: #e8effa; background: rgba(255, 255, 255, 0.055); }
.nav-item.active { color: #fff; background: linear-gradient(120deg, rgba(31, 111, 235, 0.92), rgba(31, 111, 235, 0.62)); box-shadow: 0 8px 20px rgba(31, 111, 235, 0.28); }
.rail-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.rail-agent {
  display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.rail-agent-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.rail-agent-text strong { font-size: 13px; color: #edf3fb; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-agent-text em { font-size: 11px; color: #7d90a8; font-style: normal; }
.avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #2b7cf6, #0ea5a4); color: #fff; font-size: 13px; font-weight: 700;
}

.shell { margin-left: 216px; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 60; height: 72px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 0 26px; background: rgba(255, 255, 255, 0.86); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.page-heading h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: 0.2px; }
.page-heading p { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.mode-badge {
  font-size: 11.5px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  color: var(--amber); background: var(--amber-soft); border: 1px solid #f3dfb6;
}
.mode-badge.live { color: var(--green); background: var(--green-soft); border-color: #c6edd5; }
.clock { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.clock svg { width: 16px; height: 16px; color: var(--ink-3); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; transition: 0.16s;
}
.icon-btn:hover { color: var(--brand); border-color: #c8daf8; background: var(--brand-soft); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn svg { width: 17px; height: 17px; }
.top-avatar {
  width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #2b7cf6, #0ea5a4); color: #fff; font-size: 13px; font-weight: 700;
}

.main { padding: 22px 380px 100px 26px; }
.view { display: none; animation: fade-up 0.25s ease; }
.view.active { display: block; }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- common ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: 0.16s;
}
.btn svg { width: 16px; height: 16px; }
.btn.primary { color: #fff; background: linear-gradient(120deg, #2b7cf6, #155fd0); box-shadow: 0 8px 18px rgba(31, 111, 235, 0.24); }
.btn.primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.soft { color: var(--brand); background: var(--brand-soft); }
.btn.soft:hover { background: #dcebff; }
.btn.ghost { color: var(--ink-2); background: #fff; border-color: var(--line); }
.btn.ghost:hover { color: var(--brand); border-color: #c8daf8; }
.btn.danger-ghost { color: var(--red); background: #fff; border-color: #f4c9cb; }
.btn.danger-ghost:hover { background: var(--red-soft); }
.btn.answer { color: #fff; background: linear-gradient(120deg, #18b45f, #0d8f49); box-shadow: 0 8px 18px rgba(18, 161, 80, 0.3); }
.btn.answer:hover { filter: brightness(1.06); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.link { border: 0; background: transparent; color: var(--brand); font-size: 12.5px; font-weight: 600; padding: 4px; }
.link:hover { text-decoration: underline; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 0; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.panel-head p { margin: 3px 0 0; font-size: 12px; color: var(--ink-3); }
.muted { color: var(--ink-3); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi {
  display: flex; align-items: center; gap: 14px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.kpi-icon { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex: none; }
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-icon.blue { color: var(--brand); background: var(--brand-soft); }
.kpi-icon.teal { color: var(--brand-2); background: #e5f7f7; }
.kpi-icon.amber { color: var(--amber); background: var(--amber-soft); }
.kpi-icon.violet { color: var(--violet); background: var(--violet-soft); }
.kpi-body { min-width: 0; display: flex; flex-direction: column; }
.kpi-body span { font-size: 12px; color: var(--ink-2); }
.kpi-body strong { font-size: 27px; line-height: 1.25; font-weight: 700; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.kpi-body em { font-size: 11px; color: var(--ink-3); font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.work-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.work-col { display: grid; gap: 18px; min-width: 0; }

/* ---------- stage ---------- */
.stage-panel { overflow: hidden; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap;
}
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.status-pill.ready { color: var(--green); background: var(--green-soft); border-color: #c6edd5; }
.status-pill.ready i { background: var(--green); box-shadow: 0 0 0 3px rgba(18, 161, 80, 0.16); }
.status-pill.busy { color: var(--brand); background: var(--brand-soft); border-color: #c8daf8; }
.status-pill.busy i { background: var(--brand); animation: blink 1s infinite; }
.status-pill.break, .status-pill.aftercall { color: var(--amber); background: var(--amber-soft); border-color: #f3dfb6; }
.status-pill.break i, .status-pill.aftercall i { background: var(--amber); }
.status-pill.offline i { background: var(--ink-3); }

.stage { padding: 18px 20px 20px; }
.agent-hero { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; background: linear-gradient(120deg, #f7faff, #f2f7ff); border: 1px solid #e8f0fd; }
.agent-avatar { width: 52px; height: 52px; border-radius: 15px; flex: none; display: flex; align-items: center; justify-content: center; background: linear-gradient(145deg, #2b7cf6, #0ea5a4); color: #fff; font-size: 18px; font-weight: 700; box-shadow: 0 10px 22px rgba(31, 111, 235, 0.22); }
.agent-hero-info { min-width: 0; }
.agent-hero-info h3 { margin: 0; font-size: 16px; font-weight: 700; }
.agent-hero-info p { margin: 3px 0 0; font-size: 12px; color: var(--ink-3); }
.agent-hero-actions { margin-left: auto; display: flex; gap: 8px; }
.agent-hero-actions .btn { height: 36px; padding: 0 12px; font-size: 12.5px; }

.stage-tips { display: flex; gap: 11px; align-items: flex-start; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #fbfcfe; border: 1px dashed var(--line); }
.stage-tips > span { color: var(--brand-2); }
.stage-tips strong { display: block; font-size: 12.5px; }
.stage-tips p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-3); }

.quick-dial { margin-top: 18px; }
.quick-dial > label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.quick-dial-row { display: flex; gap: 10px; margin-top: 8px; }
.quick-dial-row input {
  flex: 1; min-width: 0; height: 44px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface-2); padding: 0 14px; outline: none; font-size: 15px; letter-spacing: 0.5px;
}
.quick-dial-row input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.1); }
.quick-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 11.5px; transition: 0.15s;
}
.chip:hover { color: var(--brand); border-color: #c8daf8; background: var(--brand-soft); }
.chip svg { width: 12px; height: 12px; }

.active-call { background: linear-gradient(160deg, #0c1c31, #102a4a 60%, #0c2138); border-radius: 14px; margin: 0; color: #fff; padding: 18px; }
.active-top { display: flex; align-items: center; justify-content: space-between; }
.call-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); color: #d9e8ff; }
.call-badge i { width: 7px; height: 7px; border-radius: 50%; background: #4ee08b; animation: blink 1.2s infinite; }
.call-timer { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.5px; }
.active-person { text-align: center; padding: 12px 0 18px; }
.wave { display: flex; align-items: center; justify-content: center; gap: 4px; height: 34px; margin-bottom: 10px; }
.wave i { width: 4px; height: 10px; border-radius: 4px; background: linear-gradient(180deg, #59c3ff, #2b7cf6); animation: wave 1.1s ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: 0.1s; }
.wave i:nth-child(3) { animation-delay: 0.2s; }
.wave i:nth-child(4) { animation-delay: 0.3s; }
.wave i:nth-child(5) { animation-delay: 0.4s; }
.wave i:nth-child(6) { animation-delay: 0.5s; }
.wave i:nth-child(7) { animation-delay: 0.6s; }
.wave.paused i { animation-play-state: paused; opacity: 0.45; }
.active-person h3 { margin: 0; font-size: 19px; }
.active-person p { margin: 4px 0 0; font-size: 14px; color: #a8bfdc; letter-spacing: 0.6px; }
.active-person .muted { font-size: 12px; color: #7f97b5; }
.call-controls { display: flex; justify-content: center; gap: clamp(14px, 4vw, 26px); padding: 4px 0 14px; }
.call-controls button {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  width: 58px; border: 0; background: transparent; color: #c6d7ee; font-size: 11px;
}
.call-controls button svg { width: 46px; height: 46px; padding: 12px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); transition: 0.15s; }
.call-controls button:hover svg { background: rgba(255, 255, 255, 0.2); }
.call-controls button.danger svg { background: linear-gradient(145deg, #f05a5f, #d63a40); color: #fff; box-shadow: 0 8px 20px rgba(229, 72, 77, 0.35); }
.call-controls button.active svg { background: #fff; color: #102a4a; }
.call-controls button:disabled { opacity: 0.45; }
.call-note-row input { width: 100%; height: 40px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.07); color: #eaf3ff; padding: 0 12px; outline: none; }
.call-note-row input::placeholder { color: #8098b6; }
.call-note-row input:focus { border-color: #59c3ff; background: rgba(255, 255, 255, 0.1); }

.wrapup { background: linear-gradient(120deg, #fffaf0, #fffdf8); border: 1px solid #f6e4bf; border-radius: 14px; margin: 0; padding: 18px; }
.wrapup-head { display: flex; align-items: center; gap: 12px; }
.wrapup-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: #fff1d6; color: var(--amber); }
.wrapup-head h3 { margin: 0; font-size: 15px; }
.wrapup-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-3); }
.wrapup-timer { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }
.wrapup textarea {
  width: 100%; margin-top: 14px; border-radius: 11px; border: 1px solid #efdfc0; background: #fff;
  padding: 11px 12px; resize: vertical; outline: none; min-height: 78px;
}
.wrapup textarea:focus { border-color: var(--amber); box-shadow: 0 0 0 4px rgba(224, 138, 0, 0.1); }
.wrapup-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.wrapup-summary { margin-top: 12px; font-size: 12px; color: var(--ink-2); }

/* ---------- lists ---------- */
.todo-list, .mini-call-list, .customer-mini-list { padding: 12px 12px 14px; display: grid; gap: 4px; }
.todo-item { display: flex; gap: 11px; align-items: flex-start; padding: 11px 10px; border-radius: 11px; border: 0; background: transparent; text-align: left; width: 100%; }
.todo-item:hover { background: var(--surface-2); }
.todo-prio { width: 4px; align-self: stretch; border-radius: 4px; background: var(--line); flex: none; }
.todo-prio.urgent { background: var(--red); }
.todo-prio.high { background: var(--amber); }
.todo-prio.normal { background: var(--brand); }
.todo-prio.low { background: var(--ink-3); }
.todo-body { min-width: 0; flex: 1; }
.todo-body strong { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-body span { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.todo-time { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }

.mini-call { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 11px; }
.mini-call:hover { background: var(--surface-2); }
.dir-icon { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; }
.dir-icon.inbound { color: var(--brand); background: var(--brand-soft); }
.dir-icon.outbound { color: var(--brand-2); background: #e5f7f7; }
.dir-icon svg { width: 15px; height: 15px; }
.mini-call-body { flex: 1; min-width: 0; }
.mini-call-body strong { display: block; font-size: 12.5px; font-weight: 600; }
.mini-call-body span { font-size: 11px; color: var(--ink-3); }
.mini-call-meta { text-align: right; font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.mini-call-meta b { display: block; font-weight: 600; color: var(--ink-2); font-size: 11px; }

.customer-mini { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 11px; }
.customer-mini:hover { background: var(--surface-2); }
.customer-mini .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }
.customer-mini-body { flex: 1; min-width: 0; }
.customer-mini-body strong { display: block; font-size: 12.5px; font-weight: 600; }
.customer-mini-body span { display: block; font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-dial { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--brand); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.mini-dial:hover { background: var(--brand-soft); border-color: #c8daf8; }
.mini-dial svg { width: 14px; height: 14px; }

/* ---------- toolbar / tables ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.search-box { display: flex; align-items: center; gap: 9px; height: 42px; min-width: 280px; flex: 1; max-width: 460px; padding: 0 13px; border-radius: 11px; background: #fff; border: 1px solid var(--line); }
.search-box svg { color: var(--ink-3); width: 17px; height: 17px; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 13.5px; }
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.09); }
.count-text { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.select { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; padding: 0 30px 0 12px; font-size: 12.5px; color: var(--ink-2); outline: none; }
.select:focus { border-color: var(--brand); }

.table-panel { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.data-table th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  padding: 13px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table th.right, .data-table td.right { text-align: right; }
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); font-size: 13px; vertical-align: middle; }
.data-table tbody tr:hover { background: #fafcff; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.cell-person { display: flex; align-items: center; gap: 10px; }
.cell-person .avatar { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }
.cell-person strong { display: block; font-size: 12.5px; }
.cell-person span { display: block; font-size: 10.5px; color: var(--ink-3); }
.phone-cell { font-variant-numeric: tabular-nums; letter-spacing: 0.3px; }
.row-actions { display: inline-flex; gap: 6px; }
.row-actions button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; }
.row-actions button:hover { color: var(--brand); border-color: #c8daf8; background: var(--brand-soft); }
.row-actions button svg { width: 14px; height: 14px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.blue { color: var(--brand); background: var(--brand-soft); }
.badge.green { color: var(--green); background: var(--green-soft); }
.badge.amber { color: var(--amber); background: var(--amber-soft); }
.badge.red { color: var(--red); background: var(--red-soft); }
.badge.violet { color: var(--violet); background: var(--violet-soft); }
.badge.gray { color: var(--ink-2); background: #eef1f6; }
.level-chip { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 7px; font-size: 11px; font-weight: 700; }
.level-A { color: #b77900; background: #fff2cc; }
.level-B { color: var(--brand); background: var(--brand-soft); }
.level-C { color: var(--ink-2); background: #eef1f6; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 10.5px; padding: 2px 7px; border-radius: 6px; background: #f1f4f9; color: var(--ink-2); white-space: nowrap; }
.note-cell { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); font-size: 12px; }
.time-cell { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
.time-cell small { display: block; color: var(--ink-3); font-size: 10px; }

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 54px 20px; text-align: center; color: var(--ink-3); }
.empty svg { width: 40px; height: 40px; color: #c4cddd; margin-bottom: 12px; }
.empty p { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.empty span { font-size: 12px; margin-top: 4px; }

/* ---------- tickets ---------- */
.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: 11px; background: #e9eef6; }
.segmented button { height: 32px; padding: 0 13px; border: 0; border-radius: 8px; background: transparent; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.segmented button.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 2px 8px rgba(20, 32, 55, 0.08); }
.ticket-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.ticket-col { background: #eef2f8; border-radius: var(--radius); padding: 12px; min-height: 300px; }
.ticket-col > header { display: flex; align-items: center; gap: 7px; padding: 4px 6px 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.ticket-col > header em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--ink-3); background: #fff; border-radius: 999px; padding: 1px 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot.open { background: var(--amber); }
.dot.processing { background: var(--brand); }
.dot.resolved { background: var(--green); }
.ticket-list { display: grid; gap: 9px; }
.ticket-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 13px; cursor: pointer; transition: 0.16s; }
.ticket-card:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(20, 32, 55, 0.09); border-color: #cfdcf1; }
.ticket-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.ticket-card h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; line-height: 1.45; }
.ticket-card p { margin: 0; font-size: 11.5px; color: var(--ink-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ticket-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 10.5px; color: var(--ink-3); }
.ticket-customer { display: inline-flex; align-items: center; gap: 5px; }
.ticket-customer svg { width: 12px; height: 12px; }

/* ---------- charts ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.chart-panel { padding-bottom: 18px; }
.span-2 { grid-column: span 2; }
.legend-inline { font-size: 11.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.legend-inline i { width: 8px; height: 8px; border-radius: 3px; background: var(--brand); }
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 210px; padding: 18px 20px 0; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.bar-col .bar-track { width: 100%; flex: 1 1 auto; min-height: 0; display: flex; align-items: flex-end; justify-content: center; }
.bar-col .bar {
  width: min(18px, 70%); border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #5a9bff, #2b7cf6);
  min-height: 3px; transition: 0.3s; position: relative;
}
.bar-col:hover .bar { filter: brightness(1.08); }
.bar-col span { font-size: 9.5px; color: var(--ink-3); white-space: nowrap; }
.bar-col em { font-size: 9.5px; color: var(--ink-2); font-style: normal; font-weight: 600; opacity: 0; transition: 0.15s; }
.bar-col:hover em { opacity: 1; }

.donut-wrap { display: flex; align-items: center; gap: 22px; padding: 18px 20px 0; }
.donut { width: 138px; height: 138px; border-radius: 50%; position: relative; flex: none; background: conic-gradient(var(--brand) 0 50%, var(--brand-2) 50% 100%); }
.donut::after { content: ""; position: absolute; inset: 17px; border-radius: 50%; background: #fff; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 2; }
.donut-center strong { font-size: 25px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.donut-center span { font-size: 10.5px; color: var(--ink-3); }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.donut-legend li { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.donut-legend i { width: 9px; height: 9px; border-radius: 3px; }
.donut-legend b { margin-left: auto; color: var(--ink); font-weight: 600; }

.hbar-list { padding: 16px 20px 0; display: grid; gap: 13px; }
.hbar-row { display: grid; gap: 5px; }
.hbar-row > div { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-2); }
.hbar-row b { color: var(--ink); font-weight: 600; }
.hbar-track { height: 7px; border-radius: 999px; background: #eef2f8; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #5a9bff, #2b7cf6); transition: 0.3s; }
.hbar-fill.green { background: linear-gradient(90deg, #3fd07f, #12a150); }
.hbar-fill.amber { background: linear-gradient(90deg, #ffc45c, #e08a00); }
.hbar-fill.violet { background: linear-gradient(90deg, #a48bff, #7c5cfc); }

/* ---------- softphone dock ---------- */
.softphone {
  position: fixed; top: 88px; right: 18px; width: 344px; max-height: calc(100vh - 106px); z-index: 70;
  display: flex; flex-direction: column; gap: 10px; padding: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg);
  overflow-y: auto; transition: transform 0.25s ease;
}
.softphone-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 0 6px; }
.softphone-head .icon-btn { display: none; }
.softphone-title { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.softphone-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.softphone-title .dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(18, 161, 80, 0.14); }
.softphone-title em { font-style: normal; font-size: 10px; font-weight: 600; color: var(--amber); background: var(--amber-soft); padding: 2px 7px; border-radius: 999px; }
.softphone-title em.live { color: var(--green); background: var(--green-soft); }
.sdk-wrap { width: 100%; min-height: 540px; }
.sdk-wrap > div { width: 100% !important; }

.mock-phone { display: flex; flex-direction: column; gap: 10px; }
.mp-status { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; font-size: 11px; color: var(--ink-3); }
.mp-state { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 600; }
.mp-state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.mp-state .dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(18, 161, 80, 0.14); }
.mp-state .dot.busy { background: var(--brand); animation: blink 1s infinite; }
.mp-device { display: inline-flex; align-items: center; gap: 4px; }
.mp-device svg { width: 12px; height: 12px; color: var(--green); }
.mp-screen { background: radial-gradient(140% 120% at 20% 0%, #16385f, #0b1b2e 65%); border-radius: 16px; padding: 16px; color: #fff; min-height: 112px; display: flex; flex-direction: column; justify-content: center; }
.mp-label { font-size: 10.5px; color: #8fa8c6; letter-spacing: 0.5px; }
.mp-number { font-size: 27px; font-weight: 600; letter-spacing: 1px; margin-top: 4px; min-height: 34px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mp-hint { font-size: 10.5px; color: #7d96b4; margin-top: 6px; }
.mp-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 2px 4px; }
.mp-keypad button {
  border: 1px solid var(--line); background: #fbfcfe; border-radius: 12px; height: 47px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  font-size: 18px; font-weight: 600; color: var(--ink); transition: 0.12s;
}
.mp-keypad button:hover { background: var(--brand-soft); border-color: #c8daf8; color: var(--brand); }
.mp-keypad button:active { transform: scale(0.96); }
.mp-keypad small { font-size: 8px; letter-spacing: 1.2px; color: var(--ink-3); font-weight: 600; height: 10px; }
.mp-actions { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 1px 4px 2px; }
.mp-actions button { border: 0; display: inline-flex; align-items: center; justify-content: center; }
.mp-back { width: 42px; height: 42px; border-radius: 50%; background: #f1f4f9; color: var(--ink-2); }
.mp-back svg { width: 17px; height: 17px; }
.mp-call { width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(145deg, #20c26a, #0d8f49); color: #fff; box-shadow: 0 10px 24px rgba(18, 161, 80, 0.3); }
.mp-call svg { width: 24px; height: 24px; }
.mp-call:hover { filter: brightness(1.07); }
.mp-mute { width: 42px; height: 42px; border-radius: 50%; background: #f1f4f9; color: var(--ink-2); }
.mp-mute svg { width: 17px; height: 17px; }
.mp-mute.active { background: var(--amber-soft); color: var(--amber); }
.mp-demo { margin: 0 4px; height: 36px; border-radius: 10px; border: 1px dashed #d8e3f4; background: #fbfdff; color: var(--brand); font-size: 12px; font-weight: 600; }
.mp-demo:hover { background: var(--brand-soft); border-color: #b9d2fa; }

.sdk-fallback { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 22px; }
.fallback-icon { width: 54px; height: 54px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--amber-soft); color: var(--amber); margin-bottom: 14px; }
.sdk-fallback h3 { margin: 0 0 6px; font-size: 15px; }
.sdk-fallback p { margin: 0 0 18px; font-size: 12px; color: var(--ink-3); line-height: 1.7; }

.phone-fab {
  display: none; position: fixed; right: 18px; bottom: 22px; z-index: 75;
  align-items: center; gap: 8px; height: 48px; padding: 0 18px; border: 0; border-radius: 999px;
  color: #fff; background: linear-gradient(120deg, #2b7cf6, #155fd0); box-shadow: 0 12px 28px rgba(31, 111, 235, 0.4);
  font-size: 13px; font-weight: 600;
}
.phone-fab svg { width: 18px; height: 18px; }

/* ---------- incoming call ---------- */
.call-overlay {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 22px; background: rgba(6, 14, 26, 0.58); backdrop-filter: blur(10px); animation: fade-in 0.18s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.incoming-card {
  position: relative; width: min(520px, 100%); max-height: calc(100vh - 44px); overflow-y: auto;
  background: #fff; border-radius: 24px; padding: 22px 24px 18px; box-shadow: 0 40px 100px rgba(0, 0, 0, 0.42);
  animation: pop-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
@keyframes pop-in { from { opacity: 0; transform: scale(0.94) translateY(12px); } to { opacity: 1; transform: none; } }
.incoming-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; border-radius: 24px 24px 0 0;
  background: linear-gradient(90deg, #12a150, #2b7cf6, #0ea5a4);
}
.incoming-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ring-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; color: var(--green); background: var(--green-soft); padding: 5px 11px; border-radius: 999px; }
.ring-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: blink 1s infinite; }
.ring-count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.incoming-avatar {
  width: 66px; height: 66px; border-radius: 20px; margin: 4px auto 10px;
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: #fff;
  background: linear-gradient(145deg, #2b7cf6, #0ea5a4); box-shadow: 0 0 0 8px rgba(31, 111, 235, 0.08), 0 14px 30px rgba(31, 111, 235, 0.28);
  animation: ring-pulse 1.6s ease-in-out infinite;
}
@keyframes ring-pulse { 0%, 100% { box-shadow: 0 0 0 8px rgba(31, 111, 235, 0.08), 0 14px 30px rgba(31, 111, 235, 0.28); } 50% { box-shadow: 0 0 0 16px rgba(31, 111, 235, 0.04), 0 14px 30px rgba(31, 111, 235, 0.28); } }
.incoming-card h2 { margin: 0; text-align: center; font-size: 20px; }
.incoming-number { text-align: center; font-size: 26px; font-weight: 700; letter-spacing: 1px; margin-top: 2px; color: var(--ink); font-variant-numeric: tabular-nums; }
.incoming-meta { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 4px; min-height: 18px; }
.incoming-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; margin-top: 16px; }
.incoming-grid > div { background: #fbfcfe; padding: 10px 12px; }
.incoming-grid span { display: block; font-size: 10.5px; color: var(--ink-3); }
.incoming-grid b { display: block; font-size: 12px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.incoming-orders { margin-top: 12px; display: grid; gap: 6px; }
.order-row { display: flex; align-items: center; gap: 10px; padding: 8px 11px; border-radius: 10px; background: var(--surface-2); font-size: 11.5px; }
.order-row b { font-weight: 600; }
.order-row span { color: var(--ink-3); }
.order-row em { margin-left: auto; font-style: normal; font-weight: 600; color: var(--ink); }
.incoming-actions { display: flex; gap: 12px; margin-top: 18px; }
.incoming-actions .btn { flex: 1; height: 50px; border-radius: 13px; font-size: 15px; }
.incoming-hint { margin: 10px 0 0; text-align: center; font-size: 10.5px; color: var(--ink-3); }

/* ---------- modal / toast ---------- */
.modal-root { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 22px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 16, 28, 0.5); backdrop-filter: blur(6px); animation: fade-in 0.15s ease; }
.modal {
  position: relative; width: min(560px, 100%); max-height: calc(100vh - 44px); overflow-y: auto;
  background: #fff; border-radius: 20px; padding: 24px; box-shadow: var(--shadow-lg);
  animation: pop-in 0.2s ease;
}
.modal.wide { width: min(680px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head p { margin: 3px 0 0; font-size: 12px; color: var(--ink-3); }
.modal-close { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; }
.modal-close:hover { color: var(--red); border-color: #f4c9cb; background: var(--red-soft); }
.modal-close svg { width: 15px; height: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .col-2 { grid-column: span 2; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.form-grid input, .form-grid select, .form-grid textarea, .modal input, .modal select, .modal textarea {
  width: 100%; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
  padding: 10px 12px; outline: none; font-size: 13px;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.modal input:focus, .modal select:focus, .modal textarea:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.09); }
.form-grid textarea, .modal textarea { resize: vertical; min-height: 84px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.detail-list { display: grid; gap: 10px; }
.detail-row { display: flex; gap: 14px; font-size: 13px; }
.detail-row > span { width: 78px; color: var(--ink-3); flex: none; }
.detail-row > b { font-weight: 500; color: var(--ink); }
.detail-note { padding: 12px; border-radius: 11px; background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); line-height: 1.7; white-space: pre-wrap; }
.order-card { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 12px; }

.toast-stack { position: fixed; right: 22px; bottom: 94px; z-index: 400; display: flex; flex-direction: column; gap: 9px; align-items: flex-end; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 9px; max-width: min(360px, 88vw);
  padding: 11px 15px; border-radius: 12px; background: #122033; color: #fff; font-size: 12.5px;
  box-shadow: 0 14px 34px rgba(9, 19, 35, 0.3); animation: toast-in 0.22s ease; pointer-events: auto;
}
.toast svg { width: 16px; height: 16px; }
.toast.success svg { color: #4ee08b; }
.toast.error svg { color: #ff8a8e; }
.toast.warn svg { color: #ffc45c; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes wave { 0%, 100% { height: 9px; } 50% { height: 30px; } }

/* ---------- responsive ---------- */
@media (max-width: 1439px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1359px) {
  .rail { width: 80px; padding: 20px 11px 16px; }
  .rail-brand { justify-content: center; padding: 0 0 24px; }
  .rail-brand-text, .nav-item span, .rail-agent-text { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .rail-agent { justify-content: center; padding: 12px 0 0; }
  .shell { margin-left: 80px; }
  .work-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
}

@media (max-width: 1279px) {
  .main { padding-right: 380px; }
  .kpi-body strong { font-size: 24px; }
  .call-controls { gap: 12px; }
  .call-controls button { width: 52px; }
  .call-controls button svg { width: 42px; height: 42px; padding: 11px; }
}

@media (max-width: 1023px) {
  .rail {
    inset: auto 0 0 0; width: auto; height: 68px; flex-direction: row; align-items: center;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .rail-brand, .rail-bottom .nav-item, .rail-agent { display: none; }
  .rail-nav { flex-direction: row; flex: 1; gap: 2px; }
  .nav-item { flex: 1; height: 52px; flex-direction: column; gap: 3px; font-size: 10px; border-radius: 10px; justify-content: center; }
  .nav-item span { display: block; }
  .nav-item svg { width: 19px; height: 19px; }
  .nav-item.active { box-shadow: none; background: rgba(31, 111, 235, 0.9); }
  .rail-bottom { display: none; }
  .shell { margin-left: 0; padding-bottom: 76px; }
  .main { padding: 18px 16px 96px; }
  .topbar { height: 64px; padding: 0 16px; }
  .page-heading p { display: none; }
  .softphone { top: auto; bottom: calc(78px + env(safe-area-inset-bottom)); right: 12px; width: min(360px, calc(100vw - 24px)); max-height: calc(100vh - 160px); transform: translateY(calc(100% + 120px)); }
  .softphone.open { transform: none; }
  .softphone-head .icon-btn { display: inline-flex; }
  .phone-fab { display: inline-flex; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 85; }
  .toast-stack { bottom: 150px; }
  .work-grid { grid-template-columns: 1fr; }
  .ticket-board { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr 1fr; }
  .span-2 { grid-column: span 2; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 34px 28px 30px; min-height: 270px; }
  .login-copy { margin: 26px 0 12px; }
  .login-copy h1 { font-size: 32px; margin-bottom: 12px; }
  .login-copy p { font-size: 13px; margin-bottom: 18px; }
  .login-points { display: none; }
  .login-foot { display: none; }
  .login-panel { padding: 26px 18px 44px; }
}

@media (max-width: 700px) {
  .kpi-grid { gap: 10px; }
  .kpi { padding: 14px; gap: 10px; }
  .kpi-icon { width: 38px; height: 38px; border-radius: 11px; }
  .kpi-icon svg { width: 18px; height: 18px; }
  .kpi-body strong { font-size: 21px; }
  .kpi-body em { display: none; }
  .toolbar { align-items: stretch; }
  .search-box { min-width: 0; max-width: none; }
  .toolbar-right { flex-wrap: wrap; }
  .chart-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .donut-wrap { justify-content: center; }
  .agent-hero { flex-wrap: wrap; }
  .agent-hero-actions { width: 100%; margin-left: 0; }
  .agent-hero-actions .btn { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .col-2 { grid-column: span 1; }
  .modal { padding: 20px; }
  .incoming-card { padding: 20px 18px 16px; }
  .incoming-number { font-size: 23px; }
  .incoming-grid { grid-template-columns: 1fr 1fr; }
  .clock { display: none; }
  .top-avatar { display: none; }
  .mode-badge { font-size: 10.5px; }
  .segmented { width: 100%; overflow-x: auto; }
  .segmented button { flex: 1; white-space: nowrap; }
  .calls-toolbar .toolbar-right { width: 100%; }
  .calls-toolbar .select { flex: 1; }
}
