:root {
    --bg: #050812;
    --surface: rgba(10, 17, 32, 0.78);
    --surface-strong: #101a2f;
    --surface-dark: #02040a;
    --ink: #eef5ff;
    --muted: #8fa3bd;
    --line: rgba(148, 177, 214, 0.16);
    --primary: #4f8cff;
    --primary-deep: #7c4dff;
    --accent: #31d6c9;
    --accent-soft: rgba(49, 214, 201, 0.14);
    --gold: #f5c76b;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --mono: "IBM Plex Mono", monospace;
    --sans: "Manrope", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--sans);
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 0%, rgba(79, 140, 255, 0.33), transparent 28%),
        radial-gradient(circle at 90% 8%, rgba(49, 214, 201, 0.22), transparent 26%),
        radial-gradient(circle at 50% 50%, rgba(124, 77, 255, 0.16), transparent 34%),
        linear-gradient(180deg, #050812 0%, #08111f 48%, #040711 100%);
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image:
        linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: radial-gradient(circle at top, black, transparent 74%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.page-shell {
    width: min(1400px, calc(100vw - 48px));
    margin: 0 auto;
    padding-top: 16px;
    padding-bottom: 48px;
}

.topbar {
    position: sticky;
    top: 14px;
    z-index: 24;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 18px;
    border: 1px solid rgba(148, 177, 214, 0.18);
    border-radius: 24px;
    backdrop-filter: blur(22px) saturate(150%);
    background:
        linear-gradient(135deg, rgba(79, 140, 255, 0.12), rgba(49, 214, 201, 0.06) 38%, rgba(8, 15, 30, 0.9)),
        rgba(5, 8, 18, 0.8);
    box-shadow:
        0 18px 50px rgba(0, 0, 0, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

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

.brand-mark {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background:
        radial-gradient(circle at 30% 25%, rgba(255,255,255,0.22), transparent 42%),
        linear-gradient(135deg, #4f8cff, #6a5cff 48%, #31d6c9);
    color: #fff;
    font-weight: 800;
    box-shadow:
        0 18px 34px rgba(79, 140, 255, 0.26),
        inset 0 1px 0 rgba(255,255,255,0.14);
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 1.05rem;
    letter-spacing: -0.03em;
}

.brand small {
    margin-top: 3px;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand small,
.eyebrow,
.metric-label,
.kpi-label,
.card-label,
.footer p,
.footer-links a,
.muted {
    color: var(--muted);
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border: 1px solid rgba(148, 177, 214, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    font-weight: 600;
    color: #dce8ff;
}

.nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    color: rgba(220, 232, 255, 0.78);
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.nav a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.nav a.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.24), rgba(49, 214, 201, 0.14));
    border: 1px solid rgba(95, 154, 255, 0.28);
    text-shadow: none;
    box-shadow:
        0 10px 24px rgba(79, 140, 255, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.topbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: #fff;
    box-shadow: 0 18px 34px rgba(79, 140, 255, 0.32);
}

.btn-ghost {
    background: rgba(238, 245, 255, 0.06);
    color: var(--ink);
    border: 1px solid var(--line);
}

.btn-block {
    width: 100%;
    justify-content: center;
    text-align: center;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.82rem;
}

.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 28px;
    padding: 44px 0 32px;
}

.hero-copy,
.hero-panel,
.panel,
.product-card,
.price-card,
.docs-card,
.dashboard-shell,
.analytics-panel,
.modal-card,
.auth-card,
.stat-card,
.admin-card {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px);
}

.hero-copy {
    padding: 42px;
    background:
        linear-gradient(135deg, rgba(79, 140, 255, 0.16), transparent 40%),
        var(--surface);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.76rem;
    font-weight: 800;
}

.hero h1 {
    font-size: clamp(3rem, 7vw, 6.2rem);
    line-height: 0.95;
    margin: 18px 0;
    letter-spacing: -0.06em;
    text-wrap: balance;
}

.hero p {
    max-width: 62ch;
    color: var(--muted);
    font-size: 1.06rem;
}

.hero-actions,
.inline-actions,
.section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.hero-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 34px;
}

.metric {
    padding: 16px;
    border-radius: var(--radius-lg);
    background: rgba(238, 245, 255, 0.06);
    border: 1px solid var(--line);
}

.metric strong,
.kpi strong,
.big-number {
    display: block;
    font-size: 1.5rem;
}

.hero-panel {
    padding: 28px;
    background:
        radial-gradient(circle at top right, rgba(49, 214, 201, 0.24), transparent 34%),
        linear-gradient(180deg, rgba(10, 17, 32, 0.98), rgba(2, 4, 10, 0.98));
    color: #eef7f6;
}

.hero-panel .terminal {
    background: rgba(6, 12, 14, 0.76);
    border-radius: 18px;
    padding: 18px;
    font-family: var(--mono);
    font-size: 0.9rem;
    line-height: 1.6;
    overflow: auto;
}

.hero-panel .dashboard-preview {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.preview-card {
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
}

.preview-card strong {
    font-size: 1.4rem;
}

.section {
    padding: 40px 0;
}

.section-tight {
    padding-top: 12px;
}

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.section-head h2 {
    margin: 8px 0 0;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

.section-head p {
    max-width: 60ch;
    color: var(--muted);
}

.products-grid,
.pricing-grid,
.stats-grid,
.analytics-grid,
.dashboard-grid,
.docs-grid,
.admin-grid {
    display: grid;
    gap: 18px;
}

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

.product-card,
.price-card,
.docs-card,
.panel,
.analytics-panel,
.stat-card,
.admin-card {
    padding: 26px;
}

.product-card h3,
.price-card h3,
.panel h3,
.docs-card h3,
.analytics-panel h3,
.stat-card h3,
.admin-card h3 {
    margin: 0 0 10px;
    font-size: 1.4rem;
}

.code-block,
pre,
code {
    font-family: var(--mono);
}

.code-block,
.mini-log {
    background: #030713;
    color: #ecf5f4;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    overflow: auto;
}

.price-card.featured {
    background:
        radial-gradient(circle at top right, rgba(79, 140, 255, 0.28), transparent 42%),
        linear-gradient(180deg, rgba(16, 26, 47, 0.96), rgba(5, 8, 18, 0.96));
    border-color: rgba(79, 140, 255, 0.5);
}

.price {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 10px 0 18px;
}

.price span {
    font-size: 1rem;
    color: var(--muted);
}

.list {
    display: grid;
    gap: 10px;
    padding: 0;
    list-style: none;
    margin: 0 0 22px;
}

.dashboard-shell {
    padding: 28px;
}

.dashboard-grid {
    grid-template-columns: 1.3fr 0.7fr;
}

.dashboard-grid-wide {
    grid-template-columns: 1fr 1fr;
}

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

.analytics-grid {
    grid-template-columns: 1.1fr 0.9fr;
}

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

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

.app-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.app-sidebar {
    position: sticky;
    top: 100px;
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--line);
    background: rgba(8, 14, 26, 0.86);
    box-shadow: var(--shadow);
}

.side-link {
    display: block;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--muted);
    font-weight: 700;
    border: 1px solid transparent;
}

.side-link.active,
.side-link:hover {
    color: var(--ink);
    border-color: var(--line);
    background: rgba(238, 245, 255, 0.06);
}

.app-content {
    display: grid;
    gap: 18px;
}

.dashboard-shell .stack,
.panel .stack,
.analytics-panel .stack,
.admin-card .stack {
    display: grid;
    gap: 14px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 16px;
}

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

.kpi {
    padding: 16px;
    border-radius: 18px;
    background: rgba(238, 245, 255, 0.06);
    border: 1px solid var(--line);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.94rem;
}

.table th,
.table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
}

.table th {
    color: var(--muted);
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.worldmap {
    border-radius: 22px;
    background:
        radial-gradient(circle at 50% 40%, rgba(49, 214, 201, 0.18), transparent 46%),
        linear-gradient(180deg, #071321, #030713);
    min-height: 320px;
    padding: 18px;
    position: relative;
    overflow: hidden;
}

.worldmap svg {
    width: 100%;
    height: 100%;
}

.map-country {
    fill: rgba(255, 255, 255, 0.1);
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 1.4;
    transition: fill 0.2s ease, transform 0.2s ease;
}

.map-country:hover {
    transform: translateY(-2px);
    fill: #f0c96b;
}

.map-tooltip {
    position: absolute;
    inset: auto 16px 16px auto;
    background: rgba(3, 7, 19, 0.94);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 12px;
    min-width: 150px;
    box-shadow: var(--shadow);
}

.form {
    display: grid;
    gap: 14px;
}

.form-row {
    display: grid;
    gap: 8px;
}

.form-row-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.card-form {
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(238, 245, 255, 0.04);
}

label {
    font-size: 0.88rem;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    padding: 13px 14px;
    border-radius: 14px;
    color: var(--ink);
    border: 1px solid var(--line);
    background: rgba(3, 7, 19, 0.76);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.15);
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.68);
    display: grid;
    place-items: center;
    padding: 24px;
}

.modal.hidden,
.hidden {
    display: none !important;
}

.modal-card {
    width: min(520px, calc(100vw - 32px));
    padding: 26px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 1.6rem;
    cursor: pointer;
}

.modal-switches {
    display: inline-flex;
    padding: 6px;
    background: rgba(238, 245, 255, 0.07);
    border-radius: 999px;
    margin-bottom: 18px;
}

.modal-tab {
    border: 0;
    background: transparent;
    color: var(--ink);
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
}

.modal-tab.active {
    background: rgba(79, 140, 255, 0.26);
    box-shadow: var(--shadow);
}

.auth-github {
    display: flex;
}

.oauth-panel {
    display: grid;
    gap: 16px;
}

.oauth-panel h2 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: -0.04em;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--line);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #bafbf5;
    font-weight: 700;
}

