:root {
    color-scheme: dark;
    --canvas: #09090b;
    --surface: #111114;
    --surface-raised: #18181c;
    --line: rgba(255, 255, 255, .08);
    --line-hover: rgba(255, 255, 255, .16);
    --blurple: #5865f2;
    --blurple-hover: #4752c4;
    --emerald: #10b981;
    --amber: #f59e0b;
    --rose: #f43f5e;
    --ink: #f4f4f6;
    --subtle: #9696a5;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    background: var(--canvas);
    color: var(--ink);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    min-width: 0;
    overflow-x: hidden;
}
body::before {
    content: '';
    position: fixed;
    inset: 0 0 auto;
    height: 32rem;
    pointer-events: none;
    background: radial-gradient(ellipse 46rem 22rem at 50% -8rem, rgba(88, 101, 242, .065), transparent 75%);
    z-index: -1;
}
::selection { background: rgba(88, 101, 242, .35); color: #fff; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--blurple);
    outline-offset: 2px;
}
input[type='checkbox'], input[type='radio'] { accent-color: var(--blurple) !important; }

.top-gradient-bar { height: 1px; background: linear-gradient(90deg, transparent 8%, rgba(152, 160, 255, .6) 50%, transparent 92%); }
.panel-card {
    position: relative;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, .12);
}
.panel-card-hover { transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease; }
.panel-card-hover:hover { background: var(--surface-raised); border-color: var(--line-hover); box-shadow: none; transform: translateY(-2px); }
.panel-card .overflow-x-auto { max-width: 100%; scrollbar-width: thin; }
.panel-card table { min-width: 610px; border-collapse: separate; border-spacing: 0; }
.panel-card table th { position: sticky; top: 0; z-index: 1; background: var(--surface-raised); color: var(--subtle); font-size: 10px; letter-spacing: .075em; }
.panel-card table td { border-bottom: 1px solid var(--line); vertical-align: middle; }
.panel-card table tbody tr:last-child td { border-bottom: 0; }
.panel-card table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.panel-card code, .panel-card .font-mono, .tabular-nums, #stat-invoice, #stat-health, #stat-remaining,
#line-total, #line-remaining, .countdown, [data-expires] {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
}

