*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg: #0a0e14;
    --bg-card: #121820;
    --bg-elevated: #1a2332;
    --border: #2a3544;
    --text: #e7ecf1;
    --muted: #8899aa;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #22c55e;
    --warning: #fbbf24;
    --danger: #f87171;
    --radius: 10px;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
}

a { color: #6eb5ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.75rem;
    background: rgba(18, 24, 32, 0.95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-public { background: var(--bg-elevated); }

.topbar .brand {
    font-weight: 700;
    font-size: 1.35rem;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.brand-tag {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    background: #7c3aed;
    color: #fff;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 0.35rem;
}

.topbar nav {
    display: flex;
    gap: 1.1rem;
    align-items: center;
    flex-wrap: wrap;
}

.topbar nav a {
    color: #c8d4e0;
    text-decoration: none;
    font-size: 0.92rem;
}

.topbar nav a:hover { color: #fff; }
.topbar nav a.active { color: #fff; font-weight: 600; }
.topbar nav a.nav-muted { color: var(--muted); font-size: 0.85rem; }
.topbar nav a.nav-admin { color: #c4b5fd; }

.topbar .user {
    color: var(--muted);
    font-size: 0.85rem;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Layout ── */
.container { max-width: 980px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.container-auth { max-width: 440px; padding-top: 2.5rem; padding-bottom: 2rem; }

.page-heading { margin-bottom: 1.75rem; }
.page-heading h1 { margin: 0 0 0.35rem; font-size: 1.75rem; letter-spacing: -0.02em; }
.page-subtitle { margin: 0; color: var(--muted); font-size: 1rem; }

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem 1.5rem;
    margin-bottom: 1.25rem;
}

.card h2, .card h3 { margin-top: 0; }
.card h2 { font-size: 1.05rem; font-weight: 600; }
.card-muted { color: var(--muted); font-size: 0.92rem; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.stat-card .stat-label { color: var(--muted); font-size: 0.88rem; margin-top: 0.25rem; }

.stat-card a { text-decoration: none; color: inherit; display: block; }
.stat-card a:hover .stat-value { color: var(--accent); }

.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.quick-link {
    display: block;
    padding: 1rem 1.15rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s;
}

.quick-link:hover {
    border-color: var(--accent);
    text-decoration: none;
}

.quick-link strong { display: block; margin-bottom: 0.25rem; }
.quick-link span { color: var(--muted); font-size: 0.88rem; }

/* ── Landing ── */
.landing-hero {
    text-align: center;
    padding: 4rem 1.5rem 3rem;
    background: radial-gradient(ellipse at 50% 0%, rgba(59, 130, 246, 0.12) 0%, transparent 60%);
}

.landing-hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 1rem;
    line-height: 1.15;
}

.landing-hero .lead {
    color: var(--muted);
    font-size: 1.1rem;
    max-width: 560px;
    margin: 0 auto 2rem;
}

.hero-actions { display: flex; gap: 0.85rem; justify-content: center; flex-wrap: wrap; }

.landing-section {
    padding: 3rem 0;
    border-top: 1px solid var(--border);
}

.landing-section h2 {
    text-align: center;
    font-size: 1.5rem;
    margin: 0 0 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.feature-card h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.feature-icon { font-size: 1.5rem; margin-bottom: 0.75rem; }

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    counter-reset: step;
}

.step {
    position: relative;
    padding-left: 3rem;
}

.step::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.step h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.step p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.platforms-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.platform-badge {
    padding: 0.5rem 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.9rem;
    color: #c8d4e0;
}

.cta-band {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    margin: 2rem 0;
}

/* ── Forms ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.92rem;
}
.alert-error { background: #3d1f24; color: #ffb4b4; border: 1px solid #6b2a32; }
.alert-success { background: #1f3d2a; color: #b4ffca; border: 1px solid #2a6b3a; }
.alert-info { background: #1e293b; color: #93c5fd; border: 1px solid #334155; }

label { display: block; margin-bottom: 0.35rem; color: #aab8c8; font-size: 0.88rem; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="url"], select, textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.9rem;
    border: 1px solid #3a4a5c;
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

button, .btn {
    display: inline-block;
    padding: 0.6rem 1.15rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
}
button:hover, .btn:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }

.btn-secondary { background: #374151; }
.btn-secondary:hover { background: #4b5563; }

.btn-success { background: #059669; }
.btn-success:hover { background: #047857; }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.88rem; }

.btn-lg { padding: 0.85rem 1.75rem; font-size: 1.05rem; }

.btn-block { display: block; width: 100%; text-align: center; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-active { background: #14532d; color: #86efac; }
.badge-pending { background: #422006; color: #fde68a; }
.badge-expired, .badge-revoked { background: #450a0a; color: #fca5a5; }

.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.88rem; word-break: break-all; }

.copy-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 0.75rem 0;
}

.form-inline { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: flex-end; }
.form-inline input { flex: 1; min-width: 160px; margin-bottom: 0; }

.auth-card { margin-top: 0.5rem; }
.auth-card h2 { margin-bottom: 1rem; }

/* ── Footer ── */
.footer {
    border-top: 1px solid var(--border);
    padding: 2rem 1.5rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.footer-inner {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    text-align: center;
}

.footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: #fff; }
.footer-minimal { padding: 1.5rem; }
.footer-landing { background: var(--bg-elevated); }

.body-admin .container { max-width: 1140px; }

@media (max-width: 768px) {
    .topbar { flex-direction: column; align-items: flex-start; gap: 0.75rem; padding: 1rem; }
    .topbar nav { gap: 0.65rem; }
    .landing-hero { padding: 2.5rem 1rem; }
}
