:root {
  color-scheme: light;
  --ink: #14213d;
  --muted: #6f7f98;
  --line: #dfe5ef;
  --line-strong: #cbd5e3;
  --paper: #ffffff;
  --canvas: #f4f6fa;
  --navy: #0e1b36;
  --navy-soft: #182746;
  --blue: #246bfe;
  --blue-dark: #1755d8;
  --blue-soft: #edf4ff;
  --green: #16a36a;
  --green-soft: #eaf9f2;
  --amber: #d68413;
  --amber-soft: #fff6e7;
  --red: #d34f4f;
  --red-soft: #fff0f0;
  --shadow: 0 18px 50px rgba(27, 43, 73, 0.1);
  --radius: 18px;
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); }
body.modal-open { overflow: hidden; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.58; }
:focus-visible { outline: 3px solid rgba(36, 107, 254, 0.28); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.boot-screen { min-height: 100vh; display: grid; place-content: center; gap: 18px; text-align: center; color: var(--muted); }
.boot-mark { display: flex; gap: 7px; justify-content: center; }
.boot-mark span { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); animation: pulse 1s ease-in-out infinite; }
.boot-mark span:nth-child(2) { animation-delay: 0.12s; }
.boot-mark span:nth-child(3) { animation-delay: 0.24s; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(420px, 0.82fr); background: var(--paper); }
.login-story { position: relative; overflow: hidden; padding: clamp(34px, 6vw, 86px); color: white; background: #0d1b34; display: flex; flex-direction: column; justify-content: space-between; isolation: isolate; }
.login-story::before { content: ""; position: absolute; inset: -15%; z-index: -2; background: radial-gradient(circle at 72% 28%, rgba(62, 132, 255, 0.34), transparent 26%), radial-gradient(circle at 14% 82%, rgba(83, 213, 177, 0.15), transparent 24%), linear-gradient(135deg, #0b1830 0%, #10254a 62%, #0d1b34 100%); }
.login-story::after { content: ""; position: absolute; width: 560px; height: 560px; right: -240px; top: 50%; translate: 0 -50%; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; box-shadow: 0 0 0 90px rgba(255,255,255,.03), 0 0 0 180px rgba(255,255,255,.018); z-index: -1; }
.brand-lockup, .sidebar-brand { display: flex; align-items: center; gap: 14px; font-weight: 700; letter-spacing: .12em; }
.brand-symbol { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(145deg, #4f8dff, #1f62f3); box-shadow: 0 14px 28px rgba(20, 91, 230, .3); }
.brand-symbol span { font-family: Georgia, serif; font-size: 25px; font-weight: 700; }
.brand-symbol.small { width: 42px; height: 42px; border-radius: 13px; flex: 0 0 auto; }
.brand-symbol.small span { font-size: 21px; }
.login-copy { max-width: 720px; margin: 9vh 0; }
.eyebrow { margin: 0 0 10px; color: #6381ad; font-size: 12px; font-weight: 800; letter-spacing: .16em; }
.login-story .eyebrow { color: #84aefd; }
.login-copy h1 { margin: 0; max-width: 720px; font-size: clamp(42px, 5.5vw, 76px); line-height: 1.13; letter-spacing: -.045em; }
.login-copy .lead { margin: 28px 0 0; max-width: 590px; color: #b9c8dc; font-size: clamp(16px, 1.5vw, 20px); line-height: 1.8; }
.trust-row { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid rgba(255,255,255,.12); }
.trust-row div { padding: 26px 22px 0 0; display: grid; gap: 7px; }
.trust-row strong { font-size: 15px; }
.trust-row span { color: #8fa1ba; font-size: 13px; }
.login-panel { display: grid; place-items: center; padding: clamp(28px, 5vw, 76px); background: linear-gradient(155deg, #fbfcfe, #f3f6fb); }
.login-card { width: min(430px, 100%); padding: 42px; background: rgba(255,255,255,.96); border: 1px solid #e1e7f0; border-radius: 24px; box-shadow: var(--shadow); }
.login-heading { display: flex; align-items: center; gap: 14px; }
.login-heading .status-dot { width: 11px; height: 11px; box-shadow: 0 0 0 6px var(--green-soft); }
.login-heading p { margin: 0 0 4px; color: var(--muted); font-size: 13px; font-weight: 700; }
.login-heading h2 { margin: 0; font-size: 31px; letter-spacing: -.03em; }
.login-card > .muted { margin: 18px 0 30px; line-height: 1.7; }
label { display: grid; gap: 9px; margin-top: 20px; }
label > span, fieldset legend { font-size: 13px; font-weight: 750; color: #43516a; }
input, textarea { width: 100%; color: var(--ink); background: #fbfcfe; border: 1px solid var(--line-strong); border-radius: 11px; padding: 13px 14px; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
input:hover, textarea:hover { border-color: #a9b7cb; }
input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(36,107,254,.1); background: white; outline: 0; }
textarea { resize: vertical; }
.password-field { position: relative; }
.password-field input { padding-right: 68px; }
.text-button { border: 0; background: transparent; color: var(--blue); font-size: 13px; font-weight: 700; }
.password-field .text-button { position: absolute; right: 10px; top: 50%; translate: 0 -50%; }
.primary-button, .secondary-button, .ghost-button, .icon-button { border: 1px solid transparent; border-radius: 10px; min-height: 42px; padding: 0 16px; font-weight: 750; transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.primary-button { color: white; background: var(--blue); box-shadow: 0 8px 18px rgba(36,107,254,.2); }
.primary-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
.secondary-button { color: #2d4c7e; background: white; border-color: var(--line); }
.secondary-button:hover { border-color: #aabbd2; background: #f9fbfe; }
.ghost-button { color: #aebbd1; background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.1); }
.ghost-button:hover { color: white; background: rgba(255,255,255,.09); }
.icon-button { width: 42px; padding: 0; background: transparent; border-color: var(--line); color: var(--ink); font-size: 22px; }
.wide { width: 100%; margin-top: 26px; display: flex; justify-content: space-between; align-items: center; }
.security-note { text-align: center; color: #8b99ad; font-size: 12px; margin: 18px 0 0; }
.form-message { margin: 16px 0 0; padding: 11px 13px; border-radius: 9px; font-size: 13px; line-height: 1.5; }
.form-message.error { color: #a93434; background: var(--red-soft); border: 1px solid #facaca; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 18px; color: white; background: var(--navy); z-index: 20; }
.sidebar-scrim { display: none; }
.sidebar-brand { padding: 0 8px 30px; letter-spacing: normal; }
.sidebar-brand > div:last-child { display: grid; gap: 4px; }
.sidebar-brand strong { font-size: 16px; }
.sidebar-brand span { color: #7990b1; font-size: 10px; letter-spacing: .14em; }
.sidebar nav { display: grid; gap: 7px; }
.nav-button { width: 100%; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; min-height: 46px; padding: 0 13px; border: 0; border-radius: 11px; color: #91a2bb; background: transparent; text-align: left; font-weight: 650; }
.nav-button:hover { color: white; background: rgba(255,255,255,.05); }
.nav-button.active { color: white; background: var(--navy-soft); box-shadow: inset 3px 0 var(--blue); }
.nav-icon { font-size: 19px; text-align: center; }
.nav-count { min-width: 25px; padding: 3px 7px; border-radius: 20px; background: rgba(255,255,255,.08); color: #b7c5da; text-align: center; font-size: 11px; }
.sidebar-foot { margin-top: auto; display: grid; gap: 14px; }
.server-pill { display: flex; align-items: center; gap: 9px; padding: 12px; color: #aab9ce; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; box-shadow: 0 0 0 4px rgba(22,163,106,.13); }
.workspace { min-width: 0; padding: 0 clamp(24px, 4vw, 58px) 50px; }
.topbar { height: 108px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: -.025em; }
.topbar .eyebrow { margin-bottom: 5px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.profile-chip { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.profile-chip > span { width: 39px; height: 39px; border-radius: 12px; display: grid; place-items: center; color: white; background: var(--navy); font-weight: 800; }
.profile-chip div { display: grid; gap: 2px; }
.profile-chip strong { font-size: 13px; }
.profile-chip small { color: var(--muted); font-size: 11px; }
.page { display: none; padding-top: 30px; animation: fade-up .22s ease; }
.page.active { display: block; }
.hero-panel { min-height: 190px; display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: 36px 40px; border-radius: var(--radius); color: white; background: linear-gradient(122deg, #102344, #17448b); box-shadow: 0 18px 38px rgba(28, 64, 121, .16); position: relative; overflow: hidden; }
.hero-panel::after { content: ""; position: absolute; width: 310px; height: 310px; right: -70px; top: -155px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 58px rgba(255,255,255,.035); }
.hero-panel > * { position: relative; z-index: 1; }
.hero-panel .eyebrow { color: #94b7f7; }
.hero-panel h2 { margin: 0 0 10px; font-size: clamp(25px, 3vw, 38px); letter-spacing: -.035em; }
.hero-panel p:not(.eyebrow) { margin: 0; color: #becde2; line-height: 1.7; }
.pending-alert { width: 100%; min-height: 68px; margin-top: 16px; padding: 14px 18px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 13px; align-items: center; text-align: left; color: #71460a; background: var(--amber-soft); border: 1px solid #efd39d; border-radius: 10px; }
.pending-alert:hover { border-color: #d6a64d; background: #fff2d9; }
.pending-alert-mark { display: grid; place-items: center; width: 30px; height: 30px; color: white; background: var(--amber); border-radius: 50%; font-weight: 850; }
.pending-alert > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.pending-alert strong { font-size: 14px; }
.pending-alert small { color: #8e6c34; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-alert b { color: #9a5a04; font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 20px 0; }
.metric-card, .surface-card { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 7px 20px rgba(31,49,82,.035); }
.metric-card { min-height: 142px; padding: 23px; position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; width: 5px; height: 36px; right: 0; top: 23px; border-radius: 5px 0 0 5px; background: #c9d4e4; }
.metric-card.accent::after { background: var(--green); }
.metric-card.warm::after { background: var(--amber); }
.metric-card > span { color: var(--muted); font-size: 13px; font-weight: 700; }
.metric-card strong { display: block; margin: 12px 0 5px; font-size: 35px; letter-spacing: -.035em; }
.metric-card small { color: #93a0b2; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr); gap: 20px; }
.surface-card { padding: 24px; }
.surface-card.compact { padding: 14px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-heading h3 { margin: 0; font-size: 18px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.text-link { border: 0; background: transparent; color: var(--blue); font-weight: 700; }
.recent-list { min-height: 240px; display: grid; align-content: start; }
.recent-item { display: grid; grid-template-columns: 45px minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 15px 3px; border-top: 1px solid #edf1f6; }
.recent-item:first-child { border-top: 0; }
.avatar { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-weight: 850; }
.recent-item div { min-width: 0; display: grid; gap: 4px; }
.recent-item strong, .recent-item small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.recent-item small { color: var(--muted); }
.status-badge { display: inline-flex; align-items: center; min-height: 27px; padding: 0 10px; border-radius: 20px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.status-badge.active { color: #087a4d; background: var(--green-soft); }
.status-badge.pending { color: #9a5a04; background: var(--amber-soft); }
.status-badge.expiring { color: #a35f05; background: var(--amber-soft); }
.status-badge.disabled, .status-badge.expired { color: #a94343; background: var(--red-soft); }
.health-visual { display: grid; place-items: center; min-height: 165px; }
.health-ring { width: 132px; height: 132px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: radial-gradient(circle at center, white 56%, transparent 57%), conic-gradient(var(--green) 0 100%, #edf1f5 0); }
.health-ring span { font-size: 25px; font-weight: 850; }
.health-ring small { color: var(--muted); }
.health-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.health-list li { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.health-list strong { color: #13794f; }
.health-list i { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--green); }

.queue-intro { min-height: 128px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 6px 4px 24px; }
.queue-intro h2 { margin: 0 0 8px; font-size: 26px; }
.queue-intro p:not(.eyebrow) { max-width: 680px; margin: 0; color: var(--muted); line-height: 1.7; }
.queue-count { display: grid; place-items: center; flex: 0 0 92px; min-height: 76px; color: #9a5a04; background: var(--amber-soft); border: 1px solid #efd39d; border-radius: 8px; }
.queue-count strong { font-size: 28px; line-height: 1; }
.queue-count span { font-size: 11px; font-weight: 750; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.toolbar > .muted { margin-left: auto; padding: 0 8px; font-size: 12px; }
.search-box { margin: 0 auto 0 0; width: min(340px, 32vw); display: flex; align-items: center; gap: 8px; padding: 0 11px; background: #f9fbfd; border: 1px solid var(--line); border-radius: 10px; }
.search-box input { border: 0; background: transparent; box-shadow: none; padding: 11px 0; }
.filter-tabs { display: flex; gap: 4px; padding: 4px; background: #f1f4f8; border-radius: 10px; }
.filter-tabs button { border: 0; border-radius: 7px; padding: 8px 11px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 750; }
.filter-tabs button.active { color: var(--ink); background: white; box-shadow: 0 2px 8px rgba(26,45,78,.08); }
.table-card { padding: 0; overflow: hidden; }
.table-heading { padding: 24px 24px 0; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1180px; }
.registration-table { min-width: 860px; }
th, td { padding: 16px 18px; border-top: 1px solid #edf1f6; text-align: left; vertical-align: middle; }
th { color: #7b899d; background: #fbfcfe; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
td { color: #43516a; font-size: 13px; }
th:last-child, td:last-child { position: sticky; right: 0; background: #ffffff; box-shadow: -10px 0 18px -18px rgba(20, 33, 61, 0.55); }
th:last-child { background: #fbfcfe; }
.account-cell { display: flex; align-items: center; gap: 11px; }
.account-cell div { display: grid; gap: 3px; }
.account-cell strong { color: var(--ink); font-size: 14px; }
.account-cell small { color: var(--muted); }
.align-right { text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: 7px; white-space: nowrap; }
.row-actions button { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; color: #405272; background: white; font-size: 12px; font-weight: 700; white-space: nowrap; }
#users-page th:last-child, #users-table-body td:last-child { min-width: 258px; }
.row-actions button:hover { border-color: #9eb3d2; color: var(--blue); }
.row-actions button.danger { color: var(--red); }
.review-button { min-height: 34px; padding: 0 15px; color: white; background: var(--blue); border: 1px solid var(--blue); border-radius: 8px; font-size: 12px; font-weight: 750; }
.review-button:hover { background: var(--blue-dark); }
.device-cell { display: grid; gap: 4px; }
.device-cell strong { color: var(--ink); font-size: 13px; }
.device-cell small { color: var(--muted); font-size: 11px; }
.kind-badge, .device-state { display: inline-flex; min-height: 26px; align-items: center; padding: 0 9px; color: #31517d; background: #eef3f9; border-radius: 7px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.kind-badge.temporary { color: #945906; background: var(--amber-soft); }
.device-state { color: #68778d; background: #f2f4f7; }
.device-state.bound { color: #087a4d; background: var(--green-soft); }
.empty-state { padding: 76px 20px; text-align: center; }
.empty-state div { font-size: 42px; color: #b2c1d8; }
.empty-state h3 { margin: 14px 0 7px; }
.empty-state p { margin: 0; color: var(--muted); }
.audit-timeline { display: grid; min-height: 300px; }
.audit-item { position: relative; display: grid; grid-template-columns: 150px 15px minmax(0,1fr); gap: 14px; min-height: 82px; }
.audit-item time { color: var(--muted); font-size: 12px; padding-top: 5px; text-align: right; }
.audit-line { position: relative; }
.audit-line::before { content: ""; position: absolute; width: 1px; inset: 18px 7px -6px; background: var(--line); }
.audit-line::after { content: ""; position: absolute; width: 9px; height: 9px; left: 3px; top: 7px; border: 2px solid white; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px #9dbbfa; }
.audit-item:last-child .audit-line::before { display: none; }
.audit-copy strong { display: block; margin-bottom: 5px; font-size: 14px; }
.audit-copy p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.toast-region { position: fixed; top: 22px; right: 24px; z-index: 80; display: grid; gap: 9px; }
.toast { min-width: 270px; max-width: 420px; padding: 13px 15px; border-radius: 11px; color: white; background: #1f314e; box-shadow: var(--shadow); animation: toast-in .2s ease; }
.toast.error { background: #a83b3b; }
.toast.success { background: #147a51; }
.modal-backdrop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background: rgba(10,20,38,.55); backdrop-filter: blur(5px); }
.modal { width: min(680px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: white; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 28px 90px rgba(5,16,35,.25); animation: modal-in .2s ease; }
.modal.modal-compact { width: min(520px, 100%); }
.modal > header { display: flex; justify-content: space-between; align-items: start; padding: 25px 27px 18px; border-bottom: 1px solid var(--line); }
.modal h2 { margin: 0; font-size: 23px; }
.modal form { padding: 5px 27px 0; }
.modal-intro { margin: 20px 0 4px; font-size: 13px; line-height: 1.7; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { margin: 22px 0 0; padding: 0; border: 0; }
.duration-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 9px; }
.duration-option { min-height: 68px; display: grid; gap: 4px; place-content: center; border: 1px solid var(--line); border-radius: 10px; color: #4c5c75; background: #fbfcfe; }
.duration-option strong { font-size: 13px; }
.duration-option small { color: var(--muted); font-size: 10px; }
.duration-option.active { color: var(--blue); background: var(--blue-soft); border-color: #8fb3ff; box-shadow: 0 0 0 2px rgba(36,107,254,.07); }
.account-kind-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 9px; }
.account-kind-option { min-height: 66px; display: grid; gap: 5px; align-content: center; padding: 10px 14px; text-align: left; color: #4c5c75; background: #fbfcfe; border: 1px solid var(--line); border-radius: 8px; }
.account-kind-option strong { font-size: 13px; }
.account-kind-option small { color: var(--muted); font-size: 10px; }
.account-kind-option.active { color: var(--blue); background: var(--blue-soft); border-color: #8fb3ff; box-shadow: 0 0 0 2px rgba(36,107,254,.07); }
.registration-durations { grid-template-columns: repeat(4, 1fr); }
.registration-applicant { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 14px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; }
.registration-applicant > div { display: grid; gap: 4px; }
.registration-applicant small { color: var(--muted); }
.decision-footer { align-items: center; }
.decision-footer > span { flex: 1; }
.danger-button { min-height: 42px; padding: 0 16px; color: #a93434; background: var(--red-soft); border: 1px solid #f0c8c8; border-radius: 8px; font-weight: 750; }
.danger-button:hover { background: #ffe5e5; border-color: #dfa6a6; }
.modal footer { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: flex-end; gap: 10px; margin: 26px -27px 0; padding: 18px 27px; background: #f8fafc; border-top: 1px solid var(--line); }
.mobile-only { display: none; }
.skeleton-list { background: linear-gradient(90deg, transparent, rgba(234,239,247,.75), transparent); background-size: 220% 100%; animation: shimmer 1.3s linear infinite; }

@keyframes pulse { 0%,100%{ opacity:.35; transform:scale(.8)} 50%{opacity:1; transform:scale(1)} }
@keyframes fade-up { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }
@keyframes modal-in { from{opacity:0;transform:translateY(8px) scale(.985)} to{opacity:1;transform:none} }
@keyframes toast-in { from{opacity:0;transform:translateX(10px)} to{opacity:1;transform:none} }
@keyframes shimmer { from{background-position:100% 0} to{background-position:-100% 0} }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-wrap: wrap; }
  .search-box { width: 100%; }
  .filter-tabs { order: 3; overflow-x: auto; }
}

@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-story { min-height: 43vh; padding: 28px; }
  .login-copy { margin: 8vh 0 5vh; }
  .login-copy h1 { font-size: clamp(36px, 10vw, 54px); }
  .trust-row { display: none; }
  .login-panel { padding: 24px; }
  .login-card { margin-top: -56px; position: relative; z-index: 2; padding: 28px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; translate: -100% 0; width: 260px; transition: translate .2s ease; box-shadow: 20px 0 50px rgba(10,20,38,.2); }
  .sidebar.open { translate: 0; }
  .sidebar-scrim { position: fixed; inset: 0 0 0 260px; z-index: 19; display: block; border: 0; padding: 0; background: rgba(10,20,38,.38); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .sidebar-scrim.visible { opacity: 1; pointer-events: auto; }
  .workspace { padding: 0 18px 32px; }
  .topbar { height: 92px; justify-content: flex-start; }
  .topbar-actions { margin-left: auto; }
  .profile-chip div, #refresh-button { display: none; }
  #settings-button { min-width: 42px; padding: 0 10px; }
  .mobile-only { display: inline-grid; place-items: center; }
  .hero-panel { min-height: 200px; padding: 28px; align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .duration-grid { grid-template-columns: repeat(2, 1fr); }
  .registration-durations { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
}

@media (max-width: 520px) {
  .topbar h1 { font-size: 21px; }
  .profile-chip { padding-left: 0; border: 0; }
  .hero-panel { padding: 24px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 116px; }
  .toolbar > .primary-button { width: 100%; }
  .pending-alert { grid-template-columns: 30px minmax(0, 1fr); }
  .pending-alert b { grid-column: 2; }
  .queue-intro { align-items: flex-start; }
  .queue-count { flex-basis: 76px; min-height: 68px; }
  .filter-tabs { width: 100%; }
  .filter-tabs button { flex: 0 0 auto; }
  .audit-item { grid-template-columns: 12px 1fr; gap: 12px; }
  .audit-item time { grid-column: 2; text-align: left; padding: 0; order: 2; }
  .audit-line { grid-row: 1 / 3; }
  .audit-copy { grid-column: 2; grid-row: 1; }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); }
  .modal > header, .modal form { padding-left: 19px; padding-right: 19px; }
  .modal footer { margin-left: -19px; margin-right: -19px; padding-left: 19px; padding-right: 19px; }
  .decision-footer { flex-wrap: wrap; }
  .decision-footer > span { display: none; }
  .decision-footer button { flex: 1 1 calc(50% - 6px); }
  .account-kind-grid, .registration-durations { grid-template-columns: 1fr 1fr; }
}

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