:root {
    color-scheme: dark;
    --bg: #07101f;
    --panel: rgba(14, 27, 48, .82);
    --panel-solid: #0e1b30;
    --line: rgba(255, 255, 255, .09);
    --text: #f7f9ff;
    --muted: #8d9bb4;
    --blue: #4f83ff;
    --blue-2: #6da7ff;
    --green: #44d4a4;
    --amber: #f9b650;
    --red: #ff6b7a;
    --violet: #9b83ff;
    --radius: 24px;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 78% 5%, rgba(57, 103, 190, .25), transparent 31rem),
        radial-gradient(circle at 12% 94%, rgba(27, 162, 136, .14), transparent 32rem),
        var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 26px 18px 20px;
    border-right: 1px solid var(--line);
    background: rgba(5, 13, 27, .74);
    backdrop-filter: blur(22px);
}
.brand, .admin-chip { display: flex; align-items: center; gap: 12px; }
.brand { padding: 0 10px 30px; }
.brand strong, .admin-chip strong { display: block; }
.brand small, .admin-chip small { display: block; color: var(--muted); margin-top: 2px; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    font-weight: 900;
    background: linear-gradient(145deg, #6596ff, #315ddd);
    box-shadow: 0 12px 30px rgba(53, 100, 220, .35);
}
.brand-mark.large { width: 54px; height: 54px; border-radius: 18px; font-size: 22px; }
.nav { display: grid; gap: 7px; }
.nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--muted);
    font-weight: 650;
}
.nav a:hover, .nav a.active { color: white; background: rgba(92, 134, 230, .15); }
.nav a.active { box-shadow: inset 0 0 0 1px rgba(112, 154, 255, .12); }
.nav-icon { width: 22px; text-align: center; color: var(--blue-2); font-size: 18px; }
.sidebar-foot { margin-top: auto; display: grid; gap: 15px; padding: 14px 8px 0; }
.admin-chip { padding-top: 18px; border-top: 1px solid var(--line); }
.avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(86, 135, 255, .2);
    color: #a9c4ff;
    font-weight: 800;
}

