@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Syne:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Outfit:wght@200;300;400;500;600;700;800;900&display=swap');

:root {
    --bg-dark: #02040a;
    --bg-subtle: #0a0c14;
    --accent-primary: #00f2ff;
    /* Neon Cyan */
    --accent-secondary: #7000ff;
    /* Deep Purple */
    --accent-mint: #00ffaa;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(10, 15, 30, 0.8);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.12);
    --blur-strength: 0px;
    --grain-opacity: 0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: default;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- BACKGROUND DESIGN --- */
.premium-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background: radial-gradient(circle at 0% 0%, #0a0c1e 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, #1a0b2e 0%, transparent 50%),
        var(--bg-dark);
}

.mesh-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -21;
    opacity: 0.1;
    /* Very subtle now */
    filter: blur(40px);
}

.mesh-blob {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
}

.blob-primary {
    background: var(--accent-secondary);
    top: -10%;
    left: -10%;
}

.blob-secondary {
    background: var(--accent-primary);
    bottom: -10%;
    right: -10%;
}

.grain-overlay {
    display: none;
    /* Removed for performance */
}

/* --- TYPOGRAPHY --- */
h1,
h2,
h3,
.syne-font {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.accent-text {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-mint));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative;
}

/* --- LAYOUT --- */
.dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 3rem 2rem;
    position: relative;
    z-index: 1;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 4rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
}

.header-content h1 {
    font-size: 3.5rem;
    line-height: 0.9;
    margin-bottom: 0.5rem;
}

.header-content p {
    font-size: 1rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* --- UI ELEMENTS --- */
.api-control {
    display: flex;
    gap: 0.75rem;
    background: var(--glass-bg);
    padding: 0.5rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.api-input {
    background: transparent;
    border: none;
    padding: 0.6rem 1rem;
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    width: 180px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.api-input:focus {
    background: var(--glass-highlight);
    border-radius: 10px;
}

.sync-btn {
    background: var(--accent-primary);
    color: #000;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 0 rgba(0, 242, 255, 0);
}

.sync-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(0, 242, 255, 0.4);
    letter-spacing: 0.05em;
}

.sync-btn:active {
    transform: scale(0.98);
}

.date-range {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent-mint);
    padding: 0.5rem 1rem;
    border-left: 2px solid var(--accent-mint);
}

/* --- LUXURY CARDS --- */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: 0.5s;
}

.card:hover {
    border-color: var(--glass-highlight);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.card:hover::before {
    left: 100%;
}

/* Metrics Grid Enhancement */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.metric-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
}

.card-icon {
    width: 48px;
    height: 48px;
    background: var(--glass-highlight);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    margin-bottom: 1.5rem;
    border: 1px solid var(--glass-border);
}

.metric-value {
    font-size: 1.5rem;
    line-height: 1.2;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    color: var(--accent-primary);
}

.card-info h3 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-family: 'Space Grotesk', sans-serif;
}

.metric-trend {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.metric-trend.positive {
    color: var(--accent-mint);
}

.metric-note {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* Appointment Specific Cards */
.appointment-card.booked {
    border-left: 4px solid var(--accent-mint);
}

.appointment-card.booked .card-icon {
    color: var(--accent-mint);
}

.appointment-card.booked .metric-value {
    color: var(--accent-mint);
}

.appointment-card.cancelled {
    border-left: 4px solid #ff4d4d;
}

.appointment-card.cancelled .card-icon {
    color: #ff4d4d;
}

.appointment-card.cancelled .metric-value {
    color: #ff4d4d;
}

.appointment-card.modified {
    border-left: 4px solid var(--accent-secondary);
}

.appointment-card.modified .card-icon {
    color: var(--accent-secondary);
}

.appointment-card.modified .metric-value {
    color: var(--accent-secondary);
}

.agent-stats-mini {
    display: flex;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Charts & Tables Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2rem;
}

.chart-card {
    grid-column: span 2;
}

.chart-card.large {
    grid-column: span 3;
}

.table-card {
    grid-column: span 3;
}

#table-twilio-card {
    grid-column: span 6;
}

#table-twilio-card .table-wrapper {
    max-height: 420px;
    overflow-y: auto;
    position: relative;
}