.pill-row,
.site-list,
.key-list,
.invoice-list,
.feed-list {
    display: grid;
    gap: 12px;
}

.pill,
.row-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(238, 245, 255, 0.06);
    border: 1px solid var(--line);
}

.table-wrap {
    overflow-x: auto;
}

.chart-card {
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(238, 245, 255, 0.04);
    margin-bottom: 16px;
}

.bar-chart {
    height: 160px;
    display: grid;
    grid-template-columns: repeat(14, minmax(0, 1fr));
    gap: 8px;
    align-items: end;
    margin-top: 14px;
}

.bar-slot {
    display: grid;
    justify-items: center;
    gap: 8px;
}

.bar-slot span {
    font-size: 0.72rem;
    color: var(--muted);
}

.bar {
    width: 100%;
    min-height: 8px;
    border-radius: 10px 10px 4px 4px;
    background: linear-gradient(180deg, var(--accent), var(--primary));
    box-shadow: 0 10px 24px rgba(79, 140, 255, 0.18);
}

.inline-note {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    color: var(--muted);
}

.checkbox-row label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.row-card strong,
.pill strong {
    display: block;
}

.tiny {
    font-size: 0.84rem;
    color: var(--muted);
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 34px 0 18px;
    border-top: 1px solid var(--line);
}

.footer-links {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 20;
    background: #14252a;
    color: #fff;
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: var(--shadow);
}

@media (max-width: 1080px) {
    .hero,
    .app-layout,
    .dashboard-grid,
    .dashboard-grid-wide,
    .analytics-grid,
    .products-grid,
    .docs-grid,
    .admin-grid,
    .stats-grid,
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .page-shell {
        width: min(100vw - 24px, 1400px);
    }

    .topbar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 14px;
        padding: 12px;
        border-radius: 22px;
    }

    .nav {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        overflow: auto;
        scrollbar-width: none;
    }

    .nav::-webkit-scrollbar {
        display: none;
    }

    .brand {
        width: 100%;
        justify-content: space-between;
    }

    .brand span:last-child {
        text-align: right;
    }

    .topbar-actions {
        width: 100%;
    }

    .topbar-actions .btn {
        flex: 1 1 0;
        justify-content: center;
    }

    .hero-copy,
    .hero-panel,
    .dashboard-shell,
    .product-card,
    .price-card,
    .docs-card,
    .analytics-panel,
    .panel,
    .stat-card,
    .admin-card {
        padding: 20px;
    }

    .form-row-grid {
        grid-template-columns: 1fr;
    }
}

/* Accessibility: Focus visible outline for interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
