:root {
    --black: #000000;
    --panel: #04060c;
    --panel-strong: #070b14;
    --panel-soft: #0c1220;
    --navy: #001f54;
    --navy-light: #0b3d91;
    --navy-glow: rgba(11, 61, 145, 0.35);
    --accent: #e8000a;
    --accent-soft: rgba(232, 0, 10, 0.18);
    --accent-glow: rgba(232, 0, 10, 0.12);
    --glass: rgba(13, 18, 31, 0.82);
    --glass-border: rgba(194, 210, 255, 0.16);
    --glass-border-strong: rgba(210, 224, 255, 0.24);
    --line: rgba(210, 224, 255, 0.13);
    --white: #ffffff;
    --muted: #a9b3c9;
    --text: rgba(242, 246, 255, 0.95);
    --radius: 12px;
    --radius-lg: 16px;
    --bs-body-bg: #04060c;
    --bs-body-color: rgba(230, 235, 245, 0.92);
}

* { box-sizing: border-box; }

body {
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(11, 61, 145, 0.18), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(232, 0, 10, 0.10), transparent 60%),
        var(--black);
    color: var(--text);
    font-family: "Poppins", "Segoe UI", Arial, sans-serif;
    min-height: 100vh;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    color: #fff;
    text-decoration: none;
}
.brand-logo img {
    display: block;
    width: 156px;
    max-width: 42vw;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(232, 0, 10, 0.14));
}

a { color: #7fb0ff; }
a:hover { color: #a9c8ff; }

/* ---- Glass surfaces ---- */
.glass-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.035),
        0 18px 44px rgba(0, 0, 0, 0.44);
    backdrop-filter: blur(10px);
}