.twilio-log-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) transparent;
}

.twilio-log-scroll::-webkit-scrollbar {
    width: 6px;
}

.twilio-log-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.twilio-log-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 242, 255, 0.3);
    border-radius: 3px;
}

.twilio-log-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 242, 255, 0.5);
}

#table-twilio-card thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #0d111d;
    /* Solid cover for scroll */
}

.chart-container {
    height: 320px;
    margin-top: 2rem;
}

/* --- PREMIUM TABLES --- */
.table-wrapper {
    margin-top: 1.5rem;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.2rem;
    text-align: left;
    font-family: 'Syne', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1.2rem;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: background 0.3s;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.agent-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 800;
    color: white;
}

.status-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.success {
    background: rgba(0, 255, 170, 0.1);
    color: var(--accent-mint);
    border: 1px solid rgba(0, 255, 170, 0.2);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* --- DRAG & DROP VISUALS --- */
.card.dragging {
    opacity: 0.4;
    scale: 0.95;
    border: 2px dashed var(--accent-primary);
    backdrop-filter: blur(5px);
}

.card.drag-over {
    border: 1px solid var(--accent-primary);
    box-shadow: 0 0 40px rgba(0, 242, 255, 0.2);
}

/* --- ANIMATIONS --- */
@keyframes meshRotate {
    0% {
        transform: rotate(0deg) scale(1.2);
    }

    50% {
        transform: rotate(180deg) scale(1);
    }

    100% {
        transform: rotate(360deg) scale(1.2);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(-5%, 5%);
    }
}

@keyframes entry {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.metrics-grid>.card,
.charts-grid>.card {
    opacity: 0;
    animation: entry 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.metrics-grid>.card:nth-child(2) {
    animation-delay: 0.1s;
}

.metrics-grid>.card:nth-child(3) {
    animation-delay: 0.2s;
}

.metrics-grid>.card:nth-child(4) {
    animation-delay: 0.3s;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--glass-highlight);
}

/* Responsive */
@media (max-width: 1400px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-card,
    .chart-card.large,
    .table-card {
        grid-column: span 1;
    }

    #table-twilio-card {
        grid-column: span 2;
    }
}

@media (max-width: 800px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 2rem;
    }

    .header-content h1 {
        font-size: 2.5rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-card,
    .chart-card.large,
    .table-card,
    #table-twilio-card {
        grid-column: span 1;
    }
}

/* ── LOGIN SECTION ──────────────────────────────────── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    padding: 2rem;
}

.login-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    letter-spacing: 0.05em;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-family: 'Syne', sans-serif;
}

.form-group .api-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-group .api-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.15);
}

.login-error {
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: #ff4d4d;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    text-align: center;
}

.login-btn {
    width: 100%;
    justify-content: center;
    padding: 1rem;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

/* ── USER BADGE ─────────────────────────────────────── */
.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    color: var(--accent-mint);
    font-size: 0.85rem;
    font-weight: 600;
}

/* ── LOGOUT BUTTON ──────────────────────────────────── */
.logout-btn {
    background: transparent;
    border: 1px solid rgba(255, 77, 77, 0.3) !important;
    color: #ff4d4d !important;
    font-size: 0.75rem;
    padding: 0.6rem 1rem;
}

.logout-btn:hover {
    background: rgba(255, 77, 77, 0.1);
    box-shadow: 0 0 20px rgba(255, 77, 77, 0.2);
}

/* ══════════════════════════════════════════════════════
   BILLING SECTION — "Financial Ledger Noir"
   DM Mono for data / Outfit for headings
   Amber gold revenue, jade profit, crimson costs
   ══════════════════════════════════════════════════════ */

/* ── Billing Command Bar ─────────────────────────────── */
.billing-command-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(10, 12, 20, 0.95), rgba(18, 22, 38, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

.billing-command-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(232, 186, 73, 0.4), transparent);
}

.billing-command-left {
    display: flex;
    gap: 1.25rem;
    align-items: flex-end;
}

.billing-command-right {
    display: flex;
    gap: 0.75rem;
}

