:root {
    --bg-base: #080d17;
    --bg-surface: rgba(18, 25, 40, 0.72);
    --bg-surface-strong: rgba(22, 32, 49, 0.9);
    --stroke: rgba(128, 157, 198, 0.22);
    --text-primary: #ebf2ff;
    --text-muted: #9fb2cc;
    --brand: #37d5a3;
    --warn: #f3b553;
    --danger: #ff6b6b;
    --shadow-lg: 0 24px 60px rgba(4, 8, 15, 0.55);
    --font-heading: "Space Grotesk", sans-serif;
    --font-body: "IBM Plex Sans", sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--text-primary);
    background:
        radial-gradient(circle at 20% 0%, #132749 0%, transparent 45%),
        radial-gradient(circle at 85% 25%, #1d3c33 0%, transparent 40%),
        linear-gradient(145deg, #070b14 0%, #0d1424 55%, #0a121f 100%);
    overflow-x: hidden;
}

.background-glow {
    position: fixed;
    border-radius: 999px;
    filter: blur(65px);
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
}

.glow-a {
    width: 420px;
    height: 420px;
    top: -160px;
    left: -100px;
    background: #2aa8ff;
}

.glow-b {
    width: 420px;
    height: 420px;
    right: -150px;
    bottom: -170px;
    background: #38d39f;
}

.view {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

.panel {
    border: 1px solid var(--stroke);
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
}

.btn {
    appearance: none;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 120ms ease, opacity 120ms ease, background-color 120ms ease;
    padding: 10px 14px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(145deg, #35d6a4, #1da2ff);
    color: #001126;
}

.btn-outline {
    background: rgba(4, 10, 19, 0.6);
    border: 1px solid var(--stroke);
    color: var(--text-primary);
}

.btn-link {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--stroke);
    background: rgba(7, 13, 24, 0.72);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

textarea {
    min-height: 110px;
    resize: vertical;
    font-family: "Consolas", "Menlo", monospace;
    font-size: 12px;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(55, 213, 163, 0.65);
    box-shadow: 0 0 0 3px rgba(55, 213, 163, 0.2);
}

/* Landing */
.hero {
    max-width: 1100px;
    margin: 34px auto;
    padding: 32px;
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 30px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 12px;
    color: #9fd3f4;
}

.hero h1 {
    margin-top: 10px;
    font-family: var(--font-heading);
    font-size: clamp(34px, 5vw, 50px);
    line-height: 1.05;
}

.hero-lead {
    margin-top: 18px;
    color: #c6d7ef;
    line-height: 1.65;
    max-width: 620px;
}

.hero-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.hero-points {
    display: grid;
    gap: 12px;
}

.hero-points article {
    border: 1px solid rgba(124, 157, 198, 0.24);
    border-radius: 14px;
    background: rgba(10, 17, 29, 0.8);
    padding: 14px;
}

.hero-points h3 {
    font-family: var(--font-heading);
    font-size: 16px;
}

.hero-points p {
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Auth */
.auth-shell {
    width: min(92vw, 460px);
    margin: 52px auto;
    padding: 24px;
}

.auth-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
}

.tab-btn {
    border: 1px solid var(--stroke);
    background: rgba(8, 14, 24, 0.7);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    font-weight: 600;
}

.tab-btn.active {
    border-color: rgba(55, 213, 163, 0.6);
    background: rgba(33, 145, 113, 0.18);
}

.auth-form {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.auth-form label {
    font-size: 13px;
    color: var(--text-muted);
}

/* Dashboard */
.app-shell {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 18px;
    min-height: 100vh;
    padding: 18px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 22px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-family: var(--font-heading);
    font-weight: 700;
    color: #001b14;
    background: linear-gradient(130deg, #7cf4c2, #22b3ff);
}

.brand h1 {
    font-family: var(--font-heading);
    font-size: 24px;
}

.brand p {
    color: var(--text-muted);
    font-size: 13px;
}

.section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 12px;
    color: #b9cae1;
}

.input-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.account-list-wrap {
    min-height: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.account-list {
    list-style: none;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 2px;
}

.account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(8, 14, 25, 0.78);
    border: 1px solid rgba(104, 132, 170, 0.18);
}

.account-name {
    font-size: 14px;
    font-weight: 600;
}

.account-token-preview {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: "Consolas", "Menlo", monospace;
}

.delete-btn {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    border: 1px solid rgba(255, 107, 107, 0.25);
    color: #ffc3c3;
    background: rgba(255, 107, 107, 0.09);
    cursor: pointer;
}

.delete-btn:hover {
    background: rgba(255, 107, 107, 0.2);
}

.sidebar-footer {
    margin-top: auto;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    background: var(--bg-surface-strong);
}

.status-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
}

.dot.green {
    background: var(--brand);
    box-shadow: 0 0 18px rgba(55, 213, 163, 0.7);
}

.dot.yellow {
    background: var(--warn);
    box-shadow: 0 0 14px rgba(243, 181, 83, 0.7);
}

.dot.red {
    background: var(--danger);
    box-shadow: 0 0 14px rgba(255, 107, 107, 0.7);
}

.last-checked {
    color: var(--text-muted);
    font-size: 13px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.metric-card {
    padding: 16px 18px;
}

.metric-card p {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.metric-card h3 {
    font-family: var(--font-heading);
    font-size: 31px;
    margin-top: 8px;
}

.quota-panel {
    padding: 18px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.quota-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.quota-panel h2 {
    font-family: var(--font-heading);
    font-size: 20px;
}

.hint {
    color: var(--text-muted);
    font-size: 13px;
}

.quota-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 12px;
    overflow: auto;
    padding-right: 2px;
}

.account-card {
    border-radius: 16px;
    padding: 16px;
    background: rgba(8, 13, 23, 0.85);
    border: 1px solid rgba(104, 132, 170, 0.22);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-title h3 {
    font-family: var(--font-heading);
    font-size: 18px;
}

.card-title p {
    font-size: 12px;
    color: var(--text-muted);
}

.mini-refresh {
    border: 1px solid var(--stroke);
    background: rgba(8, 14, 24, 0.7);
    color: var(--text-primary);
    border-radius: 9px;
    width: 30px;
    height: 30px;
    cursor: pointer;
}

.model-list {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.model-item {
    border-radius: 11px;
    border: 1px solid rgba(84, 109, 145, 0.24);
    background: rgba(11, 19, 33, 0.85);
    padding: 10px;
}

.model-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
}

.progress-bg {
    margin-top: 8px;
    height: 7px;
    border-radius: 99px;
    background: rgba(137, 163, 197, 0.16);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 260ms ease;
}

.model-footer {
    margin-top: 7px;
    font-size: 12px;
    color: var(--text-muted);
}

.state-note {
    color: var(--text-muted);
    font-size: 14px;
}

.error {
    color: #ffc3c3;
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.35);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
}

.empty-state {
    grid-column: 1 / -1;
    min-height: 240px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--text-muted);
    border: 1px dashed rgba(145, 173, 209, 0.28);
    border-radius: 16px;
}

.toast {
    position: fixed;
    right: 16px;
    bottom: 14px;
    z-index: 20;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(145, 173, 209, 0.26);
    background: rgba(12, 19, 31, 0.95);
    color: var(--text-primary);
    font-size: 13px;
    transform: translateY(18px);
    opacity: 0;
    pointer-events: none;
    transition: transform 160ms ease, opacity 160ms ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 1180px) {
    .hero {
        margin: 20px;
        grid-template-columns: 1fr;
    }

    .app-shell {
        grid-template-columns: 300px minmax(0, 1fr);
    }

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

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .quota-panel {
        min-height: 60vh;
    }
}

@media (max-width: 620px) {
    .hero {
        margin: 12px;
        padding: 18px;
    }

    .hero-actions {
        flex-direction: column;
    }

    .auth-shell {
        margin: 18px auto;
        padding: 16px;
    }

    .app-shell {
        padding: 10px;
        gap: 10px;
    }

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

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

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