/* ============================================================================
   DialPilot — Telegram Mini App dialer console
   Mobile-first dark UI. Deep near-black, teal/cyan telecom accent.
   Display: "Space Grotesk"-free — uses a characterful grotesk stack via the
   system; body uses a clean humanist stack. No external font imports.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* ---- Surfaces (deep near-black, layered) ---- */
  --bg:            #06080d;
  --bg-deep:       #04050a;
  --surface-1:     #0c1018;   /* cards */
  --surface-2:     #11161f;   /* nested / inputs */
  --surface-3:     #161c27;   /* hover / raised */
  --surface-glass: rgba(12, 16, 24, 0.82);

  /* ---- Lines & dividers ---- */
  --line:        rgba(140, 160, 190, 0.14);
  --line-strong: rgba(140, 160, 190, 0.24);
  --line-soft:   rgba(140, 160, 190, 0.08);

  /* ---- Text ---- */
  --ink:    #eaf1fb;
  --ink-2:  #c2cddf;
  --muted:  #7c8aa5;
  --faint:  #5b6780;

  /* ---- Accent: azul corporativo serio (enterprise) ---- */
  --accent:        #4569d6;
  --accent-2:      #5a7ce6;
  --accent-deep:   #32509f;
  --accent-ink:    #f4f7ff;            /* text on accent fills */
  --accent-soft:   rgba(69, 105, 214, 0.16);
  --accent-line:   rgba(69, 105, 214, 0.42);
  --accent-glow:   rgba(69, 105, 214, 0.26);

  /* ---- State colors (also read by Chart.js via getPropertyValue) ---- */
  --ok:        #34d989;
  --ok-soft:   rgba(52, 217, 137, 0.14);
  --warn:      #f5b13d;
  --warn-soft: rgba(245, 177, 61, 0.14);
  --danger:    #f5556d;
  --danger-soft: rgba(245, 85, 109, 0.14);
  --neutral-soft: rgba(140, 160, 190, 0.12);

  /* ---- Radii ---- */
  --r-xs: 8px;
  --r-sm: 11px;
  --r-md: 15px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-pill: 999px;

  /* ---- Shadows ---- */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.55);
  --shadow-accent: 0 14px 36px -10px var(--accent-glow);

  /* ---- Layout ---- */
  --app-max: 1120px;
  --gap: 14px;
  --pad: 16px;
  --tap: 44px;            /* min touch target */
  --topbar-h: 60px;
  --tabbar-h: 64px;

  /* ---- Type ---- */
  --font-body: "Inter var", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue",
    system-ui, -apple-system, sans-serif;
  --font-display: "SF Pro Display", "Segoe UI Semibold", "Helvetica Neue",
    system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code",
    "Roboto Mono", Menlo, Consolas, monospace;
}

/* ============================================================================
   Reset
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.locked {
  overflow: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

img, canvas, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a {
  color: inherit;
}

/* Hidden-state contract — must stay display:none */
[hidden] {
  display: none !important;
}
.compat-hidden[hidden] {
  display: none !important;
}

/* Lucide icons render at a consistent size */
[data-lucide],
svg.lucide {
  width: 1.05em;
  height: 1.05em;
  stroke-width: 2;
  flex-shrink: 0;
}

/* ============================================================================
   Atmospheric backdrop
   ========================================================================== */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(69, 105, 214, 0.10), transparent 55%),
    radial-gradient(90% 70% at 100% 0%, rgba(90, 124, 230, 0.06), transparent 60%),
    radial-gradient(120% 100% at 0% 100%, rgba(50, 80, 159, 0.07), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}
.backdrop::after {
  /* subtle grain so flat surfaces gain texture */
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================================================================
   App frame
   ========================================================================== */
.shell {
  width: 100%;
  max-width: var(--app-max);
  margin: 0 auto;
  padding: calc(var(--topbar-h) + 12px) var(--pad)
           calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 18px);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* Shared label style */
.label {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ============================================================================
   Header / topbar
   On mobile: a compact STICKY bar (brand · balance · sub dot).
   The fuller account/operator details live just below it.
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand-strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 var(--pad);
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.brand-strip > div {
  min-width: 0;
}
.brand-strip h1 {
  font-size: 17px;
  letter-spacing: -0.02em;
}
.brand-strip p {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--accent-ink);
  background: linear-gradient(145deg, var(--accent-2), var(--accent-deep));
  box-shadow: var(--shadow-accent);
}
.brand-mark i,
.brand-mark svg {
  width: 20px;
  height: 20px;
}

/* Compact balance + sub dot, pinned to the right of the sticky bar */
.account-corner {
  position: fixed;
  top: 0;
  right: var(--pad);
  z-index: 61;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas: "sub money";
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
.account-corner > * {
  pointer-events: auto;
}

.account-line {
  grid-area: sub;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.account-line .label {
  display: none;
}

.account-money {
  grid-area: money;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
}
.account-money > div:last-child {
  display: none;          /* hide "Gastado" in the tight bar; visible in metrics */
}
.balance-main span,
.account-money span {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.balance-main strong,
.account-money strong {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* In the compact bar, hide the activate button + access copy (they reappear
   inside the launch hero / metrics where there's room). */
.account-corner .activate-sub,
.account-corner #cornerAccessText,
.account-corner .sub-tier {
  display: none;
}

/* Tramo de la suscripción (móvil 6xx/7xx vs fijo 8xx/9xx), junto a la cuota. */
.sub-tier {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Operator pill — sits in the scrolling content under the sticky bar */
.operator-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding: 9px 13px;
  border-radius: var(--r-pill);
  background: var(--surface-1);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
}
.pulse {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow); }
  70%  { box-shadow: 0 0 0 9px rgba(69, 105, 214, 0); }
  100% { box-shadow: 0 0 0 0 rgba(69, 105, 214, 0); }
}
.user-chip {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.user-chip b {
  color: var(--ink-2);
  font-family: var(--font-mono);
}

/* ============================================================================
   Badges (.ok / .warn / .neutral / .danger) + subscription dot
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(52, 217, 137, 0.30);
}
.badge.warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(245, 177, 61, 0.30);
}
.badge.info {
  color: #71b7ff;
  background: rgba(68, 154, 255, 0.14);
  border-color: rgba(68, 154, 255, 0.30);
}
.badge.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(245, 85, 109, 0.30);
}
.badge.neutral {
  color: var(--muted);
  background: var(--neutral-soft);
  border-color: var(--line);
}

/* Estado EN VIVO del agente: Disponible / Suena / En llamada / Desconectado. */
.badge.callstate { font-weight: 800; }
.badge.callstate.available {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(52, 217, 137, 0.30);
}
.badge.callstate.ringing {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(245, 177, 61, 0.35);
}
/* "En llamada": el estado que más quiere ver el dueño → rojo y con latido. */
.badge.callstate.oncall {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(245, 85, 109, 0.45);
  animation: callstate-pulse 1.4s ease-in-out infinite;
}
.badge.callstate.offline {
  color: var(--muted);
  background: var(--neutral-soft);
  border-color: var(--line);
}
@keyframes callstate-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 85, 109, 0.0); }
  50% { box-shadow: 0 0 0 4px rgba(245, 85, 109, 0.18); }
}

.sub-badge .dot,
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.sub-badge.ok .dot   { color: var(--ok); }
.sub-badge.danger .dot { color: var(--danger); }

.activate-sub {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: var(--r-md);
  font-weight: 650;
  color: var(--accent-ink);
  background: linear-gradient(140deg, var(--accent-2), var(--accent-deep));
  box-shadow: var(--shadow-accent);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.activate-sub:hover { filter: brightness(1.06); }
.activate-sub:active { transform: translateY(1px); }

/* ============================================================================
   Command bar — Start / Pause / Stop / Status
   ========================================================================== */
.command-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, rgba(69, 105, 214, 0.05), transparent 60%),
    var(--surface-1);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}
.command-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.command-copy strong {
  font-family: var(--font-display);
  font-size: 17px;
}
.command-copy #nextAction {
  font-size: 13px;
  color: var(--muted);
}

.control-cluster {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: var(--r-md);
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.control:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
}
.control:active { transform: translateY(1px); }
.control.primary {
  color: var(--accent-ink);
  background: linear-gradient(140deg, var(--accent-2), var(--accent-deep));
  border-color: transparent;
  box-shadow: var(--shadow-accent);
}
.control.primary:hover { filter: brightness(1.06); background: linear-gradient(140deg, var(--accent-2), var(--accent-deep)); }
.control.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(245, 85, 109, 0.34);
}
.control.danger:hover { background: rgba(245, 85, 109, 0.20); }

.status-stack {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.status-stack strong {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--accent);
}

/* ============================================================================
   Metrics grid
   ========================================================================== */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid var(--line);
}
.metric strong {
  font-family: var(--font-display);
  font-size: 21px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.metric > span:last-child {
  font-size: 11.5px;
  color: var(--muted);
}
.metric b {
  color: var(--ink-2);
}

/* ============================================================================
   Launch hero — primary "Lanzar campaña" CTA
   ========================================================================== */
.launch-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(69, 105, 214, 0.16), transparent 55%),
    var(--surface-1);
  border: 1px solid var(--accent-line);
  box-shadow: var(--shadow-md);
}
.launch-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.launch-copy strong {
  font-family: var(--font-display);
  font-size: 18px;
}
.launch-copy small {
  font-size: 12px;
  color: var(--warn);
}
.launch-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 650;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent-2), var(--accent-deep));
  box-shadow: var(--shadow-accent);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.launch-cta i,
.launch-cta svg { width: 19px; height: 19px; }
.launch-cta:hover { filter: brightness(1.07); }
.launch-cta:active { transform: translateY(1px) scale(0.995); }

/* ============================================================================
   Workspace + rail (mobile = fixed bottom tab bar)
   ========================================================================== */
.workspace {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.rail {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 55;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 6px 14px calc(env(safe-area-inset-bottom, 0px) + 4px);
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border-top: 1px solid var(--line);
}
.rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.14s ease, background 0.14s ease;
}
.rail-item i,
.rail-item svg { width: 21px; height: 21px; }
.rail-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}
.rail-item:active { transform: scale(0.97); }

