:root {
    --bg-panel: #0d0d12;
    --grad-top: #0f0c14;
    --grad-bot: #1c1429;
    --accent: #7c5cf6;
    --accent-bright: #a88cff;
    --field-bg: #16161d;
    --field-border: #282834;
    --text-primary: #f0f0f5;
    --text-muted: #8c8c9b;
    --success: #5adc8c;
    --danger: #eb5a5a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(160deg, var(--grad-top), var(--grad-bot));
    color: var(--text-primary);
    min-height: 100vh;
}

a { color: var(--accent-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.35);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 24px;
    font-weight: 600;
    font-size: 17px;
}

.brand-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--accent-bright), var(--accent) 70%);
    flex-shrink: 0;
}

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav a:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); }

.nav a.active {
    background: rgba(124, 92, 246, 0.16);
    color: var(--text-primary);
    box-shadow: inset 3px 0 0 var(--accent-bright);
}

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

.content {
    flex: 1;
    padding: 40px 48px;
    max-width: 1100px;
}

h1 { font-size: 24px; margin: 0 0 4px; }
.subtitle { color: var(--text-muted); margin: 0 0 28px; font-size: 14px; }

.card {
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: 14px;
    padding: 20px;
}

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--field-bg); border: 1px solid var(--field-border); border-radius: 14px; padding: 18px 20px; }
.stat-card .label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card .value { font-size: 28px; font-weight: 600; margin-top: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; padding: 10px 12px; border-bottom: 1px solid var(--field-border); }
td { padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge.active, .badge.unused { background: rgba(90, 220, 140, 0.15); color: var(--success); }
.badge.expired, .badge.revoked { background: rgba(235, 90, 90, 0.15); color: var(--danger); }
.badge.unused { background: rgba(140, 140, 155, 0.15); color: var(--text-muted); }

input, textarea, select {
    background: #101016;
    border: 1px solid var(--field-border);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; display: block; margin: 14px 0 6px; }
label:first-child { margin-top: 0; }

button {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}
button:hover { background: var(--accent-bright); }
button.secondary { background: transparent; border: 1px solid var(--field-border); color: var(--text-primary); }
button.secondary:hover { border-color: var(--accent); background: rgba(124,92,246,0.08); }
button.danger { background: transparent; border: 1px solid rgba(235,90,90,0.4); color: var(--danger); }
button.danger:hover { background: rgba(235,90,90,0.12); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; }
.toolbar .actions { display: flex; gap: 10px; }

.msg { padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; display: none; }
.msg.show { display: block; }
.msg.error { background: rgba(235,90,90,0.12); color: var(--danger); }
.msg.success { background: rgba(90,220,140,0.12); color: var(--success); }

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    display: none; align-items: center; justify-content: center; z-index: 50;
}
.modal-backdrop.show { display: flex; }
.modal {
    background: #17171f; border: 1px solid var(--field-border); border-radius: 16px;
    padding: 26px; width: 420px; max-width: 90vw;
}
.modal h2 { margin: 0 0 4px; font-size: 18px; }
.modal .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.mono { font-family: "Cascadia Code", Consolas, monospace; font-size: 13px; }
.muted { color: var(--text-muted); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* login page */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 360px; padding: 32px; }
.login-card h1 { text-align: center; margin-bottom: 4px; }
.login-card .subtitle { text-align: center; }
.login-card button { width: 100%; margin-top: 20px; padding: 12px; }

/* public download landing page */
.landing { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 60px 24px; }
.landing-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; margin-bottom: 56px; }
.landing-grid { display: flex; align-items: center; gap: 64px; max-width: 980px; width: 100%; flex-wrap: wrap; justify-content: center; }
.landing-hero { flex: 1 1 360px; min-width: 300px; text-align: center; }
.landing-hero h1 { font-size: 38px; line-height: 1.18; margin: 20px 0 12px; }
.landing-hero .accent { color: var(--accent-bright); }
.landing-hero p { color: var(--text-muted); font-size: 15px; max-width: 380px; margin: 0 auto; }

.landing-card { flex: 1 1 360px; max-width: 400px; width: 100%; padding: 28px; }
.landing-card h2 { margin: 0 0 4px; font-size: 20px; }
.landing-card .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.key-input { text-align: center; letter-spacing: 0.04em; text-transform: uppercase; font-family: "Cascadia Code", Consolas, monospace; }

.download-panel { display: none; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--field-border); text-align: center; }
.download-panel.show { display: block; }
.download-panel .product-name { color: var(--success); font-size: 14px; margin-bottom: 14px; }
.download-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 14px; font-size: 15px; font-weight: 600;
    border-radius: 12px; background: var(--accent); color: white; text-decoration: none;
}
.download-btn:hover { background: var(--accent-bright); text-decoration: none; }
.download-hint { color: var(--text-muted); font-size: 12px; margin-top: 16px; line-height: 1.6; text-align: left; }
.download-hint b { color: var(--text-primary); }

/* The spinning crystal is the real 3D gem from the Bloom launcher
   (src/gfx/Crystal3D.cpp), rendered offscreen to transparent PNG frames and
   assembled into a looping GIF - not a CSS approximation, so it matches the
   app exactly. */
.crystal-stage { width: 240px; height: 240px; margin: 0 auto 8px; position: relative; }
.crystal-glow {
    position: absolute; inset: 0; border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 92, 246, 0.38), rgba(124, 92, 246, 0) 68%);
    filter: blur(1px);
}
.crystal-gif { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

@media (max-width: 720px) {
    .landing-grid { gap: 36px; }
    .landing-hero h1 { font-size: 30px; }
}