.billing-field-label {
    display: block;
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(232, 186, 73, 0.7);
    margin-bottom: 0.4rem;
    font-weight: 400;
}

.billing-month-input,
.billing-client-input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
    color: var(--text-primary);
    font-family: 'DM Mono', monospace;
    font-size: 0.82rem;
    min-width: 160px;
    outline: none;
    transition: all 0.3s ease;
}

.billing-month-input:focus,
.billing-client-input:focus {
    border-color: rgba(232, 186, 73, 0.5);
    box-shadow: 0 0 20px rgba(232, 186, 73, 0.08);
}

.billing-client-input option {
    background: #0d111d;
    color: var(--text-primary);
}

.billing-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.billing-action-btn i {
    width: 15px;
    height: 15px;
}

.billing-action-view {
    background: rgba(232, 186, 73, 0.08);
    border-color: rgba(232, 186, 73, 0.25);
    color: #e8ba49;
}

.billing-action-view:hover {
    background: rgba(232, 186, 73, 0.18);
    box-shadow: 0 4px 20px rgba(232, 186, 73, 0.15);
    transform: translateY(-1px);
}

.billing-action-generate {
    background: linear-gradient(135deg, #e8ba49, #d4a33e);
    border-color: transparent;
    color: #0a0c14;
}

.billing-action-generate:hover {
    box-shadow: 0 4px 25px rgba(232, 186, 73, 0.35);
    transform: translateY(-1px);
}

.billing-action-generate.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ── Billing KPI Billboard Strip ────────────────────── */
.billing-kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.billing-kpi-card {
    position: relative;
    padding: 1.5rem;
    background: rgba(10, 12, 20, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    transform: translateY(12px);
    animation: billingCardEntry 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: calc(var(--delay) * 0.1s);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.billing-kpi-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

@keyframes billingCardEntry {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.billing-kpi-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 0 0 16px 16px;
    opacity: 0.8;
}

.billing-kpi-minutes .billing-kpi-bar {
    background: linear-gradient(90deg, transparent, #94a3b8, transparent);
}

.billing-kpi-revenue .billing-kpi-bar {
    background: linear-gradient(90deg, transparent, #e8ba49, transparent);
}

.billing-kpi-cost .billing-kpi-bar {
    background: linear-gradient(90deg, transparent, #ef4444, transparent);
}

.billing-kpi-margin .billing-kpi-bar {
    background: linear-gradient(90deg, transparent, #34d399, transparent);
}

.billing-kpi-icon-ring {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.billing-kpi-icon-ring i {
    width: 20px;
    height: 20px;
}

.billing-kpi-minutes .billing-kpi-icon-ring {
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.billing-kpi-revenue .billing-kpi-icon-ring {
    background: rgba(232, 186, 73, 0.08);
    border: 1px solid rgba(232, 186, 73, 0.18);
    color: #e8ba49;
}

.billing-kpi-cost .billing-kpi-icon-ring {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.billing-kpi-margin .billing-kpi-icon-ring {
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.billing-kpi-data {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.billing-kpi-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    white-space: nowrap;
}

.billing-kpi-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.billing-kpi-minutes:hover .billing-kpi-icon-ring {
    box-shadow: 0 0 15px rgba(148, 163, 184, 0.15);
}

.billing-kpi-revenue:hover .billing-kpi-value {
    color: #e8ba49;
}

.billing-kpi-revenue:hover .billing-kpi-icon-ring {
    box-shadow: 0 0 15px rgba(232, 186, 73, 0.2);
}

.billing-kpi-cost:hover .billing-kpi-value {
    color: #ef4444;
}

.billing-kpi-cost:hover .billing-kpi-icon-ring {
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.billing-kpi-margin:hover .billing-kpi-value {
    color: #34d399;
}

.billing-kpi-margin:hover .billing-kpi-icon-ring {
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.2);
}

/* ── Invoice Ledger Table ───────────────────────────── */
.billing-ledger {
    background: rgba(10, 12, 20, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.billing-ledger-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.billing-ledger-title {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.billing-ledger-title h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.billing-ledger-count {
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}

.billing-ledger-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.billing-legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 0.5rem;
}

.billing-legend-paid {
    background: #34d399;
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.4);
}

.billing-legend-pending {
    background: #e8ba49;
    box-shadow: 0 0 6px rgba(232, 186, 73, 0.4);
}

.billing-ledger-scroll {
    max-height: 520px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(232, 186, 73, 0.2) transparent;
}

.billing-ledger-scroll::-webkit-scrollbar {
    width: 5px;
}

.billing-ledger-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.billing-ledger-scroll::-webkit-scrollbar-thumb {
    background: rgba(232, 186, 73, 0.2);
    border-radius: 10px;
}

.billing-table {
    width: 100%;
    border-collapse: collapse;
}

.billing-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.billing-table thead tr {
    background: rgba(14, 18, 30, 0.98);
    backdrop-filter: blur(8px);
}

.billing-table th {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(232, 186, 73, 0.6);
    padding: 0.75rem 1rem;
    text-align: right;
    white-space: nowrap;
    border-bottom: 1px solid rgba(232, 186, 73, 0.1);
}

.billing-table th.billing-th-client {
    text-align: left;
    padding-left: 1.5rem;
}

.billing-table th.billing-th-actions {
    text-align: center;
}

.billing-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s ease;
}

.billing-table tbody tr:hover {
    background: rgba(232, 186, 73, 0.03);
}

.billing-table td {
    font-family: 'DM Mono', monospace;
    font-size: 0.82rem;
    padding: 0.9rem 1rem;
    color: var(--text-secondary);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.billing-table td:first-child {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    text-align: left;
    padding-left: 1.5rem;
    letter-spacing: -0.01em;
}

.billing-td-revenue {
    color: #e8ba49 !important;
    font-weight: 500 !important;
}

.billing-td-cost {
    color: #ef4444 !important;
    opacity: 0.85;
}

.billing-td-margin-pos {
    color: #34d399 !important;
    font-weight: 500 !important;
}

.billing-td-margin-neg {
    color: #ef4444 !important;
    font-weight: 500 !important;
}

/* Status pill in table */
.billing-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 400;
}

.billing-status-paid {
    background: rgba(52, 211, 153, 0.08);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.15);
}

.billing-status-pending {
    background: rgba(232, 186, 73, 0.08);
    color: #e8ba49;
    border: 1px solid rgba(232, 186, 73, 0.15);
}

.billing-status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}

.billing-status-paid .billing-status-dot {
    background: #34d399;
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
}

.billing-status-pending .billing-status-dot {
    background: #e8ba49;
    box-shadow: 0 0 6px rgba(232, 186, 73, 0.5);
    animation: billingPulse 2s ease-in-out infinite;
}

@keyframes billingPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes billingRowSlide {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Action buttons in table */
.billing-row-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
}

.billing-btn-breakdown,
.billing-btn-pdf {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    font-family: 'DM Mono', monospace;
    font-size: 0.68rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid;
    letter-spacing: 0.02em;
}

.billing-btn-breakdown i,
.billing-btn-pdf i {
    width: 12px;
    height: 12px;
}

.billing-btn-breakdown {
    background: rgba(148, 163, 184, 0.06);
    border-color: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.billing-btn-breakdown:hover {
    background: rgba(148, 163, 184, 0.15);
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.3);
}

.billing-btn-pdf {
    background: rgba(232, 186, 73, 0.06);
    border-color: rgba(232, 186, 73, 0.18);
    color: #e8ba49;
}

.billing-btn-pdf:hover {
    background: rgba(232, 186, 73, 0.18);
    color: #f5d06a;
    border-color: rgba(232, 186, 73, 0.35);
    box-shadow: 0 2px 12px rgba(232, 186, 73, 0.1);
}

/* Empty state */
.billing-empty-state {
    text-align: center !important;
    padding: 3.5rem 2rem !important;
}

.billing-empty-icon {
    margin-bottom: 1rem;
}

.billing-empty-icon i {
    width: 40px;
    height: 40px;
    color: rgba(232, 186, 73, 0.2);
}

.billing-empty-state p {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* ── Agent Breakdown Drawer ─────────────────────────── */
.billing-breakdown-drawer {
    background: rgba(10, 12, 20, 0.9);
    border: 1px solid rgba(52, 211, 153, 0.1);
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    animation: billingDrawerOpen 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes billingDrawerOpen {
    from {
        opacity: 0;
        transform: translateY(-8px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 600px;
    }
}

.billing-breakdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid rgba(52, 211, 153, 0.08);
    background: rgba(52, 211, 153, 0.02);
}

.billing-breakdown-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.billing-breakdown-title i {
    width: 18px;
    height: 18px;
    color: #34d399;
}

.billing-breakdown-title h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.billing-breakdown-title h3 span {
    color: #34d399;
}

.billing-breakdown-close {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.billing-breakdown-close i {
    width: 14px;
    height: 14px;
}

.billing-breakdown-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

.billing-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
}

.billing-agent-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem 1.15rem;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.billing-agent-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #34d399, rgba(52, 211, 153, 0.2));
    border-radius: 3px 0 0 3px;
}

.billing-agent-card:hover {
    border-color: rgba(52, 211, 153, 0.15);
    background: rgba(52, 211, 153, 0.03);
}

.billing-agent-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.billing-agent-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
}

.billing-agent-stat {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.billing-agent-stat-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    opacity: 0.7;
}

.billing-agent-stat-value {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.billing-agent-stat-value.val-minutes {
    color: #94a3b8;
}

.billing-agent-stat-value.val-cost {
    color: #ef4444;
}

.billing-agent-stat-value.val-billed {
    color: #e8ba49;
}

/* Billing no-data for breakdown */
.billing-breakdown-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 300;
}

/* ── Billing Responsive ─────────────────────────────── */
@media (max-width: 1200px) {
    .billing-kpi-strip {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 800px) {
    .billing-command-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .billing-command-left {
        flex-direction: column;
    }

    .billing-command-right {
        flex-direction: column;
    }

    .billing-kpi-strip {
        grid-template-columns: 1fr;
    }

    .billing-table th,
    .billing-table td {
        padding: 0.65rem 0.5rem;
        font-size: 0.72rem;
    }

    .billing-breakdown-grid {
        grid-template-columns: 1fr;
    }
}

/* ══════════════════════════════════════════════════════
   CLIENTS SECTION — Ledger Noir (matching Billing)
   Cyan as the identity accent for the clients domain
   ══════════════════════════════════════════════════════ */

/* ── Clients Summary Strip ──────────────────────────── */
.clients-summary-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.clients-summary-card {
    position: relative;
    padding: 1.3rem 1.25rem;
    background: rgba(10, 12, 20, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    transform: translateY(12px);
    animation: billingCardEntry 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: calc(var(--delay) * 0.1s);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.clients-summary-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.clients-summary-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 0 0 16px 16px;
    opacity: 0.8;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
}

.clients-summary-active::after {
    background: linear-gradient(90deg, transparent, #34d399, transparent);
}

.clients-summary-agents::after {
    background: linear-gradient(90deg, transparent, #a78bfa, transparent);
}

.clients-summary-revenue::after {
    background: linear-gradient(90deg, transparent, #e8ba49, transparent);
}

.clients-summary-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(0, 242, 255, 0.08);
    border: 1px solid rgba(0, 242, 255, 0.15);
    color: var(--accent-primary);
}

.clients-summary-icon i {
    width: 20px;
    height: 20px;
}

.clients-summary-active .clients-summary-icon {
    background: rgba(52, 211, 153, 0.08);
    border-color: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.clients-summary-agents .clients-summary-icon {
    background: rgba(167, 139, 250, 0.08);
    border-color: rgba(167, 139, 250, 0.15);
    color: #a78bfa;
}

.clients-summary-revenue .clients-summary-icon {
    background: rgba(232, 186, 73, 0.08);
    border-color: rgba(232, 186, 73, 0.18);
    color: #e8ba49;
}

.clients-summary-data {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.clients-summary-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.clients-summary-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
}

.clients-summary-card:hover .clients-summary-icon {
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.15);
}

.clients-summary-active:hover .clients-summary-icon {
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.15);
}

.clients-summary-agents:hover .clients-summary-icon {
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.15);
}

.clients-summary-revenue:hover .clients-summary-icon {
    box-shadow: 0 0 15px rgba(232, 186, 73, 0.15);
}

.clients-summary-revenue:hover .clients-summary-value {
    color: #e8ba49;
}

/* ── Clients Ledger Table ───────────────────────────── */
.clients-ledger {
    background: rgba(10, 12, 20, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    overflow: hidden;
}

.clients-ledger-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.clients-ledger-title {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.clients-ledger-title h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.clients-ledger-count {
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}

.clients-ledger-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.clients-legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 0.5rem;
}

.clients-legend-active {
    background: #34d399;
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.4);
}

.clients-legend-inactive {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.clients-ledger-scroll {
    max-height: 600px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 242, 255, 0.2) transparent;
}

.clients-ledger-scroll::-webkit-scrollbar {
    width: 5px;
}

.clients-ledger-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.clients-ledger-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 242, 255, 0.2);
    border-radius: 10px;
}

.clients-table {
    width: 100%;
    border-collapse: collapse;
}

.clients-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.clients-table thead tr {
    background: rgba(14, 18, 30, 0.98);
    backdrop-filter: blur(8px);
}

.clients-table th {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(0, 242, 255, 0.55);
    padding: 0.75rem 1rem;
    text-align: right;
    white-space: nowrap;
    border-bottom: 1px solid rgba(0, 242, 255, 0.08);
}

.clients-table th.clients-th-name {
    text-align: left;
    padding-left: 1.5rem;
}

.clients-table th.clients-th-agents {
    text-align: left;
}

.clients-table th.clients-th-actions {
    text-align: center;
}

.clients-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s ease;
}

.clients-table tbody tr:hover {
    background: rgba(0, 242, 255, 0.02);
}

.clients-table td {
    font-family: 'DM Mono', monospace;
    font-size: 0.82rem;
    padding: 0.9rem 1rem;
    color: var(--text-secondary);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.clients-table td:first-child {
    text-align: left;
    padding-left: 1.5rem;
}

/* Client name cell */
.clients-name-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.clients-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.72rem;
    color: #0a0c14;
    background: linear-gradient(135deg, var(--accent-primary), #34d399);
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.clients-name-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Status pill */
.clients-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.clients-status-active {
    background: rgba(52, 211, 153, 0.08);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.15);
}

.clients-status-inactive {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.clients-status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}

.clients-status-active .clients-status-dot {
    background: #34d399;
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
}

.clients-status-inactive .clients-status-dot {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

/* Agent tags */
.clients-agent-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    text-align: left;
}

.clients-agent-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-family: 'DM Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.02em;
    background: rgba(167, 139, 250, 0.08);
    color: #a78bfa;
    border: 1px solid rgba(167, 139, 250, 0.12);
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clients-agent-none {
    color: var(--text-secondary);
    opacity: 0.5;
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    text-align: left;
}

/* Financial cells */
.clients-td-cost {
    color: #ef4444 !important;
    opacity: 0.85;
}

.clients-td-revenue {
    color: #e8ba49 !important;
    font-weight: 500 !important;
}

.clients-td-margin-pos {
    color: #34d399 !important;
    font-weight: 500 !important;
}

.clients-td-margin-neg {
    color: #ef4444 !important;
    font-weight: 500 !important;
}

/* Detail button */
.clients-btn-detail {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-family: 'DM Mono', monospace;
    font-size: 0.68rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid rgba(0, 242, 255, 0.18);
    background: rgba(0, 242, 255, 0.06);
    color: var(--accent-primary);
    letter-spacing: 0.02em;
}

.clients-btn-detail i {
    width: 12px;
    height: 12px;
}

.clients-btn-detail:hover {
    background: rgba(0, 242, 255, 0.15);
    border-color: rgba(0, 242, 255, 0.35);
    box-shadow: 0 2px 12px rgba(0, 242, 255, 0.1);
    color: #fff;
}

/* Empty / loading state */
.clients-empty-state {
    text-align: center !important;
    padding: 3.5rem 2rem !important;
}

.clients-empty-icon {
    margin-bottom: 1rem;
}

.clients-empty-icon i {
    width: 36px;
    height: 36px;
    color: rgba(0, 242, 255, 0.2);
}

.clients-empty-state p {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* ── Client Detail Modal ────────────────────────────── */
.client-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.client-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 4, 10, 0.85);
    backdrop-filter: blur(12px);
}

.client-modal-panel {
    position: relative;
    width: 92%;
    max-width: 780px;
    max-height: 88vh;
    overflow-y: auto;
    z-index: 1001;
    background: rgba(10, 12, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    animation: clientModalEntry 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 242, 255, 0.15) transparent;
}

.client-modal-panel::-webkit-scrollbar {
    width: 4px;
}

.client-modal-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 242, 255, 0.15);
    border-radius: 10px;
}

@keyframes clientModalEntry {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.client-modal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    background: rgba(10, 12, 20, 0.98);
    backdrop-filter: blur(8px);
    z-index: 5;
    border-radius: 20px 20px 0 0;
}

.client-modal-identity {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.client-modal-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.9rem;
    color: #0a0c14;
    background: linear-gradient(135deg, var(--accent-primary), #34d399);
    flex-shrink: 0;
}

.client-modal-identity h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.client-modal-subtitle {
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.client-modal-close {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.client-modal-close i {
    width: 16px;
    height: 16px;
}

.client-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

.client-modal-body {
    padding: 1.75rem 2rem 2rem;
}

/* Modal sections */
.client-section {
    margin-bottom: 2rem;
}

.client-section:last-child {
    margin-bottom: 0;
}

.client-section-header {
    font-family: 'DM Mono', monospace;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: rgba(0, 242, 255, 0.55);
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 242, 255, 0.06);
}

.client-section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 0.75rem;
}

.client-metric-tile {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    transition: border-color 0.2s ease;
}

.client-metric-tile:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

.client-metric-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1;
}

.client-metric-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.6rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Agent tags in modal */
.client-agents-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.client-agent-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
}

.client-agent-pill-active {
    background: rgba(52, 211, 153, 0.08);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.15);
}

.client-agent-pill-inactive {
    background: rgba(239, 68, 68, 0.06);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.12);
}

.client-agent-pill-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}

.client-agent-pill-active .client-agent-pill-dot {
    background: #34d399;
    box-shadow: 0 0 5px rgba(52, 211, 153, 0.4);
}

.client-agent-pill-inactive .client-agent-pill-dot {
    background: #ef4444;
}

/* Appointments row in modal */
.client-citas-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.client-cita-tile {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: border-color 0.2s ease;
}

.client-cita-tile:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

.client-cita-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.3rem;
}

.client-cita-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
}

