:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #0b0d10;
  --surface: #111419;
  --border: #252a33;
  --border-strong: #343b47;
  --text: #f2f4f7;
  --muted: #8d96a5;
  --accent: #7c6cf2;
  --accent-hover: #9184ff;
  --green: #45c98b;
  --amber: #eab85e;
  --red: #ef6b73;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 85% -10%, #211d3c55 0, transparent 30%), var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 20px; line-height: 1.2; letter-spacing: -.02em; }
h2 { margin-bottom: 0; font-size: 17px; line-height: 1.3; letter-spacing: -.01em; }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; height: 76px; padding: 0 clamp(20px, 4vw, 56px); display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--border); background: #0d1014ed; backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { position: relative; width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #7569d7; border-radius: 11px; background: linear-gradient(145deg, #8c7eff1f, #7569d70b); color: #b9b0ff; box-shadow: inset 0 1px 0 #ffffff10, 0 5px 16px #6255d21a; overflow: hidden; }
.brand-mark::after { content: ""; position: absolute; top: -13px; right: -10px; width: 27px; height: 27px; border-radius: 50%; background: #9589ff18; }
.brand-mark svg { position: relative; z-index: 1; width: 27px; height: 27px; display: block; fill: none; stroke-linecap: square; stroke-linejoin: miter; }
.brand-h { stroke: #d1cbff; stroke-width: 2.35; }
.brand-z { stroke: #9286fa; stroke-width: 2.35; }
.eyebrow { margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.logout-form { margin: 0; }
.main-nav { min-width: 0; display: flex; align-items: center; align-self: stretch; gap: 4px; }
.nav-link { position: relative; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 650; }
.nav-link:hover, .nav-link.is-active { color: var(--text); }
.nav-link .icon { opacity: .72; }
.nav-link:hover .icon, .nav-link.is-active .icon { opacity: 1; }
.nav-alert { width: 16px; height: 16px; display: inline-grid !important; place-items: center; flex: 0 0 auto; border: 1px solid #d99a32; border-radius: 50%; background: #342713; color: #f3c56c; font-size: 10px; font-weight: 800; line-height: 1; box-shadow: 0 0 0 3px #eab85e12; }
.nav-link.is-active::after { content: ""; position: absolute; right: 12px; bottom: -21px; left: 12px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.account-role { height: 32px; padding: 0 11px; display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; background: #12161b; color: #c3c9d2; font-size: 11px; font-weight: 650; }
.system-status { height: 32px; padding: 0 11px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid #264d3c; border-radius: 999px; background: #10231a; color: #77cda2; font-size: 11px; font-weight: 650; }
.system-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #45c98b18; }
.dashboard { width: min(1360px, calc(100% - 40px)); margin: 0 auto; padding: 32px 0 56px; }
.page-heading { min-height: 76px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.page-heading h2 { margin-bottom: 6px; font-size: clamp(22px, 2vw, 28px); }
.page-heading > div > p:last-child { margin: 0; color: var(--muted); }
.total-chip, .heading-count { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: #12161b; color: var(--muted); font-size: 11px; font-weight: 650; }
.total-chip { height: 32px; padding: 0 11px; border-radius: 999px; }
.heading-count { min-width: 23px; height: 23px; margin-left: 6px; padding: 0 7px; border-radius: 7px; vertical-align: 2px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { position: relative; min-height: 94px; padding: 18px 20px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(145deg, #15191f, var(--surface)); overflow: hidden; box-shadow: 0 8px 32px #00000016; }
.stat::after { content: ""; position: absolute; top: 0; right: 0; width: 64px; height: 64px; border-radius: 50%; background: #ffffff08; transform: translate(24px, -28px); }
.stat span { color: var(--muted); font-size: 12px; }
.stat strong { font-size: 26px; line-height: 1; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-active strong { color: var(--green); }
.stat-blocked strong { color: var(--amber); }
.stat-pending strong { color: #9ba5b5; }

.panel { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; box-shadow: 0 12px 40px #0000001c; }
.section-heading { min-height: 76px; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--border); }
.section-heading > p { margin: 0; color: var(--muted); font-size: 12px; }
.create-form { padding: 20px; display: grid; grid-template-columns: 190px 230px 125px minmax(180px, 1fr) 140px auto; align-items: end; gap: 12px; }
.create-user-form { padding: 20px; display: grid; grid-template-columns: minmax(190px, 1.3fr) minmax(150px, 1fr) 150px 130px auto; align-items: end; gap: 12px; }
label { display: grid; gap: 7px; color: #c2c8d1; font-size: 12px; font-weight: 600; }
.field-group { min-width: 0; display: grid; gap: 7px; color: #c2c8d1; font-size: 12px; font-weight: 600; }
.field-group > label { display: block; }
.field-hint { color: var(--muted); font-size: 9px; font-weight: 500; }
input, select { min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 9px; outline: none; background: #0d1014; color: var(--text); transition: border-color .15s, box-shadow .15s; }
input::placeholder { color: #606978; }
input:hover, select:hover { border-color: #48515f; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #7c6cf226; }
.select-control { position: relative; min-width: 0; display: block; }
.select-control select { width: 100%; padding-right: 42px; appearance: none; -webkit-appearance: none; cursor: pointer; }
.select-control i { position: absolute; top: 50%; right: 16px; width: 8px; height: 8px; border-right: 1.5px solid #aab2bf; border-bottom: 1.5px solid #aab2bf; pointer-events: none; transform: translateY(-65%) rotate(45deg); transition: border-color .15s, transform .15s; }
.select-control:hover i { border-color: #e0e4ea; }
.select-control:focus-within i { border-color: #bcb4ff; }
.select-control.is-open i { border-color: #bcb4ff; transform: translateY(-25%) rotate(225deg); }
input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { margin: 0; appearance: none; -webkit-appearance: none; }
.input-with-suffix { display: grid; grid-template-columns: 1fr auto; align-items: center; height: 40px; border: 1px solid var(--border-strong); border-radius: 9px; background: #0d1014; overflow: hidden; }
.input-with-suffix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #7c6cf226; }
.input-with-suffix input { height: 38px; border: 0; border-radius: 0; box-shadow: none; }
.input-with-suffix > .input-suffix { padding: 0 12px 0 9px; color: var(--muted); font-weight: 500; }
.input-with-suffix.number-stepper { grid-template-columns: minmax(42px, 1fr) auto auto; }
.number-stepper { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.number-stepper.duration-stepper { grid-template-columns: minmax(42px, 1fr) auto auto; }
.stepper-controls { height: 100%; margin: 0; padding: 0; display: inline-flex; align-items: stretch; gap: 0; border: 0; border-left: 1px solid var(--border); border-radius: 0; background: transparent; }
.stepper-controls button { width: 34px; height: 100%; padding: 0; display: grid; place-items: center; border: 0; border-radius: 0; background: transparent; color: #9ba4b2; font-size: 17px; font-weight: 450; line-height: 1; transition: background .15s, color .15s, transform .08s; }
.stepper-controls button + button { border-left: 1px solid var(--border); }
.input-with-suffix .stepper-controls { border-right: 1px solid var(--border); }
.stepper-controls button:hover { background: #252a33; color: #f3f4f7; }
.stepper-controls button:active { transform: scale(.92); }
.stepper-controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.duration-toggle { height: 100%; padding: 3px; display: inline-flex; align-items: stretch; gap: 2px; border-left: 1px solid var(--border); background: #0d1014; }
.duration-toggle button { min-width: 39px; height: 100%; padding: 0 7px; border: 0; border-radius: 5px; background: transparent; color: #7f8896; font-size: 10px; font-weight: 650; line-height: 1; transition: background .15s, color .15s; }
.duration-toggle button:hover { color: #d5d9e0; }
.duration-toggle button[aria-pressed="true"] { background: #7569d72b; color: #bdb5ff; box-shadow: inset 0 0 0 1px #7569d755; }
.duration-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }

.button { min-height: 38px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 9px; color: var(--text); font-weight: 650; line-height: 1; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .08s; }
.icon { width: 15px; height: 15px; flex: 0 0 auto; transition: opacity .15s; }
.button:active { transform: translateY(1px); }
.button:focus-visible { outline: 3px solid #7c6cf244; outline-offset: 2px; }
.button:disabled { cursor: not-allowed; opacity: .42; filter: saturate(.45); transform: none; }
.button:disabled:hover { transform: none; }
.button-primary { background: var(--accent); color: white; }
.button-primary:hover { background: var(--accent-hover); }
.button-secondary { border-color: var(--border-strong); background: #171b21; color: #cbd1da; }
.button-secondary:hover, .button-ghost:hover { border-color: #4b5564; background: #20252d; color: white; }
.button-positive { border-color: #347a5c; background: #153528; color: #72dda8; }
.button-positive:hover { background: #1c4635; }
.button-danger { border-color: #69373c; background: #321b1e; color: #f38a91; }
.button-danger:hover { border-color: #8d454c; background: #482327; }
.button-danger:disabled:hover { border-color: #69373c; background: #321b1e; color: #f38a91; }
.button-ghost { border-color: var(--border); background: transparent; color: var(--muted); }
.button-small { min-height: 32px; padding: 0 10px; border-radius: 7px; font-size: 11px; }
.button-wide { width: 100%; height: 42px; }

.table-wrap { overflow-x: auto; }
.license-search { padding: 12px 16px; display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); background: #0f1216; }
.license-search label, .license-search input { width: 100%; }
.license-search .button { min-height: 40px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); background: #0f1216; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: #15191f; }
.key-prefix { padding: 5px 7px; border: 1px solid var(--border); border-radius: 6px; background: #0c0f12; color: #d5d9e0; font-size: 11px; white-space: nowrap; }
.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
.expiry-soon { color: var(--amber); }
.expiry-expired { color: var(--red); }
.note-cell { min-width: 150px; max-width: 260px; overflow-wrap: anywhere; color: #bdc3cc; }
.user-email { color: #d9dde4; font-size: 12px; }
.user-identity { display: grid; gap: 2px; }
.user-secondary { color: var(--muted); font-size: 10px; font-weight: 500; }
.role-badge { display: inline-flex; padding: 4px 8px; border: 1px solid var(--border); border-radius: 999px; background: #15191f; color: #bdc4ce; font-size: 10px; font-weight: 700; }
.role-owner { border-color: #554c92; color: #b8afff; }
.role-admin { border-color: #315f7a; color: #83c9ef; }
.role-reseller { border-color: #3e594c; color: #8bc3a5; }
.status, .binding { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 11px; font-weight: 650; }
.status i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.status-active { color: var(--green); }
.status-active i { background: var(--green); box-shadow: 0 0 0 3px #45c98b18; }
.status-pending { color: #a5aebb; }
.status-pending i { border: 1px solid #778190; background: transparent; }
.status-blocked { color: var(--amber); }
.status-blocked i { background: var(--amber); }
.status-revoked { color: var(--red); }
.status-revoked i { background: var(--red); }
.binding { color: var(--muted); }
.binding::before { content: ""; width: 7px; height: 7px; border: 1px solid #596272; border-radius: 2px; }
.binding-on { color: #bec5d0; }
.binding-on::before { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2px var(--surface); }
.binding-details { width: max-content; }
.binding-details summary { cursor: pointer; list-style: none; user-select: none; }
.binding-details summary::-webkit-details-marker { display: none; }
.binding-details summary::after { content: "⌄"; margin-left: 2px; color: var(--muted); }
.binding-details[open] summary::after { content: "⌃"; }
.binding-details > div { width: 176px; margin-top: 7px; padding: 10px; display: grid; gap: 4px; border: 1px solid var(--border-strong); border-radius: 9px; background: #0c0f13; box-shadow: 0 10px 24px #0006; }
.binding-details > div span, .binding-details > div small { color: var(--muted); font-size: 9px; }
.binding-details > div code { color: #c6beff; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.actions { min-width: 112px; display: flex; justify-content: flex-end; }
.action-menu { width: 100%; max-width: 250px; }
.action-menu summary { width: max-content; margin-left: auto; list-style: none; user-select: none; }
.action-menu summary::-webkit-details-marker { display: none; }
.action-menu summary::after { content: "⌄"; margin-left: 7px; color: var(--muted); }
.action-menu[open] summary::after { content: "⌃"; }
.action-list { margin-top: 7px; padding: 8px; display: grid; gap: 7px; border: 1px solid var(--border); border-radius: 9px; background: #0d1014; }
.action-list form { margin: 0; display: grid; gap: 5px; }
.action-list .button { width: 100%; }
.extension-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
.extension-fields label, .extension-fields .field-group { min-width: 0; gap: 5px; }
.extension-fields label > span:first-child, .extension-fields .field-group > span:first-child { color: #7f8896; font-size: 9px; font-weight: 650; letter-spacing: .04em; }
.extension-fields input { width: 100%; height: 32px; padding: 0 7px; border-radius: 7px; font-size: 11px; }
.number-stepper-compact { border: 1px solid var(--border-strong); border-radius: 7px; background: #0d1014; overflow: hidden; }
.number-stepper-compact:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px #7c6cf226; }
.extension-fields .number-stepper-compact input { min-width: 34px; border: 0; border-radius: 0; box-shadow: none; }
.number-stepper-compact .stepper-controls { margin: 0; padding: 0; border-radius: 0; }
.number-stepper-compact .stepper-controls button { width: 26px; height: 30px; font-size: 14px; }
.duration-toggle-compact { min-width: 55px; padding: 2px; gap: 1px; }
.duration-toggle-compact button { min-width: 24px; padding: 0 4px; font-size: 10px; }
.action-totp { width: 100%; height: 32px; padding: 0 8px; border-radius: 7px; font-size: 11px; letter-spacing: .08em; }
.action-list .critical-actions { margin-top: 2px; padding-top: 9px; border-top: 1px solid var(--border); gap: 7px; }
.critical-actions > span { color: #7f8896; font-size: 9px; font-weight: 650; letter-spacing: .04em; }
.critical-actions > .extension-fields { display: grid; }
.critical-actions > .sensitive-buttons { display: flex; flex-wrap: wrap; gap: 5px; }
.sensitive-buttons .button { flex: 1 1 auto; }
.action-unavailable { display: inline-block; padding: 7px 0; font-size: 11px; }
.user-actions { min-width: 210px; }
.identity-unblock { display: flex; align-items: center; gap: 8px; }
.identity-unblock .action-totp { width: 92px; }
.identity-blocks-panel code { color: #cbd1da; overflow-wrap: anywhere; }
.user-state-form { margin: 0; display: flex; gap: 6px; }
.user-state-form .action-totp { width: 76px; }
.guard-subscription-form { margin: 0; display: flex; align-items: center; gap: 6px; min-width: 250px; }
.guard-subscription-form .action-totp { width: 72px; }
.guard-subscription { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.guard-subscription input { width: 15px; height: 15px; margin: 0; padding: 0; accent-color: var(--accent); }
.guard-subscription-always { color: #aeb5c0; }
.template-create-form { padding: 16px 20px; display: grid; grid-template-columns: minmax(150px, .7fr) minmax(320px, 2fr) 140px auto; align-items: end; gap: 12px; border-bottom: 1px solid var(--border); }
.template-pattern { display: inline-block; max-width: 560px; color: #c8c1ff; overflow-wrap: anywhere; letter-spacing: .02em; }
.template-invalid { display: block; margin-top: 4px; color: var(--amber); font-size: 9px; font-weight: 700; }
.template-delete-form { margin: 0; display: flex; justify-content: flex-end; gap: 6px; }
.template-delete-form .action-totp { width: 76px; }
.template-note { margin: 0; padding: 11px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.user-state-buttons { display: flex; gap: 5px; }
.pending-actions { width: 210px; display: grid; grid-template-columns: 76px 1fr; gap: 5px; }
.pending-actions > span { grid-column: 1 / -1; color: var(--muted); font-size: 9px; }
.pending-actions .action-totp { width: 76px; }
.pending-actions > div { display: flex; gap: 5px; }

.alert { margin-bottom: 18px; padding: 13px 15px; border: 1px solid; border-radius: 11px; }
.alert-error { border-color: #69373c; background: #2b181b; color: #f49ca2; }
.alert-success { border-color: #2e6b51; background: #112b20; color: #8ae4b6; }
.alert-warning { border-color: #755c2e; background: #2a2215; color: #eac67d; }
.issuance-warning { display: grid; gap: 5px; }
.issuance-warning span { color: #ddc796; }
.issuance-warning small { color: #aa9367; }
.key-reveal { display: grid; gap: 7px; }
.key-reveal > span { font-weight: 700; }
.key-reveal code { padding: 9px 10px; border-radius: 7px; background: #091c14; color: #b1f1cf; overflow-wrap: anywhere; }
.key-reveal small { color: #70b993; }
.batch-key-reveal textarea { width: 100%; min-height: 94px; padding: 11px 12px; resize: vertical; border: 1px solid #2e6b51; border-radius: 8px; outline: none; background: #091c14; color: #b1f1cf; font: 600 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; }
.batch-key-reveal textarea:focus { border-color: #56ad82; box-shadow: 0 0 0 3px #45c98b1c; }
.batch-key-reveal > div { display: flex; }
.bulk-confirm { grid-column: 1 / -1; padding: 10px 12px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--border); border-radius: 9px; background: #11151a; color: var(--muted); cursor: pointer; }
.bulk-confirm input { width: 16px; min-width: 16px; height: 16px; margin: 1px 0 0; padding: 0; accent-color: var(--accent); }
.bulk-confirm span { display: grid; gap: 2px; }
.bulk-confirm strong { color: #aeb5c0; font-size: 11px; }
.bulk-confirm small { color: var(--muted); font-size: 9px; font-weight: 500; }
.bulk-confirm.is-required { border-color: #755c2e; background: #2a2215; }
.bulk-confirm.is-required strong { color: #eac67d; }
.bulk-confirm.is-required small { color: #aa9367; }
.muted { color: var(--muted); }
.empty-state { height: 180px; text-align: center; color: var(--muted); }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { margin-bottom: 4px; color: #d7dbe2; }
.empty-state .empty-icon { width: 34px; height: 34px; margin: 0 auto 10px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: #0d1014; color: #747e8d; }
.empty-state .empty-icon .icon { width: 16px; height: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.app-footer { width: min(1360px, calc(100% - 40px)); margin: -26px auto 0; padding: 18px 0 28px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 22px; border-top: 1px solid var(--border); color: #626b78; font-size: 10px; letter-spacing: .03em; }
.footer-brand { display: grid; gap: 3px; }
.footer-brand strong { color: #9da5b1; font-size: 11px; letter-spacing: .08em; }
.footer-brand span { color: #596270; }
.footer-links { display: flex; align-items: center; justify-content: center; gap: 14px; }
.footer-links a { color: #858e9b; text-decoration: none; transition: color .15s; }
.footer-links a:hover, .footer-links a.is-active { color: #c6beff; }
.footer-links i { width: 3px; height: 3px; border-radius: 50%; background: #444d59; }
.footer-user { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.footer-avatar { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #45405f; border-radius: 8px; background: #171527; color: #bcb4ff; font-size: 10px; font-weight: 800; }
.footer-user > span:last-child { min-width: 0; display: grid; justify-items: center; gap: 2px; text-align: center; }
.footer-user strong { max-width: 180px; overflow: hidden; color: #aeb5c0; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.footer-user small { color: #596270; font-size: 8px; }
.rules-panel { overflow: hidden; }
.rules-intro { padding: 25px 28px; display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--border); background: linear-gradient(100deg, #171527, #11151a 52%); }
.rules-mark { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #514a7d; border-radius: 11px; background: #211d38; color: #c2baff; font-size: 14px; font-weight: 800; }
.rules-intro div { display: grid; gap: 5px; }
.rules-intro h3, .rules-grid h3 { margin: 0; color: #e2e5ea; font-size: 13px; }
.rules-intro p { max-width: 800px; margin: 0; color: #a3aab5; font-size: 12px; line-height: 1.6; }
.rules-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rules-grid article { min-height: 150px; padding: 24px 28px; display: grid; grid-template-columns: 28px 1fr; align-content: start; gap: 13px; border-bottom: 1px solid var(--border); }
.rules-grid article:nth-child(odd) { border-right: 1px solid var(--border); }
.rules-grid article > span { color: #69627f; font: 700 10px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.rules-grid article div { display: grid; gap: 8px; }
.rules-grid p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.rules-note { margin: 0; padding: 17px 28px; color: #626b78; font-size: 10px; }

* { scrollbar-width: thin; scrollbar-color: #353d49 transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: #353d49; background-clip: padding-box; }

.login-shell { position: relative; isolation: isolate; min-height: 100vh; padding: 28px 18px; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 25%, #3a2e72 0, #171525 24%, var(--bg) 64%); background-size: 130% 130%; background-position: 50% 18%; animation: login-bg-shift 12s ease-in-out infinite alternate; }
.login-shell::before { content: ""; position: absolute; z-index: 0; inset: -18%; pointer-events: none; background: radial-gradient(ellipse at 18% 25%, #7569d74d 0, transparent 34%), radial-gradient(ellipse at 82% 76%, #5146a526 0, transparent 38%), linear-gradient(125deg, transparent 28%, #8b7ff20d 50%, transparent 72%); filter: blur(28px); opacity: .82; will-change: transform; animation: login-bg-drift 18s ease-in-out infinite alternate; }
.login-shell::after { display: none; }
.login-shell::before { display: none; }
.login-shell > * { position: relative; z-index: 1; }
.login-backdrop { position: absolute !important; z-index: 0 !important; inset: -22%; pointer-events: none; background: radial-gradient(ellipse at 18% 25%, #7569d780 0, transparent 34%), radial-gradient(ellipse at 82% 76%, #5146a54a 0, transparent 38%), linear-gradient(125deg, transparent 28%, #8b7ff21e 50%, transparent 72%); filter: blur(34px); opacity: .88; transform: translate3d(0, 0, 0) scale(1.08); will-change: transform; }
@keyframes login-bg-shift { from { background-position: 42% 12%; } to { background-position: 62% 34%; } }
@keyframes login-bg-drift { from { transform: translate3d(-3%, -2%, 0) scale(1); } to { transform: translate3d(4%, 3%, 0) scale(1.08); } }
@keyframes login-orb-b { from { transform: translate3d(4%, 2%, 0) scale(1); } to { transform: translate3d(-16%, -12%, 0) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .login-shell::before { animation: none; } }
.login-card { width: min(100%, 390px); padding: 30px; border: 1px solid var(--border); border-radius: 18px; background: #111419ed; box-shadow: 0 24px 80px #0008; }
.login-card .brand-mark { margin-bottom: 22px; }
.login-card h1 { margin-bottom: 8px; font-size: 24px; }
.lead { margin-bottom: 24px; color: var(--muted); }
.login-form { display: grid; gap: 15px; }
.login-form input { width: 100%; }
.totp-field { font-family: "SFMono-Regular", Consolas, monospace; letter-spacing: .18em; }
.security-note { margin: 20px 0 0; color: #697281; font-size: 11px; text-align: center; }
.beta-badge { margin-left: 5px; padding: 2px 5px; border: 1px solid #554c92; border-radius: 5px; color: #aaa0f5; font-size: 8px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; vertical-align: 1px; }
.login-card .alert { margin: 0 0 18px; }
.recovery-card { width: min(100%, 520px); }
.recovery-codes { margin: 0 0 20px; padding: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; list-style: none; border: 1px solid var(--border); border-radius: 11px; background: #0b0e12; }
.recovery-codes code { display: block; color: #b9b0ff; font-size: 12px; text-align: center; letter-spacing: .04em; }
.recovery-notice { display: grid; gap: 10px; }
.recovery-notice .recovery-codes { margin: 0; }
.security-form { padding: 20px; display: flex; align-items: end; gap: 10px; }
.security-form label { width: 150px; }
.session-revoke, .session-all-form { display: flex; align-items: center; gap: 6px; }
.session-revoke .action-totp, .session-all-form .action-totp { width: 76px; }
.security-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.security-settings .panel { min-width: 0; display: flex; flex-direction: column; }
.settings-form { padding: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 12px; }
.settings-form .button { min-height: 40px; grid-column: 1 / -1; justify-self: start; }
.compact-settings-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.totp-confirm-panel { border-color: #554c92; }
.totp-reset-grid { padding: 20px; display: grid; grid-template-columns: 260px minmax(250px, 1fr); align-items: center; gap: 28px; }
.totp-reset-grid .qr-frame { width: 200px; min-height: 200px; }
.audit-id { color: #aab1bc; font-size: 10px; overflow-wrap: anywhere; }
.audit-metadata { max-width: 360px; display: block; color: #969fac; font-size: 10px; overflow-wrap: anywhere; white-space: normal; }
.audit-event { min-width: 0; display: grid; gap: 3px; }
.audit-event strong { line-height: 1.3; }
.audit-event small { display: block; color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.audit-event-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.audit-row-alert td { background: color-mix(in srgb, #f0a94a 7%, transparent); }
.guard-flag { display: inline-flex; align-items: center; min-height: 20px; padding: 2px 7px; border: 1px solid color-mix(in srgb, #f0a94a 45%, transparent); border-radius: 999px; color: #f2bd72; background: color-mix(in srgb, #f0a94a 10%, transparent); font-size: 9px; font-weight: 800; letter-spacing: .03em; white-space: nowrap; }
.guard-critical { border-color: color-mix(in srgb, #f06b6b 55%, transparent); color: #ff9292; background: color-mix(in srgb, #f06b6b 11%, transparent); }
.guard-medium { border-color: color-mix(in srgb, var(--accent) 42%, transparent); color: #b4a9ff; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.enrollment-shell { align-items: center; }
.enrollment-card { width: min(100%, 820px); padding: 30px; border: 1px solid var(--border); border-radius: 18px; background: #111419f2; box-shadow: 0 24px 80px #0008; }
.enrollment-card > .brand-mark { margin-bottom: 20px; }
.enrollment-card > h1 { margin-bottom: 7px; font-size: 25px; }
.enrollment-grid { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(290px, 1.15fr); gap: 18px; }
.totp-setup, .password-setup { padding: 20px; border: 1px solid var(--border); border-radius: 13px; background: #0d1014; }
.totp-setup > div:first-child, .password-setup > div:first-child { display: flex; align-items: center; gap: 10px; }
.totp-setup > p, .password-setup > p { min-height: 42px; margin: 10px 0 15px; color: var(--muted); font-size: 12px; }
.step-number { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 7px; background: #7569d729; color: #a79cff; font-size: 11px; font-weight: 750; }
.qr-frame { width: 218px; min-height: 218px; margin: 0 auto 14px; padding: 10px; display: grid; place-items: center; border-radius: 12px; background: white; color: #333; font-size: 11px; }
.qr-frame svg { width: 100%; height: auto; display: block; }
.qr-frame.is-error { background: #2b181b; color: #f49ca2; text-align: center; }
.manual-setup { border: 1px solid var(--border); border-radius: 9px; background: #11151a; }
.manual-setup summary { padding: 10px 12px; color: #c5cbd4; cursor: pointer; font-size: 11px; font-weight: 650; }
.manual-setup > div { padding: 0 12px 12px; display: grid; gap: 6px; }
.manual-setup code { color: #b9b0ff; font-size: 12px; font-weight: 700; letter-spacing: .08em; overflow-wrap: anywhere; }
.manual-setup small { color: var(--muted); font-size: 9px; }
.login-card a.button, .enrollment-card a.button { text-decoration: none; }

@media (max-width: 900px) {
  .topbar { height: auto; min-height: 116px; padding: 10px max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left)); flex-wrap: wrap; gap: 6px 14px; }
  .brand, .topbar-actions { min-height: 44px; }
  .topbar-actions { margin-left: auto; }
  .main-nav { order: 3; width: 100%; height: 50px; align-self: auto; justify-content: center; overflow-x: auto; scrollbar-width: none; }
  .main-nav::-webkit-scrollbar { display: none; }
  .nav-link { height: 44px; flex: 0 0 auto; }
  .nav-link.is-active::after { right: 10px; bottom: -3px; left: 10px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .create-form { grid-template-columns: 220px 120px minmax(180px, 1fr); }
  .create-user-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .create-form .create-totp { grid-column: 1 / 2; }
  .create-form .button { grid-column: 2 / -1; }
  .create-user-form .button { min-height: 40px; }
  .section-heading > p { display: none; }
  .security-settings { grid-template-columns: 1fr; }
  .totp-reset-grid { grid-template-columns: 220px 1fr; }
}
@media (max-width: 720px) {
  .enrollment-grid { grid-template-columns: 1fr; }
  .system-status { display: none; }
  .topbar { gap: 6px 10px; }
  .nav-link { padding: 0 9px; }
  .nav-link.is-active::after { right: 9px; left: 9px; }
  .account-role { display: none; }
  .page-heading > p, .total-chip { display: none; }
  .table-wrap { padding: 8px; overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  tbody tr { margin-bottom: 8px; padding: 7px 0; border: 1px solid var(--border); border-radius: 10px; background: #0f1216; }
  tbody tr:last-child { margin-bottom: 0; }
  tbody tr:hover td { background: transparent; }
  tbody td { min-height: 42px; padding: 9px 12px; display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 12px; border: 0; }
  tbody td::before { content: attr(data-label); color: #687280; font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .license-table tbody tr { padding: 13px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 14px 16px; }
  .license-table tbody td { min-height: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 5px; }
  .license-table tbody td:first-child, .license-table tbody td:last-child { grid-column: 1 / -1; }
  .license-table tbody td::before { line-height: 1.2; }
  .license-table .key-prefix { width: 100%; padding: 7px 9px; overflow: hidden; text-overflow: ellipsis; }
  .license-table .nowrap { white-space: normal; overflow-wrap: anywhere; }
  .license-table .actions { width: 100%; }
  .license-table .action-menu { width: 100%; }
  .license-table .action-menu summary { margin-left: 0; }
  .note-cell { min-width: 0; max-width: none; }
  .actions { min-width: 0; justify-content: flex-start; }
  .action-menu { max-width: 100%; }
  .action-menu summary { margin-left: 0; }
  .empty-state { display: block; padding: 54px 16px; }
  .empty-state::before { content: none; }
  .user-state-form { width: 100%; }
  .user-state-form { flex-wrap: wrap; }
  .user-state-form .action-totp { min-width: 120px; flex: 1 1 120px; }
  .guard-subscription-form { width: 100%; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
  .guard-subscription-form .action-totp { min-width: 110px; flex: 1 1 110px; }
  .template-delete-form { width: 100%; flex-wrap: wrap; }
  .template-delete-form .action-totp { min-width: 120px; flex: 1 1 120px; }
  .user-state-buttons { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-state-buttons .button { min-width: 0; }
  .user-actions { width: 100%; }
  .identity-unblock { width: 100%; flex-wrap: wrap; }
  .identity-unblock .action-totp { min-width: 120px; flex: 1 1 120px; }
  .pending-actions { width: 100%; grid-template-columns: 1fr; }
  .pending-actions > span { grid-column: auto; }
  .pending-actions .action-totp { width: 100%; }
  .pending-actions > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pending-actions > div .button { min-width: 0; }
  .critical-actions > .sensitive-buttons, .session-revoke { flex-wrap: wrap; }
  .sensitive-buttons .button { min-width: calc(50% - 3px); }
  .binding-details, .binding-details > div { max-width: 100%; }
  .session-all-form { display: none; }
}
@media (max-width: 560px) {
  .topbar { min-height: 106px; padding: 8px max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); }
  .brand .eyebrow { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .main-nav { height: 46px; justify-content: stretch; }
  .nav-link { min-width: 44px; height: 44px; padding: 2px 1px; flex: 1 1 0; flex-direction: column; justify-content: center; gap: 2px; font-size: 9px; }
  .nav-link span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .nav-link .icon { width: 16px; height: 16px; }
  .nav-link.is-active::after { right: 9px; bottom: -2px; left: 9px; }
  .logout-form .button { width: 40px; min-height: 40px; padding: 0; }
  .logout-form .button span { display: none; }
  .dashboard { width: min(100% - 24px, 1360px); padding-top: 20px; }
  .page-heading { min-height: 64px; margin-bottom: 14px; }
  .page-heading h2 { font-size: 21px; }
  .page-heading > div > p:last-child { font-size: 12px; }
  .stats { gap: 8px; }
  .stat { min-height: 82px; padding: 14px; }
  .stat strong { font-size: 22px; }
  .create-form { grid-template-columns: 1fr; padding: 16px; }
  .create-user-form { grid-template-columns: 1fr; padding: 16px; }
  .template-create-form { grid-template-columns: 1fr; padding: 16px; }
  .user-state-buttons { grid-template-columns: 1fr; }
  .license-search { grid-template-columns: 1fr auto; padding: 12px; }
  .license-search .button-ghost { grid-column: 1 / -1; }
  .create-form .create-totp, .create-form .button { grid-column: auto; }
  .section-heading { min-height: 68px; padding: 15px 16px; }
  .login-card { padding: 24px; }
  .recovery-codes { grid-template-columns: 1fr; }
  .security-form { align-items: stretch; flex-direction: column; }
  .security-form label { width: 100%; }
  .security-form .button { width: 100%; }
  .settings-form, .compact-settings-form, .totp-reset-grid { grid-template-columns: 1fr; }
  .settings-form .button { width: 100%; }
  .enrollment-card { padding: 20px; }
  .totp-setup, .password-setup { padding: 16px; }
  th, td { padding: 13px; }
  input, select { min-height: 44px; font-size: 16px; }
  .input-with-suffix { height: 44px; }
  .input-with-suffix input { height: 42px; min-height: 42px; }
  .button-small { min-height: 40px; }
  .action-totp, .extension-fields input { height: 40px; font-size: 16px; }
  .number-stepper-compact input { min-height: 40px; }
  .number-stepper-compact .stepper-controls button { height: 40px; }
  .extension-fields { grid-template-columns: 1fr; }
  .recovery-codes { grid-template-columns: 1fr; }
  .app-footer { width: min(100% - 24px, 1360px); grid-template-columns: 1fr auto; gap: 14px; }
  .footer-links { grid-column: 1 / -1; grid-row: 1; justify-content: flex-start; }
  .footer-brand { grid-column: 1; grid-row: 2; }
  .footer-user { grid-column: 2; grid-row: 2; }
  .rules-intro { padding: 20px; align-items: flex-start; }
  .rules-grid { grid-template-columns: 1fr; }
  .rules-grid article { min-height: auto; padding: 20px; }
  .rules-grid article:nth-child(odd) { border-right: 0; }
  .rules-note { padding: 16px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
