:root {
    color-scheme: dark;
    --bg: #0b1016;
    --panel: #121922;
    --panel-2: #17212c;
    --line: #2a3643;
    --text: #f3f7fb;
    --muted: #91a6ba;
    --orange: #ff8a1f;
    --blue: #55a7ff;
    font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 85% 0, #132941 0, var(--bg) 38%); color: var(--text); }
a { color: inherit; text-decoration: none; }
.topbar { min-height: 68px; padding: 0 32px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: rgba(11,16,22,.92); }
.brand { font-weight: 800; letter-spacing: .14em; }
.brand span, .eyebrow { color: var(--orange); }
main { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 80px; }
.page-heading { margin-bottom: 32px; }
.page-heading.compact { margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; font-size: .75rem; font-weight: 800; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.7rem); letter-spacing: -.04em; }
.muted { color: var(--muted); max-width: 700px; }
.status-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border: 1px solid var(--line); background: var(--line); margin-bottom: 22px; }
.status-strip.four-up { grid-template-columns: repeat(4, 1fr); }
.status-strip div { padding: 18px; background: var(--panel); }
.status-strip span { display: block; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; }
.status-strip strong { display: block; margin-top: 5px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.module-card { min-height: 190px; padding: 24px; border: 1px solid var(--line); background: linear-gradient(145deg, var(--panel), #0e151d); transition: border-color .15s, transform .15s; }
.module-card:hover { border-color: var(--orange); transform: translateY(-2px); }
.module-icon { color: var(--blue); font-size: 1.5rem; }
.module-card h2 { margin: 28px 0 8px; }
.module-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.button-link { display: inline-block; margin: 18px 8px 0 0; padding: 10px 14px; border: 1px solid var(--line); background: var(--panel-2); color: var(--blue); font-weight: 700; }
.button-link:hover { border-color: var(--blue); color: var(--text); }
.login-shell { min-height: calc(100vh - 190px); display: grid; place-items: center; }
.login-card { width: min(430px, 100%); padding: 34px; border: 1px solid var(--line); background: rgba(18,25,34,.96); box-shadow: 0 24px 80px rgba(0,0,0,.34); }
.login-card h1 { font-size: 2.2rem; }
label { display: block; margin: 18px 0 7px; color: var(--muted); font-size: .82rem; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); background: #080d12; color: var(--text); font: inherit; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--blue); border-color: var(--blue); }
button { font: inherit; color: var(--text); cursor: pointer; }
.primary { width: 100%; min-height: 48px; margin-top: 24px; border: 1px solid #ff9a3b; background: #d96300; font-weight: 800; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); background: var(--panel); font-size: 1.2rem; }
.icon-button:hover { border-color: var(--orange); color: var(--orange); }
.validation { color: #ff6c6c; }
.authorization-card { max-width: 650px; padding: 30px; border: 1px solid var(--line); background: rgba(18,25,34,.96); }
.code-entry-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.code-entry-row input { text-transform: uppercase; letter-spacing: .16em; font-weight: 800; }
.secondary, .danger { min-width: 112px; padding: 0 18px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 700; }
.secondary:hover { border-color: var(--blue); }
.danger:hover { border-color: #ff5b5b; color: #ff7a7a; }
.device-request { display: flex; gap: 18px; align-items: center; margin-top: 28px; padding: 20px; border: 1px solid var(--line); background: #080d12; }
.device-request h2, .device-request p { margin: 0; }
.device-request p, .device-request small { color: var(--muted); }
.device-glyph { color: var(--blue); font-size: 2rem; }
.risk-note { color: var(--muted); line-height: 1.5; }
.authorization-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.authorization-actions form { margin: 0; }
.compact-button { width: auto; min-width: 120px; margin-top: 0; padding: 0 22px; }
.result-card { text-align: center; }
.result-icon { display: inline-grid; width: 58px; height: 58px; place-items: center; border-radius: 50%; font-size: 2rem; }
.result-icon.success { border: 1px solid #2bb673; color: #50d897; }
.result-icon.denied { border: 1px solid #d65a5a; color: #ff7777; }
.back-link { display: inline-block; margin-bottom: 20px; color: var(--blue); }
.notice { padding: 12px 14px; border: 1px solid #2b7e5a; background: rgba(25, 105, 71, .2); color: #76e0ac; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.admin-card, .inventory-section { padding: 24px; border: 1px solid var(--line); background: rgba(18,25,34,.92); }
.admin-card h2 { margin: 0; }
.field-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, .35fr); gap: 10px; }
.inventory-section { margin-top: 18px; }
.inventory-row { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.inventory-row:first-of-type { border-top: 0; }
.inventory-row h3, .inventory-row p { margin: 0 0 5px; }
.inventory-row p, .inventory-row small { color: var(--muted); }
.inventory-row small, .inventory-row code { display: block; margin-top: 5px; overflow-wrap: anywhere; }
.inventory-row.disabled { opacity: .55; }
.danger-icon:hover { color: #ff7777; border-color: #ff5b5b; }
.download-icon { display: inline-grid; place-items: center; color: var(--blue); }
.download-icon:hover { color: var(--text); border-color: var(--blue); }
.inline-editor { margin: -4px 0 14px; padding: 12px; border: 1px solid var(--line); background: #0b1118; }
.inline-editor summary { color: var(--blue); cursor: pointer; }
.inline-editor form { display: grid; gap: 10px; margin-top: 12px; }
.inline-editor .secondary { min-height: 42px; }
.empty-state { min-height: 340px; display: grid; place-content: center; text-align: center; padding: 40px; border: 1px dashed var(--line); background: rgba(18,25,34,.72); }
.empty-state > span { color: var(--orange); font-size: 2.8rem; }
.empty-state h2 { margin: 14px 0 5px; }
.empty-state p { margin: 0; color: var(--muted); }
@media (max-width: 680px) {
    .topbar { padding: 0 18px; }
    main { width: min(100% - 24px, 1160px); padding-top: 32px; }
    .status-strip, .status-strip.four-up { grid-template-columns: 1fr; }
    .field-pair { grid-template-columns: 1fr; }
}