/* Views */
.views { display: block; }
.view {
  display: none;
  flex-direction: column;
  gap: var(--gap);
}
.view.active {
  display: flex;
  animation: viewIn 0.28s ease both;
}

/* Single-number route tests */
.test-call-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
}
.test-call-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.test-call-context {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
}
.test-call-context span {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 10px;
  background: var(--surface-2);
  color: var(--muted);
}
.test-call-context svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--accent); }
.test-call-context b {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.test-call-timeline {
  display: grid;
  gap: 1px;
  overflow: hidden;
  min-height: 166px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
}
.test-call-step {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 8px 10px;
  background: var(--surface-2);
}
.test-call-step i,
.test-call-step svg { width: 17px; height: 17px; color: var(--muted); }
.test-call-step.done i,
.test-call-step.done svg { color: var(--success); }
.test-call-step.current { background: var(--accent-soft); }
.test-call-step.current i,
.test-call-step.current svg { color: var(--accent); }
.test-call-step strong { min-width: 0; font-size: 12.5px; }
.test-call-step small { color: var(--muted); font-size: 10.5px; text-align: right; }
.test-call-history { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.test-call-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.1fr) minmax(130px, .85fr) 110px 80px;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 11px;
  background: var(--surface-2);
}
.test-call-row > span { min-width: 0; }
.test-call-row strong,
.test-call-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-call-row strong { font-size: 12.5px; }
.test-call-row small { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.test-call-empty { display: grid; place-items: center; min-height: 116px; padding: 20px; color: var(--muted); text-align: center; }

.activity-verifier-panel {
  min-width: 0;
}
.activity-verifier-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.05fr) minmax(300px, .95fr);
  gap: 14px;
  min-width: 0;
}
.activity-verifier-list,
.activity-verifier-config {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 10px;
}
.activity-verifier-list-head,
.activity-verifier-list-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.activity-verifier-list-head > label:first-child {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}
#activityVerifierNumbers {
  min-height: 156px;
  resize: vertical;
  font-family: var(--font-mono);
  line-height: 1.55;
}
.activity-verifier-list-foot {
  color: var(--muted);
  font-size: 11px;
}
.activity-verifier-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.activity-verifier-concurrency {
  display: grid;
  gap: 8px;
}
.activity-verifier-concurrency > span {
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 650;
}
.consent-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .025);
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.35;
}
.consent-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}
.activity-verifier-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px 104px;
  gap: 8px;
}
.activity-verifier-actions .launch-cta,
.activity-verifier-actions .control {
  min-height: 42px;
}
.activity-verifier-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}
.activity-verifier-stats > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 54px;
  padding: 9px 10px;
  background: var(--surface-2);
}
.activity-verifier-stats span {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.activity-verifier-stats strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.activity-confirmed-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 6px;
}
.activity-confirmed-item,
.activity-confirmed-empty {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .02);
  font-family: var(--font-mono);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.activity-confirmed-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-family: inherit;
  text-align: center;
}

@media (max-width: 520px) {
  .rail { padding-left: 5px; padding-right: 5px; }
  .rail-item { font-size: 10px; }
  .test-call-context { grid-template-columns: 1fr; }
  .test-call-row { grid-template-columns: minmax(0, 1fr) auto; }
  .test-call-row > span:nth-child(2) { display: none; }
  .test-call-row > span:last-child { text-align: right; }
  .activity-verifier-grid,
  .activity-verifier-fields { grid-template-columns: 1fr; }
  .activity-verifier-actions { grid-template-columns: 1fr 1fr; }
  .activity-verifier-actions .launch-cta { grid-column: 1 / -1; }
  .activity-verifier-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 521px) and (max-width: 860px) {
  .activity-verifier-grid { grid-template-columns: 1fr; }
  .activity-verifier-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 860px) {
  .test-call-layout { grid-template-columns: minmax(0, 1.12fr) minmax(320px, .88fr); }
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: 21px;
  margin-top: 2px;
}

/* ============================================================================
   Panels
   ========================================================================== */
.panel {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-head h3 {
  font-size: 15.5px;
}
.panel-head h4 { font-size: 14px; }
.panel-subline {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.sendout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

/* ============================================================================
   Form controls — inputs / selects / textareas / range
   ========================================================================== */
.panel label,
.profile-grid label,
.agent-form label,
.setup-stack label,
.deposit-panel label,
.softphone-pick label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

input:not([type="range"]):not([type="file"]):not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder,
textarea::placeholder { color: var(--faint); }

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface-3);
}
input[readonly] {
  color: var(--ink-2);
  background: var(--surface-1);
  cursor: default;
}

select {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%237c8aa5' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 5l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

textarea {
  min-height: 150px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
}

/* Range slider */
input[type="range"] {
  width: 100%;
  height: 28px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent-deep), var(--accent-2));
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent-deep), var(--accent-2));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--accent);
  box-shadow: var(--shadow-sm);
}
input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--accent);
}

.field-help {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* File pill (Import / Add audio) */
.file-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: var(--tap);
  padding: 0 15px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease;
}
.file-pill:hover { background: rgba(69, 105, 214, 0.22); }
.file-pill input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

/* Action rows + buttons */
.input-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.compact-actions { gap: 8px; }

.campaign-start-picker {
  display: grid;
  grid-template-columns: minmax(84px, 0.65fr) minmax(0, 1.35fr) minmax(80px, auto);
  align-items: end;
  gap: 8px;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.campaign-start-picker label,
.campaign-start-preview {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.campaign-start-picker label > span,
.campaign-start-preview > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.campaign-start-picker input {
  width: 100%;
  min-height: 40px;
}

.campaign-start-preview b {
  min-height: 40px;
  display: flex;
  align-items: center;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-start-picker .small-action {
  min-width: 0;
  padding-inline: 10px;
}

.small-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  transition: background 0.14s ease, transform 0.1s ease, border-color 0.14s ease;
}
.small-action:hover { background: var(--surface-3); }
.small-action:active { transform: translateY(1px); }
.small-action:disabled {
  opacity: 0.55;
  cursor: default;
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.small-action.danger-text,
.danger-text {
  color: var(--danger);
  border-color: rgba(245, 85, 109, 0.30);
  background: var(--danger-soft);
}
.small-action.danger-text:hover { background: rgba(245, 85, 109, 0.20); }

.wide-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: var(--r-md);
  font-weight: 650;
  color: var(--accent-ink);
  background: linear-gradient(140deg, var(--accent-2), var(--accent-deep));
  box-shadow: var(--shadow-accent);
  transition: filter 0.12s ease, transform 0.12s ease;
}
.wide-action:hover { filter: brightness(1.06); }
.wide-action:active { transform: translateY(1px); }

.icon-action {
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  flex: 0 0 auto;
  border-radius: var(--r-sm);
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  transition: background 0.14s ease, transform 0.1s ease;
}
.icon-action:hover { background: rgba(69, 105, 214, 0.22); }
.icon-action:active { transform: translateY(1px); }

.inline-stat {
  font-size: 12.5px;
  color: var(--muted);
  margin-left: auto;
}
.inline-stat b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.inline-input {
  display: flex;
  gap: 9px;
  align-items: stretch;
}
.inline-input input { flex: 1; }
.inline-input .small-action { flex: 0 0 auto; }

.caller-id-batch-row {
  align-items: stretch;
}

.caller-id-batch-input {
  flex: 1;
  min-height: 82px;
  resize: vertical;
  line-height: 1.45;
}

.caller-id-batch-row .small-action {
  min-width: 116px;
  justify-content: center;
}

.setup-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ============================================================================
   Progress + stat rows
   ========================================================================== */
.progress-shell {
  position: relative;
  height: 9px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent-deep), var(--accent-2));
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.stats-row > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-align: left;
}
.stats-row strong {
  font-family: var(--font-display);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}
.tight-stats > div { padding: 9px 11px; }

/* Deposit panel */
.deposit-panel {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 14px;
  border-radius: var(--r-md);
  background:
    linear-gradient(180deg, rgba(69, 105, 214, 0.05), transparent 70%),
    var(--surface-2);
  border: 1px solid var(--line);
}
.deposit-panel > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.deposit-panel strong {
  font-family: var(--font-display);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.deposit-panel #depositWarning {
  font-size: 11.5px;
  color: var(--muted);
}

/* ============================================================================
   Audio library
   ========================================================================== */
.audio-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.audio-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: border-color 0.14s ease, background 0.14s ease;
}
.audio-item.selected {
  border-color: var(--accent-line);
  background:
    linear-gradient(180deg, var(--accent-soft), transparent 80%),
    var(--surface-2);
}
.audio-item > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.audio-item strong {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.audio-item > div span {
  font-size: 11.5px;
  color: var(--muted);
}

/* ============================================================================
   Checklist / ready checks
   ========================================================================== */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ready-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-2);
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}
.ready-item i,
.ready-item svg {
  width: 18px;
  height: 18px;
  color: var(--faint);
}
.ready-item.ready {
  color: var(--ink);
  border-color: rgba(52, 217, 137, 0.32);
  background:
    linear-gradient(180deg, var(--ok-soft), transparent 75%),
    var(--surface-2);
}
.ready-item.ready i,
.ready-item.ready svg { color: var(--ok); }

/* ============================================================================
   Live monitor
   ========================================================================== */
.sending-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}
.sending-stats > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.sending-stats strong {
  font-family: var(--font-display);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.live-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
.mini-panel {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 13px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.active-call-list,
.telegram-feed,
.event-feed {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.active-call-list::-webkit-scrollbar,
.telegram-feed::-webkit-scrollbar,
.event-feed::-webkit-scrollbar,
.audio-list::-webkit-scrollbar { width: 7px; }
.active-call-list::-webkit-scrollbar-thumb,
.telegram-feed::-webkit-scrollbar-thumb,
.event-feed::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--r-pill);
}

.active-call {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-1);
  border: 1px solid var(--line);
}
.active-call > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.active-call strong {
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.active-call > div span {
  font-size: 11.5px;
  color: var(--muted);
}

.telegram-message {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
}
.telegram-message strong {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.telegram-message span {
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: pre-line;
}

.privacy-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: inherit;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, opacity .18s ease;
}
.privacy-toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
}
.privacy-toggle:disabled {
  cursor: wait;
  opacity: .7;
}
.privacy-switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-3) 70%, #000);
  border: 1px solid var(--line);
}
.privacy-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink-2);
  transition: transform .18s ease, background .18s ease;
}
.privacy-toggle.active {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
}
.privacy-toggle.active .privacy-switch {
  background: color-mix(in srgb, var(--accent) 48%, var(--surface-3));
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
}
.privacy-toggle.active .privacy-switch::after {
  transform: translateX(16px);
  background: var(--ink);
}
.privacy-toggle span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.privacy-toggle b {
  font-size: 12.5px;
  color: var(--ink);
}
.privacy-toggle small {
  color: var(--muted);
  font-size: 11px;
}

