:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e3e6eb;
  --text: #16181d;
  --muted: #646b78;
  --accent: #2f5bea;
  --accent-text: #ffffff;
  --talking: #13804f;
  --talking-bg: #e3f5ec;
  --ringing: #a85d00;
  --ringing-bg: #fff2dc;
  --hold: #c2362b;
  --hold-bg: #fde8e6;
  --dialing: #2f5bea;
  --dialing-bg: #e6ecfd;
  --idle: #8a919e;
  --warn-ring: #c2362b;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1d2128;
    --border: #2a2f38;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --accent: #6e8cff;
    --accent-text: #0f1115;
    --talking: #4cc98b;
    --talking-bg: #15301f;
    --ringing: #f0a948;
    --ringing-bg: #33260f;
    --hold: #f07268;
    --hold-bg: #3a1a18;
    --dialing: #7d9aff;
    --dialing-bg: #1b2440;
    --idle: #6b7280;
    --warn-ring: #f07268;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a20;
  --surface-2: #1d2128;
  --border: #2a2f38;
  --text: #e8eaee;
  --muted: #9aa1ad;
  --accent: #6e8cff;
  --accent-text: #0f1115;
  --talking: #4cc98b;
  --talking-bg: #15301f;
  --ringing: #f0a948;
  --ringing-bg: #33260f;
  --hold: #f07268;
  --hold-bg: #3a1a18;
  --dialing: #7d9aff;
  --dialing-bg: #1b2440;
  --idle: #6b7280;
  --warn-ring: #f07268;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: 18px; }
h2 { font-size: 15px; }
.muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* The system's name, first in every page's top bar (added by session.js) */
.app-mark { direction: ltr; font-weight: 800; font-size: 19px; letter-spacing: -.3px; color: var(--text); text-decoration: none; padding-inline-end: 10px; border-inline-end: 1px solid var(--border); }
.app-mark span span, .wb-mark > span { color: var(--accent); }
.app-mark { display: inline-flex; align-items: center; gap: 10px; }
.tabs { display: flex; gap: 4px; margin-inline-start: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.tabs a { padding: 5px 12px; border-radius: 7px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 13.5px; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.tab-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-inline-start: 4px; border-radius: 999px; background: var(--sev-serious); color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; }
.tab-count[hidden] { display: none; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--hold); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.supervisor { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.supervisor input { width: 90px; }
input, select {
  font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; min-height: 34px;
}
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.conn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border);
}
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }
.conn[data-status="connected"]::before { background: var(--talking); }
.conn[data-status="connecting"]::before { background: var(--ringing); }
.conn[data-status="error"]::before, .conn[data-status="disconnected"]::before { background: var(--hold); }
.icon-btn {
  font: inherit; font-size: 16px; width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}

main { padding: 16px 20px 32px; max-width: 1600px; margin: 0 auto; }

