:root {
    --bg: #0A0F1E;
    --surface: #111827;
    --surface-2: #1A2235;
    --border: #1F2937;
    --accent: #5B8DFF;
    --accent-hover: #7BA3FF;
    --text: #F9FAFB;
    --text-muted: #9CA3AF;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --nav-height: 64px;
    --radius: 12px;
    --radius-sm: 6px;
    --nav-bg: rgba(10, 15, 30, 0.92);
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }
h1, h2, h3, h4, h5, h6 { margin: 0; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ===== Navbar ===== */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-height);
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.site-nav .inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}
.nav-brand span { color: var(--accent); }
.nav-brand:hover { color: var(--text); }

.nav-links {
    display: flex;
    gap: 28px;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}
.nav-links a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text);
    font-size: 1rem;
    line-height: 1;
}

/* ===== Hero ===== */
.hero {
    padding: 96px 24px 80px;
    text-align: center;
    background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(91, 141, 255, 0.13) 0%, transparent 70%);
}

.hero-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(91, 141, 255, 0.1);
    border: 1px solid rgba(91, 141, 255, 0.2);
    border-radius: 100px;
    padding: 4px 14px;
    margin-bottom: 28px;
}

.hero h1 {
    font-size: clamp(2.2rem, 5.5vw, 3.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.075rem;
    color: var(--text-muted);
    max-width: 520px;
    margin: 0 auto 40px;
    line-height: 1.75;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 26px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(91, 141, 255, 0.35);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    color: var(--text);
    border-color: rgba(91, 141, 255, 0.4);
    transform: translateY(-1px);
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Section ===== */
.section { padding: 72px 0; }

.section-header {
    text-align: center;
    margin-bottom: 52px;
}
.section-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}
.section-header p {
    color: var(--text-muted);
    font-size: 0.975rem;
    max-width: 440px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ===== App Cards ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 20px;
}

.app-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: var(--text);
}
.app-card:hover {
    border-color: rgba(91, 141, 255, 0.35);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    color: var(--text);
}

.app-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(91, 141, 255, 0.1);
    border: 1px solid rgba(91, 141, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.app-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.app-card p {
    font-size: 0.855rem;
    color: var(--text-muted);
    line-height: 1.65;
    flex: 1;
    margin-bottom: 18px;
}

.app-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

/* ===== Badges ===== */
.badge {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
}
.badge-live { background: rgba(16, 185, 129, 0.12); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-beta { background: rgba(245, 158, 11, 0.12); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-soon { background: rgba(156, 163, 175, 0.08); color: var(--text-muted); border: 1px solid var(--border); }

/* ===== Page header ===== */
.page-header {
    padding: 56px 0 36px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 48px;
}
.page-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}
.page-header p { color: var(--text-muted); font-size: 0.95rem; }

/* ===== Admin / Data table ===== */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.845rem;
}
.data-table th {
    text-align: left;
    padding: 11px 16px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.78rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    max-width: 360px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }

.level-info { color: #60A5FA; }
.level-warning { color: var(--warning); }
.level-error { color: var(--error); }

.mono {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
    word-break: break-all;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Tabs ===== */
.tab-bar {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.tab-btn {
    padding: 8px 18px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== Forms ===== */
.form-row { margin-bottom: 20px; }
label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 141, 255, 0.1);
}
textarea.form-control { resize: vertical; min-height: 120px; }

/* ===== Alert ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 20px;
}
.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.2); color: var(--success); }

/* ===== App detail ===== */
.app-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 56px 0 40px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 48px;
}
.app-detail-icon {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 14px;
    background: rgba(91, 141, 255, 0.1);
    border: 1px solid rgba(91, 141, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}
.app-detail-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}
.app-detail-header p { color: var(--text-muted); line-height: 1.7; margin-bottom: 16px; }

/* ===== About ===== */
.content-prose {
    max-width: 680px;
}
.content-prose h2 {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
    margin-top: 40px;
}
.content-prose h2:first-child { margin-top: 0; }
.content-prose p {
    color: var(--text-muted);
    line-height: 1.75;
    margin-bottom: 16px;
    font-size: 0.975rem;
}

/* ===== Footer ===== */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 28px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.83rem;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ===== Empty state ===== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Theme toggle ===== */
.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-muted);
    transition: border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Light theme ===== */
[data-theme="light"] {
    --bg: #F8F9FC;
    --surface: #FFFFFF;
    --surface-2: #F1F5F9;
    --border: #E2E8F0;
    --accent: #3B6FE8;
    --accent-hover: #2D5DD4;
    --text: #0F172A;
    --text-muted: #64748B;
    --success: #059669;
    --error: #DC2626;
    --warning: #B45309;
    --nav-bg: rgba(248, 249, 252, 0.92);
}

[data-theme="light"] .hero {
    background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(59, 111, 232, 0.07) 0%, transparent 70%);
}

[data-theme="light"] .app-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .app-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.09);
}

[data-theme="light"] .table-wrap {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .btn-primary:hover {
    box-shadow: 0 4px 16px rgba(59, 111, 232, 0.3);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-toggle { display: block; }
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: var(--nav-height);
        left: 0; right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 20px 24px;
        gap: 16px;
        z-index: 99;
    }
    .hero { padding: 72px 20px 60px; }
    .section { padding: 56px 0; }
    .card-grid { grid-template-columns: 1fr; }
    .app-detail-header { flex-direction: column; gap: 12px; }
}