.event-feed { margin-top: 2px; }
.event-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.event-item strong {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  white-space: nowrap;
}
.event-item > span:first-of-type {
  font-size: 12.5px;
  color: var(--ink-2);
  min-width: 0;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 18px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-1);
  border: 1px dashed var(--line-strong);
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

/* ============================================================================
   Charts
   ========================================================================== */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
.chart-box {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.chart-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 220px;
}
.chart-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ============================================================================
   Agents view
   ========================================================================== */
.softphone-pick {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}
.softphone-pick label {
  flex: 1 1 180px;
  min-width: 150px;
}

.agents-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
.profile-grid,
.agent-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: end;
}
.create-agent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.create-agent-btn:hover { background: var(--accent-2); }
.create-agent-btn i { width: 18px; height: 18px; }

.agent-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
.agent-priority-panel {
  margin-top: var(--gap);
  margin-bottom: var(--gap);
}
.agent-priority-list {
  display: grid;
}
.agent-priority-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
}
.agent-priority-row:first-child { border-top: 0; }
.agent-priority-rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
}
.agent-priority-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}
.agent-priority-copy b,
.agent-priority-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-priority-copy b { font-size: 14px; }
.agent-priority-copy small { color: var(--text-3); font-size: 12px; }
.agent-priority-actions {
  display: flex;
  justify-content: flex-end;
  min-width: 104px;
}
.agent-priority-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
}
.agent-priority-select {
  width: 58px;
  min-height: 38px;
  padding: 6px 26px 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background-color: var(--surface-2);
  background-position: right 8px center;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}
.agent-priority-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.agent-priority-select:disabled { cursor: wait; }
@media (max-width: 480px) {
  .agent-priority-row {
    grid-template-columns: 34px minmax(0, 1fr) 58px;
    gap: 9px;
    padding-inline: 12px;
  }
  .agent-priority-actions { min-width: 58px; }
  .agent-priority-select-wrap > span { display: none; }
}
.priority-icon {
  width: 40px;
  height: 40px;
  touch-action: manipulation;
}
.priority-icon:disabled { opacity: 0.28; cursor: default; }
.agent-priority-list.saving { opacity: 0.68; }
.agent-priority-feedback {
  min-height: 20px;
  margin: 0;
  padding: 0 16px 10px;
  color: var(--text-3);
  font-size: 12px;
}
.agent-priority-feedback:empty { min-height: 0; padding-bottom: 0; }
.agent-priority-feedback.ok { color: var(--success); }
.agent-priority-feedback.error { color: var(--danger); }
.agent-priority-empty {
  padding: 18px 16px;
  color: var(--text-3);
  font-size: 13px;
}
.queue-position { white-space: nowrap; }
.agent-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px;
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, rgba(69, 105, 214, 0.04), transparent 40%),
    var(--surface-1);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.agent-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.agent-title h3 { font-size: 15px; }
.agent-name-edit {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink, #f4f7ff);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 8px;
  margin: -4px -8px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 62%;
}
.agent-name-edit:hover { border-color: var(--line, #2a2f3a); }
.agent-name-edit:focus { border-color: var(--accent); background: rgba(0, 0, 0, 0.25); outline: none; }

.secret-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.secret-row span { color: var(--muted); }
.secret-row b {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
  word-break: break-all;
  text-align: right;
}

/* QR — MUST render on a white padded background so it scans */
.agent-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.agent-qr {
  width: 180px;
  max-width: 70vw;
  height: auto;
  padding: 12px;
  border-radius: var(--r-md);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}
.qr-hint {
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}
.qr-hint b { color: var(--ink-2); }
.qr-manual {
  width: 156px;
  height: 156px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  border: 1px dashed var(--line, #2a2f3a);
  border-radius: var(--r-md);
}
.qr-manual small { font-weight: 400; opacity: 0.8; }

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.card-actions .small-action { flex: 1 1 auto; }

/* ============================================================================
   Rates (compat / dynamic)
   ========================================================================== */
.rate-row {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr;
  gap: 8px;
}

/* ============================================================================
   Paywall overlay
   ========================================================================== */
#paywallOverlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(4, 6, 10, 0.86);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.paywall-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 30px 24px;
  border-radius: var(--r-xl);
  text-align: center;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(69, 105, 214, 0.14), transparent 60%),
    var(--surface-1);
  border: 1px solid var(--accent-line);
  box-shadow: var(--shadow-lg);
  animation: viewIn 0.3s ease both;
}
.paywall-mark {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  color: var(--accent-ink);
  background: linear-gradient(145deg, var(--accent-2), var(--accent-deep));
  box-shadow: var(--shadow-accent);
}
.paywall-mark i,
.paywall-mark svg { width: 28px; height: 28px; }
.paywall-card h2 { font-size: 20px; }
.paywall-card p {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}
.paywall-pay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 50px;
  padding: 0 18px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 650;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent-2), var(--accent-deep));
  box-shadow: var(--shadow-accent);
  transition: filter 0.12s ease, transform 0.12s ease;
}
.paywall-pay:hover { filter: brightness(1.07); }
.paywall-pay:active { transform: translateY(1px); }
#paywallStatus {
  font-size: 12.5px;
  color: var(--accent);
  min-height: 1em;
}

/* ============================================================================
   Payment modal
   ========================================================================== */
#payModal {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(4, 6, 10, 0.88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.handoff-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 7, 18, 0.76);
  backdrop-filter: blur(12px);
}

.handoff-modal[hidden] {
  display: none;
}

.handoff-card {
  position: relative;
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(8, 15, 29, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
}

.handoff-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.handoff-close svg {
  width: 17px;
  height: 17px;
}

.handoff-heading {
  padding-right: 44px;
}

.handoff-heading h3 {
  margin: 5px 0 6px;
  font-size: 21px;
}

.handoff-heading p {
  margin: 0;
  color: var(--muted);
}

.handoff-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0 18px;
}

.handoff-modes button {
  min-height: 74px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  text-align: left;
  background: rgba(15, 23, 42, 0.66);
}

.handoff-modes button.active {
  border-color: rgba(52, 211, 153, 0.78);
  background: rgba(5, 150, 105, 0.13);
}

.handoff-modes svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.handoff-modes span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.handoff-modes small {
  color: var(--muted);
  font-size: 11px;
}

.handoff-target {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.handoff-target select {
  width: 100%;
  min-height: 44px;
  color: var(--text);
  background: var(--surface-strong);
}

.handoff-submit {
  width: 100%;
  min-height: 46px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  border: 0;
  border-radius: 7px;
  color: #03130e;
  font-weight: 800;
  background: #34d399;
}

.handoff-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.handoff-submit svg {
  width: 18px;
  height: 18px;
}

.handoff-status {
  min-height: 18px;
  margin-top: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.call-agent small {
  display: block;
  margin-top: 3px;
  color: var(--accent);
  font-size: 10px;
}

@media (max-width: 540px) {
  .handoff-modal {
    align-items: end;
    padding: 10px;
  }

  .handoff-card {
    padding: 20px 16px;
  }

  .handoff-modes {
    grid-template-columns: 1fr;
  }
}
.pay-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 22px;
  border-radius: var(--r-xl);
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  animation: viewIn 0.3s ease both;
}
.pay-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: color 0.14s ease, background 0.14s ease;
}
.pay-close:hover { color: var(--ink); background: var(--surface-3); }
.pay-card h3 { font-size: 19px; padding-right: 40px; }
.pay-network {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

/* QR on WHITE padded background so it scans */
.pay-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 14px;
  border-radius: var(--r-md);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}
.pay-qr-wrap canvas {
  width: 200px;
  max-width: 100%;
  height: auto;
}