/* Department scope */
.scope { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.scope label { font-weight: 600; }
.scope select { min-width: 200px; max-width: 100%; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 12.5px; }
.kpi .value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi.warn .value { color: var(--hold); }
.kpi.has-pop { position: relative; cursor: default; }
.kpi.has-pop .value { text-decoration: underline dotted var(--muted); text-underline-offset: 6px; }
.kpi-pop {
  display: none; position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 20;
  width: max-content; min-width: 240px; max-width: min(340px, 90vw); max-height: 360px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); padding: 10px 12px; font-size: 13px;
}
.kpi-pop.flip { inset-inline-start: auto; inset-inline-end: 0; }
.kpi.has-pop:hover .kpi-pop, .kpi.has-pop:focus-within .kpi-pop { display: block; }
.kpi-pop .pop-title { font-weight: 600; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.kpi-pop .pop-group {
  display: flex; justify-content: space-between; font-weight: 600; font-size: 12.5px;
  margin: 10px 0 4px; padding-bottom: 3px; border-bottom: 1px solid var(--border);
}
.kpi-pop .pop-title + .pop-group { margin-top: 0; }
.kpi-pop ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.kpi-pop li { display: flex; justify-content: space-between; gap: 12px; }
.kpi-pop li .ltr { font-variant-numeric: tabular-nums; }
.kpi-pop li.hot > .ltr { color: var(--hold); font-weight: 600; }
.kpi .kpi-pop { color: var(--text); font-weight: 400; }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } }
.side { display: grid; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.count { color: var(--muted); font-weight: 500; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input { width: 210px; }

/* Calls */
.calls { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.empty { color: var(--muted); padding: 28px 8px; text-align: center; grid-column: 1 / -1; }
.call {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
  border-inline-start: 4px solid var(--c, var(--idle));
}
.call[data-status="Talking"] { --c: var(--talking); --cbg: var(--talking-bg); }
.call[data-status="Ringing"] { --c: var(--ringing); --cbg: var(--ringing-bg); }
.call[data-status="Hold"] { --c: var(--hold); --cbg: var(--hold-bg); }
.call[data-status="Dialing"] { --c: var(--dialing); --cbg: var(--dialing-bg); }
.call.warn { box-shadow: 0 0 0 2px var(--warn-ring) inset; }
.call.flash { box-shadow: 0 0 0 3px var(--accent); transition: box-shadow .3s; }
.call-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; color: var(--c); background: var(--cbg); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.call[data-status="Ringing"] .badge .dot { animation: pulse 1s infinite; }
.dir { color: var(--muted); font-size: 12.5px; }
.caller .phone { font-size: 20px; font-weight: 700; letter-spacing: .3px; }
.caller .name { color: var(--muted); min-height: 1.45em; }
.agent-line { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.agent-line .ext { color: var(--muted); font-weight: 400; }
.timers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.timer { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.timer .t-label { font-size: 11.5px; color: var(--muted); }
.timer .t-val { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; text-align: right; }
.timer.hot .t-val { color: var(--hold); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.meta b { color: var(--text); font-weight: 500; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn {
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
  border-radius: 8px; padding: 7px 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.notice {
  margin-bottom: 16px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--ringing-bg); color: var(--text); border: 1px solid var(--border);
}
.notice a { color: var(--accent); font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:not(:disabled):hover { filter: brightness(1.06); }
.manual { font-size: 12px; color: var(--muted); margin-inline-start: auto; }

/* Agents */
.agents { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 420px; overflow: auto; }
.agent { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 7px 6px; border-radius: 8px; }
.agent:hover { background: var(--surface-2); }
.agent .sdot { width: 9px; height: 9px; border-radius: 50%; background: var(--idle); }
.agent[data-state="talking"] .sdot { background: var(--talking); }
.agent[data-state="ringing"] .sdot { background: var(--ringing); }
.agent[data-state="hold"] .sdot { background: var(--hold); }
.agent[data-state="available"] .sdot { background: var(--dialing); }
.agent .aname { font-weight: 500; }
.agent .asub { font-size: 12px; color: var(--muted); }
.agent .atime { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; direction: ltr; }

/* Queues */
.queue { border-top: 1px solid var(--border); padding: 8px 0; }
.queue:first-child { border-top: 0; padding-top: 0; }
.queue-head { display: flex; justify-content: space-between; font-weight: 500; }
.queue ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }
.queue li { display: flex; justify-content: space-between; font-size: 13px; }
.queue li .w { font-variant-numeric: tabular-nums; direction: ltr; }
.queue li.hot .w { color: var(--hold); font-weight: 600; }
.queue.has-wait { border-inline-start: 3px solid var(--ringing); padding-inline-start: 8px; }
.queue .wait-count { color: var(--ringing); font-weight: 600; }
.queue-today { font-size: 12px; color: var(--muted); margin-top: 2px; }
.queue-today b { color: var(--text); font-weight: 600; }
.queue-today .miss { color: var(--hold); }
.call-badges { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tier { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }

/* Sentiment (VC-AI) */
.senti { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.senti b { font-size: 9px; }
.senti-positive { color: var(--talking); background: var(--talking-bg); }
.senti-neutral { color: var(--muted); background: var(--surface-2); border-color: var(--border); }
.senti-negative { color: var(--hold); background: var(--hold-bg); }
.senti-none { color: var(--muted); }
.senti-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.kpi-pop li:has(.senti-line) { align-items: flex-start; }
.ai-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-height: 420px; overflow: auto; font-size: 13px; }
.ai-list li { display: grid; gap: 3px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.ai-list li:last-child { border-bottom: 0; }
.ai-head { display: flex; justify-content: space-between; gap: 8px; }
.ai-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-traits { font-size: 12px; }

/* Log */
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 360px; overflow: auto; font-size: 13px; }
.log li { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; direction: ltr; }

/* Segmented toggle + text button (shared) */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: var(--surface-2); }
.seg button { font: inherit; font-size: 13px; border: 0; background: transparent; color: var(--muted); padding: 4px 12px; border-radius: 6px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.link-btn { background: transparent; border-color: transparent; color: var(--accent); padding-inline: 4px; }

/* Alerts: severity always shows an icon + word, never color alone */
:root { --sev-critical: var(--hold); --sev-critical-bg: var(--hold-bg); --sev-serious: var(--ringing); --sev-serious-bg: var(--ringing-bg); --sev-warning: var(--muted); --sev-warning-bg: var(--surface-2); }
.alert-wrap { position: relative; }
.alert-bell { position: relative; display: inline-grid; place-items: center; }
.alert-bell[data-sev="critical"] { color: var(--sev-critical); border-color: var(--sev-critical); }
.alert-bell[data-sev="serious"] { color: var(--sev-serious); border-color: var(--sev-serious); }
.alert-count {
  position: absolute; top: -6px; inset-inline-end: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--sev-critical); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.alert-bell:not([data-sev="critical"]) .alert-count { background: var(--sev-serious); }
.alert-panel {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 30;
  width: min(440px, calc(100vw - 32px)); max-height: min(70vh, 620px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .2); padding: 12px;
}
.alert-panel-head { margin-bottom: 10px; }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert-item, .alert-card { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); border-inline-start: 4px solid var(--c); background: var(--surface-2); cursor: pointer; }
.alert-item { grid-template-columns: auto 1fr; align-items: start; gap: 10px; }
.alert-item:hover, .alert-item:focus-visible { background: var(--bg); }
.alert-item.resolved { opacity: .75; --c: var(--border) !important; }
.sev-critical { --c: var(--sev-critical); --cbg: var(--sev-critical-bg); }
.sev-serious { --c: var(--sev-serious); --cbg: var(--sev-serious-bg); }
.sev-warning { --c: var(--sev-warning); --cbg: var(--sev-warning-bg); }
.sev-badge { display: inline-flex; align-items: center; gap: 4px; justify-self: start; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; color: var(--c); background: var(--cbg); white-space: nowrap; }
.sev-badge b { font-size: 10px; }
.alert-title { font-weight: 600; }
.alert-detail { font-size: 13px; color: var(--text); }
.alert-time { font-size: 12px; }
.alert-empty { color: var(--muted); padding: 18px 4px; text-align: center; }
.alert-stack { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 40; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.alert-card { position: relative; background: var(--surface); box-shadow: 0 10px 28px rgba(0, 0, 0, .22); animation: alert-in .2s ease-out; padding-inline-end: 32px; }
.alert-close { position: absolute; top: 6px; inset-inline-end: 6px; border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px; }
@keyframes alert-in { from { transform: translateY(8px); opacity: 0; } }
/* A critical pop-up flashes (red glow and tint) for the minute it stays */
.alert-card.flash { animation: alert-in .2s ease-out, alert-flash 1s ease-in-out .2s infinite; }
@keyframes alert-flash { 0%, 100% { box-shadow: 0 10px 28px rgba(0, 0, 0, .22), 0 0 0 0 rgba(200, 22, 29, 0); background: var(--surface); } 50% { box-shadow: 0 10px 28px rgba(0, 0, 0, .22), 0 0 0 5px rgba(200, 22, 29, .45); background: var(--hold-bg); } }
@media (prefers-reduced-motion: reduce) { .alert-card.flash { animation: none; border-color: var(--hold); } }
.alert-recent-title { font-size: 12.5px; font-weight: 600; padding: 4px 4px 6px; border-top: 1px solid var(--border); }
.alert-empty + .alert-recent-title { margin-top: 0; }
.alert-settings { display: grid; gap: 10px; font-size: 13.5px; }
.set-title { font-weight: 600; margin-top: 4px; }
.set-row { display: flex; align-items: flex-start; gap: 8px; line-height: 2; }
.set-row input[type="checkbox"] { margin-top: 8px; flex: none; }
.alert-num { width: 64px; min-height: 28px; padding: 2px 6px; text-align: center; }
.set-note { font-size: 12px; }
.tier-set { width: 100%; border-collapse: collapse; font-size: 13px; }
.tier-set th { text-align: start; font-weight: 500; color: var(--muted); font-size: 12px; padding: 2px 4px; }
.tier-set td { padding: 3px 4px; border-top: 1px solid var(--border); }

/* `hidden` always wins over a component's display rule */
[hidden] { display: none !important; }

/* Logged-in user menu */
.user-wrap { position: relative; }
.user-btn { font: inherit; display: inline-flex; align-items: center; gap: 8px; padding: 3px 10px 3px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.user-avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 13px; }
.user-text { display: grid; line-height: 1.15; text-align: start; }
.user-text b { font-size: 12.5px; font-weight: 600; }
.user-text span { font-size: 11px; color: var(--muted); }
.user-menu { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 30; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .18); padding: 6px; display: grid; }
.user-menu a, .user-menu button { font: inherit; font-size: 13.5px; text-align: start; padding: 7px 10px; border-radius: 7px; border: 0; background: none; color: var(--text); text-decoration: none; cursor: pointer; }
.user-menu a:hover, .user-menu button:hover { background: var(--surface-2); }
.user-scope { font-size: 12px; padding: 6px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; max-width: 280px; }
@media (max-width: 600px) { .user-text { display: none; } }
/* Admin-only controls */
html:not(.is-admin) .admin-only { display: none !important; }

/* Toast */
.toast {
  position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  max-width: min(92vw, 520px); box-shadow: 0 6px 20px rgba(0,0,0,.2); z-index: 10;
}
.toast.error { background: var(--hold); color: #fff; }

/* The InterCall owl (Owl.svg in shell.js): blink, listen (live calls), look (loading), tilt (nothing to show) */
.owl { display: block; overflow: visible; }
.owl .owl-eye, .owl .owl-body, .owl .owl-waves path { transform-box: fill-box; transform-origin: center; }
.owl .owl-waves path { fill: none; stroke: #c8161d; stroke-width: 1.8; stroke-linecap: round; opacity: 0; }
.owl-blink .owl-eye { animation: owl-blink 4s infinite; }
@keyframes owl-blink { 0%, 44%, 52%, 100% { transform: scaleY(1); } 48% { transform: scaleY(.08); } }
.owl-listen .owl-waves path { animation: owl-wave 1.6s infinite ease-out; }
.owl-listen .owl-waves .w2 { animation-delay: .8s; }
@keyframes owl-wave { 0% { opacity: .9; transform: scale(.6); } 100% { opacity: 0; transform: scale(1.25); } }
.owl-listen .owl-body { transform-origin: 50% 100%; animation: owl-bob 1.6s infinite ease-in-out; }
@keyframes owl-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.2px); } }
.owl-look .owl-pupil { animation: owl-look 3.2s infinite ease-in-out; }
@keyframes owl-look { 0%, 15%, 85%, 100% { transform: translateX(0); } 30%, 45% { transform: translateX(-3.2px); } 60%, 75% { transform: translateX(3.2px); } }
.owl-tilt .owl-body { transform-origin: 50% 95%; animation: owl-tilt 3s infinite ease-in-out; }
@keyframes owl-tilt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-9deg); } 60% { transform: rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .owl, .owl * { animation: none !important; } }
/* An owl with a line of text, for loading and empty places */
.owl-state { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 28px 12px; color: var(--muted); }
.owl-state .owl { width: 64px; height: 64px; }

@media (max-width: 600px) {
  .topbar { padding: 10px 16px; }
  main { padding: 12px 16px 24px; }
  .calls { grid-template-columns: 1fr; }
  .filters input { width: 100%; }
  .filters { width: 100%; }
}

/* An admin viewing the system as another user: a floating bar on every page, with the way back */
.view-as-bar {
  position: fixed; z-index: 2000; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px; border-radius: 14px;
  background: var(--ringing-bg); color: var(--text); border: 2px solid var(--ringing);
  box-shadow: 0 8px 24px rgba(16, 24, 40, .18); font-size: 14px;
}
.view-as-bar .va-eye { font-size: 18px; }
.view-as-bar .va-text { line-height: 1.4; }
.view-as-bar .va-ro { display: inline-block; margin-inline-start: 6px; padding: 1px 8px; border-radius: 99px; background: var(--ringing); color: #fff; font-size: 12px; font-weight: 600; }
.view-as-bar .va-exit { flex: none; font-weight: 600; }
@media (max-width: 640px) { .view-as-bar { flex-wrap: wrap; bottom: 8px; } }
