/* Principal dark theme: neutral black with a gold accent.
   The previous charcoal/lavender palette remains available as Classic. */
html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0c0c0d;
    --surface: #141415;
    --surface-alt: #1b1b1d;
    --input-bg: #111112;
    --border: #26262a;
    --border-strong: #36363b;
    --text: #ececee;
    --text-muted: #9b9ba1;
    --muted: #9b9ba1;
    --primary: #e2b84a;
    --primary-hover: #f0c75a;
    --primary-dark: #e9c463;
    --focus: #e2b84a;
    --accent: #e2b84a;
    --gray: #9b9ba1;
    --slate: #a3a9b6;
    --cp-bg: var(--bg);
    --cp-sidebar: #0f0f10;
    --cp-header: #0f0f10;
    --cp-card: var(--surface);
    --cp-card-elevated: var(--surface-alt);
    --cp-card-hover: #1f1f22;
    --cp-border: var(--border);
    --cp-border-strong: var(--border-strong);
    --cp-border-active: #b8932f;
    --cp-primary: #e2b84a;
    --cp-primary-light: #f3d88c;
    --cp-primary-dark: #b8932f;
    --cp-primary-bg: #2a2416;
    --cp-text: var(--text);
    --cp-text-secondary: var(--text-muted);
    --cp-text-muted: #7c7c83;
    --shadow: 0 16px 40px rgb(0 0 0 / 45%);
    --on-primary: #1a1405;
}