.pay-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 13px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.pay-field small {
  font-size: 11.5px;
  color: var(--muted);
}
.pay-copyrow {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pay-copyrow strong {
  font-family: var(--font-display);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.pay-copyrow code {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
  word-break: break-all;
}
.pay-copyrow .small-action {
  flex: 0 0 auto;
  margin-left: auto;
}
.pay-status {
  font-size: 12.5px;
  color: var(--accent);
  text-align: center;
  min-height: 1em;
}

/* ============================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================================
   RESPONSIVE — small phones
   ========================================================================== */
@media (max-width: 360px) {
  .control-cluster { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr; }
  .brand-strip p { display: none; }
}

/* ============================================================================
   RESPONSIVE — large phone / small tablet
   ========================================================================== */
@media (min-width: 600px) {
  .control-cluster { grid-template-columns: repeat(4, 1fr); }
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
  .sending-stats { grid-template-columns: repeat(3, 1fr); }
  .agent-grid { grid-template-columns: repeat(2, 1fr); }
  .audio-item { grid-template-columns: 1fr auto auto; }

  /* Show "Gastado" again in the corner now there's room */
  .account-corner { gap: 18px; }
}

/* 2026-07 operational layout: denser glass workspace */
.panel,
.agent-card,
.mini-panel,
.audio-item,
.active-call {
  border-radius: 8px;
}

.panel {
  gap: 10px;
  padding: 13px;
  background: rgba(15, 20, 32, 0.78);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
  backdrop-filter: blur(16px) saturate(125%);
}

.mini-panel {
  padding: 10px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.audio-preview {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  align-items: center;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.audio-preview > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.audio-preview svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.audio-preview audio {
  width: 100%;
  min-width: 0;
  height: 34px;
}

.feature-switches {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.feature-toggle {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px;
  color: var(--ink-2);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.feature-toggle > svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.feature-toggle > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.feature-toggle b {
  color: var(--ink);
  font-size: 12.5px;
}

.feature-toggle small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feature-switch {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
}

.feature-switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  content: "";
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.16s ease, background 0.16s ease;
}

.feature-toggle.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.feature-toggle.active > svg {
  color: var(--accent);
}

.feature-toggle.active .feature-switch::after {
  background: var(--accent);
  transform: translateX(14px);
}

.caller-rotation-toggle {
  width: 100%;
}

.caller-used {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.25;
}

.dtmf-live-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  max-height: 210px;
  overflow-y: auto;
}

.dtmf-live-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
}

.dtmf-key {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
  border: 1px solid var(--accent-line);
  border-radius: 6px;
  background: var(--accent-soft);
}

.dtmf-live-row > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.dtmf-live-row strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dtmf-live-row small {
  color: var(--muted);
  font-size: 10.5px;
}

.agent-card {
  gap: 7px;
  padding: 12px;
  background: rgba(15, 20, 32, 0.78);
}

.agent-card .secret-row {
  min-height: 32px;
  padding: 5px 9px;
}

.agent-qr {
  width: 132px;
  padding: 8px;
}

.agent-qr-wrap {
  margin-top: 0;
}

@media (min-width: 600px) {
  .feature-switches {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1080px) {
  :root {
    --gap: 12px;
  }

  .shell {
    padding-left: 18px;
    padding-right: 18px;
  }

  #campana.view.active {
    display: grid;
    grid-template-columns: minmax(300px, 0.72fr) minmax(540px, 1.28fr);
    gap: 12px;
    align-items: start;
  }

  #campana > .section-head {
    grid-column: 1 / -1;
  }

  #campana > .numbers-panel { grid-column: 1; grid-row: 2; }
  #campana > .recall-panel { grid-column: 1; grid-row: 3; }
  #campana > .control-panel { grid-column: 1; grid-row: 4; }
  #campana > .checklist-panel { grid-column: 1; grid-row: 5; }
  #campana > .live-panel { grid-column: 2; grid-row: 2 / span 4; }
  #campana > .charts-panel { grid-column: 1 / -1; }

  #campana textarea {
    min-height: 112px;
  }

  .live-panel .sending-stats {
    grid-template-columns: repeat(6, 1fr);
  }

  .live-panel .sending-stats > div {
    padding: 8px;
  }

  .live-panel .sending-stats strong {
    font-size: 16px;
  }

  .agent-grid {
    grid-template-columns: repeat(2, minmax(340px, 1fr));
    gap: 10px;
  }
}

@media (max-width: 599px) {
  .campaign-start-picker {
    grid-template-columns: minmax(96px, 0.65fr) minmax(0, 1.35fr);
  }

  .campaign-start-picker .small-action {
    grid-column: 1 / -1;
    width: 100%;
  }

  .caller-id-batch-row {
    flex-direction: column;
  }

  .caller-id-batch-row .small-action {
    width: 100%;
  }

  .audio-preview {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   RESPONSIVE — desktop ( ≥ 920px )
   Contained app frame, side rail, multi-column grids.
   ========================================================================== */
@media (min-width: 920px) {
  :root {
    --pad: 24px;
    --gap: 18px;
    --topbar-h: 68px;
  }

  .shell {
    padding: calc(var(--topbar-h) + 22px) var(--pad) 56px;
    gap: 18px;
  }

  /* Centered, contained sticky header that lines up with the app frame */
  .brand-strip {
    height: var(--topbar-h);
    padding: 0 max(var(--pad), calc((100vw - var(--app-max)) / 2 + var(--pad)));
  }
  .account-corner {
    height: var(--topbar-h);
    right: max(var(--pad), calc((100vw - var(--app-max)) / 2 + var(--pad)));
    grid-template-columns: auto auto auto auto;
    grid-template-areas: "sub money access activate";
    gap: 22px;
  }
  .account-line { align-items: flex-end; }
  .account-line .label { display: inline-block; }
  .account-money {
    flex-direction: row;
    gap: 22px;
    align-items: stretch;
  }
  .account-money > div:last-child { display: flex; }
  .account-money > div {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
  }
  .account-corner .sub-tier {
    display: block;
    grid-area: sub;
    text-align: right;
  }
  .account-corner #cornerAccessText {
    display: block;
    grid-area: access;
    align-self: center;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
  }
  .account-corner .activate-sub {
    display: inline-flex;
    grid-area: activate;
    min-height: 40px;
    align-self: center;
    font-size: 13px;
  }

  /* Command bar becomes a horizontal control deck */
  .command-bar {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 22px;
  }
  .control-cluster { grid-template-columns: repeat(4, 1fr); }
  .control { min-width: 104px; }
  .status-stack {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  /* Launch hero side by side */
  .launch-hero {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
  }
  .launch-cta { width: auto; min-width: 240px; }

  /* Rail back to a normal top nav, NOT a bottom tab bar */
  .rail {
    position: static;
    height: auto;
    width: max-content;
    grid-template-columns: repeat(6, auto);
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--line);
    border-top: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface-1);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .rail-item {
    flex-direction: row;
    gap: 8px;
    min-height: 42px;
    padding: 0 18px;
    border-radius: var(--r-pill);
    font-size: 14px;
  }
  .rail-item i,
  .rail-item svg { width: 18px; height: 18px; }

  /* Multi-column workspace grids */
  .sendout-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .numbers-panel,
  .live-panel,
  .charts-panel { grid-column: 1 / -1; }

  .live-columns { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr 1fr; }
  .agents-layout { grid-template-columns: 1fr 1fr; }
  .agent-grid { grid-template-columns: repeat(3, 1fr); }

  .chart-canvas-wrap { height: 240px; }
}

/* ============================================================================
   RESPONSIVE — wide desktop
   ========================================================================== */
@media (min-width: 1180px) {
  .sendout-grid {
    grid-template-columns: 1.15fr 1fr 1fr;
  }
  .numbers-panel { grid-column: span 1; }
  .live-panel,
  .charts-panel { grid-column: 1 / -1; }
}

/* ============================================================================
   Reorganización por tareas (Inicio / Campaña / Agentes)
   ========================================================================== */
.control-panel .launch-cta {
  width: 100%;
  justify-content: center;
  margin: 4px 0 10px;
}
.control-panel .control-cluster {
  margin-bottom: 10px;
}
.warn-note {
  display: block;
  color: var(--danger);
  font-weight: 700;
  font-size: 12.5px;
  margin: -4px 0 8px;
}
.metric-grid.mini-metrics {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 12px;
}
.section-head h2 {
  font-size: 19px;
}

/* ===== Supervisión / escucha en vivo (ChanSpy) ===== */
.supervision-panel { margin-top: 12px; }

.supervision-status {
  min-height: 34px;
  margin: 8px 0 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.supervision-status[data-tone="pending"] { color: #d8e6ff; border-color: rgba(94, 153, 255, 0.32); }
.supervision-status[data-tone="success"] { color: #a9ebca; border-color: rgba(55, 201, 132, 0.32); }
.supervision-status[data-tone="error"] { color: #ffb8c0; border-color: rgba(255, 91, 112, 0.32); }

.small-action.is-loading { opacity: 0.65; cursor: wait; }
.sup-pick {
  display: grid; gap: 5px; margin: 8px 0 10px;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.sup-pick select {
  padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
}
.sup-list { display: grid; gap: 8px; }
.sup-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2);
}
.sup-row strong { display: block; font-size: 14px; }
.sup-row span { font-size: 11.5px; color: var(--muted); }
.sup-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sup-actions .small-action { padding: 7px 10px; font-size: 12px; }

/* Botones de escucha sobre cada llamada activa */
.active-call-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.call-spy { display: flex; gap: 4px; }
.call-spy .small-action { padding: 6px 8px; }
.call-spy .small-action i { margin: 0; }

/* Selector de red en el modal de pago */
.pay-networks { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0 10px; }
.pay-net {
  padding: 7px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
}
.pay-net.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* Selector de tramo (precio del día) en el modal de pago */
.pay-tiers { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 4px 0 10px; }
.pay-tier {
  display: grid; gap: 1px; padding: 9px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
  text-align: center; min-width: 130px;
}
.pay-tier b { font-size: 13px; color: var(--ink); }
.pay-tier span { font-size: 11px; color: var(--muted); }
.pay-tier.active { background: var(--accent-soft); border-color: var(--accent-line); }
.pay-tier.active b { color: var(--accent); }

/* ===== Barra de salud (estado global de un vistazo, estilo XCaller) ===== */
.health-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px 16px;
  margin: 12px 0 0; padding: 9px 14px;
  border: 1px solid var(--line); border-radius: var(--r-md, 14px);
  background: var(--surface-1); box-shadow: var(--shadow-sm);
  font-size: 12.5px;
}
.health-strip .hs-label {
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
  font-size: 10.5px; font-weight: 800;
}
.health-strip .hs-item { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.health-strip .hs-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.health-strip .hs-item.ok { color: var(--ok); }
.health-strip .hs-item.ok .hs-dot { background: var(--ok); }
.health-strip .hs-item.warn { color: var(--warn); }
.health-strip .hs-item.warn .hs-dot { background: var(--warn); }
.health-strip .hs-item.danger { color: var(--danger); }
.health-strip .hs-item.danger .hs-dot { background: var(--danger); }

/* ===== Estado de llamada con color (borde izquierdo) en el monitor en vivo ===== */
.active-call.st-dialing { border-left: 3px solid var(--accent); }
.active-call.st-ringing { border-left: 3px solid var(--warn); }
.active-call.st-connected { border-left: 3px solid var(--ok); }
.active-call.st-ended { border-left: 3px solid var(--faint); }

/* Live prompt workspace: one compact control surface inside the call monitor. */
.live-prompt-panel {
  margin-top: 14px;
  padding: 16px 0 4px;
  border-top: 1px solid var(--line);
}
.live-prompt-panel .mini-head { align-items: flex-start; }
.live-prompt-panel h4 { display: flex; align-items: center; gap: 8px; }
.live-prompt-panel h4 svg { width: 17px; height: 17px; color: var(--accent-2); }
.live-prompt-form {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.2fr) minmax(110px, .8fr) minmax(110px, .8fr) 88px 88px;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}
.live-prompt-form label,
.agent-role-control {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.live-prompt-form select,
.live-prompt-form input,
.agent-role-control select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(17, 22, 31, .86);
}
.live-prompt-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}
.live-prompt-start,
.live-prompt-finish {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  white-space: normal;
}
.live-prompt-finish {
  flex: 1;
  border-color: rgba(91, 194, 255, .32);
  background: rgba(91, 194, 255, .13);
  color: #bfe8ff;
}
.live-prompt-start:disabled { opacity: .45; cursor: not-allowed; }
.live-prompt-results { display: grid; gap: 6px; margin-top: 10px; }
.live-prompt-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-top: 1px solid var(--line-soft);
}
.live-prompt-result strong,
.live-prompt-result span { display: block; }
.live-prompt-result strong { font-size: 13px; }
.live-prompt-result div > span { color: var(--muted); font-size: 11px; }
.prompt-call-btn span { display: none; }

.agent-role-control { margin: 12px 0; }
.badge.role-agent { color: var(--ok); background: var(--ok-soft); }
.badge.role-supervisor { color: #71b7ff; background: rgba(68, 154, 255, .14); }
.badge.role-admin { color: var(--warn); background: var(--warn-soft); }

@media (min-width: 720px) {
  .live-prompt-actions { grid-column: 1 / -1; }
  .live-prompt-start { min-width: 180px; }
  .live-prompt-form { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.2fr) minmax(110px, .8fr) minmax(110px, .8fr) 88px 88px; }
  .prompt-call-btn span { display: inline; }
}

@media (max-width: 719px) {
  .live-prompt-form { grid-template-columns: 1fr 1fr; }
  .live-prompt-actions { flex-direction: column; }
  .live-prompt-form label:nth-child(1),
  .live-prompt-form label:nth-child(2),
  .live-prompt-form label:nth-child(3) { grid-column: 1 / -1; }
  .live-prompt-result { align-items: flex-start; }
}

@media (min-width: 600px) {
  .softphone-pick {
    display: grid;
    grid-template-columns: minmax(190px, 280px) 44px;
    grid-template-areas: "label label" "select button";
    align-items: end;
    gap: 7px 9px;
    flex-wrap: nowrap;
  }
  .softphone-pick label { grid-area: label; min-width: 0; }
  .softphone-pick select { grid-area: select; }
  .softphone-pick .icon-action { grid-area: button; }
}

@media (min-width: 1080px) {
  .agent-grid {
    grid-template-columns: repeat(2, minmax(340px, 1fr));
    gap: 10px;
  }
}

/* Kimbo operational console */
:root {
  --app-max: 1280px;
  --accent: #20d39a;
  --accent-2: #4f86ff;
  --accent-deep: #119d75;
  --accent-soft: rgba(32, 211, 154, 0.12);
  --accent-line: rgba(32, 211, 154, 0.35);
  --accent-glow: rgba(32, 211, 154, 0.2);
  --surface-1: #0c1220;
  --surface-2: #090f1b;
  --surface-3: #131c2d;
  --r-md: 8px;
  --r-lg: 8px;
  --r-xl: 8px;
}

.backdrop {
  background: #060a12;
}

.backdrop::after {
  opacity: 0.018;
}

.brand-strip {
  background: rgba(7, 11, 20, 0.84);
  backdrop-filter: blur(20px) saturate(130%);
}

.brand-mark {
  overflow: hidden;
  border: 1px solid rgba(32, 211, 154, 0.28);
  border-radius: 8px;
  background: #070b14;
  box-shadow: 0 0 22px rgba(32, 211, 154, 0.14);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.panel,
.mini-panel {
  border-radius: 6px;
  background: rgba(10, 16, 29, 0.82);
  backdrop-filter: blur(18px) saturate(120%);
  box-shadow: none;
}

.launch-cta,
.create-agent-btn,
.wide-action,
.paywall-pay {
  color: #03140e;
  background: var(--accent);
  box-shadow: 0 10px 30px -16px var(--accent);
}

.subscription-alert {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: #ffd8df;
  border: 1px solid rgba(245, 85, 109, 0.38);
  border-radius: 6px;
  background: rgba(82, 17, 31, 0.58);
  backdrop-filter: blur(16px);
}

.subscription-alert > svg {
  width: 20px;
  height: 20px;
  color: var(--danger);
}

.subscription-alert div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.subscription-alert strong {
  font-size: 13px;
}

.subscription-alert span {
  color: #e8afba;
  font-size: 11.5px;
}

.subscription-alert button {
  min-height: 34px;
  padding: 6px 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.campaign-run-strip {
  display: grid;
  gap: 7px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(4, 9, 18, 0.66);
}

.campaign-sidebar {
  display: grid;
  min-width: 0;
  gap: 10px;
  align-content: start;
}

.run-meta,
.run-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.run-meta b,
.run-foot strong {
  color: var(--ink);
}

.campaign-run-strip .progress-shell {
  height: 6px;
  border-radius: 3px;
}

.campaign-run-strip .progress-bar {
  border-radius: 3px;
  background: var(--accent);
}

.feature-switches {
  grid-template-columns: 1fr;
}

.recent-head {
  align-items: center;
}

.calls-table-section {
  display: grid;
  gap: 8px;
}

.calls-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(6, 11, 21, 0.62);
}

.calls-table {
  width: 100%;
  min-width: 790px;
  border-collapse: collapse;
  table-layout: auto;
}

.calls-table th {
  padding: 9px 10px;
  color: #8495b3;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 10, 19, 0.88);
}

.calls-table td {
  height: 44px;
  padding: 8px 10px;
  color: var(--ink-2);
  font-size: 11.5px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}

.calls-table tr:last-child td {
  border-bottom: 0;
}

.calls-table tbody tr {
  box-shadow: inset 3px 0 transparent;
}

.calls-table tbody tr.st-dialing { box-shadow: inset 3px 0 #4f86ff; }
.calls-table tbody tr.st-ringing { box-shadow: inset 3px 0 var(--warn); }
.calls-table tbody tr.st-connected { box-shadow: inset 3px 0 var(--ok); }
.calls-table tbody tr.st-ended { box-shadow: inset 3px 0 var(--faint); }

.calls-table .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.call-status {
  display: inline-flex;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 999px;
}

.call-status.ok { color: #77efc3; border-color: rgba(32, 211, 154, 0.26); background: rgba(32, 211, 154, 0.13); }
.call-status.info { color: #8bb3ff; border-color: rgba(79, 134, 255, 0.28); background: rgba(79, 134, 255, 0.14); }
.call-status.warn { color: #ffd083; border-color: rgba(245, 177, 61, 0.25); background: rgba(245, 177, 61, 0.12); }
.call-status.danger { color: #ff9aaa; border-color: rgba(245, 85, 109, 0.25); background: rgba(245, 85, 109, 0.12); }
.call-status.neutral { color: #a5b1c8; border-color: var(--line); background: var(--neutral-soft); }

.recording-sent {
  display: inline-flex;
  margin-left: 5px;
  padding: 2px 4px;
  color: #ff8b9d;
  font-size: 8px;
  font-weight: 800;
  border: 1px solid rgba(245, 85, 109, 0.32);
  border-radius: 3px;
}

.recording-sent.is-sent {
  color: #77efc3;
  border-color: rgba(32, 211, 154, 0.32);
  background: rgba(32, 211, 154, 0.12);
}

.recording-sent.is-pending {
  color: #ffd083;
  border-color: rgba(245, 177, 61, 0.32);
  background: rgba(245, 177, 61, 0.12);
}

.recording-sent.is-failed {
  color: #ff9aaa;
  border-color: rgba(245, 85, 109, 0.32);
  background: rgba(245, 85, 109, 0.12);
}

.table-actions,
.table-actions .call-spy {
  display: flex;
  align-items: center;
  gap: 4px;
}

.table-actions .small-action {
  min-width: 30px;
  min-height: 30px;
  padding: 6px;
}

.feature-toggle:disabled,
.launch-cta:disabled,
.control:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.recall-campaign-view {
  gap: 12px;
}

.recall-campaign-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.recall-campaign-list-panel,
.recall-campaign-control-panel,
.recall-campaign-live-panel {
  min-width: 0;
  border-radius: 8px;
  background: rgba(10, 15, 25, 0.78);
  backdrop-filter: blur(18px);
}

#recallCampaignNumbers {
  width: 100%;
  min-height: 228px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
}

.recall-list-foot,
.recall-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.recall-list-foot {
  color: var(--muted);
  font-size: 11px;
}

.recall-list-foot b {
  color: var(--ink);
  font-family: var(--font-mono);
}

.recall-context-list {
  display: grid;
  gap: 2px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(4, 9, 18, 0.58);
}

.recall-context-list > div {
  display: grid;
  grid-template-columns: 22px 72px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.recall-context-list > div:last-child { border-bottom: 0; }
.recall-context-list svg { width: 16px; color: var(--accent-2); }
.recall-context-list span { color: var(--muted); font-size: 11px; }
.recall-context-list strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recall-concurrency-label {
  display: grid;
  gap: 7px;
  color: var(--ink-2);
  font-size: 12px;
}

.recall-controls > .control { flex: 1; }

.recall-campaign-live-panel .progress-shell {
  height: 7px;
}

.recall-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
}

.recall-stat-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 11px;
  background: rgba(6, 11, 21, 0.92);
}

.recall-stat-grid span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.recall-stat-grid strong { color: var(--ink); font: 700 18px/1 var(--font-mono); }

.recall-live-list {
  display: grid;
  gap: 5px;
}

.recall-live-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 110px 74px;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(5, 10, 19, 0.62);
}

.recall-live-row strong { color: var(--ink); font: 600 12px/1.2 var(--font-mono); }
.recall-live-row > span { color: var(--muted); font-size: 11px; }
.recall-live-empty { padding: 18px; color: var(--muted); font-size: 12px; text-align: center; }

@media (min-width: 860px) {
  .recall-campaign-grid { grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); }
}

@media (max-width: 599px) {
  .recall-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recall-live-row { grid-template-columns: minmax(0, 1fr) 86px; }
  .recall-live-row > span:last-child { display: none; }
}

@media (min-width: 700px) {
  .feature-switches {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1080px) {
  #campana.view.active {
    grid-template-columns: minmax(310px, 0.64fr) minmax(630px, 1.36fr);
  }

  #campana > .section-head { grid-column: 1 / -1; grid-row: 1; }
  #campana > .campaign-sidebar { grid-column: 1; grid-row: 2; }
  #campana > .live-panel { grid-column: 2; grid-row: 2; }
  #campana > .charts-panel { grid-column: 1 / -1; grid-row: 3; }
  #campana > .checklist-panel { grid-column: 1 / -1; grid-row: 4; }

  .checklist-panel .checklist {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 699px) {
  .run-meta,
  .run-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .subscription-alert {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .subscription-alert button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* Responsive usability pass: every control remains reachable without resizing. */
.workspace,
.views,
.view,
.panel,
.mini-panel,
.agents-layout,
.agent-grid,
.audio-item,
.live-prompt-form > *,
.profile-grid > *,
.agent-form > * {
  min-width: 0;
}

.country-chip,
.language-toggle {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-2);
  background: rgba(255,255,255,.035);
  font-size: 10.5px;
  font-weight: 800;
}

.language-toggle {
  color: var(--accent);
}

.audio-upload-tools {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.audio-upload-tools select,
.audio-category-select {
  width: auto;
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-2);
  background: var(--surface-2);
  font-size: 11px;
}

.bot-code-row b {
  color: #79eac3;
  letter-spacing: .08em;
}

@media (max-width: 719px) {
  :root {
    --pad: 12px;
  }

  .shell {
    width: 100%;
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand-strip {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand-strip p,
  .operator-pill .pulse,
  #telegramStatus {
    display: none;
  }

  .operator-pill {
    gap: 6px;
    padding: 7px;
    border-radius: 7px;
  }

  .user-chip {
    margin-left: 0;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .health-strip {
    gap: 7px;
    padding: 8px;
  }

  .health-strip .hs-label {
    width: 100%;
  }

  .panel,
  .mini-panel,
  .agent-card {
    padding: 12px;
  }

  .panel-head {
    align-items: flex-start;
  }

  .control-cluster,
  .stats-row,
  .sending-stats,
  .metric-grid.mini-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calls-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .calls-table,
  .calls-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .calls-table thead {
    display: none;
  }

  .calls-table tr {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
    width: 100%;
    min-width: 0;
    margin-bottom: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(6, 11, 21, 0.78);
  }

  .calls-table td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 0;
    padding: 7px 0;
    white-space: normal;
    overflow-wrap: anywhere;
    border: 0;
  }

  .calls-table td::before {
    color: #8495b3;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .calls-table .call-time {
    grid-column: 1;
    grid-row: 2;
  }

  .calls-table .call-destination {
    grid-column: 1 / -1;
    grid-row: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 2px 12px;
    padding: 2px 0 10px;
    border-bottom: 1px solid var(--line-soft);
  }

  .calls-table .call-destination::before {
    grid-column: 1 / -1;
  }

  .calls-table .call-destination strong {
    color: var(--ink);
    font-size: 14px;
    line-height: 1.2;
  }

  .calls-table .call-destination .caller-used {
    margin: 0;
    font-size: 9.5px;
    text-align: right;
  }

  .calls-table .call-state-cell {
    grid-column: 2;
    grid-row: 2;
  }

  .calls-table .call-duration {
    grid-column: 1;
    grid-row: 3;
  }

  .calls-table .call-agent {
    grid-column: 2;
    grid-row: 3;
  }

  .calls-table .call-dtmf {
    grid-column: 1 / -1;
    grid-row: 4;
    flex-direction: row;
    align-items: center;
    gap: 7px;
    padding-top: 9px;
    border-top: 1px solid var(--line-soft);
  }

  .calls-table .call-dtmf::before {
    min-width: 40px;
  }

  .calls-table .call-actions-cell {
    grid-column: 1 / -1;
    grid-row: 5;
  }

  .calls-table .call-actions-cell.is-empty {
    display: none;
  }

  .calls-table .call-time::before { content: "Hora"; }
  .calls-table .call-destination::before { content: "Destino"; }
  .calls-table .call-state-cell::before { content: "Estado"; }
  .calls-table .call-duration::before { content: "Duración"; }
  .calls-table .call-dtmf::before { content: "DTMF"; }
  .calls-table .call-agent::before { content: "Agente"; }
  .calls-table .call-actions-cell::before { content: "Acciones"; }
  .calls-table td[colspan] {
    display: block;
    grid-column: 1 / -1;
  }
  .calls-table td[colspan]::before { content: none; }

  .table-actions,
  .table-actions .call-spy {
    flex-wrap: wrap;
  }

  .live-prompt-form {
    grid-template-columns: 1fr;
  }

  .live-prompt-form label,
  .live-prompt-form label:nth-child(1),
  .live-prompt-form label:nth-child(2),
  .live-prompt-form label:nth-child(3),
  .live-prompt-start {
    grid-column: 1;
  }

  .live-prompt-result,
  .sup-row,
  .secret-row {
    align-items: flex-start;
  }

  .secret-row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .secret-row b {
    text-align: left;
  }

  .card-actions .small-action {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    white-space: normal;
  }

  .audio-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .audio-category-select {
    width: 100%;
    grid-column: 1 / -1;
  }
}

@media (max-width: 380px) {
  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-strip h1 {
    font-size: 15px;
  }

  .account-corner {
    right: 8px;
    gap: 6px;
  }

  .account-money {
    display: none;
  }

  .control-cluster,
  .stats-row,
  .sending-stats {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   Website command center, plan details, and full-screen controls
   ========================================================================== */
.subscription-summary,
.overview-tools,
.overview-primary-actions,
.overview-progress-meta {
  display: flex;
  align-items: center;
}

.subscription-summary {
  justify-content: flex-end;
  gap: 4px;
}

.plan-expand,
.header-icon-action {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.plan-expand {
  width: 24px;
  height: 24px;
  border-color: transparent;
  background: transparent;
}

.plan-expand:hover,
.header-icon-action:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-3);
}

.plan-expand[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.plan-details-panel {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  right: max(var(--pad), calc((100vw - var(--app-max)) / 2 + var(--pad)));
  z-index: 80;
  width: min(440px, calc(100vw - 24px));
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(8, 13, 23, 0.96);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
}

.plan-details-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.plan-details-head > div {
  display: grid;
  gap: 3px;
}

.plan-details-head strong {
  font-size: 15px;
}

.plan-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 14px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.plan-details-grid > div {
  min-width: 0;
  padding: 10px 11px;
  background: var(--surface-1);
}

.plan-details-grid span,
.overview-metric span,
.overview-config-list span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.plan-details-grid strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-heading {
  align-items: center;
}

.overview-tools {
  gap: 7px;
}

.overview-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.overview-metric {
  min-width: 0;
  min-height: 96px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(12, 17, 27, 0.78);
}

.overview-metric strong {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 21px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-metric small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

.overview-primary-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, 42px);
  gap: 7px;
}

.overview-primary-actions .launch-cta {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  font-size: 14px;
}

.overview-primary-actions > * {
  min-width: 0;
}

.overview-primary-actions .control {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
}

.overview-progress-meta {
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.overview-progress-meta strong {
  max-width: 58%;
  color: var(--ink-2);
  text-align: right;
}

.overview-config-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.overview-config-list button {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 8px 10px;
  text-align: left;
  background: var(--surface-2);
}

.overview-config-list button:hover {
  background: var(--surface-3);
}

.overview-config-list strong {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-config-list svg {
  color: var(--faint);
}

.overview-call-list,
.overview-agent-list,
.overview-dtmf-list {
  display: grid;
  gap: 6px;
}

.overview-call-row,
.overview-agent-row,
.overview-dtmf-row {
  display: grid;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
}

.overview-call-row {
  grid-template-columns: 8px minmax(100px, 1.1fr) minmax(80px, 0.8fr) auto;
}

.overview-call-row .call-dot,
.overview-agent-row .agent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.overview-call-row[data-state="dialing"] .call-dot { background: var(--accent-2); }
.overview-call-row[data-state="ringing"] .call-dot { background: var(--warn); }
.overview-call-row[data-state="connected"] .call-dot { background: var(--ok); }
.overview-call-row[data-state="completed"] .call-dot { background: var(--faint); }

.overview-call-row strong,
.overview-agent-row strong,
.overview-dtmf-row strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-call-row span,
.overview-agent-row span,
.overview-dtmf-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-agent-row {
  grid-template-columns: 8px minmax(0, 1fr) auto;
}

.overview-agent-row[data-state="available"] .agent-dot { background: var(--ok); }
.overview-agent-row[data-state="ringing"] .agent-dot { background: var(--warn); }
.overview-agent-row[data-state="oncall"] .agent-dot { background: var(--danger); }

.overview-agent-row > div {
  min-width: 0;
}

.overview-agent-row > div span {
  display: block;
  margin-top: 2px;
}

.overview-dtmf-row {
  grid-template-columns: 34px minmax(0, 1fr) auto;
}

.overview-dtmf-key {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--accent-line);
  border-radius: 5px;
  color: var(--accent-2);
  background: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 800;
}

.overview-empty {
  padding: 18px 10px;
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
}

body.website-mode {
  --app-max: 1500px;
}

body.website-mode .brand-strip p::after {
  content: " · Web";
  color: var(--accent-2);
}

body.website-mode #expandAppBtn,
body.website-mode #openWebsiteBtn {
  display: none;
}

body.telegram-mode #compactModeBtn {
  display: none;
}

body.compact-mode .panel {
  gap: 9px;
  padding: 12px;
}

body.compact-mode .overview-metric {
  min-height: 82px;
  padding: 10px;
}

@media (min-width: 700px) {
  .overview-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1080px) {
  .rail {
    grid-template-columns: repeat(4, auto);
  }

  .overview-grid {
    grid-template-columns: minmax(300px, 0.75fr) minmax(520px, 1.45fr) minmax(250px, 0.8fr);
    align-items: start;
  }

  .overview-control-panel {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .overview-activity-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .overview-team-panel {
    grid-column: 3;
    grid-row: 1;
  }

  .overview-dtmf-panel {
    grid-column: 3;
    grid-row: 2;
  }

  .overview-metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .overview-view .panel {
    border-radius: 7px;
  }

  body.website-mode .shell {
    padding-top: calc(var(--topbar-h) + 14px);
  }

  .overview-view .panel {
    contain: layout paint style;
  }
}

@media (min-width: 920px) {
  body.website-mode .panel,
  body.website-mode .mini-panel {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(10, 16, 29, 0.94);
  }
}

@media (min-width: 920px) and (max-width: 1350px) {
  .account-money > div:last-child,
  .account-corner #cornerAccessText {
    display: none;
  }

  .account-corner {
    gap: 12px;
  }
}

@media (max-width: 919px) {
  .rail {
    grid-template-columns: repeat(4, 1fr);
  }

  .plan-details-panel {
    right: 12px;
  }
}

@media (max-width: 599px) {
  .plan-details-grid {
    grid-template-columns: 1fr 1fr;
  }

  .overview-heading {
    align-items: flex-start;
  }

  .overview-metric {
    min-height: 86px;
  }

  .overview-call-row {
    grid-template-columns: 8px minmax(0, 1fr) auto;
  }

  .overview-call-row > span:nth-of-type(2) {
    display: none;
  }

  .overview-progress-meta {
    flex-direction: column;
  }

  .overview-progress-meta strong {
    max-width: none;
    text-align: left;
  }

  .operator-pill .header-icon-action {
    width: 28px;
    height: 28px;
  }
}

/* Dense wide-screen operations layout */
@media (min-width: 1080px) {
  :root {
    --app-max: 1380px;
    --gap: 10px;
    --pad: 16px;
  }

  body.website-mode {
    --app-max: 1440px;
  }

  .shell {
    gap: 10px;
    padding-top: calc(var(--topbar-h) + 12px);
  }

  .views,
  .view.active {
    gap: 10px;
  }

  .panel {
    gap: 9px;
    padding: 11px 12px;
  }

  .section-head {
    min-height: 38px;
  }

  .overview-metrics {
    gap: 7px;
  }

  .overview-metric {
    min-height: 78px;
    padding: 9px 10px;
  }

  .overview-metric strong {
    font-size: 19px;
  }

  .overview-grid {
    grid-template-columns: minmax(290px, 0.7fr) minmax(520px, 1.55fr) minmax(240px, 0.75fr);
    gap: 9px;
  }

  #campana.view.active {
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 10px;
  }

  #campana > .live-panel,
  .calls-table-section,
  .calls-table-wrap {
    min-width: 0;
  }

  .live-panel .metric-grid {
    gap: 7px;
  }

  .live-panel .sending-stats {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 6px;
  }

  .live-panel .sending-stats > div {
    min-height: 48px;
    padding: 7px 8px;
  }

  .calls-table {
    min-width: 720px;
    table-layout: fixed;
  }

  .calls-table th,
  .calls-table td {
    padding-left: 8px;
    padding-right: 8px;
  }

  .calls-table th:nth-child(1) { width: 82px; }
  .calls-table th:nth-child(2) { width: 170px; }
  .calls-table th:nth-child(3) { width: 100px; }
  .calls-table th:nth-child(4) { width: 84px; }
  .calls-table th:nth-child(6) { width: 125px; }
  .calls-table th:nth-child(7) { width: 118px; }

  .calls-table .call-dtmf,
  .calls-table .call-agent {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .live-columns,
  .charts-grid {
    gap: 10px;
  }
}

@media (min-width: 1500px) {
  .overview-grid {
    grid-template-columns: 310px minmax(600px, 1fr) 280px;
  }

  #campana.view.active {
    grid-template-columns: 360px minmax(0, 1fr);
  }
}

/* ============================================================================
   Kimbo operations UI v3
   Dense desktop console, purpose-built mobile navigation, low-cost rendering.
   ========================================================================== */
:root {
  --bg: #07090e;
  --bg-deep: #07090e;
  --surface-1: #0d121a;
  --surface-2: #101721;
  --surface-3: #17202c;
  --surface-glass: #0b1017;
  --line: rgba(157, 174, 199, 0.14);
  --line-strong: rgba(157, 174, 199, 0.26);
  --line-soft: rgba(157, 174, 199, 0.08);
  --ink: #f2f5f9;
  --ink-2: #c3ccda;
  --muted: #8592a6;
  --faint: #667287;
  --accent: #2ac58a;
  --accent-2: #5b8def;
  --accent-deep: #159767;
  --accent-ink: #04110c;
  --accent-soft: rgba(42, 197, 138, 0.12);
  --accent-line: rgba(42, 197, 138, 0.34);
  --ok: #38d996;
  --warn: #f2b84b;
  --danger: #f26077;
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 7px;
  --r-lg: 8px;
  --r-xl: 8px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 24px 54px rgba(0, 0, 0, 0.38);
  --gap: 10px;
  --pad: 14px;
  --topbar-h: 68px;
  --sidebar-w: 216px;
}

*,
*::before,
*::after {
  letter-spacing: 0 !important;
}

html {
  scrollbar-color: #293346 #090d13;
  scrollbar-width: thin;
}

body {
  font-size: 14px;
  line-height: 1.4;
  background: var(--bg);
}

button,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(91, 141, 239, 0.78);
  outline-offset: 2px;
}

.backdrop {
  background: var(--bg);
}

.backdrop::after {
  display: none;
}

.brand-strip,
.panel,
.mini-panel,
.plan-details-panel,
.recall-campaign-list-panel,
.recall-campaign-control-panel,
.recall-campaign-live-panel {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.panel,
.mini-panel {
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  box-shadow: none;
}

.panel:hover {
  border-color: var(--line-strong);
}

.panel-head {
  min-height: 30px;
  gap: 10px;
}

.panel-head h3 {
  font-size: 14px;
  font-weight: 700;
}

.panel-head h4,
.mini-head h4 {
  font-size: 13px;
  font-weight: 700;
}

.panel-subline {
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.35;
}

.section-head {
  min-height: 42px;
  padding: 0 2px;
}

.section-head .label {
  margin-bottom: 2px;
  font-size: 9.5px;
}

.section-head h2 {
  font-size: 20px;
  font-weight: 700;
}

.badge,
.call-status {
  border-radius: 999px;
  font-weight: 700;
}

input,
select,
textarea {
  border-color: var(--line);
  border-radius: 6px;
  background: #090e15;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

.launch-cta,
.create-agent-btn,
.wide-action,
.paywall-pay,
.activate-sub {
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: none;
}

.launch-cta:hover,
.create-agent-btn:hover,
.wide-action:hover,
.paywall-pay:hover,
.activate-sub:hover {
  filter: brightness(1.07);
}

.control,
.small-action,
.icon-action,
.header-icon-action,
.language-toggle,
.feature-toggle,
.file-pill {
  border-radius: 6px;
}

.control,
.small-action,
.icon-action,
.header-icon-action,
.language-toggle {
  background: #111823;
}

.control:hover,
.small-action:hover,
.icon-action:hover,
.header-icon-action:hover,
.language-toggle:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
}

.subscription-alert {
  border-radius: 6px;
  background: #2a1118;
}

.health-strip {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b111a;
}

.hs-label {
  padding-right: 10px;
  border-right: 1px solid var(--line);
}

.overview-metrics {
  gap: 8px;
}

.overview-metric {
  position: relative;
  min-height: 82px;
  padding: 11px 12px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-1);
}

.overview-metric::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--line-strong);
}

.overview-metric:nth-child(1)::before,
.overview-metric:nth-child(4)::before {
  background: var(--accent);
}

.overview-metric:nth-child(3)::before,
.overview-metric:nth-child(5)::before {
  background: var(--accent-2);
}

.overview-metric strong {
  margin-top: 6px;
  font-size: 20px;
}

.overview-metric small {
  margin-top: 3px;
}

.overview-grid {
  gap: 9px;
}

.overview-call-row,
.overview-agent-row,
.overview-dtmf-row {
  min-height: 42px;
  border-radius: 5px;
  background: #0a1018;
}

.overview-config-list,
.recall-context-list,
.calls-table-wrap,
.recall-stat-grid {
  border-radius: 6px;
}

.overview-config-list button {
  min-height: 40px;
  background: #0b1119;
}

.overview-config-list button:hover {
  background: #121a25;
}

.progress-shell {
  overflow: hidden;
  border-radius: 999px;
  background: #1a2230;
}

.progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.calls-table-wrap {
  background: #090e15;
}

.calls-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 34px;
  padding: 8px 10px;
  background: #0c121b;
}

.calls-table td {
  height: 42px;
  padding: 7px 10px;
}

.calls-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.022);
}

.feature-switches {
  gap: 7px;
}

.campaign-sidebar .control-panel {
  order: -3;
}

.campaign-sidebar .numbers-panel {
  order: -2;
}

.campaign-sidebar .recall-panel {
  order: -1;
}

.feature-toggle {
  min-height: 42px;
  background: #0a1018;
}

.feature-toggle.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.audio-item,
.agent-card,
.event-item,
.telegram-item,
.live-prompt-result,
.test-call-row,
.recall-live-row {
  border-radius: 6px;
  background: #0a1018;
}

.chart-card,
.metric,
.sending-stats > div {
  border-radius: 6px;
  background: #0a1018;
}

.plan-details-panel {
  border-radius: 8px;
  background: #0b1119;
}

.plan-details-grid > div {
  background: #0d141e;
}

.payment-modal,
.modal-card {
  border-radius: 8px;
  background: #0b1119;
}

/* Desktop application shell */
@media (min-width: 1024px) {
  :root {
    --app-max: none;
    --gap: 9px;
    --pad: 18px;
  }

  body.website-mode,
  body.telegram-mode {
    --app-max: none;
  }

  .shell,
  body.website-mode .shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 82px 18px 30px calc(var(--sidebar-w) + 30px);
    gap: 9px;
  }

  .topbar {
    position: static;
  }

  .brand-strip {
    top: 0;
    right: auto;
    width: calc(var(--sidebar-w) + 14px);
    height: var(--topbar-h);
    padding: 0 16px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #090d13;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 7px;
    box-shadow: none;
  }

  .brand-strip h1 {
    font-size: 17px;
  }

  .brand-strip p {
    font-size: 10.5px;
  }

  .operator-pill {
    position: fixed;
    top: 0;
    right: 410px;
    left: calc(var(--sidebar-w) + 14px);
    z-index: 61;
    height: var(--topbar-h);
    padding: 0 18px;
    flex-wrap: nowrap;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: #090d13;
  }

  .operator-pill .pulse {
    width: 7px;
    height: 7px;
    animation: none;
  }

  .operator-pill .user-chip {
    margin-left: 10px;
  }

  .account-corner {
    top: 0;
    right: 0;
    z-index: 62;
    width: 410px;
    height: var(--topbar-h);
    padding: 0 18px;
    grid-template-columns: auto auto auto;
    grid-template-areas: "sub money action";
    gap: 16px;
    border-bottom: 1px solid var(--line);
    background: #090d13;
  }

  .account-corner .activate-sub {
    display: inline-flex;
    grid-area: action;
    min-height: 38px;
    padding: 0 13px;
    font-size: 12px;
    white-space: nowrap;
  }

  .account-corner .sub-tier,
  .account-corner #cornerAccessText,
  .account-money > div:last-child {
    display: none;
  }

  .account-line {
    align-items: flex-start;
  }

  .account-money {
    align-items: flex-start;
  }

  .workspace {
    display: block;
  }

  .rail {
    position: fixed;
    top: calc(var(--topbar-h) + 12px);
    bottom: 14px;
    left: 14px;
    z-index: 45;
    width: var(--sidebar-w);
    display: flex;
    grid-template-columns: none;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 8px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0b1018;
    box-shadow: none;
  }

  .rail::after {
    content: "KIMBO OPERATIONS";
    margin-top: auto;
    padding: 14px 10px 8px;
    color: #4f5b6d;
    font-size: 9px;
    font-weight: 700;
    text-align: left;
  }

  .rail-item {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    justify-content: flex-start;
    gap: 11px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #8e9bad;
    font-size: 12px;
    font-weight: 650;
  }

  .rail-item i,
  .rail-item svg {
    width: 17px;
    height: 17px;
  }

  .rail-item:hover {
    color: var(--ink-2);
    background: #111923;
  }

  .rail-item.active {
    color: #8ee8c1;
    border-color: rgba(42, 197, 138, 0.16);
    background: rgba(42, 197, 138, 0.1);
    box-shadow: inset 2px 0 var(--accent);
  }

  .views,
  .view.active {
    gap: 9px;
  }

  .overview-metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .overview-grid {
    grid-template-columns: 280px minmax(0, 1fr) 240px;
    align-items: stretch;
  }

  .overview-control-panel {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .overview-activity-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .overview-team-panel {
    grid-column: 3;
    grid-row: 1;
  }

  .overview-dtmf-panel {
    grid-column: 3;
    grid-row: 2;
  }

  #campana.view.active {
    grid-template-columns: minmax(320px, 350px) minmax(0, 1fr);
    gap: 9px;
  }

  #campana > .section-head {
    grid-column: 1 / -1;
  }

  #campana > .campaign-sidebar {
    grid-column: 1;
  }

  #campana > .live-panel {
    grid-column: 2;
  }

  #campana > .charts-panel,
  #campana > .checklist-panel {
    grid-column: 1 / -1;
  }

  .campaign-sidebar {
    gap: 8px;
  }

  .numbers-panel textarea {
    min-height: 154px;
  }

  .live-panel .sending-stats {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .calls-table {
    min-width: 700px;
    table-layout: fixed;
  }

  .health-strip,
  .subscription-alert {
    width: 100%;
  }

  .plan-details-panel {
    top: 76px;
    right: 18px;
  }
}

