:root {
    color-scheme: dark;
    --bg: #090b10;
    --panel: #11151d;
    --panel-2: #171c26;
    --line: #252c39;
    --text: #edf1f7;
    --muted: #8f99aa;
    --accent: #7c5cff;
    --accent-2: #5a38ee;
    --good: #37d49a;
    --warn: #f0b85a;
    --bad: #ff637a;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 20% -10%, #201943 0, transparent 32rem), var(--bg); color: var(--text); font-size: 14px; }
button, input, select { font: inherit; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 25px; letter-spacing: -0.04em; }
h2 { margin-bottom: 0; font-size: 17px; }
.muted { color: var(--muted); line-height: 1.55; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 18px; border: 1px solid #8d77ff55; border-radius: 13px; background: linear-gradient(145deg, #8e76ff, #5634de); box-shadow: 0 10px 30px #4c2dc344; font-weight: 900; }
.brand-mark.small { display: inline-grid; width: 30px; height: 30px; margin: 0 10px 0 0; border-radius: 9px; font-size: 11px; vertical-align: middle; }
.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.auth-card { width: min(390px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: #11151dea; box-shadow: 0 22px 70px #0008; backdrop-filter: blur(16px); }
.setup-card { width: min(680px, 100%); }
.form-grid { display: grid; gap: 14px; margin-top: 22px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }
label span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
input, select { width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: #0d1118; color: var(--text); transition: .18s ease; }
input:focus, select:focus { border-color: #8267ff; box-shadow: 0 0 0 3px #7658ff20; }
.button { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); cursor: pointer; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.button:hover { border-color: #465066; transform: translateY(-1px); }
.button.primary { border-color: transparent; background: linear-gradient(145deg, var(--accent), var(--accent-2)); font-weight: 750; }
.button.ghost { background: transparent; }
.button.small { min-height: 32px; padding: 0 11px; font-size: 12px; }
.button.tiny { min-height: 29px; padding: 0 9px; border-radius: 8px; font-size: 11px; }
.button.danger { border-color: #ff637a48; color: #ff94a4; }
.alert { margin: 16px 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); line-height: 1.5; }
.alert.error { border-color: #ff637a4d; color: #ff9aaa; }
.alert.success { border-color: #37d49a42; color: #75e6bd; }
.alert.keys { white-space: normal; cursor: copy; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; height: 58px; padding: 0 24px; border-bottom: 1px solid var(--line); background: #090b10df; backdrop-filter: blur(14px); }
.topbar > div { display: flex; align-items: center; }
.container { width: min(1320px, calc(100% - 32px)); margin: 22px auto 48px; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat, .panel { border: 1px solid var(--line); border-radius: 14px; background: #11151dd9; }
.stat { display: flex; align-items: center; justify-content: space-between; padding: 14px; }
.stat span { color: var(--muted); font-size: 12px; }
.stat strong { font-size: 19px; }
.panel { margin-bottom: 12px; padding: 15px; }
.generate-panel, .panel-head, .inline-form, .search, .actions { display: flex; align-items: center; }
.generate-panel, .panel-head { justify-content: space-between; gap: 18px; }
.inline-form, .search { gap: 8px; }
.inline-form select { width: 165px; }
.inline-form input { width: 78px; }
.search input { width: min(300px, 42vw); }
.table-wrap { margin: 14px -15px -15px; overflow: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 10px 12px; border-bottom: 1px solid #202733; text-align: left; font-size: 12px; }
th { color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:hover { background: #171c267a; }
.key-code { padding: 4px 7px; border: 1px solid #333d50; border-radius: 7px; background: #0b0e14; color: #c9bdff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; cursor: copy; }
.badge { display: inline-flex; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; font-size: 10px; font-weight: 800; }
.badge.success { border-color: #37d49a3d; color: var(--good); }
.badge.warning { border-color: #f0b85a42; color: var(--warn); }
.badge.danger { border-color: #ff637a42; color: var(--bad); }
.badge.neutral { color: var(--muted); }
.device { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.actions { gap: 5px; }
.actions form { margin: 0; }
.empty { padding: 28px; color: var(--muted); text-align: center; }

@media (max-width: 820px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .generate-panel, .panel-head { align-items: stretch; flex-direction: column; }
    .inline-form, .search { width: 100%; }
    .inline-form select, .inline-form input, .search input { width: 100%; }
}

@media (max-width: 560px) {
    .form-grid.two { grid-template-columns: 1fr; }
    .wide { grid-column: auto; }
    .auth-card { padding: 22px; }
    .topbar { padding: 0 14px; }
    .container { width: min(100% - 20px, 1320px); }
    .inline-form { display: grid; grid-template-columns: 1fr 72px; }
    .inline-form .button { grid-column: 1 / -1; }
}
