:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #162034;
  background: #f5f7fb;
  font-synthesis: none;
  --ink: #162034;
  --muted: #667085;
  --subtle: #98a2b3;
  --line: #e4e8f0;
  --line-strong: #d3d9e5;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --navy: #101828;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --success: #079455;
  --success-soft: #ecfdf3;
  --warning: #dc6803;
  --warning-soft: #fffaeb;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 5%);
  --shadow-md: 0 8px 24px rgb(16 24 40 / 8%);
  --shadow-lg: 0 24px 64px rgb(16 24 40 / 14%);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: #f5f7fb; color: var(--ink); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
svg { display: block; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .5rem; font-size: clamp(1.7rem, 2.3vw, 2.25rem); line-height: 1.2; letter-spacing: -.035em; }
h2 { margin: 0; font-size: 1.15rem; line-height: 1.35; letter-spacing: -.015em; }
h3 { margin-bottom: .5rem; font-size: 1rem; }
code, pre, .mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
code { overflow-wrap: anywhere; color: #344054; font-size: .82em; }
pre { max-width: 100%; overflow: auto; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: #101828; color: #e4e7ec; font-size: .82rem; }

.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; transform: translateY(-150%); padding: .65rem 1rem; border-radius: var(--radius-sm); background: var(--navy); color: white; }
.skip-link:focus { transform: translateY(0); }
.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; display: flex; width: 248px; flex-direction: column; padding: 1.25rem 1rem; background: var(--navy); color: white; }
.brand { display: flex; align-items: center; gap: .75rem; min-height: 48px; padding: .25rem .5rem 1.25rem; color: white; }
.brand:hover { color: white; }
.brand > span:last-child { display: grid; }
.brand strong { font-size: 1.08rem; letter-spacing: -.02em; }
.brand small { color: #98a2b3; font-size: .72rem; }
.brand-mark { position: relative; display: inline-flex; flex: 0 0 auto; width: 38px; height: 38px; align-items: center; justify-content: center; overflow: hidden; border-radius: 11px; background: linear-gradient(145deg, #6366f1, #06b6d4); box-shadow: 0 8px 24px rgb(79 70 229 / 32%); }
.brand-mark i { position: absolute; width: 13px; height: 13px; border: 3px solid white; border-radius: 50%; }
.brand-mark i:first-child { left: 7px; }
.brand-mark i:last-child { right: 7px; }
.brand-mark::after { width: 8px; height: 3px; border-radius: 4px; background: white; content: ""; }
.primary-nav { display: grid; gap: .3rem; margin-top: .65rem; }
.nav-item { display: flex; min-height: 44px; align-items: center; gap: .8rem; padding: .65rem .75rem; border-radius: 10px; color: #aeb8c7; font-size: .9rem; font-weight: 570; transition: background .16s ease, color .16s ease, transform .16s ease; }
.nav-item svg { width: 19px; height: 19px; fill: currentColor; }
.nav-item:hover { background: rgb(255 255 255 / 7%); color: white; transform: translateX(2px); }
.nav-item.is-active { background: linear-gradient(100deg, rgb(99 102 241 / 28%), rgb(6 182 212 / 10%)); color: white; box-shadow: inset 3px 0 #818cf8; }
.sidebar-footer { display: flex; align-items: center; gap: .5rem; margin-top: auto; padding: .85rem .5rem .15rem; border-top: 1px solid rgb(255 255 255 / 9%); }
.account { display: flex; min-width: 0; flex: 1; align-items: center; gap: .65rem; color: white; }
.account:hover { color: white; }
.account > span:last-child { display: grid; min-width: 0; }
.account strong, .account small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account strong { font-size: .84rem; }
.account small { color: #98a2b3; font-size: .7rem; }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgb(255 255 255 / 16%); border-radius: 50%; background: #344054; color: white; font-size: .8rem; font-weight: 700; }
.icon-button { display: inline-grid; width: 36px; height: 36px; min-height: 0; place-items: center; padding: 0; border: 0; border-radius: 9px; background: transparent; color: #98a2b3; box-shadow: none; }
.icon-button:hover { background: rgb(255 255 255 / 8%); color: white; }
.icon-button svg { width: 18px; height: 18px; fill: currentColor; }
.workspace { grid-column: 2; min-width: 0; }
.topbar { position: sticky; z-index: 10; top: 0; display: flex; height: 68px; align-items: center; justify-content: flex-end; gap: 1rem; padding: 0 clamp(1rem, 3vw, 2.5rem); border-bottom: 1px solid rgb(228 232 240 / 86%); background: rgb(255 255 255 / 88%); backdrop-filter: blur(14px); }
.mobile-brand { display: none; align-items: center; gap: .65rem; margin-right: auto; }
.mobile-brand .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
.mobile-brand .brand-mark i { width: 11px; height: 11px; border-width: 2px; }
.mobile-brand .brand-mark i:first-child { left: 6px; }
.mobile-brand .brand-mark i:last-child { right: 6px; }
.environment-pill { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .65rem; border: 1px solid #abefc6; border-radius: 999px; background: var(--success-soft); color: #067647; font-size: .75rem; font-weight: 650; }
.environment-pill i { width: 7px; height: 7px; border-radius: 50%; background: #17b26a; box-shadow: 0 0 0 3px rgb(23 178 106 / 14%); }
.topbar-profile { color: #475467; font-size: .82rem; font-weight: 600; }
.page-container { width: min(100%, 1440px); margin: 0 auto; padding: clamp(1.4rem, 3vw, 2.5rem); }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.25rem; margin-bottom: 1.6rem; }
.page-heading { max-width: 720px; }
.page-heading p { margin: .25rem 0 0; color: var(--muted); font-size: .94rem; }
.eyebrow { display: block; margin-bottom: .35rem; color: var(--primary); font-size: .72rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.page-actions, .inline-actions, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.section { margin-top: 1.75rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.section-header p { margin: .2rem 0 0; color: var(--muted); font-size: .84rem; }
.card, .panel { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.card { padding: 1.25rem; }
.panel { overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.panel-header p { margin: .2rem 0 0; color: var(--muted); font-size: .82rem; }
.panel-body { padding: 1.2rem; }
.narrow { width: min(100%, 520px); }
.content-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: 1 / -1; }
.stack { display: grid; gap: 1rem; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.metric-card { position: relative; min-height: 128px; overflow: hidden; padding: 1.15rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-card::after { position: absolute; top: -34px; right: -28px; width: 88px; height: 88px; border-radius: 50%; background: var(--primary-soft); content: ""; }
.metric-card strong { display: block; margin-top: .8rem; font-size: 1.8rem; line-height: 1; letter-spacing: -.04em; }
.metric-label { color: var(--muted); font-size: .78rem; font-weight: 650; text-transform: capitalize; }
.metric-trend { display: block; margin-top: .6rem; color: var(--subtle); font-size: .72rem; }
.status-card { display: flex; align-items: center; gap: .85rem; }
.status-orb { position: relative; display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 12px; background: var(--success-soft); color: var(--success); }
.status-orb::after { width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 5px rgb(7 148 85 / 12%); content: ""; }
.status-card p { margin: 0; color: var(--muted); font-size: .8rem; }

form { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field { display: grid; gap: .42rem; margin: 0; color: #344054; font-size: .82rem; font-weight: 620; }
.field.full { grid-column: 1 / -1; }
.field-hint { color: var(--subtle); font-size: .73rem; font-weight: 450; }
.form-actions.field { display: flex; }
label { color: #344054; font-size: .82rem; font-weight: 620; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { width: 100%; min-height: 42px; padding: .66rem .78rem; border: 1px solid var(--line-strong); border-radius: 10px; outline: 0; background: white; color: var(--ink); box-shadow: 0 1px 2px rgb(16 24 40 / 3%); transition: border-color .15s ease, box-shadow .15s ease; }
textarea { min-height: 105px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #98a2b3; }
input:focus, select:focus, textarea:focus { border-color: #818cf8; box-shadow: 0 0 0 4px rgb(99 102 241 / 12%); }
input[type="file"] { min-height: 46px; padding: .45rem; }
input[type="file"]::file-selector-button { margin-right: .7rem; padding: .5rem .7rem; border: 0; border-radius: 7px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 650; cursor: pointer; }
.checkbox-field { display: inline-flex; align-items: flex-start; gap: .55rem; color: #344054; font-size: .82rem; font-weight: 550; cursor: pointer; }
.checkbox-field input { width: 16px; height: 16px; margin: .18rem 0 0; accent-color: var(--primary); }
.button, button { display: inline-flex; min-height: 40px; width: auto; align-items: center; justify-content: center; gap: .45rem; padding: .58rem .9rem; border: 1px solid transparent; border-radius: 9px; background: var(--primary); color: white; font-weight: 650; line-height: 1.2; cursor: pointer; box-shadow: 0 1px 2px rgb(16 24 40 / 8%); transition: background .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.button:hover, button:hover { background: var(--primary-dark); color: white; box-shadow: 0 5px 14px rgb(79 70 229 / 20%); transform: translateY(-1px); }
.button:active, button:active { transform: translateY(0); }
.button.secondary, button.secondary { border-color: var(--line-strong); background: white; color: #344054; }
.button.secondary:hover, button.secondary:hover { border-color: #b8c0cf; background: var(--surface-soft); color: var(--ink); box-shadow: var(--shadow-sm); }
.button.ghost, button.ghost { background: transparent; color: #475467; box-shadow: none; }
.button.ghost:hover, button.ghost:hover { background: var(--surface-soft); color: var(--ink); box-shadow: none; }
.button.danger, button.danger { border-color: #fecdca; background: var(--danger-soft); color: #b42318; box-shadow: none; }
.button.danger:hover, button.danger:hover { border-color: #fda29b; background: #fee4e2; color: #912018; box-shadow: none; }
.button.small, button.small { min-height: 34px; padding: .44rem .68rem; font-size: .76rem; }
.button.full, button.full { width: 100%; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgb(99 102 241 / 28%); outline-offset: 2px; }

.table-shell { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow-sm); }
.panel > .table-shell { border: 0; border-radius: 0; box-shadow: none; }
table { width: 100%; border-collapse: collapse; background: white; font-size: .84rem; }
th { padding: .72rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface-soft); color: #667085; font-size: .69rem; font-weight: 750; letter-spacing: .045em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: .9rem 1rem; border-bottom: 1px solid #edf0f5; color: #475467; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #fafbff; }
.table-title { color: var(--ink); font-weight: 650; }
.table-subtitle { display: block; margin-top: .12rem; color: var(--subtle); font-size: .72rem; }
.table-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.table-actions form { display: inline-flex; }
.table-empty { padding: 2rem; color: var(--muted); text-align: center; }
.pagination { display: flex; justify-content: flex-end; margin-top: .9rem; }

.badge { display: inline-flex; align-items: center; gap: .36rem; padding: .24rem .55rem; border-radius: 999px; background: #f2f4f7; color: #475467; font-size: .7rem; font-weight: 700; text-transform: capitalize; white-space: nowrap; }
.badge::before { width: 6px; height: 6px; border-radius: 50%; background: #98a2b3; content: ""; }
.badge.success, .badge.active, .badge.ready, .badge.available { background: var(--success-soft); color: #067647; }
.badge.success::before, .badge.active::before, .badge.ready::before, .badge.available::before { background: #17b26a; }
.badge.warning, .badge.pending, .badge.incomplete { background: var(--warning-soft); color: #b54708; }
.badge.warning::before, .badge.pending::before, .badge.incomplete::before { background: #f79009; }
.badge.danger, .badge.revoked, .badge.disabled, .badge.failed { background: var(--danger-soft); color: #b42318; }
.badge.danger::before, .badge.revoked::before, .badge.disabled::before, .badge.failed::before { background: #f04438; }
.callout { display: flex; gap: .75rem; padding: .85rem 1rem; border: 1px solid #fedf89; border-radius: var(--radius); background: var(--warning-soft); color: #93370d; font-size: .84rem; }
.callout.danger { border-color: #fecdca; background: var(--danger-soft); color: #912018; }
.callout strong { color: inherit; }
.empty-state { padding: 2rem 1rem; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: .25rem; color: #344054; }
.empty-state p { max-width: 420px; margin: 0 auto; font-size: .84rem; }
.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; display: grid; grid-template-columns: auto 1fr; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid #edf0f5; color: #475467; font-size: .8rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline-dot { width: 8px; height: 8px; margin-top: .38rem; border-radius: 50%; background: #818cf8; box-shadow: 0 0 0 4px var(--primary-soft); }
.timeline-meta { display: block; color: var(--subtle); font-size: .7rem; }
.definition-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; margin: 1rem 0; }
.definition-grid div { padding: .75rem; border-radius: 10px; background: var(--surface-soft); }
.definition-grid dt { color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.definition-grid dd { margin: .25rem 0 0; color: var(--ink); font-size: .85rem; font-weight: 620; overflow-wrap: anywhere; }
details { border-radius: var(--radius); }
summary { padding: .65rem .8rem; border-radius: 9px; color: #475467; font-size: .8rem; font-weight: 650; cursor: pointer; }
details[open] > summary { margin-bottom: .8rem; background: var(--surface-soft); }
.danger-zone { border-color: #fecdca; }
.danger-zone .panel-header { border-color: #fee4e2; background: #fffafa; }
.secret { overflow-wrap: anywhere; padding: .85rem 1rem; border: 1px dashed #a5b4fc; border-radius: var(--radius); background: var(--primary-soft); color: #3730a3; font: 700 1.15rem "SFMono-Regular", Consolas, monospace; letter-spacing: .04em; }
.qr { display: grid; width: min(100%, 320px); place-items: center; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; }
.qr svg { width: 100%; height: auto; }

.auth-page { overflow-x: hidden; background: #f5f7ff; }
.auth-main { position: relative; display: grid; min-height: 100vh; place-items: center; padding: 2rem 1rem; isolation: isolate; }
.auth-main::before, .auth-main::after { position: fixed; z-index: -1; border-radius: 50%; filter: blur(2px); content: ""; }
.auth-main::before { top: -220px; left: -120px; width: 520px; height: 520px; background: radial-gradient(circle, rgb(99 102 241 / 18%), transparent 68%); }
.auth-main::after { right: -180px; bottom: -260px; width: 620px; height: 620px; background: radial-gradient(circle, rgb(6 182 212 / 16%), transparent 68%); }
.auth-card { width: min(100%, 440px); padding: clamp(1.5rem, 4vw, 2.2rem); border: 1px solid rgb(255 255 255 / 90%); border-radius: 24px; background: rgb(255 255 255 / 92%); box-shadow: var(--shadow-lg); backdrop-filter: blur(12px); }
.auth-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 2rem; }
.auth-brand strong { letter-spacing: -.02em; }
.auth-heading { margin-bottom: 1.5rem; }
.auth-heading h1 { margin-bottom: .45rem; }
.auth-heading p { margin: 0; color: var(--muted); font-size: .9rem; }
.auth-form { display: grid; gap: 1rem; }
.auth-footer { margin: 1.4rem 0 0; color: var(--subtle); font-size: .72rem; text-align: center; }

.title-row, .card-title { display: flex; align-items: center; gap: .7rem; }
.title-row h1, .card-title h3 { margin: 0; }
.card-title { justify-content: space-between; align-items: flex-start; }
.card-title p { margin: .2rem 0 0; color: var(--muted); font-size: .8rem; }
.muted { color: var(--muted); font-size: .82rem; }
.nowrap { white-space: nowrap; }
.hash { display: inline-block; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.storage-list { display: grid; gap: .55rem; }
.storage-list > div:not(.empty-state) { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .1rem; border-bottom: 1px solid #edf0f5; }
.storage-list > div:last-child { border-bottom: 0; }
.storage-list strong { font-size: 1.05rem; }
.jobs-table { max-height: 480px; overflow: auto; }
.jobs-table th { position: sticky; z-index: 1; top: 0; }

.filter-bar { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(160px, .6fr) auto auto; align-items: end; gap: .75rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow-sm); }
.filter-bar.filter-wide { grid-template-columns: repeat(4, minmax(140px, 1fr)) auto auto; }
.inline-field { display: flex; min-width: 240px; align-items: center; gap: .45rem; }
.inline-field input:not([type="checkbox"]):not([type="radio"]) { min-height: 36px; padding: .48rem .6rem; }
.inline-details { min-width: 74px; }
.inline-details > summary { display: inline-flex; min-height: 34px; align-items: center; padding: .44rem .68rem; background: transparent; color: #475467; list-style: none; }
.inline-details > summary::-webkit-details-marker { display: none; }
.inline-details > summary::after { margin-left: .35rem; content: "▾"; }
.inline-details[open] > summary { margin: 0; }
.details-popover { width: min(320px, 70vw); margin-top: .65rem; padding: .85rem; border: 1px solid #fecdca; border-radius: var(--radius); background: #fffafa; box-shadow: var(--shadow-md); }
.details-popover p { margin: .2rem 0 .8rem; color: var(--muted); font-size: .75rem; }
.stack.compact { gap: .65rem; }

.code-textarea { min-height: 480px; tab-size: 2; background: #101828; color: #e4e7ec; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .82rem; line-height: 1.65; }
.code-textarea:focus { border-color: #818cf8; background: #101828; }
.compact-qr { width: min(100%, 220px); }
.enrollment-card { max-width: 900px; }
.enrollment-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: center; gap: 2rem; }
.enrollment-grid .qr { justify-self: end; }

fieldset.field { min-width: 0; padding: 0; border: 0; }
fieldset.field legend { margin-bottom: .55rem; padding: 0; color: #344054; font-size: .82rem; font-weight: 620; }
.option-group { align-content: start; }
.option-group .checkbox-field + .checkbox-field { margin-top: .7rem; }
.checkbox-field span { display: grid; }
.checkbox-field strong { color: #344054; font-size: .82rem; }
.checkbox-field small { margin-top: .1rem; color: var(--subtle); font-size: .72rem; font-weight: 450; }
.upload-field { padding: 1rem; border: 1px dashed #a5b4fc; border-radius: var(--radius); background: #fafaff; }
.package-card h3 { margin: 0; font-size: 1rem; }
.package-settings { display: grid; grid-template-columns: minmax(200px, 1fr) auto auto; align-items: end; gap: 1rem; }
.package-options { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; min-height: 42px; }
.panel-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1.2rem; border-top: 1px solid var(--line); background: var(--surface-soft); }
.panel-footer form { display: inline-flex; }

.device-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.device-grid > .empty-state { grid-column: 1 / -1; }
.device-card .definition-grid { margin-bottom: .8rem; }
.profile-meta { grid-template-columns: 100px minmax(160px, .6fr) minmax(240px, 1.4fr); }
.destructive-form { margin-top: 1rem; }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 6; }
  .filter-bar.filter-wide { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .filter-bar.filter-wide > button, .filter-bar.filter-wide > .button { justify-self: start; }
  .package-settings { grid-template-columns: 1fr; align-items: stretch; }
  .package-settings > button { justify-self: start; }
}
@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; top: 0; width: 100%; height: auto; padding: .65rem .8rem; box-shadow: 0 8px 24px rgb(16 24 40 / 12%); }
  .sidebar > .brand { display: none; }
  .primary-nav { display: flex; gap: .35rem; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .primary-nav::-webkit-scrollbar { display: none; }
  .nav-item { min-width: max-content; min-height: 38px; padding: .5rem .65rem; font-size: .76rem; }
  .nav-item svg { width: 16px; height: 16px; }
  .nav-item:hover { transform: none; }
  .nav-item.is-active { box-shadow: inset 0 -2px #818cf8; }
  .sidebar-footer { display: none; }
  .workspace { min-width: 0; }
  .topbar { position: static; height: 58px; padding: 0 1rem; }
  .mobile-brand { display: flex; }
  .page-container { padding: 1.25rem 1rem 2rem; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .page-actions { width: 100%; }
  .content-grid { grid-template-columns: 1fr; }
  .span-4, .span-5, .span-6, .span-7, .span-8, .span-12 { grid-column: 1; }
  .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar > button, .filter-bar > .button { justify-self: start; }
  .device-grid { grid-template-columns: 1fr; }
  .enrollment-grid { grid-template-columns: 1fr; }
  .enrollment-grid .qr { justify-self: start; }
  .profile-meta { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .environment-pill { display: none; }
  .topbar-profile { font-size: .76rem; }
  .metrics-grid, .form-grid, .definition-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: 1; }
  .metric-card { min-height: 112px; }
  .card, .panel-body { padding: 1rem; }
  .panel-header { padding: .85rem 1rem; }
  .page-actions > *, .form-actions > * { flex: 1; }
  .table-shell { margin-inline: -1rem; width: calc(100% + 2rem); border-right: 0; border-left: 0; border-radius: 0; }
  .panel > .table-shell { margin-inline: 0; width: 100%; }
  th, td { padding: .75rem; }
  .filter-bar, .filter-bar.filter-wide { grid-template-columns: 1fr; }
  .filter-bar > button, .filter-bar > .button { width: 100%; }
  .title-row { flex-wrap: wrap; }
  .package-options { align-items: flex-start; flex-direction: column; }
  .panel-footer { align-items: stretch; flex-direction: column; }
  .panel-footer > *, .panel-footer form > button { width: 100%; }
  .enrollment-grid .qr { justify-self: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

[hidden] { display: none !important; }
.create-action { flex-shrink: 0; }
.create-action > summary { list-style: none; white-space: nowrap; }
.create-action > summary::-webkit-details-marker { display: none; }
.create-action [data-dialog-close] { display: none; }
.create-action[open] { width: 100%; }
.create-action[open] > .panel { margin-top: 1rem; }
.modal-open { overflow: hidden; }
.admin-modal { width: min(680px, calc(100vw - 1.5rem)); height: min(630px, calc(100dvh - 1.5rem)); max-height: none; margin: auto; padding: 0; overflow: hidden; border: 0; border-radius: var(--radius-lg); color: var(--ink); background: white; box-shadow: var(--shadow-md); }
.admin-modal::backdrop { background: rgb(16 24 40 / 55%); }
.admin-modal > .panel { height: 100%; display: flex; flex-direction: column; border: 0; box-shadow: none; }
.admin-modal .panel-header { flex: none; padding: 1rem; background: white; }
.modal-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-content { min-height: 0; overflow-y: auto; scrollbar-gutter: stable; scrollbar-width: thin; align-items: start; align-content: start; gap: .75rem 1rem; flex: 1; padding: .9rem 1rem; }
.modal-content .field { align-content: start; }
.modal-content .upload-field { padding: .7rem; }
.modal-content input:not([type="checkbox"]), .modal-content select { min-height: 40px; }
.modal-content input[type="file"] { padding: .25rem; }
.modal-content input[type="file"]::file-selector-button { padding: .35rem .6rem; }
.modal-content textarea { min-height: 66px; resize: none; }
.modal-footer { flex: none; padding: .65rem 1rem 1rem; border-top: 1px solid var(--line); background: var(--surface-soft); }
.form-feedback { height: 4.5rem; overflow-y: auto; scrollbar-gutter: stable; color: var(--muted); font-size: .78rem; }
.form-feedback .form-error { color: #b42318; padding: .2rem; overflow-wrap: anywhere; }
.form-feedback .form-error p { margin: .15rem 0; font-weight: 450; }
.form-feedback .form-error small { font-size: .68rem; }
.delivery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.label-line { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.label-line small { color: var(--muted); font-weight: 450; }
html:has(.modal-open) { scrollbar-gutter: stable; }
#create-user.admin-modal { height: min(510px, calc(100dvh - 1.5rem)); }
.admin-modal .form-actions { justify-content: flex-end; }
.admin-modal button:hover { transform: none; }
.form-feedback .form-error:focus { outline: none; }
.upload-status { gap: .45rem; font-size: .8rem; color: var(--muted); }
.upload-status:has([hidden]):has([data-form-status]:empty) { display: none; }
.upload-status progress { width: 100%; height: .55rem; accent-color: var(--primary); }
.form-error:focus { outline: 2px solid #b42318; outline-offset: 3px; }
.section-tools { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.filter-note { margin: .8rem 0; color: var(--muted); font-size: .8rem; }
.package-preferences { padding: .75rem 1.2rem; border-top: 1px solid var(--line); }
.package-preferences > summary { color: var(--muted); font-size: .82rem; }
.package-preferences .package-settings { padding: 1rem 0 0; }
.profile-payload > summary { margin-bottom: .5rem; font-size: .85rem; }