/* Tablet and mobile navigation */
@media (max-width: 1023px) {
  :root {
    --topbar-h: 58px;
    --tabbar-h: 68px;
  }

  .shell,
  body.website-mode .shell {
    max-width: 820px;
    padding: calc(var(--topbar-h) + 10px) 12px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
    gap: 9px;
  }

  .brand-strip {
    height: var(--topbar-h);
    padding: 0 12px;
    background: #090d13;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    box-shadow: none;
  }

  .brand-strip h1 {
    font-size: 16px;
  }

  .brand-strip p {
    font-size: 9.5px;
  }

  .account-corner {
    right: 10px;
    height: var(--topbar-h);
    gap: 8px;
  }

  .account-money strong {
    font-size: 12px;
  }

  .sub-badge {
    padding: 3px 7px;
    font-size: 9px;
  }

  .operator-pill {
    min-height: 40px;
    padding: 7px 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-radius: 7px;
    background: #0b1119;
    scrollbar-width: none;
  }

  .operator-pill::-webkit-scrollbar {
    display: none;
  }

  .operator-pill .user-chip {
    margin-left: auto;
  }

  .rail {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    width: 100%;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0;
    padding: 5px max(6px, env(safe-area-inset-left, 0px)) env(safe-area-inset-bottom, 0px) max(6px, env(safe-area-inset-right, 0px));
    border: 0;
    border-top: 1px solid var(--line-strong);
    border-radius: 0;
    background: #090e15;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.28);
  }

  .rail-item {
    min-width: 0;
    min-height: 56px;
    padding: 5px 2px 4px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    border-radius: 6px;
    font-size: 9px;
    line-height: 1;
  }

  .rail-item i,
  .rail-item svg {
    width: 18px;
    height: 18px;
  }

  .rail-item.active {
    color: #85e7bd;
    background: rgba(42, 197, 138, 0.1);
  }

  .overview-grid {
    grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.35fr);
  }

  .overview-control-panel {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .overview-activity-panel {
    grid-column: 2;
  }

  .overview-team-panel,
  .overview-dtmf-panel {
    grid-column: 2;
  }
}

