:root {
  color-scheme: light;
  --color-app-bg: #f4f6f9;
  --color-surface: #ffffff;
  --color-surface-secondary: #f8fafc;
  --color-text: #172033;
  --color-text-secondary: #4f5f72;
  --color-text-muted: #697386;
  --color-border: #dfe5ed;
  --color-border-strong: #cbd4e1;
  --color-primary: #175cd3;
  --color-primary-hover: #134cae;
  --color-primary-active: #103f91;
  --color-success: #087443;
  --color-success-bg: #e9f7f0;
  --color-warning: #7a5700;
  --color-warning-bg: #fff6d8;
  --color-error: #b42334;
  --color-error-bg: #feebee;
  --color-info: #1457a6;
  --color-info-bg: #eaf2ff;
  --color-focus: #2e7cf6;
  --color-disabled: #9aa5b5;
  --color-sidebar: #101b35;
  --color-sidebar-active: #213456;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --radius-sm: 6px;
  --radius-control: 8px;
  --radius-card: 12px;
  --radius-modal: 14px;
  --border-width: 1px;
  --shadow-1: 0 1px 2px rgb(16 24 40 / 5%);
  --shadow-2: 0 8px 24px rgb(16 24 40 / 9%);
  --z-header: 20;
  --z-dropdown: 30;
  --z-drawer: 50;
  --z-backdrop: 40;
  --z-modal: 60;
  --z-toast: 70;
  --nav-width: 264px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--color-text);
  background: var(--color-app-bg);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: var(--color-app-bg); }
body, button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }
button:not(.primary):not(.danger):not(.link-button):not(.icon-button) { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 14px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-control); background: var(--color-surface); color: var(--color-text); font-weight: 700; white-space: nowrap; }
button:not(.primary):not(.danger):not(.link-button):not(.icon-button):hover { border-color: var(--color-primary); color: var(--color-primary); }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h2 { font-size: 18px; line-height: 1.35; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--color-focus) 55%, transparent); outline-offset: 2px; }
.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; }
.skip-link { position: fixed; top: var(--space-2); left: var(--space-2); z-index: var(--z-toast); transform: translateY(-160%); padding: var(--space-3) var(--space-4); border-radius: var(--radius-control); background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-2); font-weight: 700; }
.skip-link:focus { transform: none; }