.client-cita-booked .client-cita-value { color: #34d399; }
.client-cita-cancelled .client-cita-value { color: #ef4444; }
.client-cita-modified .client-cita-value { color: #a78bfa; }

/* Modal loading */
.client-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 300;
}

.client-modal-loading i {
    width: 28px;
    height: 28px;
    color: rgba(0, 242, 255, 0.3);
    animation: spin 1.2s linear infinite;
}

.client-modal-error {
    text-align: center;
    padding: 3rem;
    color: #ef4444;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
}

/* ── Clients Responsive ─────────────────────────────── */
@media (max-width: 1200px) {
    .clients-summary-strip {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 800px) {
    .clients-summary-strip {
        grid-template-columns: 1fr;
    }

    .clients-table th,
    .clients-table td {
        padding: 0.65rem 0.5rem;
        font-size: 0.72rem;
    }

    .client-modal-panel {
        width: 96%;
        max-height: 92vh;
    }

    .client-modal-topbar {
        padding: 1.1rem 1.25rem;
    }

    .client-modal-body {
        padding: 1.25rem;
    }

    .client-section-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .client-citas-grid {
        grid-template-columns: 1fr;
    }
}

/* ── STATUS BADGES (Extended) ───────────────────────── */
.status-badge.danger {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
    border: 1px solid rgba(255, 77, 77, 0.2);
}

.status-badge.info {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(0, 242, 255, 0.2);
}

/* ── LOADING SPINNER ────────────────────────────────── */
.sync-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.sync-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Agent name cell */
.agent-name-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.agent-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── PERIOD SELECTOR ─────────────────────────────────── */
.period-selector-container {
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: flex-start;
}

.period-filter-bar {
    display: flex;
    gap: 0.4rem;
    background: var(--glass-bg);
    padding: 0.4rem;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    margin-bottom: 1.5rem;
    width: fit-content;
}

.button-group {
    display: flex;
    background: var(--glass-bg);
    padding: 0.4rem;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
}

.period-btn {
    background: transparent;
    border: none;
    padding: 0.6rem 1.2rem;
    color: var(--text-secondary);
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.period-btn:hover {
    color: var(--text-primary);
    background: var(--glass-highlight);
}

.period-btn.active {
    background: var(--accent-primary);
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.3);
}

/* ══════════════════════════════════════════════════════
   ADMIN PANEL STYLES
   ══════════════════════════════════════════════════════ */

/* Admin Navigation Tabs */
.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
    background: var(--glass-bg);
    padding: 0.4rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    flex-wrap: wrap;
}

.admin-tab {
    background: transparent;
    border: none;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-tab:hover {
    color: var(--text-primary);
    background: var(--glass-highlight);
}

.admin-tab.active {
    background: var(--accent-primary);
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.3);
}

.admin-tab i {
    width: 16px;
    height: 16px;
}

/* Tab Content Visibility */
.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

/* Admin KPI Cards accent */
.admin-kpi .card-icon {
    color: var(--accent-primary);
    background: rgba(0, 242, 255, 0.08);
    border: 1px solid rgba(0, 242, 255, 0.15);
}

/* Full-width table card */
.admin-full-width {
    grid-column: 1 / -1;
}

/* Admin Filters */
.admin-filter-card {
    margin-bottom: 2rem;
}

.admin-filters {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.filter-group label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    font-family: 'Syne', sans-serif;
}

.admin-select,
.admin-input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    min-width: 140px;
    outline: none;
    transition: border-color 0.3s ease;
}

.admin-select:focus,
.admin-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.1);
}