@media (max-width: 767px) {
  :root {
    --pad: 10px;
  }

  body {
    font-size: 13px;
  }

  .shell,
  body.website-mode .shell {
    width: 100%;
    max-width: none;
    padding-right: 9px;
    padding-left: 9px;
  }

  .brand-strip p {
    display: none;
  }

  .brand-strip {
    gap: 8px;
  }

  .account-corner {
    grid-template-columns: auto auto;
  }

  .account-line .plan-expand,
  .account-corner .sub-tier,
  .account-corner .activate-sub,
  .account-corner #cornerAccessText,
  .account-money > div:last-child {
    display: none;
  }

  .balance-main span,
  .account-money span {
    font-size: 8px;
  }

  .operator-pill {
    gap: 7px;
    font-size: 10.5px;
  }

  .operator-pill .user-chip {
    display: none;
  }

  .country-chip {
    margin-left: auto;
  }

  .health-strip {
    gap: 9px;
    padding: 7px 9px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }

  .health-strip::-webkit-scrollbar {
    display: none;
  }

  .hs-label {
    display: none;
  }

  .subscription-alert {
    padding: 10px;
  }

  .subscription-alert button {
    min-height: 36px;
  }

  .section-head {
    min-height: 36px;
  }

  .section-head h2 {
    font-size: 18px;
  }

  .section-head .label {
    font-size: 8.5px;
  }

  .panel,
  .mini-panel {
    gap: 10px;
    padding: 11px;
  }

  .overview-heading {
    align-items: center;
  }

  .overview-tools .small-action {
    width: 38px;
    padding: 0;
    font-size: 0;
  }

  .overview-tools .small-action svg {
    width: 16px;
    height: 16px;
  }

  .overview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .overview-metric {
    min-height: 78px;
    padding: 10px;
  }

  .overview-metric strong {
    font-size: 18px;
  }

  .overview-metric small {
    font-size: 9.5px;
  }

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

  .overview-control-panel,
  .overview-activity-panel,
  .overview-team-panel,
  .overview-dtmf-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .overview-primary-actions {
    grid-template-columns: minmax(0, 1fr) repeat(3, 40px);
  }

  .overview-primary-actions .control {
    width: 40px;
    min-width: 40px;
  }

  .overview-config-list button {
    grid-template-columns: 78px minmax(0, 1fr) 14px;
  }

  .campaign-sidebar {
    gap: 7px;
  }

  #campana.view.active {
    gap: 7px;
  }

  .numbers-panel textarea,
  #recallCampaignNumbers {
    min-height: 160px;
  }

  .feature-switches {
    grid-template-columns: 1fr;
  }

  .feature-toggle {
    min-height: 46px;
  }

  .live-panel .sending-stats,
  .metric-grid,
  .recall-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calls-table {
    min-width: 680px;
  }

  .calls-table th,
  .calls-table td {
    padding-right: 8px;
    padding-left: 8px;
  }

  .live-columns,
  .charts-grid,
  .agents-layout,
  .profile-grid,
  .test-call-grid,
  .recall-campaign-grid {
    grid-template-columns: 1fr !important;
  }

  .plan-details-panel {
    top: 66px;
    right: 9px;
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 84px);
    overflow-y: auto;
  }

  .plan-details-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payment-modal,
  .modal-card {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }
}

@media (max-width: 420px) {
  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-strip h1 {
    font-size: 15px;
  }

  .account-corner {
    gap: 5px;
  }

  .sub-badge {
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .language-toggle,
  .operator-pill .header-icon-action {
    width: 28px;
    height: 28px;
  }

  .operator-pill #telegramStatus {
    max-width: 104px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .overview-metric strong {
    font-size: 17px;
  }

  .rail-item {
    font-size: 8px;
  }
}

/* The compact call cards already replace the desktop table below 720px.
   Keep the later tablet rules from restoring a 680px table and widening the
   entire Mini App viewport. */
@media (max-width: 719px) {
  .calls-table-section,
  .calls-table-wrap,
  .calls-table,
  .calls-table tbody,
  .calls-table tr {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
}

@media (min-width: 1440px) {
  .shell,
  body.website-mode .shell {
    padding-right: 22px;
    padding-left: calc(var(--sidebar-w) + 34px);
  }

  .overview-grid {
    grid-template-columns: 310px minmax(0, 1fr) 280px;
  }

  #campana.view.active {
    grid-template-columns: 360px minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