/* Shell */
html[data-theme="dark"] body.app-body,
html[data-theme="dark"] body.auth-body { background: var(--bg); }
html[data-theme="dark"] .auth-body { --auth-text-muted: #7c7c83; }
html[data-theme="dark"] .sidebar { background: var(--cp-sidebar); border-right: 1px solid var(--border); }
html[data-theme="dark"] .workspace-header { background: rgb(15 15 16 / 92%); border-bottom: 1px solid var(--border); }
html[data-theme="dark"] .nav a { color: var(--text-muted); }
html[data-theme="dark"] .nav a:hover { color: var(--text); background: rgb(255 255 255 / 4%); }
html[data-theme="dark"] .nav a.active,
html[data-theme="dark"] .workspace-nav a.active {
    position: relative;
    background: #1c1c1e;
    color: var(--text);
    border-radius: 8px;
    --accent: var(--primary);
}
html[data-theme="dark"] .nav a.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 2px;
    background: var(--primary);
}
html[data-theme="dark"] .nav a.active:hover { background: #222225; }
html[data-theme="dark"] .nav a.active .caller-icon { color: var(--primary); }
html[data-theme="dark"] .nav-group > summary:hover,
html[data-theme="dark"] .nav-group[open] > summary { background: rgb(255 255 255 / 3%); }
html[data-theme="dark"] .mobile-shortcuts a.active { background: #1c1c1e; color: var(--primary); border-color: var(--border-strong); }

/* Cards, stats and headings */
html[data-theme="dark"] .card,
html[data-theme="dark"] .agent-card,
html[data-theme="dark"] .stats { background: var(--surface); border-color: var(--border); }
html[data-theme="dark"] .card-head { border-bottom-color: var(--border); }
html[data-theme="dark"] .page-head h1 { font-weight: 500; letter-spacing: -.02em; }
html[data-theme="dark"] .stat-label,
html[data-theme="dark"] .card-head .muted-label { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 500; color: var(--text-muted); }
html[data-theme="dark"] .stat-value { font-family: var(--font-ui); font-weight: 300; }
html[data-theme="dark"] .stat-icon,
html[data-theme="dark"] .summary-stats .stat-icon { background: transparent; border: 1px solid #4a3d1c; color: var(--primary); }
html[data-theme="dark"] .filters.card { border-color: var(--border); }

/* Buttons */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .auth-card .auth-submit {
    background: linear-gradient(180deg, #ecc65c, #d9ad3c);
    border-color: #d9ad3c;
    color: var(--on-primary);
    font-weight: 600;
}
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .auth-card .auth-submit:hover { background: #f0c75a; border-color: #f0c75a; color: var(--on-primary); }
html[data-theme="dark"] .btn-primary:active { background: #d0a535; border-color: #d0a535; color: var(--on-primary); }
html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .btn-secondary { background: transparent; border-color: var(--border-strong); color: var(--text); }
html[data-theme="dark"] .btn-ghost:hover,
html[data-theme="dark"] .btn-secondary:hover { background: rgb(255 255 255 / 4%); border-color: #4a4a50; }
html[data-theme="dark"] .pagination-controls .pagination-current { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* Inputs: gold border while typing */
html[data-theme="dark"] .field input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .access-card input,
html[data-theme="dark"] #records-confirmation { background: var(--input-bg); border-color: var(--border-strong); }
html[data-theme="dark"] .field input::placeholder,
html[data-theme="dark"] .field textarea::placeholder { color: #6c6c73; }
html[data-theme="dark"] .field input:focus,
html[data-theme="dark"] .field select:focus,
html[data-theme="dark"] .field textarea:focus,
html[data-theme="dark"] .auth-card .auth-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(226 184 74 / 14%);
    outline: none;
}
html[data-theme="dark"] input[type="checkbox"],
html[data-theme="dark"] input[type="radio"] { accent-color: var(--primary); }

/* Tables */
html[data-theme="dark"] .table th {
    background: transparent;
    color: #85858c;
    font-weight: 500;
    letter-spacing: .09em;
    border-bottom-color: var(--border);
}
html[data-theme="dark"] .table td { border-bottom-color: #1f1f22; }
html[data-theme="dark"] .table tbody tr:hover { background: rgb(255 255 255 / 2.5%); }

/* Badges as pills with a dot */
html[data-theme="dark"] .badge {
    --tint: 12%;
    border: 1px solid color-mix(in srgb, currentColor 32%, transparent);
    border-radius: 999px;
}
html[data-theme="dark"] .badge-orange.campaign-status-badge { --yellow: var(--primary); }

/* Segmented filters / tabs */
html[data-theme="dark"] .tab-btn { background: var(--surface); border-color: var(--border); color: var(--text-muted); }
html[data-theme="dark"] .tab-input:checked + .tab-btn { background: #2a2a2e; border-color: var(--border-strong); color: var(--text); }
html[data-theme="dark"] .sp-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

/* Progress */
html[data-theme="dark"] .campaign-progress-track { background: #232326; }
html[data-theme="dark"] .campaign-progress-track span { background: linear-gradient(90deg, #c99a2e, #ecc65c); }
html[data-theme="dark"] .campaign-progress-percent { color: var(--primary); }

/* New campaign wizard */
html[data-theme="dark"] .wizard-steps { background: #0f0f10; }
html[data-theme="dark"] .wizard-step-n { background: transparent; border-color: var(--border-strong); }
html[data-theme="dark"] #wizard-step-1:checked ~ .wizard-steps .wizard-step[data-step="1"],
html[data-theme="dark"] #wizard-step-2:checked ~ .wizard-steps .wizard-step[data-step="2"],
html[data-theme="dark"] #wizard-step-3:checked ~ .wizard-steps .wizard-step[data-step="3"],
html[data-theme="dark"] #wizard-step-4:checked ~ .wizard-steps .wizard-step[data-step="4"] {
    border-color: var(--border-strong);
    background: #1c1c1e;
}
html[data-theme="dark"] #wizard-step-1:checked ~ .wizard-steps .wizard-step[data-step="1"] .wizard-step-n,
html[data-theme="dark"] #wizard-step-2:checked ~ .wizard-steps .wizard-step[data-step="2"] .wizard-step-n,
html[data-theme="dark"] #wizard-step-3:checked ~ .wizard-steps .wizard-step[data-step="3"] .wizard-step-n,
html[data-theme="dark"] #wizard-step-4:checked ~ .wizard-steps .wizard-step[data-step="4"] .wizard-step-n {
    border-color: var(--primary);
    background: transparent;
    color: var(--primary);
    box-shadow: 0 0 0 3px rgb(226 184 74 / 12%);
}
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] #new-campaign .modal-card { background: var(--surface); border-color: var(--border-strong); }
html[data-theme="dark"] #new-campaign .modal-head { background: #161617; }
html[data-theme="dark"] #new-campaign .modal-body { background: #111112; }
html[data-theme="dark"] .field input[type="number"],
html[data-theme="dark"] .capacity-numeric input[type="number"],
html[data-theme="dark"] .capacity-inline input[type="number"] { background: var(--input-bg); }
html[data-theme="dark"] #new-campaign input[type="text"],
html[data-theme="dark"] #new-campaign input[type="number"],
html[data-theme="dark"] #new-campaign input[type="time"],
html[data-theme="dark"] #new-campaign select,
html[data-theme="dark"] #new-campaign textarea { border-color: var(--border-strong); background: var(--input-bg); }
html[data-theme="dark"] #new-campaign input:hover,
html[data-theme="dark"] #new-campaign select:hover,
html[data-theme="dark"] #new-campaign textarea:hover { border-color: #4a4a50; background: #151516; }
html[data-theme="dark"] #new-campaign input:focus,
html[data-theme="dark"] #new-campaign select:focus,
html[data-theme="dark"] #new-campaign textarea:focus { border-color: var(--primary); background: #151516; box-shadow: 0 0 0 3px rgb(226 184 74 / 14%); }
html[data-theme="dark"] .setup-number { color: var(--primary); background: #1f1c14; }
html[data-theme="dark"] #new-campaign .modal-body .campaign-form .form-actions { background: #141415; }
html[data-theme="dark"] #new-campaign .dropzone { background: rgb(255 255 255 / 1.5%); border-color: #4a4128; }
html[data-theme="dark"] #new-campaign .dropzone:hover,
html[data-theme="dark"] #new-campaign .dropzone.is-dragover { background: rgb(226 184 74 / 5%); border-color: var(--primary); }
html[data-theme="dark"] #new-campaign .campaign-check { background: rgb(255 255 255 / 2%); }
html[data-theme="dark"] #new-campaign .campaign-advanced { background: transparent; }
/* Sidebar beetles: same artwork, warm gold tint instead of purple */
html[data-theme="dark"] .caller-beetles-sidebar { background: radial-gradient(ellipse at 50% 100%, rgb(226 184 74 / .05), transparent 70%); }
html[data-theme="dark"] .caller-beetles-sidebar::before { background: linear-gradient(90deg, transparent, rgb(226 184 74 / .18), transparent); }
html[data-theme="dark"] .caller-beetle { filter: drop-shadow(0 4px 3px rgb(0 0 0 / .45)) sepia(.9) hue-rotate(5deg) saturate(1.6) brightness(.95); }

/* Header balance and account menu */
html[data-theme="dark"] .wallet-balance { border-color: #3a3220; background: #17150f; color: var(--primary); }
html[data-theme="dark"] .wallet-balance:hover { background: #1e1b12; color: #f3d88c; }
html[data-theme="dark"] .wallet-balance small { color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
html[data-theme="dark"] .user-menu[open] > summary { outline-color: rgb(226 184 74 / 22%); }
html[data-theme="dark"] .user-menu-dropdown { background: #151516; border-color: var(--border-strong); }
html[data-theme="dark"] .account-identity { background: linear-gradient(135deg, rgb(226 184 74 / 8%), transparent 85%); }
html[data-theme="dark"] .account-initial { background: #1f1c14; border-color: #5a4a22; color: var(--primary); }
html[data-theme="dark"] .account-role { color: #e9c463; background: rgb(226 184 74 / 10%); }
html[data-theme="dark"] .account-balance { background: #17150f; border-color: #3a3220; }
html[data-theme="dark"] .account-links a:hover,
html[data-theme="dark"] .account-links a:focus-visible,
html[data-theme="dark"] .account-preferences > summary:hover,
html[data-theme="dark"] .account-preferences > summary:focus-visible { background: rgb(255 255 255 / 4%); }
html[data-theme="dark"] .account-links a > svg,
html[data-theme="dark"] .account-preferences > summary > svg { color: #a3a3aa; }
html[data-theme="dark"] .user-menu-lang.is-current { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* Agents and misc accents */
html[data-theme="dark"] .agents-overview .ag-avatar { background: #1f1c14; border-color: #5a4a22; color: var(--primary); }
html[data-theme="dark"] .ag-add { border-color: #5a4a22; background: radial-gradient(ellipse at center, rgb(226 184 74 / 7%), transparent 70%); }
html[data-theme="dark"] .ag-add-icon { border-color: #5a4a22; color: var(--primary); }
html[data-theme="dark"] .access-emblem { background: rgb(226 184 74 / 10%); color: var(--primary); }
html[data-theme="dark"] .auth-card { background: var(--surface); border: 1px solid var(--border); }

/* Balance pages: main balance card and quick top-up amounts */
html[data-theme="dark"] .minute-stat-primary { border-color: #5a4a22; box-shadow: inset 0 0 0 1px rgb(226 184 74 / 8%); }
html[data-theme="dark"] .minute-stat-primary strong { color: var(--primary); }
html[data-theme="dark"] .customer-quick-amounts button { background: transparent; border-color: var(--border-strong); color: var(--text-muted); }
html[data-theme="dark"] .customer-quick-amounts button:hover { border-color: #6b5a2c; background: #17150f; color: var(--text); }
html[data-theme="dark"] .customer-quick-amounts .is-selected,
html[data-theme="dark"] .customer-quick-amounts .is-selected:hover {
    border-color: var(--primary);
    background: #221d10;
    color: var(--primary);
    box-shadow: 0 0 0 3px rgb(226 184 74 / 16%), 0 6px 18px rgb(226 184 74 / 12%);
}

/* Leftover fixed purple tones */
html[data-theme="dark"] .dialpad-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(226 184 74 / 14%); }
html[data-theme="dark"] #new-campaign .form-section-icon { background: rgb(226 184 74 / 12%); color: var(--primary); }
html[data-theme="dark"] .nav a.active { border-color: var(--border-strong); }
@media (max-width: 720px) {
    html[data-theme="dark"] .mobile-shortcuts a.active { background: #1c1c1e; color: var(--primary); border-color: var(--border-strong); }
}

html[data-theme="dark"] #new-campaign .form-section { background: #141415; }
html[data-theme="dark"] .library-origin .btn.is-on { background: #221d10; color: var(--primary); border-color: var(--primary); }

/* Call workspace pages (Llamadas en vivo, historial, PortSIP) use their own lavender accent */
html[data-theme="dark"] .call-history-page,
html[data-theme="dark"] .live-queue-page,
html[data-theme="dark"] .portsip-page { --call-accent: var(--primary); }
html[data-theme="dark"] .eyebrow { color: var(--primary); }

/* Theme picker in Preferences (shared by both themes) */
.user-menu-theme { display: flex; gap: 6px; }
