/* ══════════════════════════════════════════════════════════════════════════
   AGENT PORTAL — MULTI-THEME STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Theme Variables ──────────────────────────────────────────────────────── */
:root,
[data-theme="crystal"] {
  --bg:        #F2F2F7;
  --bg2:       #E5E5EA;
  --card:      #FFFFFF;
  --card2:     #F9F9FB;
  --text:      #1C1C1E;
  --text2:     #636366;
  --text3:     #AEAEB2;
  --primary:   #007AFF;
  --primary-d: #0062CC;
  --success:   #34C759;
  --danger:    #FF3B30;
  --warn:      #FF9500;
  --border:    rgba(0,0,0,.1);
  --shadow:    0 1px 4px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
  --topbar-bg: rgba(255,255,255,.88);
  --topbar-border: rgba(0,0,0,.1);
  --input-bg:  #FFFFFF;
  --radius:    12px;
  --radius-sm: 8px;
}

[data-theme="midnight"] {
  --bg:        #000000;
  --bg2:       #1C1C1E;
  --card:      #2C2C2E;
  --card2:     #3A3A3C;
  --text:      #FFFFFF;
  --text2:     #ABABAB;
  --text3:     #636366;
  --primary:   #0A84FF;
  --primary-d: #0070D9;
  --success:   #30D158;
  --danger:    #FF453A;
  --warn:      #FF9F0A;
  --border:    rgba(255,255,255,.12);
  --shadow:    0 1px 4px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.35);
  --topbar-bg: rgba(28,28,30,.97);
  --topbar-border: rgba(255,255,255,.1);
  --input-bg:  #3A3A3C;
  --radius:    12px;
  --radius-sm: 8px;
}

[data-theme="graphite"] {
  --bg:        #181818;
  --bg2:       #222222;
  --card:      #2A2A2A;
  --card2:     #333333;
  --text:      #E8E8E8;
  --text2:     #ABABAB;
  --text3:     #707070;
  --primary:   #6E9BF5;
  --primary-d: #5580D4;
  --success:   #4CD964;
  --danger:    #FF6B6B;
  --warn:      #FFB340;
  --border:    rgba(255,255,255,.09);
  --shadow:    0 1px 4px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.35);
  --topbar-bg: rgba(22,22,22,.97);
  --topbar-border: rgba(255,255,255,.08);
  --input-bg:  #333333;
  --radius:    10px;
  --radius-sm: 6px;
}

[data-theme="ocean"] {
  --bg:        #0A1628;
  --bg2:       #0F2040;
  --card:      #142B52;
  --card2:     #1A3566;
  --text:      #E0F0FF;
  --text2:     #8BB8E8;
  --text3:     #4A7AAE;
  --primary:   #40BFFF;
  --primary-d: #00A0E8;
  --success:   #00CFA8;
  --danger:    #FF6060;
  --warn:      #FFAA30;
  --border:    rgba(64,191,255,.15);
  --shadow:    0 1px 4px rgba(0,0,0,.5), 0 4px 20px rgba(0,40,80,.4);
  --topbar-bg: rgba(8,18,36,.97);
  --topbar-border: rgba(64,191,255,.15);
  --input-bg:  #1A3566;
  --radius:    12px;
  --radius-sm: 8px;
}

[data-theme="forest"] {
  --bg:        #0B1C0B;
  --bg2:       #112611;
  --card:      #183018;
  --card2:     #1F3D1F;
  --text:      #D8F5D8;
  --text2:     #90C890;
  --text3:     #507050;
  --primary:   #5EC96A;
  --primary-d: #46AB52;
  --success:   #4CD964;
  --danger:    #FF6060;
  --warn:      #FFBB40;
  --border:    rgba(94,201,106,.15);
  --shadow:    0 1px 4px rgba(0,0,0,.5), 0 4px 20px rgba(0,20,0,.4);
  --topbar-bg: rgba(8,22,8,.97);
  --topbar-border: rgba(94,201,106,.15);
  --input-bg:  #1F3D1F;
  --radius:    12px;
  --radius-sm: 8px;
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  height: 100dvh;   /* dynamic viewport height — excludes the mobile URL bar so bottom controls stay reachable */
  overflow: hidden;
  transition: background .25s, color .25s;
}

/* ── Login ────────────────────────────────────────────────────────────────── */
.v-login {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; background: var(--bg);
}

.login-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 40px 36px; width: 100%; max-width: 380px;
}

.login-brand { text-align: center; margin-bottom: 28px; }
.login-icon  { font-size: 48px; margin-bottom: 12px; }
.login-brand h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-brand p  { font-size: 13px; color: var(--text2); margin-top: 4px; }

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--text2); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .05em;
}

input[type=text], input[type=tel], input[type=password], select, textarea {
  display: block; width: 100%;
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 14px;
  outline: none; transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.alert-err {
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 12px; margin-top: 8px;
}

/* ── Top Bar ──────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 12px;
  height: 54px; padding: 0 16px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}

.topbar-brand {
  font-size: 15px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.topbar-center { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: center; }
.topbar-right  { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.tb-ext-wrap { font-size: 12px; color: var(--text2); }
.tb-name     { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }

.status-chip {
  display: inline-flex; align-items: center;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip-offline     { background: color-mix(in srgb,var(--text3) 20%,transparent); color: var(--text3); }
.chip-ready       { background: color-mix(in srgb,var(--success) 20%,transparent); color: var(--success); }
.chip-break       { background: color-mix(in srgb,var(--warn) 20%,transparent); color: var(--warn); }
.chip-on-call     { background: color-mix(in srgb,var(--primary) 20%,transparent); color: var(--primary); }
.chip-wrap        { background: color-mix(in srgb,var(--warn) 20%,transparent); color: var(--warn); }
.chip-pending-dial{ background: color-mix(in srgb,var(--primary) 20%,transparent); color: var(--primary); animation: pulse 1.2s infinite; }

.sip-chip {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  border: 1px solid currentColor;
}
.chip-reg    { color: var(--success); }
.chip-unreg  { color: var(--text3); }
.chip-reg-ng { color: var(--danger); }

/* ── Network / internet badge ─────────────────────────────────────────────── */
.net-chip {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  border: 1px solid currentColor;
}
.net-good    { color: var(--success); }
.net-ok      { color: var(--warn); }
.net-bad     { color: var(--danger); }
.net-offline { color: #fff; background: var(--danger); border-color: var(--danger); animation: pulse 1.2s infinite; }

/* ── Active campaign chip (topbar) ────────────────────────────────────────── */
.camp-chip {
  display: inline-flex; align-items: center;
  max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}
.camp-chip.camp-chip-paused { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }

/* ── Theme Picker ─────────────────────────────────────────────────────────── */
.theme-wrap { position: relative; }

.btn-icon {
  background: none; border: none; cursor: pointer;
  font-size: 18px; padding: 4px 6px; border-radius: 6px; color: var(--text2);
  transition: background .15s;
}
.btn-icon:hover { background: var(--border); }

.theme-picker-drop {
  display: none; position: absolute; right: 0; top: 36px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 10px 12px; gap: 8px; z-index: 300;
}
.theme-picker-drop.open { display: flex; flex-direction: column; gap: 10px; min-width: 210px; }

.tp-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text3); margin: 2px 0 -2px;
}
.tp-dots-row { display: grid; grid-template-columns: repeat(5, 26px); gap: 8px; }
.tp-divider { height: 1px; background: var(--border); margin: 2px 0; }

.theme-dot {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; transition: transform .15s, border-color .15s;
}
.theme-dot:hover { transform: scale(1.2); border-color: var(--text3); }
.theme-dot.theme-dot-active { border-color: var(--text); box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--text3); }

/* ── Main Layout ──────────────────────────────────────────────────────────── */
.main-layout {
  display: grid;
  grid-template-columns: 228px 1fr 236px;
  height: calc(100vh - 54px);
  height: calc(100dvh - 54px);
  overflow: hidden;
}

.panel-left, .panel-right {
  overflow-y: auto; padding: 12px;
  background: var(--bg2);
  display: flex; flex-direction: column; gap: 8px;
}
.panel-left  { border-right: 1px solid var(--border); }
.panel-right { border-left:  1px solid var(--border); }

.panel-center {
  overflow-y: auto; padding: 24px 20px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px;
}
.card.h-full { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }

.card-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text2); margin-bottom: 10px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 5px; padding: 8px 14px;
  border-radius: var(--radius-sm); border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .1s, background .15s; white-space: nowrap;
}
.btn:active  { transform: scale(.97); }
.btn:disabled{ opacity: .4; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-d); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { opacity: .88; }

.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled)  { opacity: .88; }

.btn-secondary { background: var(--card2); color: var(--text); border: 1px solid var(--border); }

.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: color-mix(in srgb,var(--border) 60%,transparent); }

/* Start Campaign is the primary action when idle — give it a tinted, bold look so
   it stands out from the neutral Manual Dial / Break buttons. */
