:root {
    color-scheme: dark;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #07101d;
    color: #eef4fc;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    --muted: #9fb0c5;
    --line: #25374d;
    --surface: #101c2b;
    --blue: #1974ca;
    --orange: #df8b28;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }

.admin-app { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 2; display: flex; width: 248px;
    flex-direction: column; gap: 28px; padding: 26px 16px; border-right: 1px solid var(--line);
    background: #0a1422;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; color: inherit; font-size: 18px; font-weight: 800; text-decoration: none; }
.brand b { color: #e8b942; }
.brand-mark { display: inline-flex; width: 47px; height: 39px; align-items: center; justify-content: center; border: 2px solid #dceaff; border-radius: 7px; font-size: 13px; font-weight: 800; }
.sidebar nav { display: grid; gap: 6px; }
.nav-link { min-height: 46px; padding: 11px 13px; border: 0; border-radius: 7px; background: transparent; color: #c7d4e4; text-align: left; }
.nav-link:hover, .nav-link.is-active { background: #152b43; color: #fff; }
.nav-link.is-active { box-shadow: inset 3px 0 #42cdbd; }
.logout-button { margin-top: auto; }

.main-content { max-width: 1480px; margin-left: 248px; padding: 32px clamp(20px, 4vw, 62px) 60px; }
.page-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-top h1 { margin: 4px 0 0; font-size: clamp(25px, 3vw, 34px); }
.eyebrow { margin: 0; color: #72b9ea; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.panel-date { color: var(--muted); font-size: 14px; }
.page { display: none; }
.page.is-visible { display: grid; gap: 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card, .card { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.stat-card { display: grid; min-height: 122px; align-content: space-between; padding: 18px; }
.stat-card span { color: var(--muted); font-size: 14px; }
.stat-card strong { font-size: 34px; }
.stat-card.warning strong { color: #ffb454; }
.stat-card.expired strong { color: #ff7279; }
.card { min-width: 0; padding: 22px; }
.card h2 { margin: 0 0 6px; font-size: 20px; }
.card p { margin: 0; color: var(--muted); line-height: 1.45; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.provider-value { display: block; overflow-wrap: anywhere; padding: 13px; border-radius: 7px; background: #08121f; color: #a7d4fa; }
.button { min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 6px; font-weight: 700; }
.button.primary { background: var(--blue); color: white; }
.button.primary:hover { background: #2588df; }
.button.secondary { border-color: #36506a; background: #142438; color: #e7f0fb; }
.button:focus-visible, .nav-link:focus-visible, input:focus-visible, textarea:focus-visible, .icon-button:focus-visible { outline: 3px solid #6dcfc4; outline-offset: 2px; }
.global-feedback { min-height: 24px; margin: -10px 0 8px; color: #93d9cd; }
.global-feedback.is-error, .form-error { color: #ff9a9e; }
.search-field { display: flex; align-items: center; gap: 12px; max-width: 560px; margin: 0 0 18px; color: var(--muted); }
.search-field input { flex: 1; }
input, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #354a62; border-radius: 6px; background: #091421; color: #f0f5fb; }
textarea { resize: vertical; }
label { display: grid; gap: 7px; color: #d9e3ef; font-size: 14px; font-weight: 650; }
label small { color: var(--muted); font-weight: 400; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
td { font-size: 14px; }
tr:last-child td { border-bottom: 0; }
.device-id { max-width: 225px; overflow-wrap: anywhere; color: #acd8ff; font-family: Consolas, monospace; font-size: 12px; }
.status-pill { display: inline-flex; padding: 5px 9px; border-radius: 20px; background: #183c35; color: #8de0bf; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status-pill.warning { background: #49351c; color: #ffc16b; }
.status-pill.expired, .status-pill.blocked { background: #482326; color: #ff999c; }
.table-action { padding: 7px 10px; border: 1px solid #36506a; border-radius: 5px; background: #142438; color: #dcecff; }
.table-action:hover { border-color: #74bcec; }
.empty-state { padding: 28px 8px; color: var(--muted); text-align: center; }
.form-card { max-width: 920px; }
.form-card > p { margin: 0 0 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.full-width { grid-column: 1 / -1; }
.field-hint { font-size: 13px; }
.release-summary { margin: 18px 0; padding: 13px; border: 1px solid var(--line); border-radius: 6px; color: #c8d7e8; line-height: 1.5; }
.public-download { display: grid; gap: 10px; margin: 0 0 22px; }
.public-download-controls { display: flex; align-items: center; gap: 9px; }
.public-download-controls input { min-width: 0; }
.public-download-controls a { display: inline-flex; min-height: 44px; flex: 0 0 auto; align-items: center; text-decoration: none; }
.public-download > p { font-size: 13px; }
.login-screen { display: grid; min-height: 100vh; place-items: center; padding: 20px; background: radial-gradient(ellipse at top, #15345a, transparent 60%), #07101d; }
.login-card { display: grid; width: min(100%, 420px); gap: 15px; padding: 30px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.login-card .brand-mark { width: 78px; height: 47px; font-size: 15px; }
.login-card h1 { margin: 3px 0 0; font-size: 23px; }
.login-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.login-card .feedback { min-height: 20px; color: #ff999c; }
.device-dialog { width: min(92vw, 680px); max-height: 90vh; overflow-y: auto; padding: 24px; border: 1px solid #3a506b; border-radius: 10px; background: #101c2b; color: #eef4fc; }
.device-dialog::backdrop { background: rgba(0, 0, 0, .72); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; }
.dialog-heading h2 { margin: 5px 0; }
.icon-button { width: 40px; height: 40px; border: 1px solid #354a62; border-radius: 50%; background: #17263a; color: white; font-size: 24px; }
.enabled-toggle { display: flex; align-items: center; grid-column: 1 / -1; }
.enabled-toggle input { width: 20px; min-height: 20px; }
.form-error { min-height: 20px; margin: 0; }

@media (max-width: 900px) {
    .sidebar { inset: 0 0 auto; width: auto; height: auto; gap: 14px; padding: 12px 14px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
    .brand { font-size: 16px; }
    .brand-mark { width: 39px; height: 34px; }
    .sidebar nav { display: flex; gap: 6px; overflow-x: auto; }
    .nav-link { min-height: 40px; flex: 0 0 auto; padding: 9px 11px; font-size: 13px; white-space: nowrap; }
    .nav-link.is-active { box-shadow: inset 0 -3px #42cdbd; }
    .logout-button { position: absolute; top: 10px; right: 12px; min-height: 34px; margin: 0; }
    .main-content { margin: 112px 0 0; padding: 22px clamp(14px, 4vw, 32px) 44px; }
}
@media (max-width: 620px) {
    .sidebar { gap: 9px; padding: 9px 10px; }
    .brand { min-height: 33px; font-size: 14px; }
    .brand-mark { width: 34px; height: 30px; font-size: 11px; }
    .sidebar nav { margin-right: 49px; }
    .nav-link { min-height: 38px; padding: 8px 10px; font-size: 12px; }
    .logout-button { top: 8px; right: 8px; min-height: 32px; padding: 7px 8px; font-size: 12px; }
    .main-content { margin-top: 103px; padding: 18px 13px 32px; }
    .page-top { align-items: flex-start; flex-direction: column; gap: 7px; margin-bottom: 16px; }
    .page-top h1 { font-size: 25px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .stat-card { min-height: 98px; padding: 12px; }
    .stat-card span { font-size: 12px; }
    .stat-card strong { font-size: 27px; }
    .card { padding: 15px 12px; }
    .card-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
    .card-heading .button { width: 100%; }
    .device-toolbar { align-items: stretch; }
    .search-field { align-items: stretch; flex-direction: column; gap: 6px; }
    .form-grid { grid-template-columns: 1fr; gap: 13px; }
    .form-grid > * { grid-column: 1; }
    .public-download-controls { align-items: stretch; flex-direction: column; }
    .public-download-controls a { justify-content: center; }
    .table-wrap table { min-width: 650px; }
    .release-summary { font-size: 13px; overflow-wrap: anywhere; }
    .device-dialog { padding: 17px; }
    .login-card { padding: 22px; }
}