.navbar-zoni {
    background: rgba(4, 6, 14, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.text-muted-soft { color: var(--muted) !important; }

/* ---- Bootstrap overrides ---- */
.btn-accent {
    background: linear-gradient(135deg, var(--accent), rgba(180, 0, 8, 0.95));
    border: none;
    color: #fff;
    font-weight: 600;
}
.btn-accent:hover { color: #fff; filter: brightness(1.08); }

.btn-navy {
    background: linear-gradient(135deg, rgba(11, 61, 145, 0.55), rgba(0, 31, 84, 0.5));
    border: 1px solid var(--glass-border-strong);
    color: #fff;
}
.btn-navy:hover { color: #fff; filter: brightness(1.1); }

.btn-ghost {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text);
}
.btn-ghost:hover { color: #fff; background: rgba(255,255,255,0.08); }

.form-control, .form-select {
    background: rgba(9, 14, 27, 0.95);
    border: 1px solid var(--glass-border);
    color: var(--text);
}
.form-control:focus, .form-select:focus {
    background: rgba(7, 11, 22, 0.95);
    border-color: var(--navy-light);
    box-shadow: 0 0 0 0.2rem var(--navy-glow);
    color: var(--text);
}
.form-control::placeholder { color: var(--muted); }

.card {
    background: var(--panel-soft);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}
.table {
    --bs-table-color: var(--text);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--line);
    --bs-table-hover-color: #ffffff;
    --bs-table-hover-bg: rgba(255, 255, 255, 0.045);
    color: var(--text);
}
.table > :not(caption) > * > * {
    background: transparent;
    border-color: var(--line);
    color: var(--text);
}
.table thead th {
    color: #c0cae0;
    font-weight: 700;
    border-color: rgba(210, 224, 255, 0.16);
}
.table tbody td {
    color: rgba(242, 246, 255, 0.93);
}
.table tbody tr:hover > * {
    background: rgba(255, 255, 255, 0.04);
    color: #ffffff;
}

.badge-accent { background: rgba(232, 0, 10, 0.24); color: #ffd5d8; }
.badge-navy { background: rgba(71, 115, 220, 0.28); color: #dce7ff; }
.badge-muted { background: rgba(255,255,255,0.10); color: #c0cae0; }

.stat-card {
    padding: 1.1rem 1.25rem;
    border-color: var(--glass-border-strong);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
        var(--glass);
}
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; color: #fff; }
.stat-card .stat-label { color: var(--muted); font-size: 0.85rem; }

.nav-pills .nav-link { color: #afbbe0; }
.nav-pills .nav-link.active { background: var(--accent-soft); color: #fff; }

.dropdown-menu-dark {
    background: rgba(10, 14, 26, 0.98);
    border: 1px solid var(--glass-border);
}

hr { border-color: var(--line); }
.modal-content { background: var(--panel-strong); border: 1px solid var(--glass-border); color: var(--text); }
.modal-header, .modal-footer { border-color: var(--line); }

/* ---- Billing ---- */
.billing-page {
    display: grid;
    gap: 18px;
    padding-bottom: 42px;
}

.billing-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    overflow: hidden;
    padding: 28px;
    border-color: var(--glass-border-strong);
    background:
        linear-gradient(135deg, rgba(11, 61, 145, 0.2), rgba(232, 0, 10, 0.08)),
        rgba(255, 255, 255, 0.035);
}

.billing-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 42px 42px;
    opacity: 0.18;
    pointer-events: none;
}

.billing-hero > * {
    position: relative;
}

.billing-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 12px;
    margin-bottom: 18px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--text);
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
}

.billing-back:hover {
    background: rgba(11, 61, 145, 0.35);
    color: #fff;
    text-decoration: none;
}

.billing-hero h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(2rem, 5vw, 4.1rem);
    font-weight: 800;
    letter-spacing: 0;
    line-height: 0.98;
}

.billing-hero p {
    max-width: 660px;
    margin: 14px 0 0;
    color: rgba(210, 220, 242, 0.8);
    font-size: 1rem;
    line-height: 1.6;
}

.billing-hero-status,
.gateway-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--glass-border-strong);
    border-radius: 99px;
    background: rgba(4, 6, 14, 0.72);
    color: rgba(230, 235, 245, 0.9);
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
    box-shadow: 0 0 0 4px rgba(138, 150, 176, 0.12);
}

.status-dot.is-active {
    background: #45dc7a;
    box-shadow: 0 0 0 4px rgba(69, 220, 122, 0.12), 0 0 18px rgba(69, 220, 122, 0.35);
}

.api-key-reveal {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 18px 20px;
    border: 1px solid rgba(232, 0, 10, 0.28);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(232, 0, 10, 0.13), rgba(11, 61, 145, 0.13));
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.36);
}

.api-key-reveal strong,
.api-key-reveal code {
    display: block;
}

.api-key-reveal strong {
    color: #fff;
    font-size: 1rem;
}

.api-key-reveal code,
.api-key-card code {
    overflow-wrap: anywhere;
    color: #dce8ff;
    font-size: 0.94rem;
}

.api-key-reveal p {
    max-width: 300px;
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

.billing-grid {
    display: grid;
    grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
    gap: 18px;
    align-items: start;
}

.billing-stack {
    display: grid;
    gap: 18px;
}

.billing-panel,
.plans-panel {
    padding: 22px;
    border-color: var(--glass-border-strong);
}

.panel-heading,
.plans-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.panel-heading {
    justify-content: flex-start;
}

.panel-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(11, 61, 145, 0.42);
    border-radius: 10px;
    background: rgba(11, 61, 145, 0.18);
    color: #cfe0ff;
    flex: 0 0 auto;
}

.panel-heading h2,
.plans-header h2 {
    margin: 0;
    color: #fff;
    font-size: 1.06rem;
    font-weight: 800;
    letter-spacing: 0;
}

.panel-heading p,
.plans-header p,
.plan-card p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