.btn-ready   { background: color-mix(in srgb,var(--success) 12%,var(--card2)); color: var(--success); border: 1px solid color-mix(in srgb,var(--success) 45%,transparent); font-weight: 700; }
.btn-pause   { background: var(--card2); color: var(--text2); border: 1px solid var(--border); }
.btn-brk     { background: var(--card2); color: var(--text2); border: 1px solid var(--border); }
.status-hint { font-size: 12px; color: var(--text); margin-top: 6px; text-align: center; min-height: 16px; line-height: 1.4; }
.btn-ready.btn-active  { background: var(--success); color: #fff; border-color: var(--success); font-weight: 700; }
.btn-pause.btn-active  { background: var(--primary);  color: #fff; border-color: var(--primary);  font-weight: 700; }
.btn-brk.btn-active    { background: var(--warn);     color: #fff; border-color: var(--warn);     font-weight: 700; }
.btn-ready:not(.btn-active):hover:not(:disabled) { color: var(--success); border-color: color-mix(in srgb,var(--success) 40%,transparent); }
.btn-pause:not(.btn-active):hover:not(:disabled) { color: var(--primary);  border-color: color-mix(in srgb,var(--primary)  40%,transparent); }
.btn-brk:not(.btn-active):hover:not(:disabled)   { color: var(--warn);    border-color: color-mix(in srgb,var(--warn)    40%,transparent); }
.btn-warning { background: color-mix(in srgb,var(--warn) 18%,transparent);    color: var(--warn);    border: 1px solid color-mix(in srgb,var(--warn) 35%,transparent); font-weight:600; }
.btn-warning:hover:not(:disabled) { background: color-mix(in srgb,var(--warn) 30%,transparent); }

.btn-topbar {
  background: var(--card2); border: 1px solid var(--border);
  color: var(--text); padding: 5px 10px;
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; cursor: pointer;
}
.btn-topbar:hover { opacity: .8; }
.btn-fresh { color: #34c759 !important; }

.btn-icon-sm {
  background: none; border: none; cursor: pointer;
  color: var(--text2); font-size: 14px; padding: 2px 6px; border-radius: 4px;
}
.btn-icon-sm:hover { background: var(--border); }

.w100  { width: 100%; }
.mt6   { margin-top: 6px; }
.mt8   { margin-top: 8px; }
.mt12  { margin-top: 12px; }
.mt16  { margin-top: 16px; }
.mb14  { margin-bottom: 14px; }

/* ── Status Buttons ───────────────────────────────────────────────────────── */
.status-btns { display: flex; gap: 6px; }
.status-btns .btn { flex: 1; font-size: 12px; padding: 7px 8px; }

/* ── Form Inputs ──────────────────────────────────────────────────────────── */
.inp-field { font-size: 13px; padding: 8px 11px; margin-top: 0; }
.sel       { font-size: 13px; padding: 8px 11px; }
.mt6 input { margin-top: 6px; }

.err-msg { color: var(--danger); font-size: 12px; margin-top: 5px; }

/* ── Campaign List ────────────────────────────────────────────────────────── */
.campaign-list {
  max-height: 150px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card);
}
.campaign-list:empty::before { content: 'No campaigns assigned'; display: block; padding: 10px; font-size: 12px; color: var(--text2); text-align: center; }
.camp-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px; user-select: none; transition: background .1s;
}
.camp-item:last-child { border-bottom: none; }
.camp-item:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.camp-item.camp-selected { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.camp-check {
  width: 16px; height: 16px; flex-shrink: 0;
  border-radius: 4px; border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; background: var(--card2);
  transition: all .1s;
}
.camp-item.camp-selected .camp-check { background: var(--primary); color: #fff; border-color: var(--primary); }
.camp-item.camp-disabled { opacity: .45; pointer-events: none; }
.camp-name { flex: 1; font-weight: 500; }
.camp-mode-badge { font-size: 10px; color: var(--text2); background: var(--card2); padding: 1px 6px; border-radius: 99px; white-space: nowrap; }

/* Read-only campaign list (selection happens in the Start Campaign picker) */
.camp-item.camp-ro { cursor: default; flex-wrap: wrap; }
.camp-item.camp-ro:hover { background: none; }
.camp-item.camp-ro.camp-selected { background: color-mix(in srgb, var(--primary) 12%, transparent); }

/* Campaign progress bar (dialed / total) */
.camp-prog { flex-basis: 100%; display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.camp-prog-bar { flex: 1; height: 5px; border-radius: 99px; background: var(--card2); overflow: hidden; }
.camp-prog-fill { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }
.camp-prog-txt { font-size: 10px; font-weight: 600; color: var(--text2); white-space: nowrap; min-width: 44px; text-align: right; }

/* ── Info Rows ────────────────────────────────────────────────────────────── */
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}
.info-row:last-child { border-bottom: none; }
.ir-key { color: var(--text2); }

/* ── Mic Warning ──────────────────────────────────────────────────────────── */
.mic-warn {
  background: color-mix(in srgb,var(--danger) 15%,transparent);
  border: 1px solid color-mix(in srgb,var(--danger) 30%,transparent);
  color: var(--danger); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 11px; text-align: center;
}

/* ── Preview Lead ─────────────────────────────────────────────────────────── */
.prev-number {
  font-size: 20px; font-weight: 700; color: var(--text);
  letter-spacing: .02em; margin-bottom: 2px;
}
.prev-name { font-size: 13px; color: var(--text2); margin-bottom: 8px; }

.prev-fields { max-height: 180px; overflow-y: auto; }

.pf-row {
  display: flex; gap: 8px; padding: 4px 0;
  border-bottom: 1px solid var(--border); font-size: 12px;
}
.pf-row:last-child { border-bottom: none; }
.pf-key { color: var(--text2); min-width: 72px; flex-shrink: 0; }
.pf-val { color: var(--text); word-break: break-word; }
.pf-warn .pf-key, .pf-warn .pf-val { color: var(--warn); }

/* ── Wrap ─────────────────────────────────────────────────────────────────── */
.wrap-clock {
  font-size: 34px; font-weight: 800; text-align: center;
  color: var(--warn); letter-spacing: .02em; margin: 4px 0;
}

/* ── State Boxes ──────────────────────────────────────────────────────────── */
.state-box {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  width: 100%; max-width: 440px;
  padding: 48px 32px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

.state-icon  { font-size: 60px; margin-bottom: 18px; line-height: 1; }
.state-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.state-sub   { font-size: 13px; color: var(--text2); max-width: 300px; line-height: 1.55; }

.dialing-number {
  font-size: 30px; font-weight: 800; color: var(--primary);
  letter-spacing: .04em; margin-top: 16px; font-variant-numeric: tabular-nums;
}

.ringing-number {
  font-size: 26px; font-weight: 800; color: var(--text);
  letter-spacing: .03em; margin-top: 14px;
}

.ringing-btns { display: flex; gap: 16px; margin-top: 22px; }
.ring-btn { min-width: 130px; font-size: 14px; padding: 12px 22px; border-radius: 30px; }

/* ── Active Call Card ─────────────────────────────────────────────────────── */
.call-card-main {
  width: 100%; max-width: 520px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}

/* ── Call state badge (Ringing / Dialing Customer / Connected) ────────────── */
.call-state-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-radius: 999px; margin-bottom: 14px;
  font-size: 13px; font-weight: 700; letter-spacing: .01em;
  border: 1.5px solid transparent; transition: background .3s, color .3s, border-color .3s;
}
.cstate-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
/* State: dialing (blue pulse) */
.call-state-badge.state-dialing {
  background: rgba(0,122,255,.12); color: var(--primary); border-color: rgba(0,122,255,.35);
}
.call-state-badge.state-dialing .cstate-dot {
  background: var(--primary); animation: cstate-pulse .9s infinite;
}
/* State: ringing (orange pulse — phone is ringing somewhere) */
.call-state-badge.state-ringing {
  background: rgba(255,149,0,.12); color: var(--warn); border-color: rgba(255,149,0,.35);
}
.call-state-badge.state-ringing .cstate-dot {
  background: var(--warn); animation: cstate-pulse .6s infinite;
}
/* State: connected (green solid — bridge is active) */
.call-state-badge.state-connected {
  background: rgba(52,199,89,.12); color: var(--success); border-color: rgba(52,199,89,.35);
}
.call-state-badge.state-connected .cstate-dot {
  background: var(--success); animation: none;
}
@keyframes cstate-pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.35; transform:scale(.65); }
}

.call-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px;
}

.call-number    { font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: .02em; }
.call-name-lbl  { font-size: 13px; color: var(--text2); margin-top: 2px; }
.call-mode-badge{
  display: inline-block; margin-top: 5px;
  background: color-mix(in srgb,var(--primary) 18%,transparent);
  color: var(--primary); padding: 2px 8px;
  border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase;
}

.call-right      { text-align: right; }
.call-timer      { font-size: 32px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.call-sip-cause-lbl { font-size: 10px; color: var(--danger); margin-top: 2px; font-weight: 600; }

.lead-info-box   { background: var(--card2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 12px; }
.lead-info-title { font-size: 10px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.lead-info-row   { display: flex; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.lead-info-row:last-child { border-bottom: none; }
.li-key { color: var(--text2); min-width: 66px; flex-shrink: 0; }
.li-val { color: var(--text); word-break: break-word; }

.script-box { background: color-mix(in srgb,var(--primary) 10%,transparent); border: 1px solid color-mix(in srgb,var(--primary) 25%,transparent); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 12px; }
.script-lbl { font-size: 10px; font-weight: 700; color: var(--primary); text-transform: uppercase; margin-bottom: 5px; }
.script-text{ font-size: 13px; color: var(--text); line-height: 1.5; white-space: pre-wrap; max-height: 120px; overflow-y: auto; }

.notes-block { margin-top: 10px; }
.notes-lbl   { display: block; font-size: 10px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px; }
.notes-area  { resize: vertical; min-height: 72px; font-size: 13px; line-height: 1.5; }

/* ── Disposition ──────────────────────────────────────────────────────────── */
.disp-card {
  width: 100%; max-width: 520px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}

.disp-header {
  display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px;
}
.disp-number   { font-size: 22px; font-weight: 800; color: var(--text); }
.disp-dur      { font-size: 12px; color: var(--text2); margin-top: 3px; }
.disp-head-lbl { font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; }

.disp-grid { display: flex; flex-direction: column; gap: 0; }

.btn-disp {
  padding: 9px 16px; border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--card2); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-disp:hover  { border-color: var(--disp-clr, var(--primary)); background: color-mix(in srgb, var(--disp-clr, var(--primary)) 8%, transparent); transform: translateY(-1px); }
.btn-disp.active { border-color: var(--disp-clr, var(--primary)); background: color-mix(in srgb, var(--disp-clr, var(--primary)) 18%, transparent); color: var(--disp-clr, var(--primary)); font-weight: 700; box-shadow: 0 2px 8px color-mix(in srgb, var(--disp-clr, var(--primary)) 25%, transparent); }
.btn-disp .btn-disp-arrow { opacity: .5; font-size: 12px; }
.btn-disp.active .btn-disp-arrow { opacity: 1; }
/* Keyboard hint badge (1–9) on disposition buttons */
.btn-disp .btn-disp-key {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; margin-right: 2px;
  font-size: 10px; font-weight: 700; line-height: 1;
  border-radius: 4px; color: var(--text2);
  background: color-mix(in srgb, var(--text2) 14%, transparent);
}
.btn-disp.active .btn-disp-key { background: color-mix(in srgb, var(--disp-clr, var(--primary)) 22%, transparent); color: var(--disp-clr, var(--primary)); }
.disp-kbd-hint { margin-top: 8px; text-align: center; font-size: 11px; color: var(--text2); }
.disp-kbd-hint b { color: var(--text); font-weight: 700; }

/* ── Call Log ─────────────────────────────────────────────────────────────── */
.call-log    { flex: 1; overflow-y: auto; }
.log-empty   { text-align: center; color: var(--text3); font-size: 12px; padding: 24px 0; }

.log-item {
  padding: 9px 10px 8px 12px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  background: var(--card);
  margin: 2px 4px;
  border-radius: 6px;
  transition: background .12s;
}
.log-item:hover { background: var(--card2); }
.log-item:last-child { border-bottom: none; }

.log-row1 { display: flex; justify-content: space-between; align-items: center; }
.log-number { font-size: 13px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.log-dur    { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }

.log-row2 { margin: 1px 0; }
.log-name { font-size: 11px; color: var(--text2); }

.log-row3 { display: flex; justify-content: space-between; align-items: center; margin-top: 3px; }
.log-camp { font-size: 10px; color: var(--text3); background: var(--card2); padding: 1px 6px; border-radius: 4px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-disp { font-size: 11px; font-weight: 600; }

.log-time { font-size: 10px; color: var(--text3); margin-top: 4px; }

/* ── Animations ───────────────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}
@keyframes ring-shake {
  0%, 100%    { transform: rotate(0deg); }
  20%         { transform: rotate(-14deg); }
  40%         { transform: rotate(14deg); }
  60%         { transform: rotate(-8deg); }
  80%         { transform: rotate(8deg); }
}

.pulse-anim { animation: pulse 1.4s ease-in-out infinite; }
.ring-anim  { display: inline-block; animation: ring-shake .7s ease-in-out infinite; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.agent-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 10px 22px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
  z-index: 9999; pointer-events: none;
  transition: opacity .4s;
}
.agent-toast.toast-err { background: var(--danger); color: #fff; }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ═══════════════════════════════════════════════════════════════════════════
   NEW UI ELEMENTS — Draggable Cards, Panel Controls, Right Tabs, Modal, etc.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Card Header (drag + hide button) ───────────────────────────────────── */
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; cursor: grab; user-select: none;
}
.card-header:active { cursor: grabbing; }

.drag-handle {
  padding: 2px 0 2px 2px;
  border-radius: 4px;
  transition: background .15s;
}
.drag-handle:hover { background: color-mix(in srgb, var(--border) 60%, transparent); }

.card-hide-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text3); font-size: 16px; font-weight: 700;
  padding: 0 4px; border-radius: 4px; line-height: 1;
  transition: color .15s, background .15s;
}
.card-hide-btn:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* ── Dragging State ──────────────────────────────────────────────────────── */
.card-dragging {
  opacity: .55;
  box-shadow: 0 8px 32px rgba(0,0,0,.25), 0 2px 8px rgba(0,0,0,.15) !important;
  transform: scale(1.02);
  border: 1.5px dashed var(--primary) !important;
  z-index: 50;
  pointer-events: none;
}

/* ── Hidden Card ─────────────────────────────────────────────────────────── */
.card-hidden {
  display: none !important;
}

/* ── Panel Collapsed ─────────────────────────────────────────────────────── */
.panel-left.panel-collapsed,
.panel-right.panel-collapsed {
  width: 0 !important;
  min-width: 0 !important;
  overflow: hidden;
  padding: 0;
  border: none;
}
/* When left panel collapses, update grid */
#main-layout:has(#panel-left.panel-collapsed) {
  grid-template-columns: 0 1fr var(--rw, 236px);
}
#main-layout:has(#panel-right.panel-collapsed) {
  grid-template-columns: var(--lw, 228px) 1fr 0;
}

/* ── Panel Resize Handle ─────────────────────────────────────────────────── */
.panel-resize-handle {
  position: absolute; top: 0;
  width: 12px; height: 100%;
  cursor: col-resize;
  z-index: 20;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.panel-resize-handle::after {
  content: '';
  width: 3px; height: 48px;
  border-radius: 3px;
  background: var(--border);
  transition: background .15s, height .15s, width .1s;
  pointer-events: none;
}
.panel-left  { position: relative; }
.panel-right { position: relative; }

.panel-left .panel-resize-handle  { right: -6px; }
.panel-right .panel-resize-handle { left: -6px; right: auto; }

.panel-resize-handle:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.panel-resize-handle:hover::after,
.panel-resize-handle:active::after {
  background: var(--primary);
  height: 72px; width: 4px;
}
.panel-resize-handle:active { background: color-mix(in srgb, var(--primary) 18%, transparent); cursor: col-resize; }

/* ── Hidden Cards Restore Bar ────────────────────────────────────────────── */
.hidden-cards-bar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 5px; padding: 6px 8px;
  background: color-mix(in srgb, var(--border) 50%, transparent);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
}
.hcb-label {
  font-size: 10px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
}
.hcb-chip {
  background: var(--card2); border: 1px solid var(--border);
  color: var(--text2); border-radius: 999px;
  font-size: 11px; padding: 2px 9px; cursor: pointer;
  transition: background .15s, color .15s;
}
.hcb-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Role Badge ──────────────────────────────────────────────────────────── */
.role-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .03em; white-space: nowrap;
}

/* ── Global Call Timer (topbar) ──────────────────────────────────────────── */
.call-timer-global {
  font-size: 15px; font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  padding: 3px 10px; border-radius: 999px;
}

/* ── Stats Grid (6-cell 2×3) ─────────────────────────────────────────────── */
.stats-grid-6 {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.stats-grid-7 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.stat-item {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 4px; text-align: center;
  position: relative; overflow: hidden;
  transition: transform .12s, border-color .15s, box-shadow .15s;
}
/* Each box opens its list on click — a quiet hover lift signals that (replaces
   the old inline "⌄" caret that read as a glyph error at 9px). */
.stat-item[onclick]:hover {
  transform: translateY(-1px);
  border-color: var(--text3);
  box-shadow: 0 6px 16px -12px rgba(0,0,0,.5);
}
.stat-item::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; border-radius: 2px 2px 0 0;
}
.si-blue::before   { background: #007AFF; }
.si-green::before  { background: #34C759; }
.si-gold::before   { background: #FFD60A; }
.si-orange::before { background: #FF9500; }
.si-red::before    { background: #FF3B30; }
.si-purple::before { background: #BF5AF2; }
.si-blue   .stat-n { color: #007AFF; }
.si-green  .stat-n { color: #34C759; }
.si-gold   .stat-n { color: #B8860B; }
.si-orange .stat-n { color: #FF9500; }
.si-red    .stat-n { color: #FF3B30; }
.si-purple .stat-n { color: #BF5AF2; }
.si-teal::before   { background: #00C7BE; }
.si-teal   .stat-n { color: #00897B; }
.si-pink::before   { background: #FF2D92; }
.si-pink   .stat-n { color: #FF2D92; }
.stat-n {
  font-size: 18px; font-weight: 800;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.stat-l {
  font-size: 9px; color: var(--text2); text-transform: uppercase;
  letter-spacing: .05em; margin-top: 2px;
}
.stat-talktime {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; padding: 8px 10px;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  border-radius: var(--radius-sm);
  font-size: 18px; font-weight: 800; color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.stat-talktime-lbl {
  font-size: 10px; font-weight: 600; color: var(--primary);
  text-transform: uppercase; letter-spacing: .05em; opacity: .7;
}

/* ── Right Panel Tabs ────────────────────────────────────────────────────── */
.right-tabs {
  display: flex; gap: 2px; padding: 8px 8px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg2);
}
.rtab {
  flex: 1; background: none; border: none; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--text2);
  padding: 6px 4px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color .15s, background .15s;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.rtab:hover { color: var(--text); background: color-mix(in srgb, var(--border) 50%, transparent); }
.rtab.active { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }

.rtab-content {
  flex: 1; overflow-y: hidden; display: flex; flex-direction: column; min-height: 0;
  background: var(--bg2);
}

/* The call-log inside rtab-content IS the scrollable area */
.rtab-content .call-log {
  flex: 1; overflow-y: auto; min-height: 0;
}

/* Right panel: flex column, no outer scroll — inner rtab-content scrolls */
.panel-right {
  display: flex; flex-direction: column;
  overflow: hidden; /* prevent double scrollbar */
  padding: 0 !important; /* remove generic padding — toolbar/content have own padding */
}

/* Right panel resize handle needs position:absolute within the panel */
.panel-right { position: relative; }

/* ── Log Filter Row ──────────────────────────────────────────────────────── */
.log-filter-row { padding: 5px 8px 4px; }

.log-search-inp {
  width: 100%; font-size: 12px; padding: 6px 10px;
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s;
}
.log-search-inp::placeholder { color: var(--text3); }
.log-search-inp:focus { border-color: var(--primary); }

/* ── Log Date Filter Row (legacy — kept for compat) ──────────────────────── */
.log-date-row {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 8px 6px; flex-wrap: nowrap;
}
.log-date-inp {
  flex: 1; min-width: 0; font-size: 11px; padding: 4px 6px;
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s;
}
.log-date-inp:focus { border-color: var(--primary); }
.log-date-inp::-webkit-calendar-picker-indicator { opacity: .5; cursor: pointer; }

/* ── Log Pagination ──────────────────────────────────────────────────────── */
.log-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 8px; flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

#log-page-lbl { font-size: 11px; color: var(--text2); white-space: nowrap; }

.btn-xs {
  padding: 4px 10px !important; font-size: 11px !important;
  border-radius: 6px !important;
}

/* ── Recording Playback ──────────────────────────────────────────────────── */
.log-rec {
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
}
.btn-rec {
  flex-shrink: 0;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  color: var(--primary); border-radius: 999px;
  font-size: 12px; font-weight: 800; padding: 3px 10px;
  cursor: pointer; transition: background .15s, color .15s;
  min-width: 32px; text-align: center;
}
.btn-rec:hover { background: var(--primary); color: #fff; }

.rec-progress {
  flex: 1; display: flex; align-items: center; gap: 5px;
}
.rec-bar {
  flex: 1; height: 4px;
  background: var(--border); border-radius: 2px; cursor: pointer;
  position: relative;
}
.rec-fill {
  height: 100%; background: var(--primary); border-radius: 2px;
  width: 0; transition: width .1s linear; pointer-events: none;
}
.rec-time {
  font-size: 10px; color: var(--text3);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ── API Docs Tab ────────────────────────────────────────────────────────── */
.apidocs-content {
  padding: 10px 8px; overflow-y: auto;
  font-size: 12px; line-height: 1.5;
}
.apidoc-title {
  font-size: 13px; font-weight: 800; color: var(--text);
  margin-bottom: 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.apidoc-section {
  margin-bottom: 14px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.apidoc-section:last-child { border-bottom: none; }

.apidoc-method {
  font-size: 11px; font-weight: 800; color: var(--primary);
  font-family: 'SF Mono', 'Consolas', monospace;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  margin-bottom: 4px;
}
.apidoc-desc {
  color: var(--text2); font-size: 11px; margin-bottom: 5px;
}
.apidoc-code {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 5px; padding: 6px 8px;
  font-size: 11px; font-family: 'SF Mono', 'Consolas', monospace;
  color: var(--text); white-space: pre-wrap; word-break: break-all;
  margin: 0;
}

/* ── Drag Grip Icon ──────────────────────────────────────────────────────── */
.drag-grip {
  font-size: 13px; color: var(--text3); line-height: 1;
  cursor: grab; padding: 0 2px;
  user-select: none; letter-spacing: -1px;
  flex-shrink: 0;
}
.drag-grip:active { cursor: grabbing; }

/* ── Center Panel Manual Dial ────────────────────────────────────────────── */
.center-manual-wrap {
  width: 100%; max-width: 520px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 18px; margin-bottom: 14px;
  flex-shrink: 0;
}
.center-manual-inner { display: flex; flex-direction: column; gap: 0; }

.cmd-fields {
  display: flex; gap: 8px; align-items: center;
}
.cmd-inp-num  { flex: 1.5; font-size: 14px; font-weight: 600; }
.cmd-inp-name { flex: 1; }

/* ── Center Manual Dial: num-row ─────────────────────────────────────────── */
.cmd-num-row {
  display: flex; gap: 6px; align-items: stretch;
}
.cmd-kp-btn   { flex-shrink: 0; padding: 8px 11px; font-size: 16px; }
.cmd-dial-btn { flex-shrink: 0; min-width: 80px; }

/* ── Keypad ──────────────────────────────────────────────────────────────── */
.keypad-wrap {
  margin-top: 8px;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px;
}
.keypad-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 6px;
  margin-bottom: 8px;
}
.key-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 6px;
  cursor: pointer; transition: background .1s, transform .1s;
  user-select: none;
}
.key-btn:hover  { background: color-mix(in srgb, var(--primary) 10%, var(--card)); }
.key-btn:active { transform: scale(.93); background: color-mix(in srgb, var(--primary) 20%, var(--card)); }
.key-digit { font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.1; }
.key-sub   { font-size: 8px; font-weight: 700; color: var(--text3); letter-spacing: .12em; min-height: 10px; }
.keypad-actions {
  display: flex; gap: 6px;
}

/* ── Right Tab Toolbar ────────────────────────────────────────────────────── */
.rtab-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 8px 4px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.rtab-toolbar-lbl {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text2);
}

/* ── Log datetime-range row (merged date+time) ───────────────────────────── */
.log-dtrange-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; flex-wrap: wrap;   /* wrap so the two datetime inputs never push "Go" off */
  border-bottom: 1px solid var(--border);
}
.log-dt-inp {
  flex: 1 1 44%; min-width: 120px; font-size: 11px; padding: 5px 6px;
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s;
}
/* "Go" (apply) button keeps its size — never shrinks or gets clipped */
.log-dtrange-row .btn { flex: 0 0 auto; }
.log-dt-inp:focus { border-color: var(--primary); }
.log-dt-inp::-webkit-calendar-picker-indicator { opacity: .4; cursor: pointer; }
.log-dt-sep {
  font-size: 11px; color: var(--text3); flex-shrink: 0;
}

/* ── Lead Editor Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 16px 64px rgba(0,0,0,.4);
  width: 100%; max-width: 540px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-size: 15px; font-weight: 700; color: var(--text);
}
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--text2); padding: 0 4px;
  border-radius: 4px; transition: color .15s;
  line-height: 1;
}
.modal-close:hover { color: var(--danger); }

/* ── Countdown ring ── */
.countdown-ring {
  width: 96px; height: 96px; border-radius: 50%;
  background: conic-gradient(var(--primary) 0%, var(--bg2) 0%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 15%, transparent);
  animation: countdown-spin 1s linear;
}
.countdown-ring span {
  font-size: 40px; font-weight: 800; color: var(--primary);
  background: var(--card); width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
@keyframes countdown-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Campaign select items ── */
.camp-sel-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.camp-sel-item.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--card));
}
.camp-sel-item input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }
.camp-sel-name { font-weight: 600; font-size: 13px; color: var(--text); }
.camp-sel-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing:.05em;
  padding: 2px 6px; border-radius: 4px; background: color-mix(in srgb, var(--primary) 15%, var(--bg2)); color: var(--primary); margin-left:auto; }

.modal-box form {
  overflow-y: auto; padding: 16px 20px; flex: 1;
}
.modal-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── In-call controls + transfer panel ──────────────────────────────────────── */
.call-ctrl { flex:1; min-width:78px; font-size:13px; }
.call-ctrl.ctrl-active { background:var(--primary,#2563eb); color:#fff; border-color:var(--primary,#2563eb); }
.transfer-panel {
  border:1px solid var(--border,#2a3550); border-radius:10px;
  padding:12px; margin-bottom:14px; background:var(--bg2,#141c2e);
}
.xfer-title { font-weight:700; font-size:13px; margin-bottom:8px; }
.xfer-seg { display:flex; gap:0; margin-bottom:8px; border:1px solid var(--border,#2a3550); border-radius:8px; overflow:hidden; }
.xfer-tt {
  flex:1; padding:7px 10px; font-size:12px; font-weight:600; cursor:pointer;
  border:none; background:transparent; color:var(--text2,#8b97b3);
}
.xfer-tt.seg-active { background:var(--primary,#2563eb); color:#fff; }
.xfer-input {
  width:100%; padding:9px 11px; font-size:14px; border-radius:8px;
  border:1px solid var(--border,#2a3550); background:var(--bg,#0e1422); color:var(--text,#e8eefc);
}
.xfer-hint { font-size:11px; color:var(--text2,#8b97b3); margin-top:5px; }
.xfer-state { font-size:13px; font-weight:600; padding:8px 10px; border-radius:8px; background:var(--bg,#0e1422); }
.xfer-err { font-size:12px; color:var(--danger,#ef4444); margin-top:6px; }

/* ── Inbound call badge ───────────────────────────────────────────────────── */
#call-inbound-badge {
  display: none;
  font-size: 11px;
  font-weight: 700;
  color: #7c3aed;
  background: #f3e8ff;
  border-radius: 4px;
  padding: 2px 7px;
  margin-top: 3px;
  letter-spacing: .3px;
}

/* ── Duplicate session dialog ─────────────────────────────────────────────── */
.dup-session-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.dup-session-box {
  background: var(--bg2, #fff); border-radius: 16px; padding: 32px 28px;
  max-width: 380px; width: 90%; text-align: center;
  border: 1px solid var(--border, transparent);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.dup-session-icon { font-size: 40px; margin-bottom: 10px; }
.dup-session-title { font-size: 18px; font-weight: 800; color: var(--text, #0f172a); margin-bottom: 8px; }
.dup-session-msg { font-size: 13px; color: var(--text2, #64748b); line-height: 1.6; margin-bottom: 22px; }
.dup-session-btns { display: flex; flex-direction: column; gap: 8px; }
.dup-session-btns .btn { padding: 10px; font-size: 14px; border-radius: 8px; cursor: pointer; border: none; }
.dup-session-btns .btn-primary { background: var(--primary, #6366f1); color: #fff; }
.dup-session-btns .btn-primary:hover { filter: brightness(1.08); }
.dup-session-btns .btn-secondary { background: var(--bg3, var(--border, #f1f5f9)); color: var(--text, #475569); }
.dup-session-btns .btn-secondary:hover { filter: brightness(1.06); }

/* ══════════════════════════════════════════════════════════════════════════
   EXTENDED COLOR THEMES (10 new)
   ═══════════════════════════════════════════════════════════════════════════ */

[data-theme="sunset"] {
  --bg:        #FFF0ED; --bg2:       #FFE4DF;
  --card:      #FFFFFF; --card2:     #FFF5F3;
  --text:      #2D1B0E; --text2:     #8B5543; --text3: #C49080;
  --primary:   #FF6B35; --primary-d: #E8531D;
  --success:   #45B649; --danger:    #E53935; --warn: #FF8F00;
  --border:    rgba(255,107,53,.15);
  --shadow:    0 1px 4px rgba(200,60,0,.1), 0 4px 12px rgba(200,60,0,.06);
  --topbar-bg: rgba(255,240,237,.92); --topbar-border: rgba(255,107,53,.2);
  --input-bg:  #FFFFFF; --radius: 12px; --radius-sm: 8px;
}
[data-theme="violet"] {
  --bg:        #1A0A2E; --bg2:       #250D42;
  --card:      #2D1155; --card2:     #3A1A6E;
  --text:      #F0E8FF; --text2:     #B89DDA; --text3: #7A5C9E;
  --primary:   #A855F7; --primary-d: #9333EA;
  --success:   #34D399; --danger:    #F87171; --warn: #FBBF24;
  --border:    rgba(168,85,247,.2);
  --shadow:    0 1px 4px rgba(0,0,0,.5), 0 4px 20px rgba(80,0,160,.3);
  --topbar-bg: rgba(20,8,40,.97); --topbar-border: rgba(168,85,247,.2);
  --input-bg:  #3A1A6E; --radius: 12px; --radius-sm: 8px;
}
[data-theme="rose"] {
  --bg:        #FFF5F7; --bg2:       #FEE8EC;
  --card:      #FFFFFF; --card2:     #FFF0F3;
  --text:      #2D0A14; --text2:     #9B4A5A; --text3: #C9848E;
  --primary:   #E91E63; --primary-d: #C2185B;
  --success:   #4CAF50; --danger:    #D32F2F; --warn: #FF9800;
  --border:    rgba(233,30,99,.15);
  --shadow:    0 1px 4px rgba(200,0,60,.1), 0 4px 12px rgba(200,0,60,.05);
  --topbar-bg: rgba(255,245,247,.92); --topbar-border: rgba(233,30,99,.2);
  --input-bg:  #FFFFFF; --radius: 12px; --radius-sm: 8px;
}
[data-theme="arctic"] {
  --bg:        #EEF6FD; --bg2:       #DFF0FA;
  --card:      #FFFFFF; --card2:     #F5FAFE;
  --text:      #0A2540; --text2:     #4A7EA5; --text3: #88B5CC;
  --primary:   #00B0D7; --primary-d: #0090B8;
  --success:   #00C853; --danger:    #F44336; --warn: #FF9800;
  --border:    rgba(0,176,215,.15);
  --shadow:    0 1px 4px rgba(0,100,180,.08), 0 4px 12px rgba(0,100,180,.04);
  --topbar-bg: rgba(238,246,253,.92); --topbar-border: rgba(0,176,215,.2);
  --input-bg:  #FFFFFF; --radius: 12px; --radius-sm: 8px;
}
[data-theme="lavender"] {
  --bg:        #F5F0FF; --bg2:       #EDE5FF;
  --card:      #FFFFFF; --card2:     #FAF7FF;
  --text:      #2D1B5E; --text2:     #7B5EA7; --text3: #B09CC8;
  --primary:   #7C3AED; --primary-d: #6D28D9;
  --success:   #059669; --danger:    #DC2626; --warn: #D97706;
  --border:    rgba(124,58,237,.15);
  --shadow:    0 1px 4px rgba(80,0,180,.08), 0 4px 12px rgba(80,0,180,.05);
  --topbar-bg: rgba(245,240,255,.92); --topbar-border: rgba(124,58,237,.2);
  --input-bg:  #FFFFFF; --radius: 14px; --radius-sm: 10px;
}
[data-theme="coffee"] {
  --bg:        #1C1008; --bg2:       #2A1A0C;
  --card:      #352010; --card2:     #442A18;
  --text:      #FFE8C8; --text2:     #C8945A; --text3: #886040;
  --primary:   #D4845A; --primary-d: #B86040;
  --success:   #66BB6A; --danger:    #FF5252; --warn: #FFD740;
  --border:    rgba(212,132,90,.2);
  --shadow:    0 1px 4px rgba(0,0,0,.5), 0 4px 16px rgba(60,20,0,.35);
  --topbar-bg: rgba(20,10,5,.97); --topbar-border: rgba(212,132,90,.2);
  --input-bg:  #442A18; --radius: 10px; --radius-sm: 6px;
}

[data-theme="tower"] {
  /* Control Tower — the company console's daylight palette, so the agent
     cockpit matches what the admin sees. Warm ivory ground, white cards,
     jade for live/positive, marigold for waiting, clay for trouble. */
  --bg:        #F6F5F1; --bg2:       #EFEEE8;
  --card:      #FFFFFF; --card2:     #F1F0EB;
  --text:      #10221F; --text2:     #414F4C; --text3: #646F6D;
  --primary:   #0E8A6A; --primary-d: #0C7E61;
  --success:   #1F9D55; --danger:    #B0392C; --warn: #C07C18;
  --border:    rgba(16,34,31,.11);
  --shadow:    0 1px 2px rgba(16,34,31,.05), 0 4px 14px rgba(16,34,31,.07);
  --topbar-bg: rgba(255,255,255,.92); --topbar-border: rgba(16,34,31,.11);
  --input-bg:  #FFFFFF; --radius: 10px; --radius-sm: 7px;
}

[data-theme="nightshift"] {
  /* Night Shift — the superadmin switchboard's graphite, tuned for a dim
     room and a long shift. Teal carries "live", brass "waiting", oxide
     "trouble" — the same signal language as the rest of the platform. */
  --bg:        #0E1116; --bg2:       #12161C;
  --card:      #161A21; --card2:     #1E242C;
  --text:      #ECEEF0; --text2:     #B4BAC2; --text3: #7F8792;
  --primary:   #10A57C; --primary-d: #0D8E6B;
  --success:   #2ED3A3; --danger:    #F1655A; --warn: #E8A33D;
  --border:    rgba(255,255,255,.09);
  --shadow:    0 1px 4px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.4);
  --topbar-bg: rgba(9,12,16,.97); --topbar-border: rgba(255,255,255,.09);
  --input-bg:  #1E242C; --radius: 10px; --radius-sm: 7px;
}

/* ══════════════════════════════════════════════════════════════════════════
   LAYOUT PICKER
   ═══════════════════════════════════════════════════════════════════════════ */
.layout-wrap { position: relative; }

.layout-picker-drop {
  display: none; position: absolute; right: 0; top: 38px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 6px; z-index: 300; min-width: 192px;
}
.layout-picker-drop.open { display: flex; flex-direction: column; gap: 2px; }

.layout-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px; border: none;
  background: none; cursor: pointer; text-align: left;
  font-size: 13px; color: var(--text); width: 100%;
  transition: background .1s;
}
.layout-opt:hover { background: var(--card2); }
.layout-opt.layout-active {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.layout-opt-icon { font-size: 17px; flex-shrink: 0; }
.layout-opt-info { display: flex; flex-direction: column; gap: 1px; }
.layout-opt-name { font-weight: 700; font-size: 13px; }
.layout-opt-desc { font-size: 10px; color: var(--text3); }

/* NOTE: the theme dropdown lays out as a column (Color-theme dots + Layout list).
   The dots grid lives on .tp-dots-row (near the top of this file) — never force
   the whole .theme-picker-drop into a fixed dot grid, or the Layout section gets
   crushed into 26px columns. That stale rule was the "long bar" bug. */


/* ══════════════════════════════════════════════════════════════════════════
   LAYOUT THEMES — 4 completely different structural designs
   Each layout rearranges the PAGE STRUCTURE (grid areas, panel positions)
   AND overrides the full color system.
   ═══════════════════════════════════════════════════════════════════════════ */



/* ────────────────────────────────────────────────────────────────────────────
   LAYOUT: GLASS — frosted / visionOS
   Its identity is a deep, tinted gradient behind white FROSTED cards (blur +
   translucency + light text). The tint (gradient + accent) is derived from the
   active colour theme's --primary, so the colour dots re-colour the glass
   (ocean = blue glass, forest = green glass, …) while it always LOOKS glassy.
   ──────────────────────────────────────────────────────────────────────────── */
[data-layout="glass"] {
  /* Glass keeps light-on-dark FROSTED surfaces; only the HUE follows the colour
     theme (via --primary, which is NOT overridden here). Every surface token is
     set to a dark/translucent value so ANY component using var(--card)/var(--bg2)
     picks up the glass look instead of the theme's light card (which showed as
     white patches, and white-on-white unreadable text). */
  --bg:      #0a0e24;
  --bg2:     rgba(255,255,255,.06);
  /* --card stays fairly OPAQUE so modals/popups that use var(--card) as a solid
     background stay readable; real .card elements get extra frost+blur below. */
  --card:    #171b3a;
  --card2:   rgba(255,255,255,.16);
  --text:    #FFFFFF;
  --text2:   rgba(255,255,255,.74);
  --text3:   rgba(255,255,255,.46);
  --border:  rgba(255,255,255,.18);
  --input-bg: rgba(255,255,255,.12);
  --radius: 18px;
  --radius-sm: 12px;
}

/* Deep gradient tinted by the picked theme's --primary */
[data-layout="glass"] body,
[data-layout="glass"] .v-login {
  background:
    radial-gradient(1200px 720px at 8% -12%,  color-mix(in srgb, var(--primary) 62%, transparent), transparent 60%),
    radial-gradient(1000px 760px at 116% 10%, color-mix(in srgb, var(--primary) 34%, transparent), transparent 55%),
    linear-gradient(140deg, #0b0a1e 0%, #0a1330 55%, #06131a 100%) fixed;
}

/* STRUCTURE: standard 3-column (the old bottom dock clipped the cards) */
[data-layout="glass"] .main-layout {
  grid-template-columns: 232px 1fr 264px;
  height: calc(100vh - 54px);
  height: calc(100dvh - 54px);
  background: transparent;
}
[data-layout="glass"] .panel-center { background: transparent; }

/* Frosted white surfaces = the glass look (same on every theme) */
[data-layout="glass"] .panel-left,
[data-layout="glass"] .panel-right {
  background: rgba(255,255,255,.06);
  backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
  border-color: rgba(255,255,255,.12);
}
[data-layout="glass"] .topbar {
  background: rgba(255,255,255,.10) !important;
  backdrop-filter: blur(40px) saturate(160%);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
  border-bottom: 1px solid rgba(255,255,255,.14);
}
[data-layout="glass"] .card {
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid rgba(255,255,255,.20);
  box-shadow: 0 8px 32px rgba(0,0,0,.28);
  border-radius: 20px;
}
[data-layout="glass"] .call-card-main {
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 16px 48px rgba(0,0,0,.32);
  border-radius: 28px;
}
[data-layout="glass"] .stat-item {
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
}
[data-layout="glass"] .login-card {
  background: rgba(255,255,255,.13);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 24px 64px rgba(0,0,0,.40);
  border-radius: 28px;
}
[data-layout="glass"] input[type=text],
[data-layout="glass"] input[type=password],
[data-layout="glass"] input[type=tel],
[data-layout="glass"] select,
[data-layout="glass"] textarea {
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
  border-radius: 12px;
}
[data-layout="glass"] input::placeholder { color: rgba(255,255,255,.5); }
[data-layout="glass"] .status-chip { border-radius: 999px; }
/* Primary accent follows the theme; secondary buttons stay frosted */
[data-layout="glass"] .btn-primary {
  background: color-mix(in srgb, var(--primary) 85%, transparent);
  border: 1px solid rgba(255,255,255,.25);
}
[data-layout="glass"] .btn-ready,
[data-layout="glass"] .btn-pause,
[data-layout="glass"] .btn-brk {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
}
[data-layout="glass"] .rtab { background: rgba(255,255,255,.08); color: rgba(255,255,255,.7); border: none; }
[data-layout="glass"] .rtab.active { background: rgba(255,255,255,.18); color: #fff; }
[data-layout="glass"] .btn-topbar { color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.2); }
[data-layout="glass"] .btn-topbar:hover { background: rgba(255,255,255,.14); opacity: 1; }
[data-layout="glass"] .btn-icon { color: rgba(255,255,255,.82); }
[data-layout="glass"] .btn-icon:hover { background: rgba(255,255,255,.14); }
[data-layout="glass"] .drag-grip { color: rgba(255,255,255,.35); }
[data-layout="glass"] .camp-chip { color: #fff !important; background: rgba(255,255,255,.14) !important; }
[data-layout="glass"] .sip-chip, [data-layout="glass"] .net-chip { color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.35); }
[data-layout="glass"] .call-timer-global { color: #fff; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25); }
[data-layout="glass"] .theme-picker-drop,
[data-layout="glass"] .layout-picker-drop {
  background: rgba(16,14,40,.82);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(255,255,255,.2);
}
[data-layout="glass"] select option { background: #141230; color: #fff; }
[data-layout="glass"] .hidden-cards-bar { display: none; }
[data-layout="glass"] .panel-resize-handle { display: none; }


/* ────────────────────────────────────────────────────────────────────────────
   LAYOUT: DASHBOARD ("Windows") — Material, REVERSED columns
   Identity is STRUCTURE (right panel on the left) + a flat material card shape.
   Colour comes from the ACTIVE colour theme, so the colour dots fully drive it.
   ──────────────────────────────────────────────────────────────────────────── */
[data-layout="dashboard"] {
  --radius: 10px;
  --radius-sm: 8px;
}

/* STRUCTURE: reversed 3-column (right | center | left) */
[data-layout="dashboard"] .main-layout {
  grid-template-areas: "right center left";
  grid-template-columns: 240px 1fr 220px;
  height: calc(100vh - 54px);
  height: calc(100dvh - 54px);
}
[data-layout="dashboard"] .panel-left  { grid-area: left;  border-left: 1px solid var(--border); border-right: none; }
[data-layout="dashboard"] .panel-right { grid-area: right; border-right: 1px solid var(--border); border-left: none; }
[data-layout="dashboard"] .panel-center { grid-area: center; }

/* Flat material cards (dense, small radius, subtle shadow) — colour from theme */
[data-layout="dashboard"] .card {
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
[data-layout="dashboard"] .card-title {
  color: var(--primary); font-weight: 700; letter-spacing: .06em;
  border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 10px;
}
[data-layout="dashboard"] .btn { border-radius: 8px; font-weight: 600; }
[data-layout="dashboard"] .status-chip { border-radius: 6px; font-weight: 600; }
[data-layout="dashboard"] .rtab { border-radius: 7px; }
[data-layout="dashboard"] .stat-item::before { background: var(--primary); }


/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — mobile-first media queries
   Breakpoints: phone < 640px, tablet 640–1023px, desktop ≥ 1024px
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Tablet (640 – 1023px): same STACKED single column as phone ───────────────
   The old 200px + drawer grid looked cramped/broken at ~40% laptop width, so the
   whole ≤1023px range now stacks: controls, call area, call log — one scrolling
   column, no side drawers. (Covers every layout; [data-layout] grid rules
   out-rank a bare .main-layout, so they're named + !important.) */
@media (max-width: 1023px) {
  .main-layout,
  [data-layout="glass"] .main-layout,
  [data-layout="dashboard"] .main-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    grid-template-areas: none !important;
    grid-template-rows: none !important;
    height: calc(100vh - 54px);
    height: calc(100dvh - 54px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .panel-left,
  .panel-right,
  .panel-center {
    position: static !important;
    display: flex !important;
    flex-direction: column;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    box-shadow: none !important;
    animation: none !important;
    overflow: visible !important;
    z-index: auto;
    box-sizing: border-box;
  }
  .panel-left   { order: 1; }
  .panel-center { order: 2; border-top: 1px solid var(--border); }
  .panel-right  { order: 3; border-top: 1px solid var(--border);
    padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .main-layout.ml-oncall .panel-center { order: 0; border-top: none; }
  .main-layout.ml-oncall .panel-left   { border-top: 1px solid var(--border); }
  #btn-toggle-left, #btn-toggle-right { display: none !important; }
  .panel-overlay-backdrop { display: none !important; }

  /* Hide extension and name on smaller screens */
  #tb-ext-wrap { display: none !important; }

  /* Slightly smaller topbar chips */
  .status-chip { font-size: 11px; padding: 3px 9px; }
  .sip-chip, .net-chip, .camp-chip { font-size: 10px; padding: 2px 7px; }

  /* Shrink call timer */
  .call-timer-global { font-size: 13px; padding: 3px 8px; }

  /* Tablet touch: give the main action buttons the same comfortable target as phone */
  .btn { min-height: 40px; }
  .btn-disp { min-height: 44px; }

  /* Login page */
  .login-card { max-width: 400px; margin: 0 16px; }
}

/* ── Phone (< 640px): full mobile layout ──────────────────────────────────── */
@media (max-width: 639px) {

  /* ── Topbar ── */
  .topbar {
    height: 50px; padding: 0 10px; gap: 6px;
  }

  .topbar-brand { font-size: 13px; gap: 4px; }
  .topbar-brand span { display: none; } /* hide text, keep emoji */

  .topbar-center { gap: 4px; justify-content: flex-start; flex: 1; overflow: hidden; }
  .topbar-right  { gap: 5px; }

  /* Hide non-critical topbar items on phone */
  #tb-net       { display: none !important; }
  #tb-role-badge { display: none !important; }
  #tb-ext-wrap  { display: none !important; }
  .tb-name      { display: none; }

  /* Compact chips on phone */
  .status-chip  { font-size: 10px; padding: 3px 8px; }
  .sip-chip     { font-size: 10px; padding: 2px 6px; }
  .camp-chip    { font-size: 10px; padding: 2px 6px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .call-timer-global { font-size: 12px; padding: 2px 6px; letter-spacing: .05em; }

  /* Topbar controls: keep a usable ~36px tap target within the 50px bar */
  .btn-topbar, .btn-icon {
    min-height: 36px; min-width: 34px;
    display: inline-flex; align-items: center; justify-content: center;
  }

  /* Toggle buttons icon-only */
  #btn-toggle-left  { padding: 4px 8px; font-size: 15px; }
  #btn-toggle-right { padding: 4px 8px; font-size: 15px; }

  /* Compact fresh + logout (still ~36px tall via .btn-topbar above) */
  #btn-fresh  { padding: 6px 9px; font-size: 11px; }
  #btn-logout { padding: 6px 9px; font-size: 11px; }

  /* ── Main Layout: STACKED single column ──────────────────────────────────
     Every panel is visible and the page scrolls — NO off-canvas drawers on
     mobile (those hid the Start/Manual/Break controls and read as "broken").
     Order: call area first, then controls + stats, then call log. */
  .main-layout,
  [data-layout="glass"] .main-layout,
  [data-layout="dashboard"] .main-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    grid-template-areas: none !important;
    grid-template-rows: none !important;
    height: calc(100vh - 50px);
    height: calc(100dvh - 50px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* All three panels in normal flow, full width, always visible. flex:0 0 auto
     is CRITICAL: main-layout has a fixed (dvh) height and is a flex column, so
     without it the panels shrink to fit and their overflow:visible content
     spills out and OVERLAPS the panel below. Keeping natural height + the
     container's overflow-y:auto makes it scroll cleanly instead. */
  .panel-left,
  .panel-right,
  .panel-center {
    position: static !important;
    display: flex !important;
    flex-direction: column;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    box-shadow: none !important;
    animation: none !important;
    overflow: visible !important;
    z-index: auto;
    box-sizing: border-box;
  }
  /* Default (idle/ready): controls FIRST so Start Campaign is at the top, then
     the call area, then the call log. During a live call the call area jumps to
     the top (.ml-oncall) so End Call / disposition are immediately in reach. */
  .panel-left   { order: 1; padding: 10px; }
  .panel-center { order: 2; padding: 14px 10px; border: none; border-top: 1px solid var(--border); }
  .panel-right  { order: 3; padding: 10px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
  }
  .main-layout.ml-oncall .panel-center { order: 0; border-top: none; }
  .main-layout.ml-oncall .panel-left  { border-top: 1px solid var(--border); }

  /* Drawer machinery is unused on mobile now */
  #btn-toggle-left, #btn-toggle-right { display: none !important; }
  .panel-overlay-backdrop { display: none !important; }

  /* ── Cards fill mobile width ── */
  .call-card-main { max-width: 100%; width: 100%; }
  .disp-card      { max-width: 100%; width: 100%; }

  /* ── Cards in panel: full width, less padding ── */
  .card { padding: 10px; }

  /* ── Status buttons: full width vertical on mobile ── */
  .status-btns {
    flex-direction: column; gap: 6px;
  }
  .btn-ready, .btn-pause, .btn-brk {
    width: 100%; text-align: center;
  }

  /* ── Bigger tap targets ── */
  .btn { min-height: 40px; font-size: 13px; }
  .btn-ready, .btn-pause, .btn-brk { min-height: 42px; }

  /* ── In-call controls: wrap on mobile (real container is #call-controls, buttons .call-ctrl) ── */
  #call-controls {
    flex-wrap: wrap; gap: 6px;
  }
  #call-controls .btn {
    flex: 1 1 calc(50% - 6px); min-width: 0;
    font-size: 12px; padding: 8px 6px;
  }

  /* ── Disposition buttons: 1-column on phone (real container is #disp-buttons.disp-grid) ── */
  .disp-grid {
    display: flex !important; flex-direction: column; gap: 6px;
  }
  .disp-grid .btn, .disp-grid .btn-disp {
    width: 100%;
  }

  /* ── Lead info in call card (real classes: .call-number / .call-name-lbl) ── */
  .call-number   { font-size: 22px; }
  .call-name-lbl { font-size: 13px; }

  /* ── Stat grid: 2 columns on phone (real container is .stats-grid-7) ── */
  .stats-grid-7 { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-n       { font-size: 18px !important; }

  /* ── Right-tab bar (real classes: .right-tabs / .rtab) ── */
  .right-tabs { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .rtab { font-size: 11px; padding: 6px 12px; }

  /* ── Right-tab content ── */
  .rtab-content { padding: 10px; }

  /* ── Login page ── */
  .v-login { padding: 0; }
  .login-card {
    width: 100%; min-height: 100vh;
    border-radius: 0;
    padding: 28px 20px 20px;
    box-shadow: none;
    border: none;
  }

  /* ── Modal / overlay panels ── */
  .modal-box {
    width: 96vw; max-width: 96vw;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    border-top: 1px solid var(--border);
    padding-bottom: calc(env(safe-area-inset-bottom));
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  /* ── Transfer panel: full width ── */
  #transfer-panel { width: 100%; }

  /* ── Wrap card ── */
  .wrap-clock { font-size: 28px; }

  /* ── Hidden cards bar ── */
  .hidden-cards-bar { flex-wrap: wrap; gap: 4px; }

  /* ── Break code grid on mobile ── */
  .break-code-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ── Theme / Layout pickers ── */
  .theme-picker-drop.open { right: -6px; }
  .tp-dots-row {
    grid-template-columns: repeat(4, 24px) !important;
  }

  .layout-picker-drop {
    right: -10px; left: auto;
    min-width: 180px;
  }

  /* ── Dup session dialog ── */
  .dup-session-box {
    width: 90vw; padding: 24px 16px;
  }

  /* ── Tab-blocked overlay ── */
  .tab-blocked-box {
    width: 90vw; padding: 28px 20px;
  }

  /* ── Panel resize handles: hidden on mobile (no drag needed) ── */
  .panel-resize-handle { display: none; }

  /* ── Adjust panel-collapsed for mobile (use panel-visible toggle instead) ── */
  .panel-left.panel-collapsed,
  .panel-right.panel-collapsed {
    display: none;
  }

  /* ── State-idle (big empty state in center) ── */
  .state-idle { padding: 40px 20px; }

  /* ── Ringing card ── */
  .ring-card { max-width: 100%; padding: 16px 12px; }

  /* ── WhatsApp inbox: full-screen + stack sidebar over chat (inline styles → !important) ── */
  .wa-modal-box {
    right: 0 !important; left: 0 !important; top: 0 !important; bottom: 0 !important;
    width: 100% !important; max-width: 100% !important;
    border-radius: 0 !important;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .wa-ag-row { flex-direction: column !important; }
  .wa-ag-sidebar {
    flex: 0 0 auto !important; max-height: 38vh;
    border-right: none !important; border-bottom: 1px solid #e2e8f0;
  }
  .wa-ag-pane { min-height: 0; }

  /* ── Date-range filter row: allow wrap so 3 datetime inputs + buttons fit ── */
  .log-dtrange-row { flex-wrap: wrap !important; }
  .log-dt-inp { flex: 1 1 45%; min-width: 0; }
}

/* ── Very small phones (< 380px) ─────────────────────────────────────────── */
@media (max-width: 379px) {
  #call-controls .btn { flex: 1 1 100%; }
  .stats-grid-7 { grid-template-columns: 1fr 1fr; }
  .topbar-brand { font-size: 16px; }
}

/* ── Landscape phone (height < 500px) ───────────────────────────────────── */
@media (max-height: 499px) and (max-width: 900px) {
  .topbar { height: 42px; }
  .main-layout { height: calc(100vh - 42px); height: calc(100dvh - 42px); }
  .panel-left { top: 42px; }
  .panel-right { top: 42px; }
  .panel-center { padding: 8px; }
  .card { padding: 8px; }
  .call-card-main { padding: 12px; }
}

/* ── Desktop (≥ 1024px): ONE consistent 3-column layout ───────────────────────
   Below 1024px the layout stacks (see the ≤1023px block). At/above 1024px it is
   always the base 228px / 1fr / 236px grid — no narrower "wide-tablet" variant,
   which is what made the panels look collapsed just past the stacking boundary.
   The base .main-layout already provides these columns, so no rule is needed. */

/* ── Panel overlay backdrop (shared) ───────────────────────────────────────── */
.panel-overlay-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 295;
  background: rgba(0,0,0,.38);
}
.panel-overlay-backdrop.active { display: block; }

/* ── Layout-specific responsive adjustments ───────────────────────────────── */

/* Glass on phone: uses the standard single-column + drawer layout (base phone
   media query handles it); only the login card needs a glass-specific tweak. */
@media (max-width: 639px) {
  [data-layout="glass"] .login-card { border-radius: 0; min-height: 100vh; min-height: 100dvh; }
}


/* Dashboard + glass now collapse via the unified .main-layout rules above and
   use the base mobile drawers — no layout-specific mobile overrides needed. */


/* ══════════════════════════════════════════════════════════════════════════
   CALLER HISTORY PANEL — shown during any call (inbound or outbound)
   ══════════════════════════════════════════════════════════════════════════ */
.caller-history-box {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg2);
  overflow: hidden;
}

.ch-header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.ch-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text2);
}

.ch-count {
  font-size: 11px; font-weight: 700;
  background: var(--primary); color: #fff;
  padding: 1px 7px; border-radius: 999px;
  display: none;
}

.ch-count.visible { display: inline; }

.ch-toggle {
  margin-left: auto; background: none; border: none;
  color: var(--text3); font-size: 14px; cursor: pointer;
  padding: 0 2px; line-height: 1;
  transition: transform .2s;
}

.caller-history-box.ch-collapsed .ch-toggle { transform: rotate(-90deg); }
.caller-history-box.ch-collapsed .ch-list   { display: none; }

.ch-list {
  max-height: 220px; overflow-y: auto;
  padding: 6px 0;
}

.ch-item {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 4px 8px;
  align-items: start;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  transition: background .12s;
}

.ch-item:last-child { border-bottom: none; }
.ch-item:hover { background: var(--card); }

.ch-dir {
  font-size: 14px; line-height: 1.4;
  flex-shrink: 0;
}

.ch-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.ch-date {
  font-size: 10px; color: var(--text3); font-weight: 500; white-space: nowrap;
}

.ch-disp {
  font-size: 11px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ch-meta {
  font-size: 10px; color: var(--text3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ch-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0;
}

.ch-dur {
  font-size: 11px; color: var(--text2); font-weight: 600;
  white-space: nowrap;
}

.ch-rec {
  font-size: 11px; color: var(--primary); cursor: pointer; white-space: nowrap;
}

.ch-status-pill {
  font-size: 10px; padding: 1px 6px; border-radius: 999px;
  font-weight: 600; white-space: nowrap;
}
.ch-status-pill.s-answered { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.ch-status-pill.s-missed   { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.ch-status-pill.s-inbound  { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }

.ch-empty {
  padding: 14px 12px; text-align: center;
  color: var(--text3); font-size: 12px;
}

.ch-loading {
  padding: 14px 12px; text-align: center;
  color: var(--text3); font-size: 11px;
}

/* ============================================================
   BROADCAST NOTIFICATIONS (super-admin → agent)
   ============================================================ */
.broadcast-host {
  position: relative; z-index: 200;
  display: flex; flex-direction: column; gap: 1px;
}
.broadcast-banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 18px; font-size: 14px; line-height: 1.4;
  border-bottom: 2px solid rgba(0,0,0,.15);
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  animation: bcSlideDown .25s ease;
}
@keyframes bcSlideDown { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.broadcast-banner .bc-banner-icon { font-size: 18px; line-height: 1.2; flex-shrink: 0; }
.broadcast-banner .bc-banner-body { flex: 1; }
.broadcast-banner .bc-banner-title { font-weight: 700; margin-bottom: 1px; }
.broadcast-banner .bc-banner-msg { font-weight: 500; }
.broadcast-banner .bc-banner-x {
  flex-shrink: 0; border: none; background: transparent; cursor: pointer;
  font-size: 20px; line-height: 1; color: inherit; opacity: .6; padding: 0 2px;
}
.broadcast-banner .bc-banner-x:hover { opacity: 1; }
.broadcast-banner.bc-info     { background: #eff6ff; color: #1e3a8a; border-bottom-color: #3b82f6; }
.broadcast-banner.bc-success  { background: #ecfdf5; color: #065f46; border-bottom-color: #10b981; }
.broadcast-banner.bc-warning  { background: #fffbeb; color: #92400e; border-bottom-color: #f59e0b; }
.broadcast-banner.bc-maint    { background: #f5f3ff; color: #5b21b6; border-bottom-color: #8b5cf6; }
.broadcast-banner.bc-critical { background: #fef2f2; color: #991b1b; border-bottom-color: #ef4444; }

/* ============================================================
   CHAT (Conversation with company admin)
   ============================================================ */
.btn-chat { position: relative; }
.chat-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  font-size: 10px; font-weight: 700; color: #fff; background: #ef4444;
  border-radius: 999px; display: flex; align-items: center; justify-content: center; line-height: 1;
}
.chat-modal {
  position: fixed; inset: 0; z-index: 9500;
  background: transparent;            /* no page dimming — clicking the empty area minimizes */
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 0 20px 20px 0;
}
.chat-box {
  width: 380px; max-width: calc(100vw - 24px); height: 540px; max-height: calc(100vh - 90px);
  background: var(--bg2, #fff); color: var(--text, #111);
  border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,.35);
  animation: chatPop .18s ease;
}
@keyframes chatPop { from { transform: translateY(16px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--topbar-bg, #128C7E); color: #fff; }
.chat-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.chat-head-name { font-weight: 700; font-size: 15px; flex: 1; }
.chat-head-sub { font-size: 11px; font-weight: 500; opacity: .85; }
.chat-close { background: transparent; border: none; color: #fff; font-size: 24px; cursor: pointer; line-height: 1; opacity: .85; }
.chat-close:hover { opacity: 1; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 7px; background: var(--bg, #efe7dd); }
.chat-empty { margin: auto; text-align: center; color: var(--text2, #888); font-size: 13px; }
.chat-msg { display: flex; max-width: 80%; }
.chat-msg.mine { align-self: flex-end; }
.chat-msg.theirs { align-self: flex-start; }
.chat-bubble { padding: 7px 11px 5px; border-radius: 12px; font-size: 14px; line-height: 1.4; word-break: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.chat-msg.mine .chat-bubble { background: #d9fdd3; color: #111; border-bottom-right-radius: 3px; }
.chat-msg.theirs .chat-bubble { background: #fff; color: #111; border-bottom-left-radius: 3px; }
.chat-meta { display: block; text-align: right; font-size: 10px; color: #667; margin-top: 1px; }
.chat-ticks { color: #9ca3af; margin-left: 2px; }
.chat-ticks.seen { color: #2563eb; }
.chat-input { display: flex; gap: 8px; padding: 10px 12px; background: var(--bg2, #fff); border-top: 1px solid var(--border, #ddd); }
.chat-input input { flex: 1; padding: 9px 14px; border: 1px solid var(--border, #ccc); border-radius: 999px; font-size: 14px; outline: none; background: var(--card, #fff); color: var(--text, #111); }
.chat-input input:focus { border-color: #128C7E; }

/* Chat contact list (categorized: Admin / Administrator) */
.chat-list { flex: 1; overflow-y: auto; background: var(--bg, #efe7dd); }
.chat-contact { display: flex; align-items: center; gap: 11px; padding: 12px 14px; cursor: pointer; border-bottom: 1px solid rgba(0,0,0,.06); background: var(--bg2, #fff); }
.chat-contact:hover { background: rgba(18,140,126,.08); }
.chat-contact-body { flex: 1; min-width: 0; }
.chat-contact-name { font-weight: 700; font-size: 14px; }
.chat-contact-prev { font-size: 12px; color: var(--text2, #888); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-unread { background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.chat-back { background: transparent; border: none; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px 0 0; opacity: .9; }
.chat-back:hover { opacity: 1; }

/* ============================================================
   CHAT — enhanced appearance (overrides the minimal base above)
   ============================================================ */
.chat-box {
  width: 400px; height: 580px; max-height: calc(100vh - 86px);
  border-radius: 18px; overflow: hidden;
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 24px 60px rgba(0,0,0,.32), 0 4px 12px rgba(0,0,0,.18);
}
.chat-head {
  gap: 11px; padding: 14px 16px;
  background: linear-gradient(135deg, #128C7E 0%, #075E54 100%);
  color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.15); position: relative; z-index: 2;
}
.chat-head .chat-avatar {
  width: 40px; height: 40px; background: rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.35); font-size: 20px;
}
.chat-head-name { font-size: 16px; font-weight: 700; }
.chat-head-sub { font-size: 11.5px; opacity: .9; font-weight: 500; }
.chat-close {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: rgba(255,255,255,.12); transition: background .15s;
}
.chat-close:hover { background: rgba(255,255,255,.28); opacity: 1; }
.chat-back {
  width: 30px; height: 30px; border-radius: 50%; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.12); transition: background .15s;
}
.chat-back:hover { background: rgba(255,255,255,.28); }

/* Message area — subtle chat wallpaper */
.chat-msgs {
  padding: 16px; gap: 8px;
  background:
    radial-gradient(circle at 18% 12%, rgba(18,140,126,.05), transparent 60%),
    radial-gradient(circle at 82% 80%, rgba(7,94,84,.05), transparent 55%),
    var(--bg, #ece5dd);
}
.chat-bubble {
  padding: 8px 12px 6px; border-radius: 14px; font-size: 14px; line-height: 1.45;
  box-shadow: 0 1px 1.5px rgba(0,0,0,.12);
}
.chat-msg.mine .chat-bubble  { background: #d9fdd3; border-bottom-right-radius: 4px; }
.chat-msg.theirs .chat-bubble { background: #fff; border-bottom-left-radius: 4px; }
.chat-meta { font-size: 10px; color: #5b6b66; margin-top: 2px; }

/* Contact list — richer rows */
.chat-list { padding: 6px 0; }
.chat-contact { padding: 13px 16px; gap: 13px; transition: background .12s; }
.chat-contact .chat-avatar {
  width: 44px; height: 44px; font-size: 22px;
  background: linear-gradient(135deg, #e8f5f2, #d2ece6);
  border: 1px solid rgba(18,140,126,.18);
}
.chat-contact-name { font-size: 15px; font-weight: 700; }
.chat-contact-prev { font-size: 12.5px; margin-top: 1px; }

/* Composer */
.chat-input { padding: 11px 13px; gap: 9px; background: var(--bg2, #f7f7f7); }
.chat-input input { padding: 10px 15px; font-size: 14px; box-shadow: inset 0 1px 2px rgba(0,0,0,.05); }
.chat-input .btn { border-radius: 999px; padding: 9px 18px; font-weight: 600; }

/* Chat composer icons, emoji picker, attachments */
.chat-input { position: relative; }
.chat-icon-btn { background: transparent; border: none; font-size: 20px; cursor: pointer; padding: 4px 6px; border-radius: 8px; line-height: 1; display: flex; align-items: center; }
.chat-icon-btn:hover { background: rgba(0,0,0,.06); }
.chat-emoji-panel { position: absolute; bottom: 60px; left: 12px; right: 12px; background: var(--bg2, #fff); border: 1px solid var(--border, #ddd); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 8px; display: flex; flex-wrap: wrap; gap: 2px; max-height: 180px; overflow-y: auto; z-index: 30; }
.chat-emoji { background: transparent; border: none; font-size: 20px; cursor: pointer; padding: 4px; border-radius: 6px; }
.chat-emoji:hover { background: rgba(0,0,0,.08); }
.chat-text-body { white-space: pre-wrap; }
.chat-att-img img { max-width: 220px; max-height: 220px; border-radius: 10px; display: block; margin: 2px 0; }
.chat-att-file { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; background: rgba(0,0,0,.06); border-radius: 8px; color: inherit; text-decoration: none; font-size: 13px; margin: 2px 0; }
.chat-att-file:hover { background: rgba(0,0,0,.12); }

/* ── Accessibility: visible keyboard focus ring (was missing entirely) ───────── */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible, .btn-disp:focus-visible {
  outline: 2px solid var(--primary, #007AFF);
  outline-offset: 2px;
}

/* ============================================================
   UI ENHANCEMENT PASS — presentation only, appended (overrides by cascade).
   Uses existing theme variables so it works in light + dark themes.
   No markup/JS changes; class names the JS toggles are preserved.
   ============================================================ */

/* Cards: a little more depth + breathing room */
.card { box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 12px 28px -20px rgba(0,0,0,.30); }
.card-title { margin-bottom: 11px; }

/* Live-call card: more room */
.call-card-main { padding: 18px 18px 16px; }

/* Caller name/number hierarchy — make the WHO unmistakable */
.call-number   { font-size: 23px; font-weight: 800; letter-spacing: -.3px; line-height: 1.1; }
.call-name-lbl { font-size: 14px; color: var(--text2); margin-top: 3px; }

/* Timer: bigger + monospace so digits never jitter */
.call-timer {
  font-size: 40px; font-weight: 800; letter-spacing: .5px; line-height: 1;
  font-family: "SF Mono", ui-monospace, "Roboto Mono", Menlo, Consolas, monospace;
}

/* State badge: a soft glow in its own state color for presence */
.call-state-badge { padding: 7px 18px; }
.call-state-badge.state-dialing   { box-shadow: 0 8px 20px -12px var(--primary); }
.call-state-badge.state-ringing   { box-shadow: 0 8px 20px -12px var(--warn); }
.call-state-badge.state-connected { box-shadow: 0 8px 20px -12px var(--success); }

/* In-call controls: cohesive cluster, bigger targets, hover lift, clear ON state */
#call-controls { gap: 8px; }
.call-ctrl {
  padding: 11px 12px; border-radius: 12px; font-weight: 600;
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: transform .12s, background .15s, border-color .15s, box-shadow .15s;
}
.call-ctrl:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--text3); }
.call-ctrl.ctrl-active { box-shadow: 0 8px 18px -10px var(--primary); }

/* End Call: prominent, its own weight, separated from secondary controls */
#state-call .btn-danger {
  padding: 13px 16px; border-radius: 12px; font-weight: 700; font-size: 14px;
  box-shadow: 0 10px 22px -12px var(--danger);
}
#state-call .btn-danger:hover:not(:disabled) { opacity: 1; transform: translateY(-1px); }

/* Status buttons: bigger touch + semantic glow when active */
.btn-ready, .btn-pause, .btn-brk {
  padding: 10px 12px; border-radius: 11px;
  transition: transform .12s, box-shadow .15s, background .15s, border-color .15s;
}
.btn-ready:hover:not(:disabled),
.btn-pause:hover:not(:disabled),
.btn-brk:hover:not(:disabled) { transform: translateY(-1px); }
.btn-ready.btn-active { box-shadow: 0 8px 18px -10px var(--success); }
.btn-pause.btn-active { box-shadow: 0 8px 18px -10px var(--primary); }
.btn-brk.btn-active   { box-shadow: 0 8px 18px -10px var(--warn); }

/* Tabular figures wherever digits line up (no width jitter) */
.call-timer, .call-timer-global, .camp-prog, .kpi .v, .stat-value, .log-number { font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════════════════════════════════════
   PRODUCT TYPE SYSTEM — applies to every theme
   ═══════════════════════════════════════════════════════════════════════════
   This is the product's own typography and hierarchy, not a theme: every rule
   reads the active theme's tokens (--text, --border, --primary …), so colour
   still comes from whichever theme the agent picked while the structure — the
   mono numerals, the condensed labels, the target sizes — is the same for
   everyone. Colour is a preference; legibility is not.

   Design intent, in one paragraph: the agent lives on the CENTER panel, in
   four moments — waiting, dialing, talking, disposing. The type does the work:
   every number an agent reads under pressure (timer, phone number, stats) is
   JetBrains Mono with tabular numerals so digits do not shuffle as they tick;
   labels are condensed caps; and the disposition grid gets big targets with
   visible keyboard hints, because that screen is raced through 200 times a day.
   ────────────────────────────────────────────────────────────────────────── */

body {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Topbar: identity left, state centre, tools right ── */
.topbar-brand {
  font-weight: 700;
  letter-spacing: -.015em;
}
:is(.status-chip,.sip-chip,.net-chip,.camp-chip) {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -.01em;
  border-radius: 6px;
}
.call-timer-global {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ── Cards: condensed caps titles carry the structure ── */
.card-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--text2);
}
.card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* ── The four moments of the centre panel ── */
.state-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.015em;
}
:is(.dialing-number,.ringing-number) {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.02em;
}

/* On call: the number and the clock are what the agent glances at — both mono,
   the clock large enough to read from an arm's length away. */
.call-number {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.call-timer {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--success);
}
.call-state-badge {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Wrap-up clock — same instrument treatment. */
.wrap-clock {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ── Disposition: the screen raced through 200 times a day ──
   Bigger targets, a real pressed state, and the keyboard hint visible on the
   button itself rather than in a footnote. */
.btn-disp {
  min-height: 44px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background .1s, border-color .1s, transform .06s;
}
.btn-disp:active { transform: scale(.985); }
.btn-disp-key {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  opacity: .8;
}
.disp-number {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ── Keypad: phone-grade keys, mono digits ── */
.key-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: background .08s, transform .06s;
}
.key-btn:active { transform: scale(.96); }
.key-digit {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 19px;
  font-weight: 600;
}
.key-sub {
  font-size: 8.5px;
  letter-spacing: .14em;
}
.cmd-inp-num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

/* ── Today's Performance: numbers align, labels recede ── */
.stat-n {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.stat-l {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
}
.stat-talktime span:first-child {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ── Call log: number is the anchor, meta is quiet mono ── */
.log-number {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
:is(.log-time,.log-dur,.ch-dur,.ch-date) {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
}
.rtab {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ── Empty states say what to do, not just what is absent ── */
:is(.log-empty,.ch-empty,.chat-empty) {
  color: var(--text3);
  font-size: 12.5px;
  padding: 26px 12px;
  text-align: center;
}

/* ── Login: first thing a new agent sees ── */
.login-brand h1 {
  font-weight: 700;
  letter-spacing: -.02em;
}
.login-card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* ── Quality floor ── */
:is(button,a,input,select,textarea):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   PRODUCT POLISH — applies to every theme
   ═══════════════════════════════════════════════════════════════════════════
   Motion, depth and feedback. Same contract as the type system above: every
   value comes from the active theme's tokens, so this is the product feeling
   finished, not a look competing with the agent's chosen colours.
   ────────────────────────────────────────────────────────────────────────── */

/* Buttons: hover states derived from the colour itself, not from opacity —
   a translucent button over a card reads as disabled, not hovered. */
.btn { transition: background .13s, transform .08s, box-shadow .13s, border-color .13s, opacity .15s; }
.btn-primary { box-shadow: 0 1px 2px color-mix(in srgb, var(--primary) 40%, transparent); }
.btn-success:hover:not(:disabled) { opacity: 1; background: color-mix(in srgb, var(--success) 88%, #000); }
.btn-danger:hover:not(:disabled)  { opacity: 1; background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--card2) 80%, var(--text) 6%); }

/* The three status controls are the agent's gearstick — they get real height. */
.status-btns .btn { min-height: 34px; }

/* The centre panel's screens arrive instead of snapping. The animation runs
   when a screen's display flips from none, so it fires exactly once per state
   change — 180ms, 5px of rise, never in anyone's way. */
.state-box, .call-card-main, .disp-card, .center-manual-wrap {
  animation: ag-arrive .18s ease-out;
}
@keyframes ag-arrive {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}

/* Live timer breathes while a call is up: colour, not size — the clock must
   never move under the eye that is reading it. */
.call-timer { transition: color .3s; }

/* Disposition buttons answer the hover before the click. */
.btn-disp:hover { background: color-mix(in srgb, var(--primary) 8%, var(--card)); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }

/* Log rows acknowledge the pointer. */
.log-item:hover, .call-log-item:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }

/* Toast: rises into place, and sits on a real radius rather than a full pill
   so multi-line messages keep their shape. */
.agent-toast { border-radius: 12px; animation: ag-toast-in .22s cubic-bezier(.2,.7,.3,1); }
@keyframes ag-toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Scrollbars belong to the theme, not the OS. */
.panel-left, .panel-right, .rtab-content, .call-log, .campaign-list, .chat-msgs, .ch-list {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text3) 45%, transparent) transparent;
}
:is(.panel-left,.panel-right,.rtab-content,.call-log,.campaign-list,.chat-msgs,.ch-list)::-webkit-scrollbar { width: 5px; }
:is(.panel-left,.panel-right,.rtab-content,.call-log,.campaign-list,.chat-msgs,.ch-list)::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text3) 45%, transparent);
  border-radius: 3px;
}

/* Inputs: one focus language everywhere. */
:is(.inp-field,.log-search-inp,.log-dt-inp,.xfer-input,.notes-area,.chat-input):focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .state-box, .call-card-main, .disp-card, .center-manual-wrap, .agent-toast { animation: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   CALL-STATE VISUALS — drawn in CSS on the existing hooks
   ═══════════════════════════════════════════════════════════════════════════
   The .state-icon elements are empty divs — the old emoji were removed, so the
   dialing screen was animating a blank space. Rather than putting emoji back,
   the states get real instrument graphics drawn entirely in CSS: a radiating
   pulse while dialing, a ringing ripple on an incoming call, a quiet standby
   ring when idle. No markup or JS involved, so nothing functional can move.
   ────────────────────────────────────────────────────────────────────────── */

/* Idle: a calm standby ring — present, not demanding. */
#state-idle .state-icon {
  width: 64px; height: 64px; margin: 0 auto 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  position: relative;
}
#state-idle .state-icon::after {
  content: ''; position: absolute; inset: 22px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text3) 35%, transparent);
}

/* Dialing: radiating pulse in the primary colour — energy going OUT. */
.state-icon.pulse-anim {
  width: 64px; height: 64px; margin: 0 auto 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  position: relative;
  animation: none;                      /* replaces the old scale-pulse on nothing */
}
.state-icon.pulse-anim::before {
  content: ''; position: absolute; inset: 18px;
  border-radius: 50%;
  background: var(--primary);
}
.state-icon.pulse-anim::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid var(--primary);
  animation: ag-radiate 1.5s ease-out infinite;
}
@keyframes ag-radiate {
  from { transform: scale(1);    opacity: .7; }
  to   { transform: scale(1.85); opacity: 0; }
}

/* Incoming: the same ripple, in the success colour, faster — energy coming IN
   and needing an answer. The old shake animated an empty box; replaced. */
.state-icon.ring-anim {
  width: 64px; height: 64px; margin: 0 auto 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--success) 20%, transparent);
  position: relative;
  animation: none;
}
.state-icon.ring-anim::before {
  content: ''; position: absolute; inset: 18px;
  border-radius: 50%;
  background: var(--success);
}
.state-icon.ring-anim::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid var(--success);
  animation: ag-radiate .9s ease-out infinite;
}

/* The Answer button carries a breathing glow — on an incoming call it must be
   the most findable thing on the screen. */
.btn-success.ring-btn { animation: ag-answer-glow 1.2s ease-in-out infinite; }
@keyframes ag-answer-glow {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 45%, transparent); }
  50%      { box-shadow: 0 0 0 9px color-mix(in srgb, var(--success) 0%, transparent); }
}

/* ── Today's Performance: one voice, seven accents ──
   Seven differently-coloured NUMBERS is a fruit machine — nothing stands out
   because everything does. The identity colour stays on each metric's accent
   bar, where it works as a legend; the numbers themselves all speak in the
   theme's ink, so a glance reads values, not a rainbow. */
.stats-grid-7 .stat-n,
.si-blue .stat-n, .si-green .stat-n, .si-gold .stat-n, .si-orange .stat-n,
.si-red .stat-n, .si-purple .stat-n, .si-teal .stat-n {
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  .state-icon.pulse-anim::after, .state-icon.ring-anim::after,
  .btn-success.ring-btn { animation: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   READY SCREEN · WRAP RING · LOG PILLS · LOGIN — applies to every theme
   ────────────────────────────────────────────────────────────────────────── */

/* Idle as a ready screen: greeting, today's line, and a Start that proxies the
   real control (so permission and break logic stay in exactly one place). */
.idle-greet {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--text);
  margin-bottom: 6px;
}
.idle-today {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text2);
}
.idle-today b {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
}
.idle-dot { color: var(--text3); }
.idle-start { margin-top: 18px; min-height: 38px; padding: 9px 26px; }

/* Wrap-up: the clock sits inside a ring that drains with the timer. The ring is
   an ::after masked to the rim, so it can never sit over the digits. */
.wrap-clock {
  position: relative;
  width: 92px; height: 92px;
  margin: 6px auto 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--card2);
  font-size: 22px;
}
.wrap-clock::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--warn) var(--wrap-pct, 100%), color-mix(in srgb, var(--border) 60%, transparent) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
}

/* Call log: the disposition reads as a pill in its own colour (the renderer
   already sets color inline — currentColor turns it into the tint), and the
   campaign name recedes to a quiet label. */
.log-disp {
  background: color-mix(in srgb, currentColor 12%, transparent);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
}
.log-camp {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text3);
}

/* Login: the first thing a new agent sees. The empty .login-icon becomes the
   brand mark — a ring with a live dot, drawn in CSS. */
.v-login {
  background:
    radial-gradient(1100px 500px at 50% -10%, color-mix(in srgb, var(--primary) 7%, transparent), transparent 70%),
    var(--bg);
}
.login-card { border: 1px solid var(--border); }
.login-icon {
  width: 54px; height: 54px;
  margin: 0 auto 14px;
  border: 2.5px solid var(--primary);
  border-radius: 50%;
  position: relative;
}
.login-icon::after {
  content: '';
  position: absolute; inset: 17px;
  border-radius: 50%;
  background: var(--primary);
}
.login-brand h1 { letter-spacing: -.02em; }
.login-brand p {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text3);
}


/* ── Live call journey (campaign-gated) ────────────────────────────────────── */
.journey-box {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card2);
  overflow: hidden;
}
.journey-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 11px;
  border-bottom: 1px solid var(--border);
}
.journey-title {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text2);
}
.journey-live {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9px; font-weight: 700;
  color: var(--success);
  animation: journey-pulse 1.6s ease-in-out infinite;
}
@keyframes journey-pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.journey-list {
  max-height: 150px; overflow-y: auto;
  padding: 6px 11px 8px;
  scrollbar-width: thin;
}
.journey-row {
  display: flex; gap: 9px; align-items: baseline;
  padding: 2.5px 0;
  font-size: 12px; line-height: 1.4;
  color: var(--text);
}
.jr-time {
  flex: none;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 10px; color: var(--text3);
}
.jr-detail { min-width: 0; }
.journey-row.jr-dtmf .jr-detail,
.journey-row.jr-dtmf_invalid .jr-detail { font-weight: 600; color: var(--primary); }
.journey-row.jr-agent_declined .jr-detail,
.journey-row.jr-agent_no_answer .jr-detail { color: var(--warn); }
.journey-row.jr-transfer_failed .jr-detail { color: var(--danger); }

/* Compact version on the incoming-call screen */
.ringing-journey {
  margin: 12px auto 0;
  max-width: 330px;
  text-align: left;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: var(--card2);
}
.rj-row {
  font-size: 11.5px; color: var(--text2);
  padding: 1.5px 0; line-height: 1.4;
}
.rj-row:last-child { color: var(--text); font-weight: 600; }

@media (prefers-reduced-motion: reduce) { .journey-live { animation: none; } }

/* Animated Qallixo logo — the Q's three bars pulse like a live voice equalizer */
.login-logo svg g rect,
.login-icon svg g rect,
.kg-brand svg g rect,
.topbar-brand svg g rect,
.topbar-left .brand svg g rect{
  transform-box:fill-box; transform-origin:center center;
  animation:qeq 1.15s ease-in-out infinite;
}
.login-logo svg g rect:nth-child(1),.login-icon svg g rect:nth-child(1),.kg-brand svg g rect:nth-child(1),.topbar-brand svg g rect:nth-child(1),.topbar-left .brand svg g rect:nth-child(1){animation-delay:0s}
.login-logo svg g rect:nth-child(2),.login-icon svg g rect:nth-child(2),.kg-brand svg g rect:nth-child(2),.topbar-brand svg g rect:nth-child(2),.topbar-left .brand svg g rect:nth-child(2){animation-delay:.16s}
.login-logo svg g rect:nth-child(3),.login-icon svg g rect:nth-child(3),.kg-brand svg g rect:nth-child(3),.topbar-brand svg g rect:nth-child(3),.topbar-left .brand svg g rect:nth-child(3){animation-delay:.32s}
@keyframes qeq{0%,100%{transform:scaleY(.5)}50%{transform:scaleY(1)}}
@media (prefers-reduced-motion:reduce){.login-logo svg g rect,.login-icon svg g rect,.kg-brand svg g rect,.topbar-brand svg g rect,.topbar-left .brand svg g rect{animation:none}}