.admin-select option {
    background: #0d111d;
    color: var(--text-primary);
}

/* Status Indicator in Client Table */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-dot.active {
    background: var(--accent-mint);
    box-shadow: 0 0 8px rgba(0, 255, 170, 0.5);
}

.status-dot.inactive {
    background: #ff4d4d;
    box-shadow: 0 0 8px rgba(255, 77, 77, 0.4);
}

/* Client Detail Button */
.admin-detail-btn {
    background: rgba(0, 242, 255, 0.08);
    border: 1px solid rgba(0, 242, 255, 0.2);
    color: var(--accent-primary);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Space Grotesk', sans-serif;
}

.admin-detail-btn:hover {
    background: var(--accent-primary);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
}

/* Admin Modal */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.admin-modal-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1001;
    animation: entry 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.admin-modal-header h2 {
    font-size: 1.5rem;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-mint));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.admin-modal-close {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-modal-close:hover {
    background: rgba(255, 77, 77, 0.1);
    border-color: #ff4d4d;
    color: #ff4d4d;
}

/* Modal body sections */
.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section h3 {
    font-size: 0.85rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    font-family: 'Syne', sans-serif;
}

.modal-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal-kpi {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.modal-kpi .kpi-value {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent-primary);
    font-variant-numeric: tabular-nums;
}

.modal-kpi .kpi-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.3rem;
}

/* Appointment type badges */
.tipo-badge {
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tipo-badge.booked {
    background: rgba(0, 255, 170, 0.1);
    color: var(--accent-mint);
    border: 1px solid rgba(0, 255, 170, 0.2);
}

.tipo-badge.cancelled {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
    border: 1px solid rgba(255, 77, 77, 0.2);
}

.tipo-badge.modified {
    background: rgba(112, 0, 255, 0.1);
    color: var(--accent-secondary);
    border: 1px solid rgba(112, 0, 255, 0.2);
}

/* Responsive admin */
@media (max-width: 1400px) {
    .admin-filters {
        flex-wrap: wrap;
    }
}

@media (max-width: 800px) {
    .admin-tabs {
        flex-direction: column;
    }

    .admin-filters {
        flex-direction: column;
    }

    .admin-modal-content {
        width: 95%;
        max-height: 90vh;
    }
}