.eyebrow {
    display: block;
    margin-bottom: 5px;
    color: rgba(180, 200, 255, 0.74);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.current-plan,
.api-key-card,
.empty-billing-state {
    display: grid;
    gap: 8px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
}

.current-plan strong,
.empty-billing-state strong {
    color: #fff;
    font-size: 1rem;
}

.current-plan small,
.empty-billing-state span {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

.api-key-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.compact-metrics,
.plan-quotas {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 16px;
}

.compact-metrics div,
.plan-quotas div {
    padding: 12px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.026);
}

.compact-metrics dt,
.plan-quotas dt {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.compact-metrics dd,
.plan-quotas dd {
    margin: 0;
    color: #fff;
    font-size: 0.94rem;
    font-weight: 700;
}

.billing-actions,
.payment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.plan-list {
    display: grid;
    gap: 12px;
}

.plan-card {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
        rgba(7, 11, 22, 0.7);
    transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.plan-card:hover,
.plan-card.is-current {
    border-color: rgba(232, 0, 10, 0.32);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
    transform: translateY(-1px);
}

.plan-card-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
}

.plan-name-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.plan-name-row h3 {
    margin: 0;
    color: #fff;
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: 0;
}

.plan-price {
    min-width: 150px;
    text-align: right;
}

.plan-price span,
.plan-price small {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.plan-price strong {
    display: block;
    color: #fff;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
}

.gateway-warning {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid rgba(255, 193, 7, 0.22);
    border-radius: 8px;
    background: rgba(255, 193, 7, 0.08);
    color: #ffd980;
    font-size: 0.82rem;
    font-weight: 700;
}

.billing-page .btn {
    border-radius: 8px;
    font-weight: 700;
}

/* ======================================================
   LIGHT THEME
   Applied when <html data-theme="light"> is set
   ====================================================== */
[data-theme="light"] {
    --panel:              #f0f2f8;
    --panel-strong:       #e8ebf4;
    --panel-soft:         #dde1ef;
    --glass:              rgba(255, 255, 255, 0.88);
    --glass-border:       rgba(24, 34, 64, 0.13);
    --glass-border-strong:rgba(24, 34, 64, 0.18);
    --line:               rgba(24, 34, 64, 0.12);
    --white:              #ffffff;
    --muted:              #58627c;
    --text:               #151d38;
    --bs-body-bg:         #f0f2f8;
    --bs-body-color:      #1b2340;
}

[data-theme="light"] body {
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(11, 61, 145, 0.07), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(232, 0, 10, 0.05), transparent 60%),
        #f0f2f8;
    color: var(--text);
}

[data-theme="light"] .navbar-zoni {
    background: rgba(240, 242, 248, 0.95);
    border-bottom: 1px solid var(--line);
}

[data-theme="light"] .glass-card {
    background: rgba(255, 255, 255, 0.90);
    border-color: var(--glass-border);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.72),
        0 16px 38px rgba(30, 38, 70, 0.10);
}

[data-theme="light"] .card {
    background: rgba(255, 255, 255, 0.90);
    border-color: var(--glass-border);
}

[data-theme="light"] .modal-content {
    background: #ffffff;
    border-color: var(--glass-border);
    color: var(--text);
}

[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
    background: #ffffff;
    border-color: rgba(24, 34, 64, 0.18);
    color: var(--text);
}

[data-theme="light"] .form-control:focus,
[data-theme="light"] .form-select:focus {
    background: #ffffff;
    color: var(--text);
}

[data-theme="light"] .form-control::placeholder { color: #9aa2bc; }

[data-theme="light"] .btn-ghost {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.12);
    color: var(--text);
}
[data-theme="light"] .btn-ghost:hover {
    background: rgba(0,0,0,0.08);
    color: var(--text);
}

[data-theme="light"] .btn-navy {
    background: linear-gradient(135deg, rgba(11,61,145,0.85), rgba(0,31,84,0.80));
    border-color: transparent;
    color: #fff;
}

[data-theme="light"] .table {
    --bs-table-color: var(--text);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--line);
    --bs-table-hover-color: #0f1730;
    --bs-table-hover-bg: rgba(11, 61, 145, 0.045);
    color: var(--text);
}
[data-theme="light"] .table > :not(caption) > * > * {
    background: transparent;
    border-color: var(--line);
    color: var(--text);
}
[data-theme="light"] .table thead th {
    color: #4e5a78;
    border-color: rgba(24, 34, 64, 0.14);
}
[data-theme="light"] .table tbody td {
    color: #151d38;
}
[data-theme="light"] .table tbody tr:hover > * {
    background: rgba(11, 61, 145, 0.045);
    color: #0f1730;
}