.field {
    display: block;
    width: 100%;
    padding: .65rem .85rem;
    font-size: .875rem;
    background: #0e0e11;
    border: 1px solid var(--line-hover);
    border-radius: 9px;
    min-width: 0;
    min-height: 42px;
    color: var(--ink);
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
.field:hover { border-color: rgba(255, 255, 255, .23); }
.field:focus { border-color: var(--blurple); box-shadow: 0 0 0 3px rgba(88, 101, 242, .15); background: #111115; }
.field::placeholder { color: #696977; }
.field.pl-10 { padding-left: 2.5rem; }
.field.pr-10 { padding-right: 2.5rem; }
select.field option { background: var(--surface-raised); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .62rem 1.05rem;
    border: 1px solid transparent;
    font-size: .8125rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 9px;
    min-height: 40px;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease, opacity 150ms ease;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .44; cursor: not-allowed; filter: saturate(.7); }
.btn-primary { background: var(--blurple); color: #fff; border-color: var(--blurple); }
.btn-primary:hover:not(:disabled) { background: var(--blurple-hover); border-color: var(--blurple-hover); }
.btn-ghost { background: rgba(255, 255, 255, .025); color: #dedee6; border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-raised); border-color: var(--line-hover); color: #fff; }
.btn-danger { background: rgba(244, 63, 94, .13); border-color: rgba(244, 63, 94, .25); color: #ffa7b7; }
.btn-danger:hover:not(:disabled) { background: rgba(244, 63, 94, .23); border-color: rgba(244, 63, 94, .4); }

.badge { display: inline-flex; align-items: center; gap: .4rem; border-radius: 999px; padding: .28rem .65rem; font-size: 10px; font-weight: 700; letter-spacing: .015em; white-space: nowrap; }
.badge-on { background: rgba(16, 185, 129, .09); color: #48d8a4; border: 1px solid rgba(16, 185, 129, .22); }
.badge-info { background: rgba(88, 101, 242, .1); color: #aeb5ff; border: 1px solid rgba(88, 101, 242, .24); }
.badge-warn { background: rgba(245, 158, 11, .09); color: #f6bd62; border: 1px solid rgba(245, 158, 11, .24); }
.badge-err { background: rgba(244, 63, 94, .1); color: #ff8ca2; border: 1px solid rgba(244, 63, 94, .23); }
.badge-off { background: rgba(255, 255, 255, .035); color: var(--subtle); border: 1px solid var(--line); }
.copy-btn { border: 1px solid transparent; border-radius: 7px; padding: .35rem .45rem; transition: color 150ms ease, background-color 150ms ease; }
.copy-btn:hover { background: rgba(88, 101, 242, .1); color: #adb4ff; }
.copy-btn.copied { color: var(--emerald); }

#toast-container { position: fixed; z-index: 9999; top: 0; left: auto; right: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; width: min(100%, 420px); padding: 20px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: .75rem; width: 100%; min-width: 0; padding: .85rem 1rem; background: var(--surface-raised); border: 1px solid var(--line-hover); border-radius: 12px; box-shadow: 0 20px 45px rgba(0, 0, 0, .32); }
.toast-success { border-left: 2px solid var(--emerald); }
.toast-error { border-left: 2px solid var(--rose); }
.toast-info { border-left: 2px solid var(--blurple); }
.toast-success .fa-circle-check { color: var(--emerald); }
.toast-error .fa-circle-exclamation { color: var(--rose); }
.toast-info .fa-circle-info { color: #aeb5ff; }
.toast { transform: translateY(-12px); opacity: 0; animation: toastIn 220ms ease forwards; }
.toast.hiding { animation: toastOut 180ms ease forwards; }
@keyframes toastIn { to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { to { transform: translateY(-10px); opacity: 0; } }
.fade-in { animation: fadeIn 320ms ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--canvas); }
::-webkit-scrollbar-thumb { background: #303038; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #41414b; }

.dashboard-shell { min-height: 100vh; }
.dashboard-shell .dashboard-header { margin-left: 248px; background: rgba(9, 9, 11, .86); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.dashboard-header > div { max-width: none; padding: 15px clamp(20px, 3vw, 44px); }
.dashboard-shell .dashboard-main { margin-left: 248px; margin-right: 0; max-width: none; padding: 30px clamp(20px, 3vw, 44px) 48px; min-width: 0; }
.dashboard-main > [data-panel] { max-width: 1440px; }
.dashboard-shell .dashboard-nav {
    position: fixed;
    z-index: 45;
    inset: 1px auto 0 0;
    width: 248px;
    padding: 22px 14px;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 4px;
    overflow-y: auto;
    background: #101013;
    border: 0;
    border-right: 1px solid var(--line);
}
.dashboard-nav-brand { padding: 10px 10px 26px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.dashboard-nav-label { padding: 8px 12px 6px; color: #777786; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.dashboard-nav .tab-btn { justify-content: flex-start; width: 100%; min-height: 43px; padding: 10px 12px; font-size: 12px; font-weight: 600; background: transparent; border-color: transparent; color: #a6a6b1; }
.dashboard-nav .tab-btn i { width: 18px; color: #777784; text-align: center; }
.dashboard-nav .tab-btn:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.dashboard-nav .tab-btn.btn-primary { background: rgba(88, 101, 242, .12); border-color: rgba(88, 101, 242, .18); color: #cbd0ff; }
.dashboard-nav .tab-btn.btn-primary i { color: #9da6ff; }
.dashboard-menu-toggle { display: none; width: 38px; height: 38px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 9px; color: #ddd; }
.dashboard-overlay { display: none; }
.dashboard-intro { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 26px; }
.dashboard-intro .eyebrow { color: #9da6ff; font-size: 10px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.dashboard-intro h1 { margin-top: 5px; font-size: clamp(22px, 2.4vw, 30px); font-weight: 800; letter-spacing: -.035em; }
.dashboard-intro p { margin-top: 6px; color: var(--subtle); font-size: 12px; }
.kpi-grid > .panel-card { min-height: 118px; padding: 18px 19px; }
.kpi-grid > .panel-card p:last-child { font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.invoice-card { position: sticky; top: 84px; }
.invoice-card #line-total { letter-spacing: -.04em; }
.addon-option { min-width: 0; border: 1px solid var(--line) !important; background: var(--surface-raised) !important; border-radius: 10px; transition: border-color 150ms ease, background-color 150ms ease; }
.addon-option:hover { border-color: var(--line-hover) !important; }
.addon-option:has(input:checked) { border-color: rgba(88, 101, 242, .65) !important; background: rgba(88, 101, 242, .09) !important; }

.customer-page { position: relative; }
.customer-page > div { max-width: 1080px; }
.state-card { max-width: 620px; margin: 64px auto 0; border-top: 1px solid rgba(152, 160, 255, .25); }
.customer-header { display: flex; justify-content: space-between; align-items: center; text-align: left; gap: 18px; margin-bottom: 28px; }
.customer-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.customer-brand-mark { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 13px; color: #c4c9ff; background: rgba(88, 101, 242, .12); border: 1px solid rgba(88, 101, 242, .22); }
.customer-brand h1 { font-size: clamp(17px, 2vw, 24px); font-weight: 800; letter-spacing: -.035em; }
.customer-brand .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.customer-header-meta { text-align: right; flex: none; }
.customer-header-meta p { margin-top: 5px; color: var(--subtle); font-family: 'JetBrains Mono', monospace; font-size: 11px; font-variant-numeric: tabular-nums; }
.live-pulse { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); }
.live-pulse::after { content: ''; position: absolute; inset: -4px; border: 1px solid rgba(16, 185, 129, .42); border-radius: 50%; animation: statusPulse 2s ease-out infinite; }
@keyframes statusPulse { 0% { transform: scale(.55); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
.customer-stepper { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 6px; margin-bottom: 20px; }
.customer-step { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-radius: 10px; min-width: 0; color: var(--subtle); }
.customer-step + .customer-step { border-left: 1px solid var(--line); }
.customer-step .step-number { display: grid; place-items: center; flex: none; width: 27px; height: 27px; border-radius: 8px; background: var(--surface-raised); border: 1px solid var(--line); color: var(--subtle); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.customer-step span:last-child { font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.customer-step.is-current { background: rgba(88, 101, 242, .1); color: #e6e8ff; }
.customer-step.is-current .step-number { background: var(--blurple); border-color: var(--blurple); color: #fff; }
.customer-step.is-complete { color: #b4dfd0; }
.customer-step.is-complete .step-number { color: var(--emerald); background: rgba(16, 185, 129, .08); border-color: rgba(16, 185, 129, .2); }
.customer-summary { border-top: 1px solid rgba(152, 160, 255, .28); }
.customer-summary .package-code { color: var(--subtle); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.telemetry-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.telemetry-cell { min-width: 0; padding: 18px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: 12px; }
.telemetry-cell .metric-label { color: var(--subtle); font-size: 11px; font-weight: 600; }
.telemetry-cell .metric-value { margin-top: 9px; color: #fff; font-family: 'JetBrains Mono', monospace; font-size: clamp(18px, 2.3vw, 25px); font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.telemetry-cell #stat-health, .telemetry-cell #stat-remaining { margin-top: 9px; font-family: 'JetBrains Mono', monospace; font-size: clamp(18px, 2.3vw, 25px); line-height: 1.2; font-variant-numeric: tabular-nums; }
.telemetry-cell #stat-health.text-accent { color: var(--emerald); }
.telemetry-cell #stat-health.text-amber-400 { color: var(--amber); }
.telemetry-cell #stat-health.text-red-400, .telemetry-cell #stat-remaining.text-red-400 { color: var(--rose); }
.telemetry-cell .metric-detail { margin-top: 7px; color: var(--subtle); font-size: 10px; }
.telemetry-cell .health-rail { height: 4px; margin-top: 13px; border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, .09); }
.telemetry-cell #health-bar { background: var(--emerald) !important; }
.telemetry-cell #health-bar[class*='from-amber'] { background: var(--amber) !important; }
.telemetry-cell #health-bar[class*='from-red'] { background: var(--rose) !important; }
.channel-option, #channel-list label, #move-channels label { min-width: 0; border: 1px solid var(--line) !important; background: var(--surface-raised) !important; border-radius: 10px; transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease; }
#channel-list label:hover, #move-channels label:hover { border-color: var(--line-hover) !important; background: #202026 !important; }
#channel-list label:has(input:checked), #move-channels label:has(input:checked) { border-color: rgba(88, 101, 242, .65) !important; background: rgba(88, 101, 242, .09) !important; }
#channel-list label:active, #move-channels label:active { transform: scale(.995); }
.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.feature-card { min-width: 0; height: 100%; background: var(--surface-raised) !important; border: 1px solid var(--line) !important; border-radius: 11px !important; padding: 16px !important; }
.feature-card:focus-within { border-color: rgba(88, 101, 242, .45) !important; }
.feature-card.is-locked { opacity: .72; }
.feature-card:has(.fa-lock) { background: #141418 !important; opacity: .72; }
.partner-card { background: #121216; }
.partner-card .btn { border-radius: 999px; }
.action-band { background: rgba(245, 158, 11, .06); border: 1px solid rgba(245, 158, 11, .23); border-radius: 11px; }
.login-page { position: relative; }
.login-page::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle 300px at 50% 36%, rgba(88, 101, 242, .09), transparent 80%); }
.login-page > div { position: relative; }
.login-card { border-top: 1px solid rgba(152, 160, 255, .3); }
.login-error { color: #ff9cad; background: rgba(244, 63, 94, .08); border: 1px solid rgba(244, 63, 94, .23); border-radius: 10px; }

@media (max-width: 1023px) {
    .dashboard-shell .dashboard-header, .dashboard-shell .dashboard-main { margin-left: 0; }
    .dashboard-menu-toggle { display: inline-flex; }
    .dashboard-shell .dashboard-nav { width: min(280px, calc(100vw - 46px)); transform: translateX(-101%); transition: transform 180ms ease; box-shadow: 20px 0 40px rgba(0, 0, 0, .3); }
    .dashboard-shell.nav-open .dashboard-nav { transform: translateX(0); }
    .dashboard-shell.nav-open .dashboard-overlay { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(0, 0, 0, .65); backdrop-filter: blur(3px); }
    .invoice-card { position: static; }
}
@media (max-width: 640px) {
    .dashboard-shell .dashboard-main { padding: 22px 14px 38px; }
    .dashboard-header > div { padding: 12px 14px; }
    .dashboard-intro { align-items: start; }
    .kpi-grid > .panel-card { min-height: 98px; padding: 15px; }
    .kpi-grid > .panel-card p:last-child { font-size: 19px; overflow-wrap: anywhere; }
    .panel-card table { min-width: 570px; }
    main.customer-page { padding: 24px 14px 42px; }
    .customer-header { align-items: flex-start; margin-bottom: 20px; }
    .customer-brand { gap: 9px; }
    .customer-brand-mark { width: 38px; height: 38px; border-radius: 10px; }
    .customer-brand h1 { font-size: 16px; }
    .customer-header-meta p { display: block; max-width: 112px; margin-left: auto; font-size: 9px; line-height: 1.45; }
    .customer-summary > .flex { flex-direction: column; }
    .customer-summary .flex-col.items-end { align-items: flex-start; }
    .customer-stepper { padding: 5px; }
    .customer-step { padding: 9px 5px; justify-content: center; gap: 5px; flex-direction: column; text-align: center; }
    .customer-step + .customer-step { border-left: 0; }
    .customer-step span:last-child { width: 100%; font-size: 9px; }
    .telemetry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .telemetry-cell { padding: 13px; }
    .telemetry-cell:last-child { grid-column: 1 / -1; }
    .telemetry-cell .metric-value { font-size: 18px; }
    .feature-grid { grid-template-columns: 1fr; }
    #toast-container { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