.admin-shell { display: grid; grid-template-columns: var(--nav-width) minmax(0, 1fr); transition: grid-template-columns 180ms ease; }
.sidebar { position: sticky; top: 0; z-index: var(--z-drawer); display: flex; flex-direction: column; width: var(--nav-width); height: 100dvh; overflow: hidden; background: var(--color-sidebar); color: white; transition: width 180ms ease; }
.sidebar-header { display: flex; align-items: center; min-height: 80px; padding: var(--space-4); border-bottom: 1px solid rgb(255 255 255 / 12%); }
.brand { display: flex; flex: 1; gap: var(--space-3); align-items: center; min-width: 0; color: white; }
.brand:hover { text-decoration: none; }
.brand img { width: 48px; height: 34px; object-fit: contain; }
.brand span { font-size: 14px; font-weight: 750; line-height: 1.2; }
.brand small { display: block; margin-top: var(--space-1); color: #afbdd4; font-size: 12px; font-weight: 500; }
.sidebar-collapse { display: inline-grid; flex: 0 0 36px; width: 36px; height: 36px; place-items: center; padding: 0; border: 1px solid rgb(255 255 255 / 18%); border-radius: var(--radius-control); background: rgb(255 255 255 / 8%); color: white; font-size: 22px; }
.sidebar-collapse:hover { background: rgb(255 255 255 / 14%); }
.sidebar > nav { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-3); scrollbar-width: thin; }
.nav-group + .nav-group { margin-top: var(--space-5); }
.nav-group-label { margin: 0 var(--space-3) var(--space-2); color: #8fa1bf; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.nav-link { display: flex; gap: var(--space-3); align-items: center; min-height: 42px; padding: 9px var(--space-3); border-radius: var(--radius-control); color: #c6d0e1; font-size: 13px; font-weight: 650; }
.nav-link > span:first-child { display: grid; flex: 0 0 22px; place-items: center; font-size: 15px; }
.nav-link:hover { background: rgb(255 255 255 / 8%); color: white; text-decoration: none; }
.nav-link.active { background: var(--color-sidebar-active); color: white; box-shadow: inset 3px 0 #57c5dd; }
.sidebar-user { display: grid; padding: var(--space-4) var(--space-5); border-top: 1px solid rgb(255 255 255 / 12%); }
.sidebar-user strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { display: block; margin: var(--space-1) 0 var(--space-3); color: #aebbd0; font-size: 11px; overflow-wrap: anywhere; }
.link-button { display: flex; gap: var(--space-2); align-items: center; min-height: 36px; padding: 0; border: 0; background: none; color: inherit; text-align: left; }
.sidebar-close, .nav-trigger, .nav-backdrop { display: none; }

.sidebar-collapsed.admin-shell { grid-template-columns: 76px minmax(0, 1fr); }
.sidebar-collapsed .sidebar { width: 76px; }
.sidebar-collapsed .sidebar-header { justify-content: center; padding-inline: var(--space-3); }
.sidebar-collapsed .brand { flex: 0 0 auto; }
.sidebar-collapsed .brand img { width: 44px; }
.sidebar-collapsed .brand-label,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-group-label,
.sidebar-collapsed .sidebar-user-copy,
.sidebar-collapsed .logout-label { display: none; }
.sidebar-collapsed .sidebar-collapse { position: absolute; top: 62px; right: 8px; z-index: 1; width: 28px; height: 28px; background: var(--color-sidebar-active); font-size: 18px; transform: rotate(180deg); }
.sidebar-collapsed .sidebar > nav { padding: var(--space-3) var(--space-2); }
.sidebar-collapsed .nav-group + .nav-group { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid rgb(255 255 255 / 10%); }
.sidebar-collapsed .nav-link { justify-content: center; min-height: 46px; padding: var(--space-2); }
.sidebar-collapsed .nav-link > span:first-child { flex-basis: 24px; font-size: 17px; }
.sidebar-collapsed .sidebar-user { place-items: center; padding: var(--space-3); }
.sidebar-collapsed .link-button { justify-content: center; width: 44px; height: 44px; }

.main { min-width: 0; min-height: 100vh; container: admin-content / inline-size; }
.topbar { position: sticky; top: 0; z-index: var(--z-header); display: flex; gap: var(--space-4); align-items: center; min-height: 80px; padding: var(--space-4) clamp(var(--space-4), 3vw, var(--space-10)); border-bottom: 1px solid var(--color-border); background: rgb(255 255 255 / 94%); backdrop-filter: blur(10px); }
.page-heading { min-width: 0; margin-right: auto; }
.topbar h1 { margin: 2px 0 0; font-size: clamp(22px, 2vw, 28px); line-height: 1.2; }
.eyebrow { margin: 0; color: var(--color-primary); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.visit, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 14px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-control); background: var(--color-surface); color: var(--color-text); font-size: 13px; font-weight: 700; white-space: nowrap; }
.visit:hover, .button:hover { border-color: var(--color-primary); color: var(--color-primary); text-decoration: none; }
.page-content { width: min(100%, 1600px); margin-inline: auto; padding: clamp(var(--space-4), 3vw, var(--space-10)); }

.stats, .summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); margin: 0 0 var(--space-5); }
.stats article, .card { min-width: 0; border: 1px solid var(--color-border); border-radius: var(--radius-card); background: var(--color-surface); box-shadow: var(--shadow-1); }
.stats article { display: grid; padding: var(--space-5); }
.stats small { color: var(--color-text-secondary); font-size: 12px; font-weight: 700; }
.stats strong { margin: var(--space-2) 0 var(--space-1); font-size: clamp(25px, 2.5vw, 32px); line-height: 1.1; overflow-wrap: anywhere; }
.stats span { color: var(--color-text-muted); font-size: 12px; }
.metric-text { font-size: 16px !important; line-height: 1.35 !important; }
.report-context { margin: 0 0 var(--space-4); }
.pagination { display: flex; gap: var(--space-2); align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-top: var(--space-4); }
.pagination > span { margin-right: auto; color: var(--color-text-muted); font-size: 12px; }
.interaction-timeline { display: grid; }
.grid { display: grid; gap: var(--space-5); }
.grid + .grid, .card + .card, .grid + .card, .card + .grid { margin-top: var(--space-5); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-grid { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.card { padding: clamp(var(--space-4), 2vw, var(--space-6)); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card h2 { margin: 0 0 var(--space-4); }
.narrow { width: min(100%, 720px); margin-inline: auto; }
.form-spaced, .section-heading-spaced, .inline-spaced { margin-top: var(--space-5); }
.section-title-spaced { margin-top: var(--space-6) !important; }
.section-heading { display: flex; gap: var(--space-4); align-items: flex-start; justify-content: space-between; margin-bottom: var(--space-5); }
.section-heading h2 { margin-bottom: var(--space-1); }
.section-heading p, .muted { margin: 0; color: var(--color-text-muted); font-size: 13px; line-height: 1.5; }
.status-row, .activity { display: flex; gap: var(--space-3); justify-content: space-between; padding: var(--space-3) 0; border-top: 1px solid var(--color-border); font-size: 13px; }
.status-row > :last-child { min-width: 0; text-align: right; overflow-wrap: anywhere; }
.status-dot { color: var(--color-success); font-weight: 750; }
.status-dot::before { content: "✓ "; }
.activity { display: grid; }
.activity span { color: var(--color-text-muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }

.badge, .risk-badge { display: inline-flex; gap: var(--space-1); align-items: center; width: fit-content; max-width: 100%; padding: 4px 9px; border: 1px solid transparent; border-radius: 999px; background: #eef1f5; color: var(--color-text-secondary); font-size: 11px; font-weight: 800; line-height: 1.25; text-transform: uppercase; overflow-wrap: anywhere; }
.badge::before, .risk-badge::before { content: ""; flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active, .badge.enabled, .badge.connected, .badge.success, .badge.successful, .badge.published, .badge.assigned { background: var(--color-success-bg); color: var(--color-success); }
.badge.inactive, .badge.disabled, .badge.disconnected, .badge.unassigned, .badge.archived { background: #eef1f5; color: #58677b; }
.badge.blocked, .badge.failed, .badge.error { background: var(--color-error-bg); color: var(--color-error); }
.badge.pending, .badge.warning, .badge.draft, .badge.planned { background: var(--color-warning-bg); color: var(--color-warning); }
.badge.visual, .badge.info { background: var(--color-info-bg); color: var(--color-info); }

.table-wrap { position: relative; width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; border: 1px solid var(--color-border); border-radius: var(--radius-control); scrollbar-width: thin; }
.table-wrap::after { position: sticky; right: 0; display: block; width: 24px; height: 1px; content: ""; }
table { width: 100%; min-width: 640px; border-collapse: collapse; background: var(--color-surface); font-size: 13px; }
th { position: sticky; top: 0; z-index: 1; padding: 11px var(--space-3); border-bottom: 1px solid var(--color-border-strong); background: var(--color-surface-secondary); color: var(--color-text-secondary); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { max-width: 380px; padding: var(--space-3); border-bottom: 1px solid var(--color-border); vertical-align: middle; overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fbff; }
td strong, td small { display: block; }
td small { margin-top: var(--space-1); color: var(--color-text-muted); }
td.actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
code, .json-cell { color: #35445c; font-size: 12px; overflow-wrap: anywhere; word-break: break-word; }
.json-cell { max-width: 320px; margin: 0; white-space: pre-wrap; line-height: 1.45; }
.env-export { max-width: none; }
.empty { padding: var(--space-10) var(--space-5); color: var(--color-text-muted); text-align: center; }
.empty::before { display: block; margin-bottom: var(--space-2); color: var(--color-text-secondary); content: "No results"; font-size: 14px; font-weight: 750; }
.detail-list { display: grid; grid-template-columns: minmax(120px, .7fr) minmax(0, 1.3fr); margin: 0 0 var(--space-5); }
.detail-list dt, .detail-list dd { min-width: 0; margin: 0; padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); font-size: 13px; overflow-wrap: anywhere; }
.detail-list dt { color: var(--color-text-secondary); font-weight: 700; }
.detail-list dd small { display: block; margin-top: var(--space-1); color: var(--color-text-muted); }

.stack { display: grid; gap: var(--space-4); }
.stack fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.stack fieldset + fieldset { padding-top: var(--space-5); border-top: 1px solid var(--color-border); }
.stack legend { width: 100%; margin-bottom: var(--space-3); padding: 0; color: var(--color-text); font-size: 14px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-5); }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.field-help { color: var(--color-text-muted); font-size: 11px; font-weight: 500; }
.span-2 { grid-column: span 2; }
label { display: grid; gap: 7px; color: #35445c; font-size: 12px; font-weight: 750; line-height: 1.4; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-control); background: var(--color-surface); color: var(--color-text); }
textarea { min-height: 96px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #9cabc0; }
input:focus, select:focus, textarea:focus { border-color: var(--color-focus); outline: 3px solid color-mix(in srgb, var(--color-focus) 20%, transparent); }
input:disabled, select:disabled, textarea:disabled, button:disabled, [aria-disabled="true"] { cursor: not-allowed; opacity: .62; }
label.check { display: flex; gap: var(--space-2); align-items: flex-start; min-height: 36px; padding-block: var(--space-2); }
label.check input { flex: 0 0 auto; width: 18px; min-height: 18px; margin-top: 1px; accent-color: var(--color-primary); }
.primary, .primary-link, .filters button, .inline button, button.danger { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 15px; border: 1px solid transparent; border-radius: var(--radius-control); background: var(--color-primary); color: white; font-weight: 750; white-space: nowrap; }
.primary:hover, .primary-link:hover, .filters button:hover, .inline button:hover { background: var(--color-primary-hover); text-decoration: none; }
.primary:active, .primary-link:active, .filters button:active, .inline button:active { background: var(--color-primary-active); }
button.danger { background: var(--color-error); }
button.danger:hover { background: #8f1d2c; }
.is-loading::before { width: 14px; height: 14px; margin-right: var(--space-2); border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; content: ""; animation: spin .7s linear infinite; }
.inline, .filters, .actions-row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.inline select { min-width: 120px; padding: 7px 9px; }
.inline button { min-height: 36px; padding: 7px 10px; }
.inline-tag-form { margin-top: var(--space-2); }
.inline-tag-form select { min-width: 170px; }
.copy-value { display: flex; gap: var(--space-2); align-items: center; min-width: 240px; }
.copy-value code { display: -webkit-box; flex: 1; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.copy-button { min-height: 36px !important; padding: 6px 9px !important; font-size: 11px; }
.danger-zone { display: grid; gap: var(--space-3); margin-top: var(--space-8); padding: var(--space-4); border: 1px solid #f0bbc2; border-radius: var(--radius-control); background: #fff8f9; }
.danger-zone h2 { margin: 0; color: var(--color-error); }
.filters { margin-bottom: var(--space-5); padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface-secondary); }
.filters input { max-width: 360px; }
.filters select { max-width: 240px; }

.flash { position: relative; padding: var(--space-3) var(--space-4) var(--space-3) 42px; border: 1px solid; border-radius: var(--radius-control); margin-bottom: var(--space-5); font-size: 13px; font-weight: 650; line-height: 1.5; }
.flash::before { position: absolute; left: var(--space-4); content: "✓"; font-weight: 900; }
.flash.success { border-color: #b8e3ce; background: var(--color-success-bg); color: var(--color-success); }
.flash.error { border-color: #f3bcc4; background: var(--color-error-bg); color: var(--color-error); }
.flash.error::before { content: "!"; }
.page-modal-layer { position: fixed; inset: 0; z-index: var(--z-backdrop); display: grid; place-items: center; padding: var(--space-6); overflow-y: auto; overscroll-behavior: contain; background: rgb(8 15 30 / 64%); backdrop-filter: blur(3px); }
.page-modal { z-index: var(--z-modal); width: min(100%, 560px); max-height: calc(100dvh - 48px); overflow-y: auto; border: 1px solid var(--color-border); border-radius: var(--radius-modal); background: var(--color-surface); box-shadow: 0 24px 70px rgb(3 8 23 / 35%); }
.page-modal-header { display: flex; gap: var(--space-4); align-items: flex-start; justify-content: space-between; padding: var(--space-6); border-bottom: 1px solid var(--color-border); }
.page-modal-header h2 { margin: var(--space-1) 0 0; font-size: 21px; }
.page-modal-body { padding: var(--space-6); }
.security-icon { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: var(--color-info-bg); color: var(--color-primary); font-size: 14px; box-shadow: inset 0 0 0 1px #cddfff; }
.page-modal-actions { display: flex; justify-content: flex-end; padding-top: var(--space-1); }
.page-modal-actions .primary { min-width: 210px; }
.page-modal-open { overflow: hidden; }
.tag-pill { display: inline-flex; align-items: center; margin: 2px 4px 2px 0; padding: 3px 8px; border-radius: 999px; background: #eef1f5; color: #44546d; font-size: 11px; font-weight: 750; }
.tag-pill.staff { background: #0057b8; color: white; }
.tag-list { display: grid; gap: var(--space-3); }
.tag-card { display: grid; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-card); background: var(--color-surface); }
.tag-main { display: flex; gap: var(--space-3); align-items: flex-start; min-width: 0; }
.tag-main > div { min-width: 0; }
.tag-preview { display: inline-block; min-width: 72px; max-width: 100%; padding: 6px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-align: center; overflow-wrap: anywhere; }
.tag-main p { margin: var(--space-1) 0 0; color: var(--color-text-muted); font-size: 13px; }
.tag-meta, .tag-actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.usage { color: var(--color-text-muted); font-size: 12px; }
.player-preview { position: relative; display: grid; min-height: 180px; place-items: center; margin-bottom: var(--space-4); border-radius: var(--radius-card); background: linear-gradient(90deg, #e3e8f0 1px, transparent 1px), linear-gradient(#e3e8f0 1px, transparent 1px); background-size: 24px 24px; }
.avatar-circle { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 50%; background: var(--color-sidebar); color: white; font-weight: 800; }
.player-preview .tag-preview { position: absolute; top: 42px; left: 50%; transform: translateX(-50%); box-shadow: var(--shadow-2); }
.disabled-link { pointer-events: none; opacity: .45; }

.login-shell { display: grid; min-height: 100dvh; place-items: center; padding: var(--space-6); background: radial-gradient(circle at 20% 15%, #2468d9 0, transparent 34%), linear-gradient(145deg, #0c162d, #172b52); }
.login-main { width: min(100%, 440px); }
.login-card { padding: clamp(var(--space-6), 8vw, var(--space-10)); border: 1px solid rgb(255 255 255 / 28%); border-radius: var(--radius-modal); background: var(--color-surface); box-shadow: 0 28px 70px rgb(3 8 23 / 48%); text-align: center; }
.login-logo { width: 120px; height: 78px; margin-bottom: var(--space-2); object-fit: contain; }
.login-card h1 { margin: var(--space-2) 0; font-size: clamp(23px, 6vw, 27px); }
.login-card .stack { margin-top: var(--space-6); text-align: left; }
.login-card .primary { width: 100%; min-height: 46px; }
.login-note { margin: var(--space-5) 0 0; color: var(--color-text-muted); font-size: 11px; }
.error-logo { width: 130px; }
.profile-avatar { width: 80px; height: 80px; margin-bottom: var(--space-4); border-radius: 50%; object-fit: cover; }
.profile-data { max-width: 100%; margin: 0; color: var(--color-text-secondary); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  .stats, .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
}

@container admin-content (max-width: 980px) {
  .stats, .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
  .grid.two { grid-template-columns: 1fr; }
  .section-heading { flex-wrap: wrap; }
}

@container admin-content (max-width: 680px) {
  .grid.two, .form-grid, .check-grid, .stats, .summary-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .filters { align-items: stretch; flex-direction: column; }
  .filters input, .filters select, .filters button, .filters .button { width: 100%; max-width: none; }
  .status-row { align-items: flex-start; flex-direction: column; }
  .status-row > :last-child { text-align: left; }
}

@media (max-width: 900px) {
  .admin-shell, .sidebar-collapsed.admin-shell { display: block; }
  .sidebar { position: fixed; left: 0; width: min(86vw, 304px); transform: translateX(-105%); box-shadow: var(--shadow-2); transition: transform 180ms ease; }
  .sidebar-collapsed .sidebar { width: min(86vw, 304px); }
  .sidebar-collapse { display: none; }
  .sidebar-collapsed .brand-label, .sidebar-collapsed .nav-label, .sidebar-collapsed .nav-group-label, .sidebar-collapsed .sidebar-user-copy, .sidebar-collapsed .logout-label { display: initial; }
  .sidebar-collapsed .sidebar-header { justify-content: initial; padding: var(--space-4); }
  .sidebar-collapsed .brand { flex: 1; }
  .sidebar-collapsed .sidebar > nav { padding: var(--space-3); }
  .sidebar-collapsed .nav-group + .nav-group { margin-top: var(--space-5); padding-top: 0; border-top: 0; }
  .sidebar-collapsed .nav-link { justify-content: flex-start; min-height: 42px; padding: 9px var(--space-3); }
  .sidebar-collapsed .sidebar-user { display: grid; place-items: initial; padding: var(--space-4) var(--space-5); }
  .sidebar-collapsed .link-button { justify-content: flex-start; width: auto; height: auto; }
  .sidebar-close, .nav-trigger { display: inline-grid; }
  .icon-button { width: 44px; height: 44px; flex: 0 0 44px; place-items: center; padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface); color: var(--color-text); font-size: 20px; }
  .sidebar-close { border-color: rgb(255 255 255 / 18%); background: rgb(255 255 255 / 8%); color: white; }
  .nav-backdrop { position: fixed; inset: 0; z-index: var(--z-backdrop); width: 100%; height: 100%; border: 0; background: rgb(8 15 30 / 58%); opacity: 0; }
  .nav-open { overflow: hidden; }
  .nav-open .sidebar { transform: none; }
  .nav-open .nav-backdrop { display: block; opacity: 1; }
  .topbar { min-height: 72px; padding: var(--space-3) var(--space-4); }
  .page-content { padding: var(--space-5) var(--space-4); }
}

@media (max-width: 700px) {
  .grid.two, .form-grid, .check-grid, .stats, .summary-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .section-heading > .button, .section-heading > button { width: 100%; }
  .filters { align-items: stretch; flex-direction: column; }
  .filters input, .filters select, .filters button, .filters .button { width: 100%; max-width: none; }
  .status-row { align-items: flex-start; flex-direction: column; }
  .status-row > :last-child { text-align: left; }
  .detail-list { grid-template-columns: 1fr; }
  .detail-list dt { padding-bottom: 0; border-bottom: 0; }
  .tag-main { flex-direction: column; }
  .table-wrap { background: linear-gradient(to right, transparent calc(100% - 18px), rgb(23 32 51 / 8%)); }
  table { min-width: 680px; }
  td.actions { min-width: 150px; }
  .visit { width: 44px; height: 44px; padding: 0; overflow: hidden; color: transparent; }
  .visit span[aria-hidden] { color: var(--color-text); font-size: 18px; }
  .visit .sr-only { color: var(--color-text); }
  .login-shell { padding: var(--space-4); }
  .page-modal-layer { align-items: end; padding: var(--space-3); }
  .page-modal { width: 100%; max-height: calc(100dvh - 24px); border-radius: var(--radius-modal) var(--radius-modal) var(--radius-control) var(--radius-control); }
  .page-modal-header, .page-modal-body { padding: var(--space-5); }
  .page-modal-actions .primary { width: 100%; min-width: 0; }
}

@media (max-width: 380px) {
  .page-content { padding-inline: var(--space-3); }
  .topbar { padding-inline: var(--space-3); }
  .eyebrow { display: none; }
  .card { padding: var(--space-4); }
  .inline, .actions-row { align-items: stretch; flex-direction: column; }
  .inline > *, .actions-row > * { width: 100%; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .sidebar, .topbar, .filters, .nav-backdrop { display: none !important; }
  .admin-shell { display: block; }
  .page-content { width: 100%; padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
}
