@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=Manrope:wght@500;600;700&display=swap');

:root {
  --navy: #0b2341;
  --navy-2: #12345b;
  --navy-3: #1b4774;
  --teal: #10a6a0;
  --teal-dark: #087a76;
  --coral: #ef6a5b;
  --coral-soft: #fff0ed;
  --blue-soft: #eaf3fb;
  --teal-soft: #e5f7f5;
  --ink: #172335;
  --muted: #68778c;
  --line: #dfe7ef;
  --surface: #fbfdff;
  --page: #eef3f7;
  --shadow: 0 10px 30px rgba(11, 35, 65, .08), 0 2px 8px rgba(11, 35, 65, .04);
  --sidebar: 260px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body { margin: 0; overflow-x: hidden; background: var(--page); color: var(--ink); font-family: "IBM Plex Sans Arabic", sans-serif; line-height: 1.65; letter-spacing: 0; }
html[lang="en"] body { font-family: Manrope, sans-serif; line-height: 1.55; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(16, 166, 160, .28); outline-offset: 2px; }
.skip-link { position: fixed; inset-block-start: 8px; inset-inline-start: 8px; z-index: 100; transform: translateY(-150%); background: var(--navy); color: #f8fbff; padding: 10px 16px; border-radius: 6px; }
.skip-link:focus { transform: translateY(0); }

.app-shell { min-height: 100dvh; }
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar); z-index: 20; display: flex; flex-direction: column; padding: 22px 16px 18px; background: var(--navy); color: #dce8f4; box-shadow: 0 0 28px rgba(11, 35, 65, .12); }
.brand-block { display: flex; align-items: center; gap: 12px; padding: 2px 8px 24px; border-block-end: 1px solid rgba(255,255,255,.1); }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; background: var(--teal); color: #f8fffe; font: 700 16px Manrope, sans-serif; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.brand-block strong, .brand-block span { display: block; }
.brand-block strong { color: #f9fbfd; font: 700 17px Manrope, "IBM Plex Sans Arabic", sans-serif; }
.brand-block span { color: #8fa6be; font-size: 11px; margin-block-start: 2px; }
.main-nav { display: grid; gap: 5px; margin-block-start: 20px; }
.nav-label { color: #718ba5; font-size: 11px; font-weight: 700; padding-inline: 12px; margin: 0 0 4px; }
.nav-item { width: 100%; min-height: 46px; display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 11px; border: 0; border-radius: 7px; padding: 9px 11px; color: #aebfd0; background: transparent; text-align: start; transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav-item svg { width: 19px; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; transform: translateX(-2px); }
.nav-item.active { background: #183b62; color: #fff; box-shadow: inset -3px 0 0 var(--teal); }
html[dir="rtl"] .nav-item.active { box-shadow: inset 3px 0 0 var(--teal); }
html[dir="ltr"] .nav-item:hover { transform: translateX(2px); }
.nav-item b { min-width: 24px; border-radius: 10px; padding: 1px 6px; background: rgba(16,166,160,.2); color: #76ded8; text-align: center; font-size: 11px; }
.platform-status { margin-block-start: auto; display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; padding: 13px 10px; border-block-start: 1px solid rgba(255,255,255,.1); }
.platform-status strong, .platform-status small { display: block; }
.platform-status strong { color: #f4f8fc; font-size: 13px; }
.platform-status small { color: #8fa6be; font-size: 10px; }
.status-dot, .live-indicator span, .call-state span, .pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(16,166,160,.14); }
.status-chip { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; padding: 2px 8px; border-radius: 12px; background: rgba(255,255,255,.08); color: #89dcd7; font-size: 10px; font-weight: 700; white-space: nowrap; }
.status-chip.success { background: var(--teal-soft); color: var(--teal-dark); }
.status-chip.busy, .status-chip.warning { background: var(--coral-soft); color: #bd493e; }
.status-chip.muted { background: #eef1f5; color: #647286; }

.workspace { margin-inline-start: var(--sidebar); min-width: 0; }
.topbar { position: sticky; inset-block-start: 0; z-index: 15; height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 30px; background: rgba(251,253,255,.96); border-block-end: 1px solid var(--line); backdrop-filter: blur(12px); }
.search-wrap { width: min(520px, 48vw); height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 13px; background: #f1f5f8; border: 1px solid transparent; border-radius: 7px; }
.search-wrap:focus-within { background: var(--surface); border-color: var(--teal); box-shadow: 0 0 0 3px rgba(16,166,160,.1); }
.search-wrap svg { width: 18px; color: var(--muted); }
.search-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; }
.search-wrap kbd { direction: ltr; border: 1px solid #d5dee7; border-block-end-width: 2px; border-radius: 5px; padding: 1px 6px; color: #7a8798; background: #fbfcfd; font: 11px Manrope, sans-serif; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 7px; color: #516176; background: var(--surface); transition: border-color .18s, color .18s, background .18s; }
.icon-button:hover { border-color: #b8c8d8; color: var(--navy); background: #f3f7fa; }
.icon-button svg { width: 19px; }
.notification-button > span { position: absolute; inset-block-start: -5px; inset-inline-start: -5px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; background: var(--coral); color: #fff; font: 700 10px Manrope, sans-serif; }
.profile-button { display: flex; align-items: center; gap: 9px; border: 0; color: var(--ink); background: transparent; padding: 5px 7px; border-radius: 7px; text-align: start; }
.profile-button:hover { background: #f1f5f8; }
.profile-button strong, .profile-button small { display: block; }
.profile-button strong { font-size: 13px; }
.profile-button small { color: var(--muted); font-size: 10px; }
.profile-button svg { width: 16px; color: var(--muted); }
.avatar, .caller-avatar, .mini-avatar { display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--navy-2); color: #f8fbff; font-weight: 700; }
.avatar { width: 36px; height: 36px; font-size: 12px; }

main { padding: 28px 30px 44px; }
.view { display: none; }
.view.active { display: block; animation: reveal .32s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-block-end: 24px; }
.eyebrow, .section-kicker { margin: 0 0 3px; color: var(--teal-dark); font-size: 11px; font-weight: 700; }
h1, h2, p { margin-block-start: 0; }
h1 { margin-block-end: 4px; font-size: clamp(26px, 3vw, 34px); line-height: 1.3; color: var(--navy); }
h2 { margin-block-end: 0; font-size: 17px; color: var(--navy); }
.page-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 14px; }
.heading-actions, .call-actions, .dialog-actions { display: flex; align-items: center; gap: 10px; }
.live-indicator { display: inline-flex; align-items: center; gap: 9px; color: var(--teal-dark); font-size: 12px; font-weight: 700; }
.primary-button, .secondary-button, .danger-button, .text-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 7px; padding: 8px 15px; font-weight: 700; border: 1px solid transparent; transition: transform .18s, box-shadow .18s, background .18s; }
.primary-button { background: var(--navy); color: #fff; box-shadow: 0 6px 16px rgba(11,35,65,.16); }
.primary-button:hover { background: var(--navy-2); transform: translateY(-1px); }
.secondary-button { background: var(--surface); color: var(--navy); border-color: #cbd7e2; }
.secondary-button:hover { background: #f0f5f8; }
.danger-button { background: var(--coral); color: #fff; }
.danger-button:hover { background: #d85649; }
.primary-button:disabled, .secondary-button:disabled, .danger-button:disabled { opacity: .52; cursor: not-allowed; transform: none; box-shadow: none; }
.text-button { padding: 5px 9px; background: transparent; color: var(--teal-dark); }
.primary-button svg, .secondary-button svg, .danger-button svg { width: 17px; }

.stats-grid { display: grid; grid-template-columns: 1.14fr 1fr .9fr; gap: 16px; margin-block-end: 16px; }
.stat-card, .panel { background: var(--surface); border: 1px solid rgba(207,219,230,.86); border-radius: 8px; box-shadow: var(--shadow); }
.stat-card { padding: 18px; min-height: 156px; }
.stat-head, .panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.icon-box { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 7px; }
.icon-box svg { width: 20px; }
.icon-box.blue { color: #326fa5; background: var(--blue-soft); }
.icon-box.teal { color: var(--teal-dark); background: var(--teal-soft); }
.icon-box.coral { color: #bd493e; background: var(--coral-soft); }
.trend { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; }
.trend svg { width: 14px; }
.trend.up { color: var(--teal-dark); }
.trend.neutral { color: var(--muted); }
.stat-card > p { margin: 15px 0 1px; color: var(--muted); font-size: 13px; }
.stat-card > strong { display: block; color: var(--navy); font: 700 28px Manrope, "IBM Plex Sans Arabic", sans-serif; }
.stat-card > small { color: #8592a3; font-size: 11px; }
.dashboard-row { display: grid; gap: 16px; margin-block-end: 16px; }
.split-wide { grid-template-columns: 1.42fr .78fr; }
.split-even { grid-template-columns: 1.05fr .95fr; }
.split-wide.reverse { grid-template-columns: 1.3fr .7fr; }
.panel { padding: 19px; min-width: 0; }
.panel-header { margin-block-end: 16px; }
.north-star-panel { margin-block-end: 16px; }
.north-star-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; margin-block-end: 10px; }
.north-star-row strong { color: var(--navy); font: 700 34px Manrope, "IBM Plex Sans Arabic", sans-serif; }
.north-star-panel p { margin: 0; color: #55677a; font-size: 12px; }
.north-star-panel small { display: block; margin-top: 6px; color: #7c8a98; font-size: 10px; }
.call-state { display: inline-flex; align-items: center; gap: 8px; color: var(--teal-dark); background: var(--teal-soft); padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.call-customer { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-block: 1px solid var(--line); }
.caller-avatar { width: 44px; height: 44px; background: #dce9f5; color: var(--navy); }
.call-customer strong, .call-customer span { display: block; }
.call-customer span { color: var(--muted); font: 12px Manrope, sans-serif; margin-block-start: 2px; }
.call-customer time { margin-inline-start: auto; direction: ltr; color: var(--navy); font: 700 22px Manrope, sans-serif; }
.waveform-wrap { height: 92px; margin: 9px 0 4px; overflow: hidden; }
#waveform { width: 100%; height: 92px; }
.call-signals { display: flex; flex-wrap: wrap; gap: 8px 16px; color: #59697d; font-size: 11px; }
.call-signals span { display: inline-flex; align-items: center; gap: 5px; }
.call-signals svg { width: 14px; color: var(--teal-dark); }
.transcript { margin: 13px 0; padding: 12px 14px; background: #f3f7fa; border-inline-start: 3px solid var(--teal); border-radius: 5px; }
.transcript p { margin: 0; font-size: 12px; color: #506075; }
.transcript p + p { margin-block-start: 7px; }
.transcript b { color: var(--navy); margin-inline-end: 5px; }

.sentiment-panel { display: flex; flex-direction: column; }
.donut { width: 142px; height: 142px; margin: 2px auto 15px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--teal) 0 78%, #f5a76b 78% 95%, #e3e9ef 95% 100%); position: relative; }
.donut::after { content: ""; position: absolute; width: 102px; height: 102px; border-radius: 50%; background: var(--surface); }
.donut span { position: relative; z-index: 1; text-align: center; }
.donut strong, .donut small { display: block; }
.donut strong { color: var(--navy); font: 700 26px Manrope, sans-serif; }
.donut small { color: var(--muted); font-size: 11px; }
.sentiment-bars { display: grid; gap: 8px; }
.sentiment-bars div, .reason-list div { display: grid; grid-template-columns: 88px 1fr; gap: 10px; align-items: center; }
.sentiment-bars span, .reason-list span { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
progress { width: 100%; height: 6px; border: 0; border-radius: 3px; overflow: hidden; background: #e7edf2; accent-color: var(--teal); }
progress::-webkit-progress-bar { background: #e7edf2; }
progress::-webkit-progress-value { background: var(--teal); border-radius: 3px; }
.sentiment-bars div:nth-child(2) progress { accent-color: #f5a76b; }
.sentiment-bars div:nth-child(3) progress { accent-color: var(--coral); }
.sentiment-note { display: flex; gap: 9px; margin-block-start: auto; padding: 11px; color: #59697d; background: var(--teal-soft); border-radius: 6px; }
.sentiment-note svg { flex: 0 0 auto; width: 17px; color: var(--teal-dark); }
.sentiment-note p { margin: 0; font-size: 11px; }
.legend { display: flex; gap: 13px; color: var(--muted); font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend-line { width: 15px; height: 3px; border-radius: 2px; background: var(--teal); }
.legend-line.failed { background: var(--coral); }
#performanceChart { width: 100%; height: 245px; }
.agent-summary { display: grid; grid-template-columns: 1.2fr 1fr .8fr; gap: 8px; margin-block-end: 12px; }
.agent-summary div { padding: 10px; background: #f2f6f9; border-radius: 6px; }
.agent-summary strong, .agent-summary span { display: block; }
.agent-summary strong { color: var(--navy); font: 700 21px Manrope, sans-serif; }
.agent-summary span { color: var(--muted); font-size: 10px; }
.agent-list { list-style: none; padding: 0; margin: 0; }
.agent-list li { display: flex; align-items: center; gap: 9px; padding: 10px 0; border-block-start: 1px solid var(--line); }
.mini-avatar { width: 34px; height: 34px; background: #e5eef7; color: var(--navy); font-size: 11px; }
.agent-list div { flex: 1; }
.agent-list strong, .agent-list small { display: block; }
.agent-list strong { font-size: 12px; }
.agent-list small { color: var(--muted); font-size: 10px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 580px; }
th, td { padding: 11px 9px; text-align: start; border-block-end: 1px solid var(--line); font-size: 11px; white-space: nowrap; }
th { color: #718095; background: #f4f7f9; font-weight: 700; }
td { color: #38485b; }
.direction { display: inline-flex; gap: 5px; align-items: center; font-weight: 600; }
.direction::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.direction.inbound::before { background: var(--teal); }
.direction.outbound::before { background: #3d78aa; }
.pulse-dot { animation: pulse 1.8s ease infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(16,166,160,0); } }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 10px; padding: 10px 0; }
.timeline li + li { border-block-start: 1px solid var(--line); }
.timeline-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--blue-soft); color: #326fa5; }
.timeline-icon.teal { background: var(--teal-soft); color: var(--teal-dark); }
.timeline-icon.coral { background: var(--coral-soft); color: var(--coral); }
.timeline-icon svg { width: 15px; }
.timeline li div { flex: 1; }
.timeline strong, .timeline p, .timeline time { display: block; }
.timeline strong { font-size: 12px; }
.timeline p { margin: 1px 0; color: var(--muted); font-size: 10px; }
.timeline time { color: #98a3b1; font-size: 9px; }

.panel-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .85fr) minmax(0, 1.25fr) auto; gap: 8px; margin-block-end: 12px; }
.panel-input, .panel-select { width: 100%; min-height: 40px; border: 1px solid #cbd7e2; border-radius: 7px; padding: 8px 10px; background: #fff; color: var(--ink); }
.panel-input:focus-visible, .panel-select:focus-visible { outline: 3px solid rgba(16, 166, 160, .28); outline-offset: 1px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.audit-tools { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.compliance-state { margin: 0 0 10px; display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px; border-radius: 999px; font-size: 10px; font-weight: 700; background: #eef3f8; color: #4b5d72; }
.compliance-state[data-state="loading"] { background: rgba(59, 113, 162, .14); color: #2f5f89; }
.compliance-state[data-state="ready"] { background: rgba(16, 166, 160, .14); color: #0e6f6b; }
.compliance-state[data-state="empty"] { background: #eef3f8; color: #4b5d72; }
.compliance-state[data-state="error"] { background: rgba(239, 106, 91, .16); color: #a74439; }
.compliance-state[data-state="permission"] { background: rgba(240, 188, 64, .2); color: #7b5f13; }
.compliance-state[data-state="degraded"] { background: rgba(103, 124, 147, .18); color: #455669; }

.tenant-banner-actions { display: flex; align-items: center; gap: 10px; }
.data-mode-badge { min-height: 28px; display: inline-flex; align-items: center; padding: 4px 10px; border: 1px solid #d6dee7; border-radius: 14px; color: #58697d; background: #f3f6f8; font-size: 10px; font-weight: 700; white-space: nowrap; }
.data-mode-badge[data-mode="demo"] { border-color: #e7c980; color: #6d5311; background: #fff8df; }
.knowledge-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-block-end: 16px; }
.knowledge-summary article { min-height: 108px; display: grid; align-content: center; padding: 16px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.knowledge-summary span { color: var(--muted); font-size: 11px; }
.knowledge-summary strong { color: var(--navy); font: 700 28px Manrope, "IBM Plex Sans Arabic", sans-serif; }
.summary-cell { min-width: 260px; max-width: 420px; white-space: normal; line-height: 1.65; }
.permissions-cell { min-width: 260px; max-width: 440px; white-space: normal; line-height: 1.65; }
.compact-value { font-size: 18px !important; }
.governance-details { display: grid; gap: 10px; margin: 0; }
.governance-details div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block-end: 9px; border-block-end: 1px solid var(--line); }
.governance-details dt { color: var(--muted); font-size: 11px; }
.governance-details dd { margin: 0; color: var(--ink); font-size: 12px; font-weight: 700; text-align: end; }
.evidence-note { display: flex; align-items: flex-start; gap: 8px; margin: 16px 0 0; padding: 11px; border-radius: 6px; color: #53657a; background: var(--teal-soft); font-size: 11px; }
.evidence-note svg { width: 17px; flex: 0 0 auto; color: var(--teal-dark); }
.analytics-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.call-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-block-end: 14px; }
.call-kpi-grid article { min-height: 92px; display: grid; align-content: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.call-kpi-grid span { color: var(--muted); font-size: 11px; }
.call-kpi-grid strong { color: var(--navy); font: 700 25px Manrope, "IBM Plex Sans Arabic", sans-serif; }
.call-workbench-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(150px, .35fr) minmax(280px, .9fr); align-items: end; gap: 12px; margin-block-end: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: rgba(251, 253, 255, .78); }
.call-workbench-toolbar p { display: flex; align-items: flex-start; gap: 7px; margin: 0; padding: 8px 10px; border-radius: 6px; color: #6d5311; background: #fff8df; font-size: 10px; }
.call-workbench-toolbar p svg { width: 16px; flex: 0 0 auto; }
.call-workbench-grid { display: grid; grid-template-columns: minmax(300px, .72fr) minmax(0, 1.28fr); gap: 14px; margin-block-end: 16px; align-items: start; }
.call-queue-panel { padding: 0; overflow: hidden; }
.call-queue-panel > .panel-header { margin: 0; padding: 16px 17px; border-block-end: 1px solid var(--line); }
.call-session-list { max-height: 680px; overflow-y: auto; }
.call-session-item { width: 100%; min-height: 88px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 14px; border: 0; border-block-end: 1px solid var(--line); background: transparent; color: var(--ink); text-align: start; }
.call-session-item:hover { background: #f5f8fa; }
.call-session-item.active { background: #ecf7f6; box-shadow: inset 3px 0 0 var(--teal); }
html[dir="ltr"] .call-session-item.active { box-shadow: inset -3px 0 0 var(--teal); }
.call-session-item > span:nth-child(2) { min-width: 0; }
.call-session-item strong, .call-session-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-session-item strong { font-size: 12px; }
.call-session-item small { color: var(--muted); font-size: 10px; }
.call-session-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 7px; background: #eef2f5; color: #617186; }
.call-session-icon::before { content: "·"; font: 700 20px Manrope, sans-serif; }
.call-session-icon[data-state-marker="ACTIVE"]::before { content: "▶"; font-size: 11px; }
.call-session-icon[data-state-marker="RINGING"]::before { content: "◌"; }
.call-session-icon[data-state-marker="FAILED"]::before { content: "×"; }
.call-session-icon[data-state-marker="ENDED"]::before { content: "✓"; font-size: 14px; }
.call-session-icon[data-state-marker="CANCELLED"]::before { content: "−"; }
.call-session-icon.success { color: var(--teal-dark); background: var(--teal-soft); }
.call-session-icon.busy { color: #bd493e; background: var(--coral-soft); }
.call-session-icon.warning { color: #896511; background: #fff5d8; }
.call-detail-panel { position: sticky; inset-block-start: 88px; min-height: 400px; }
.call-detail-header { padding-block-end: 13px; border-block-end: 1px solid var(--line); }
.call-metadata { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.call-metadata div { min-width: 0; padding: 9px 10px; border-radius: 6px; background: #f3f7fa; }
.call-metadata dt { color: var(--muted); font-size: 9px; }
.call-metadata dd { margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-size: 11px; font-weight: 700; white-space: nowrap; }
.call-eligibility { display: flex; align-items: center; gap: 8px; margin-block-end: 12px; padding: 10px 12px; border-radius: 6px; color: #596b7d; background: #eef3f7; font-size: 11px; font-weight: 700; }
.call-eligibility[data-eligible="true"] { color: var(--teal-dark); background: var(--teal-soft); }
.call-eligibility svg { width: 17px; }
.call-command-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-block-end: 12px; }
.retry-form { display: grid; gap: 8px; margin-block-end: 14px; padding: 12px; border: 1px solid #e7c980; border-radius: 7px; background: #fffaf0; }
.retry-form textarea { width: 100%; min-height: 96px; resize: vertical; border: 1px solid #cbd7e2; border-radius: 6px; padding: 9px 11px; background: #fff; color: var(--ink); font: inherit; }
.retry-form textarea:focus-visible { outline: 3px solid rgba(16, 166, 160, .28); outline-offset: 1px; }
.retry-form > div { display: flex; justify-content: flex-end; gap: 8px; }
.call-detail-section { margin-block-start: 16px; padding-block-start: 14px; border-block-start: 1px solid var(--line); }
.call-detail-section h3 { margin: 0; color: var(--navy); font-size: 14px; }
.call-event-timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 7px; list-style: none; padding: 0; margin: 0; }
.call-event-timeline li { min-width: 0; display: flex; align-items: flex-start; gap: 7px; padding: 9px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafb; }
.call-event-timeline li > span { width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #fff; background: var(--navy); font: 700 9px Manrope, sans-serif; }
.call-event-timeline strong, .call-event-timeline time { display: block; }
.call-event-timeline strong { font-size: 10px; }
.call-event-timeline time { color: var(--muted); font-size: 8px; }
.empty-state.compact { min-height: 180px; }

.module-view { min-height: calc(100dvh - 144px); }
.module-grid, .studio-layout { display: grid; grid-template-columns: 1.25fr .75fr; gap: 16px; }
.empty-state { min-height: 240px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.empty-state svg { width: 44px; height: 44px; color: #97a8ba; margin-block-end: 10px; }
.empty-state strong { color: var(--navy); }
.empty-state p { margin: 4px 0; }
.setting-list { list-style: none; padding: 0; margin: 12px 0 0; }
.setting-list li { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-block-end: 1px solid var(--line); }
.agent-directory { display: grid; grid-template-columns: repeat(3, minmax(210px, 1fr)); gap: 15px; }
.directory-card { padding: 17px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.directory-card header { display: flex; align-items: center; gap: 10px; }
.directory-card header div { flex: 1; }
.directory-card strong, .directory-card small { display: block; }
.directory-card small { color: var(--muted); }
.directory-meta { display: flex; justify-content: space-between; margin-block-start: 16px; padding-block-start: 12px; border-block-start: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.campaign-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) 1fr 54px 72px; align-items: center; gap: 16px; padding: 16px 0; }
.campaign-row + .campaign-row { border-block-start: 1px solid var(--line); }
.campaign-row p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.voice-preview { text-align: center; min-height: 300px; display: grid; place-items: center; align-content: center; }
.voice-preview .icon-box { width: 58px; height: 58px; }
.voice-preview p { max-width: 36ch; color: var(--muted); }
.studio-layout article:nth-child(2), .settings-form { display: grid; align-content: start; gap: 16px; }
label { display: grid; gap: 7px; color: #435368; font-size: 12px; font-weight: 600; }
input[type="text"], select { width: 100%; min-height: 44px; border: 1px solid #cbd7e2; border-radius: 6px; padding: 8px 11px; background: var(--surface); color: var(--ink); }
input[type="range"] { width: 100%; accent-color: var(--teal); }
.reason-list { display: grid; gap: 16px; margin-block-start: 20px; }
.reason-list div { grid-template-columns: 110px 1fr 40px; }
.quality-score { display: flex; align-items: baseline; gap: 7px; margin-block-start: 30px; }
.quality-score strong { font: 700 64px Manrope, sans-serif; color: var(--navy); }
.quality-score span { color: var(--muted); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 14px; background: #f3f7fa; border-radius: 7px; }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row small { color: var(--muted); font-weight: 400; }
.toggle-row input { width: 42px; height: 22px; accent-color: var(--teal); }

.mobile-nav { display: none; }
.toast { position: fixed; inset-inline-start: 24px; inset-block-end: 24px; z-index: 80; max-width: min(360px, calc(100vw - 48px)); padding: 12px 16px; border-radius: 7px; background: var(--navy); color: #fff; box-shadow: var(--shadow); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
dialog { width: min(460px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 8px; padding: 24px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 80px rgba(11,35,65,.24); }
dialog::backdrop { background: rgba(11,35,65,.48); backdrop-filter: blur(3px); }
dialog h2 { margin-block-end: 8px; font-size: 22px; }
dialog p { color: var(--muted); }
.dialog-close.icon-button { position: absolute; inset-block-start: 12px; inset-inline-start: 12px; }
.dialog-actions { margin-block-start: 20px; }
#callForm { display: grid; gap: 14px; margin-block-start: 18px; }
#tenantLinkForm { display: grid; gap: 14px; margin-block-start: 18px; }
.review-summary { margin-block: 14px 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #f6f9fb; }
.review-summary p { margin: 0; }
.review-summary p + p { margin-block-start: 6px; }

@media (max-width: 1120px) {
  :root { --sidebar: 226px; }
  .split-wide, .split-wide.reverse { grid-template-columns: 1.2fr .8fr; }
  .agent-directory { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .workspace { margin-inline-start: 0; }
  .topbar { padding: 0 18px; }
  .search-wrap { flex: 1; width: auto; min-width: 0; }
  .top-actions { flex: 0 0 auto; }
  .profile-button > span:not(.avatar), .profile-button > svg, .search-wrap kbd { display: none; }
  .search-wrap { width: 100%; }
  main { padding: 20px 16px 92px; }
  .stats-grid { grid-template-columns: 1.15fr .85fr; }
  .stat-card:last-child { grid-column: 1 / -1; min-height: 130px; }
  .split-wide, .split-even, .split-wide.reverse, .module-grid, .studio-layout { grid-template-columns: 1fr; }
  .call-workbench-grid { grid-template-columns: 1fr; }
  .call-detail-panel { position: static; }
  .mobile-nav { position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 40; height: 68px; display: grid; grid-template-columns: repeat(6, minmax(62px, 1fr)); overflow-x: auto; background: rgba(251,253,255,.97); border-block-start: 1px solid var(--line); box-shadow: 0 -8px 26px rgba(11,35,65,.08); backdrop-filter: blur(12px); }
  .mobile-nav button { display: grid; place-items: center; align-content: center; gap: 2px; border: 0; background: transparent; color: #718095; font-size: 10px; }
  .mobile-nav button.active { color: var(--teal-dark); }
  .mobile-nav svg { width: 19px; }
}

@media (max-width: 560px) {
  .topbar { height: 64px; gap: 8px; padding: 0 12px; }
  .top-actions { gap: 4px; }
  #helpButton { display: none; }
  .profile-button { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; justify-content: space-between; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card:last-child { grid-column: auto; }
  .panel, .stat-card { padding: 15px; }
  .call-customer time { font-size: 18px; }
  .call-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .agent-directory { grid-template-columns: 1fr; }
  .campaign-row { grid-template-columns: 1fr 60px; }
  .campaign-row progress { grid-column: 1 / -1; }
  .campaign-row .status-chip { grid-column: 2; grid-row: 1; }
  .legend { display: none; }
  .panel-tools { grid-template-columns: 1fr; }
  .panel-tools .text-button { width: 100%; }
  .north-star-row { grid-template-columns: 1fr; }
  .call-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .call-workbench-toolbar { grid-template-columns: 1fr; }
  .call-metadata { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .call-event-timeline { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Provider SaaS layer */
.context-switch { display: inline-flex; gap: 4px; padding: 4px; background: #f1f5f8; border: 1px solid var(--line); border-radius: 9px; }
.context-switch button { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: 600 13px "IBM Plex Sans Arabic", sans-serif; cursor: pointer; }
.context-switch button svg { width: 16px; }
.context-switch button.active { background: var(--navy); color: #f8fbff; box-shadow: var(--shadow); }
.context-switch button:hover:not(.active) { color: var(--ink); }

.tenant-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-block-end: 20px; padding: 12px 18px; background: var(--teal-soft); border: 1px solid #bfe6e3; border-radius: 10px; }
.tenant-banner > div { display: flex; align-items: center; gap: 8px; color: var(--teal-dark); font-size: 14px; }
.tenant-banner svg { width: 18px; }
.tenant-banner strong { color: var(--ink); }

.accounts-directory { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.account-card { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.account-card header { display: flex; align-items: center; gap: 10px; margin-block-end: 14px; }
.account-card header div { flex: 1; }
.account-card strong, .account-card small { display: block; }
.account-card small { color: var(--muted); }
.account-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 16px; }
.account-meta div { padding: 10px; background: var(--page); border-radius: 7px; text-align: center; }
.account-meta dt { color: var(--muted); font-size: 11px; }
.account-meta dd { margin: 4px 0 0; font-weight: 700; }
.account-actions { display: flex; gap: 8px; }
.account-actions .primary-button, .account-actions .secondary-button { flex: 1; justify-content: center; }
.compliance-grid { margin-block-start: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }


@media (max-width: 860px) {
  .context-switch button span { display: none; }
  .context-switch button { padding: 0 10px; }
}
@media (max-width: 560px) {
  .context-switch { display: none; }
  .tenant-banner { flex-direction: column; align-items: stretch; }
  .tenant-banner > .tenant-banner-actions { align-items: stretch; flex-direction: column; }
  .knowledge-summary, .analytics-stats { grid-template-columns: 1fr; }
  .account-actions { flex-direction: column; }
}