.content { min-width: 0; padding: 44px clamp(24px, 4vw, 66px) 70px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 32px; }
.topbar h1 { max-width: 780px; margin: 4px 0 0; font-size: clamp(29px, 4vw, 48px); line-height: 1.06; letter-spacing: -.045em; }
.eyebrow { margin: 0; color: #7da4ff; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; }

.button, .ghost {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 13px;
    cursor: pointer;
    color: white;
    font-weight: 750;
}
.button { background: linear-gradient(135deg, #5d8fff, #3665e6); box-shadow: 0 10px 25px rgba(49, 95, 220, .25); }
.button:hover { filter: brightness(1.08); }
.button.secondary { background: rgba(85, 126, 225, .16); box-shadow: none; color: #bad0ff; border: 1px solid rgba(106, 149, 247, .18); }
.button.light { background: white; color: #13203a; box-shadow: none; }
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.full { width: 100%; }
.text-link { color: #8fb0ff; font-weight: 700; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metrics article, .panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(18, 34, 59, .9), rgba(10, 22, 40, .82));
    box-shadow: 0 25px 70px rgba(0, 0, 0, .18);
}
.metrics article { padding: 22px; }
.metrics article small { display: block; margin: 17px 0 6px; color: var(--muted); }
.metrics article strong { display: block; font-size: 34px; letter-spacing: -.04em; }
.metrics article p { margin: 4px 0 0; color: #667691; font-size: 13px; }
.metric-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-weight: 900;
}
.metric-icon.blue { color: #9cb9ff; background: rgba(76, 123, 239, .16); }
.metric-icon.green { color: #75e4bf; background: rgba(52, 194, 151, .15); }
.metric-icon.amber { color: #ffd184; background: rgba(239, 169, 61, .15); }
.metric-icon.violet { color: #b9a8ff; background: rgba(137, 110, 239, .15); }

.dashboard-grid, .detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr); gap: 20px; }
.panel { padding: 22px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 19px; }
.panel-head h2, .section-title h2, .summary-panel h2 { margin: 3px 0 0; font-size: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 12px; color: #71819d; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; text-align: left; }
td { padding: 14px 12px; border-top: 1px solid var(--line); vertical-align: middle; color: #c8d2e5; }
td small, .activation-list small { display: block; margin-top: 4px; color: #71819d; }
.row-title { color: white; font-weight: 750; }
code { color: #a9c0f4; font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; font-size: 13px; }
.status {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.status.active { color: #68deb7; background: rgba(44, 188, 143, .13); }
.status.suspended { color: #f6c46f; background: rgba(235, 167, 50, .13); }
.status.revoked { color: #ff909b; background: rgba(237, 82, 100, .13); }
.empty { color: var(--muted); text-align: center; padding: 30px; }
.timeline { display: grid; }
.timeline article { display: grid; grid-template-columns: 12px 1fr; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.timeline article:first-child { border-top: 0; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--blue); box-shadow: 0 0 0 5px rgba(79, 131, 255, .1); }
.timeline small { display: block; color: var(--muted); margin-top: 4px; }

.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filters input { min-width: min(360px, 70vw); }
label { display: grid; gap: 8px; color: #b7c3d8; font-weight: 650; font-size: 13px; }
label em { color: #65758f; font-style: normal; font-weight: 500; }
input, select, textarea {
    min-height: 46px;
    padding: 11px 13px;
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 13px;
    outline: 0;
    color: white;
    background: rgba(4, 12, 25, .58);
}
input:focus, select:focus, textarea:focus { border-color: rgba(99, 145, 255, .7); box-shadow: 0 0 0 3px rgba(74, 119, 229, .14); }
textarea { min-height: 104px; resize: vertical; }
.pagination { margin-top: 20px; }
.pagination nav > div:first-child { display: none; }
.pagination nav > div:last-child { display: flex; justify-content: space-between; align-items: center; gap: 14px; color: var(--muted); }
.pagination span[aria-current] span, .pagination a, .pagination span[aria-disabled] span { display: inline-flex; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; margin: 0 2px; }
.pagination span[aria-current] span { color: white; background: rgba(79, 131, 255, .2); }

.form-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .58fr); gap: 20px; align-items: start; }
.form-panel { display: grid; gap: 18px; }
.section-title { display: flex; gap: 12px; align-items: center; padding-top: 9px; }
.section-title p, .summary-panel p { margin: 4px 0 0; color: var(--muted); line-height: 1.55; }
.step { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: #abc3ff; background: rgba(79, 131, 255, .16); font-weight: 800; }
.form-columns { display: grid; grid-template-columns: .45fr 1fr; gap: 16px; }
.conditional { display: none; }
.conditional.visible { display: grid; }
.summary-panel { position: sticky; top: 24px; }
.summary-panel .metric-icon { margin-bottom: 18px; }
.check-list { list-style: none; padding: 0; margin: 22px 0; display: grid; gap: 12px; color: #c2cde0; }
.check-list li::before { content: "✓"; color: var(--green); margin-right: 10px; }
.summary-panel .button { margin-top: 18px; }

.key-reveal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 24px;
    margin-bottom: 20px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #3767dd, #2c9a84);
    box-shadow: 0 25px 60px rgba(31, 89, 174, .28);
}
.key-reveal h2 { margin: 4px 0 15px; }
.key-reveal code { color: white; font-size: clamp(13px, 2vw, 19px); word-break: break-all; }
.detail-list { display: grid; margin: 0; }
.detail-list div { display: grid; grid-template-columns: 150px 1fr; gap: 18px; padding: 13px 0; border-top: 1px solid var(--line); }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; color: #d7deed; }
.notes { margin-top: 18px; padding: 16px; border-radius: 15px; background: rgba(4, 12, 25, .45); }
.notes p { margin: 7px 0 0; color: var(--muted); white-space: pre-wrap; }
.status-form { display: flex; gap: 10px; margin-top: 18px; }
.feature-form { display: grid; gap: 14px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.feature-option { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); cursor: pointer; }
.feature-option input { width: 18px; height: 18px; margin-top: 2px; accent-color: #6f80ff; }
.feature-option span { display: grid; gap: 3px; }
.feature-option small { color: var(--muted); }
.button.danger { background: #d9485f; color: #fff; }
.release-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 20px; align-items: start; margin-bottom: 20px; }
.upload-zone { padding: 18px; border: 1px dashed rgba(109,167,255,.4); border-radius: 16px; background: rgba(79,131,255,.06); }
.upload-zone input { padding: 12px 0 5px; border: 0; background: transparent; }
.upload-zone small { color: var(--muted); }
.release-history { scroll-margin-top: 24px; }
.release-list article { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 17px 0; border-top: 1px solid var(--line); }
.release-title { display: flex; gap: 10px; align-items: center; }
.release-list p { margin: 5px 0; color: #c8d2e5; }
.release-list small { color: var(--muted); }
.activation-list { display: grid; }
.activation-list article { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; padding: 15px 0; border-top: 1px solid var(--line); }
.activation-list article:first-child { border-top: 0; }
.device-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #9db9fa; background: rgba(79, 131, 255, .13); }
.count-pill { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.danger-link { border: 0; background: transparent; color: #ff8997; cursor: pointer; font-weight: 700; }

.alert { padding: 15px 17px; border-radius: 15px; margin-bottom: 18px; line-height: 1.5; }
.alert.success { color: #9ce8cf; border: 1px solid rgba(68, 212, 164, .24); background: rgba(68, 212, 164, .09); }
.alert.error { color: #ffc0c7; border: 1px solid rgba(255, 107, 122, .24); background: rgba(255, 107, 122, .09); }
.alert ul { margin: 7px 0 0; }

.auth-body { display: grid; place-items: center; padding: 24px; }
.login-card {
    width: min(460px, 100%);
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 30px;
    background: rgba(12, 25, 45, .88);
    box-shadow: 0 35px 100px rgba(0, 0, 0, .38);
    backdrop-filter: blur(22px);
}
.login-brand { display: flex; align-items: center; gap: 15px; }
.login-brand h1 { margin: 4px 0 0; letter-spacing: -.04em; }
.login-copy { color: var(--muted); line-height: 1.6; margin: 22px 0; }
.stack { display: grid; gap: 16px; }
.security-note { margin: 22px 0 0; color: #71819d; font-size: 12px; text-align: center; }
.security-note span { color: var(--green); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

@media (max-width: 1050px) {
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid, .detail-grid, .form-layout, .release-grid { grid-template-columns: 1fr; }
    .summary-panel { position: static; }
}
@media (max-width: 760px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; width: 100%; height: auto; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
    .brand { padding-bottom: 15px; }
    .nav { grid-template-columns: repeat(3, 1fr); }
    .nav a { justify-content: center; padding: 10px; font-size: 12px; }
    .nav-icon { display: none; }
    .sidebar-foot { display: none; }
    .content { padding: 28px 16px 50px; }
    .topbar { align-items: flex-start; }
    .topbar .button { display: none; }
    .metrics { grid-template-columns: 1fr 1fr; }
    .form-columns { grid-template-columns: 1fr; }
    .key-reveal { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 480px) {
    .metrics { grid-template-columns: 1fr; }
    .panel { padding: 17px; border-radius: 20px; }
    .detail-list div { grid-template-columns: 1fr; gap: 4px; }
    .status-form { align-items: stretch; flex-direction: column; }
    .release-list article { grid-template-columns: 42px minmax(0, 1fr); }
    .release-list article form { grid-column: 1 / -1; }
}