[data-theme="light"] .badge-accent { background: rgba(232,0,10,0.13); color: #a80008; }
[data-theme="light"] .badge-navy   { background: rgba(11,61,145,0.13); color: #07347f; }
[data-theme="light"] .badge-muted  { background: rgba(24,34,64,0.08); color: #58627c; }

[data-theme="light"] .nav-pills .nav-link { color: var(--muted); }
[data-theme="light"] .nav-pills .nav-link.active { background: var(--accent-soft); color: var(--accent); }

[data-theme="light"] .stat-card .stat-value { color: #1b2340; }
[data-theme="light"] .stat-card {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.9)),
        var(--glass);
    border-color: rgba(24, 34, 64, 0.12);
}

[data-theme="light"] a { color: #0b3d91; }
[data-theme="light"] a:hover { color: #001f54; }

[data-theme="light"] .dropdown-menu-dark {
    background: #ffffff;
    border-color: var(--glass-border);
    color: var(--text);
}

[data-theme="light"] .billing-hero {
    background:
        linear-gradient(135deg, rgba(11, 61, 145, 0.10), rgba(232, 0, 10, 0.04)),
        rgba(255, 255, 255, 0.60);
}
[data-theme="light"] .billing-hero h1 { color: #1b2340; }
[data-theme="light"] .billing-hero p  { color: #4a5578; }
[data-theme="light"] .billing-hero-status,
[data-theme="light"] .gateway-pill {
    background: rgba(255,255,255,0.85);
    color: var(--text);
}
[data-theme="light"] .plan-card {
    background: rgba(255,255,255,0.80);
}
[data-theme="light"] .compact-metrics div,
[data-theme="light"] .plan-quotas div {
    background: rgba(0,0,0,0.025);
}
[data-theme="light"] .compact-metrics dd,
[data-theme="light"] .plan-quotas dd,
[data-theme="light"] .panel-heading h2,
[data-theme="light"] .plans-header h2,
[data-theme="light"] .plan-name-row h3,
[data-theme="light"] .plan-price strong,
[data-theme="light"] .current-plan strong,
[data-theme="light"] .empty-billing-state strong,
[data-theme="light"] .api-key-reveal strong { color: #1b2340; }

[data-theme="light"] .api-key-reveal code,
[data-theme="light"] .api-key-card code { color: #0b3d91; }

[data-theme="light"] hr { border-color: var(--line); }

/* ── Theme toggle button ── */
.btn-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-size: 0.95rem;
}
.btn-theme-toggle:hover { background: rgba(255,255,255,0.12); }
[data-theme="light"] .btn-theme-toggle:hover { background: rgba(0,0,0,0.08); }

@media (max-width: 992px) {
    .billing-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .billing-hero,
    .api-key-reveal,
    .plan-card-main,
    .plans-header {
        grid-template-columns: 1fr;
    }

    .billing-hero {
        align-items: flex-start;
        padding: 22px;
        flex-direction: column;
    }

    .api-key-reveal {
        display: grid;
    }

    .api-key-reveal p {
        max-width: none;
    }

    .plan-price {
        min-width: 0;
        text-align: left;
    }

    .compact-metrics,
    .plan-quotas {
        grid-template-columns: 1fr;
    }
}
