:root {
  --nav: #0b1628;
  --nav-soft: #13223a;
  --primary: #075985;
  --primary-hover: #06496d;
  --primary-soft: #e0f2fe;
  --accent: #15803d;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --warning: #a16207;
  --warning-soft: #fefce8;
  --surface: #ffffff;
  --background: #f4f7fb;
  --border: #dbe3ee;
  --text: #172033;
  --text-secondary: #526176;
  --text-muted: #718096;
  --shadow: 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 12px;
  --sidebar-width: 248px;
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: var(--text);
  background: var(--background);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--background); }
body { margin: 0; min-height: 100vh; overflow-x: hidden; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(14, 165, 233, .3); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#i-grid path { fill: currentColor; stroke: none; }
.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; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; background: radial-gradient(circle at 50% 0, #173760 0, var(--nav) 42%, #07101e 100%); }
.auth-panel { width: min(100%, 460px); padding: 40px; border-radius: 18px; background: var(--surface); box-shadow: 0 30px 80px rgba(0, 0, 0, .32); }
.auth-panel > .brand-mark { margin-bottom: 22px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: #fff; background: #0ea5e9; }
.brand-mark.large { width: 52px; height: 52px; border-radius: 14px; }
.brand-mark.large svg { width: 28px; height: 28px; }
.eyebrow { margin: 0 0 5px; font-size: 11px; line-height: 1.4; font-weight: 700; letter-spacing: .14em; color: var(--primary); }
.auth-panel h1 { margin: 0; font-size: 27px; line-height: 1.25; letter-spacing: -.02em; }
.auth-description { margin: 8px 0 28px; color: var(--text-secondary); }
.auth-form { display: grid; gap: 17px; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 24px 0 0; padding-top: 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.auth-foot svg { width: 16px; height: 16px; color: var(--accent); }
.notice { display: flex; gap: 10px; padding: 12px; border: 1px solid #bae6fd; border-radius: 9px; background: #f0f9ff; font-size: 13px; color: #0c4a6e; }
.notice svg { flex: 0 0 auto; width: 18px; }

label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #334155; }
label > span, legend > span { margin-left: 3px; color: var(--danger); }
input, select, textarea { width: 100%; min-height: 43px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 9px 11px; color: var(--text); background: #fff; transition: border-color .18s ease, box-shadow .18s ease; }
textarea { resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:focus, select:focus, textarea:focus { border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14, 165, 233, .12); outline: none; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
label small { min-height: 0; font-weight: 400; color: var(--text-muted); }
label small:empty { display: none; }
small[data-error]:not(:empty) { color: var(--danger); }
.form-alert { padding: 10px 12px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 13px; }

.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; border: 1px solid transparent; border-radius: 8px; font-weight: 650; font-size: 14px; transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease; }
.button svg { width: 18px; height: 18px; }
.button.primary { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(7, 89, 133, .18); }
.button.primary:hover { background: var(--primary-hover); }
.button.secondary { border-color: #cbd5e1; background: #fff; color: #334155; }
.button.secondary:hover { border-color: #94a3b8; background: #f8fafc; }
.button.danger { background: var(--danger); color: #fff; }
.button.danger:hover { background: #991b1b; }
.button.full { width: 100%; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border: 0; border-radius: 8px; color: inherit; background: transparent; transition: background .18s ease; }
.icon-button:hover { background: rgba(148, 163, 184, .14); }
.text-button { min-height: 38px; border: 0; padding: 7px 4px; background: transparent; color: var(--primary); font-weight: 650; }
.text-button svg { width: 15px; height: 15px; margin-right: 4px; vertical-align: -3px; }
.text-button:hover { color: var(--primary-hover); text-decoration: underline; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 20px 14px 14px; color: #dbeafe; background: var(--nav); }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 26px; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: 15px; color: #fff; }
.sidebar-brand span { margin-top: 1px; font: 500 10px/1.4 Consolas, monospace; letter-spacing: .09em; color: #7f9ab9; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { position: relative; width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 8px; padding: 9px 12px; text-align: left; color: #9eb2ca; background: transparent; transition: background .18s ease, color .18s ease; }
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { color: #e5f2ff; background: rgba(255, 255, 255, .06); }
.nav-item.active { color: #fff; background: #164e73; }
.nav-item.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 22px; border-radius: 0 2px 2px 0; background: #38bdf8; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; border-radius: 10px; color: #fde68a; background: rgba(161, 98, 7, .35); font-size: 11px; }
.sidebar-security { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 12px; border: 1px solid rgba(56, 189, 248, .12); border-radius: 9px; background: rgba(14, 165, 233, .06); }
.sidebar-security strong, .sidebar-security small { display: block; }
.sidebar-security strong { font-size: 12px; color: #cbeafe; }
.sidebar-security small { margin-top: 2px; font-size: 10px; color: #718ba8; }
.status-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .12); }
.status-dot.needs-attention { background: #d97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, .12); }
.sidebar-user { display: grid; grid-template-columns: 34px 1fr 36px; align-items: center; gap: 9px; margin-top: 12px; padding: 13px 5px 2px; border-top: 1px solid rgba(148, 163, 184, .14); }
.sidebar-user strong, .sidebar-user small { display: block; }
.sidebar-user strong { overflow: hidden; color: #f8fafc; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { color: #718ba8; font-size: 10px; }
.sidebar-user .icon-button { width: 36px; height: 36px; color: #7f9ab9; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #1e3a5f; color: #e0f2fe; font-weight: 700; font-size: 13px; }

.content-shell { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 30px; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .95); }
.topbar p { margin: 0 0 2px; color: var(--text-muted); font-size: 11px; }
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.topbar-meta { display: flex; align-items: center; gap: 20px; font-size: 12px; color: var(--text-secondary); }
.topbar-meta span { display: flex; align-items: center; gap: 8px; }
.topbar-meta b { font-weight: 500; color: var(--text-muted); }
.main-content { max-width: 1520px; margin: 0 auto; padding: 28px 30px 48px; }
.page { display: none; }
.page.active { display: block; animation: page-in .18s ease-out; }
@keyframes page-in { from { opacity: .35; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.hero-row, .section-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 23px; }
.hero-row h2, .section-toolbar h2 { margin: 0; font-size: 25px; line-height: 1.3; letter-spacing: -.025em; }
.hero-row p:last-child, .section-toolbar p:last-child { margin: 5px 0 0; color: var(--text-secondary); font-size: 14px; }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { min-height: 116px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); color: var(--text); text-align: left; }
.metric:hover { border-color: var(--primary); }
.metric:active { background: var(--primary-soft); }
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-secondary); font-size: 12px; }
.metric-head span:last-child { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--primary); background: var(--primary-soft); }
.metric-head svg { width: 16px; height: 16px; }
.metric strong { display: block; margin-top: 10px; font: 700 27px/1.1 Consolas, "Segoe UI", sans-serif; letter-spacing: -.03em; }
.metric small { display: block; margin-top: 7px; color: var(--text-muted); }
.metric.warning .metric-head span:last-child { color: var(--warning); background: var(--warning-soft); }
.metric.warning strong { color: #854d0e; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, .75fr); gap: 18px; }
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card-head { min-height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 19px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; font-size: 15px; }
.card-head p { margin: 2px 0 0; color: var(--text-muted); font-size: 11px; }
.recent-list { display: grid; }
.recent-row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) 110px 88px; align-items: center; gap: 14px; min-height: 68px; padding: 12px 19px; border-bottom: 1px solid #edf1f6; font-size: 12px; }
.recent-row:last-child { border-bottom: 0; }
.recent-row strong, .recent-row small { display: block; }
.recent-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.recent-row small { margin-top: 2px; color: var(--text-muted); }
.security-list { display: grid; padding: 5px 18px; }
.security-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 14px 0; border-bottom: 1px solid #edf1f6; }
.security-item:last-child { border: 0; }
.security-item > span { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: #ecfdf5; }
.security-item.needs-attention > span { color: #92400e; background: #fffbeb; }
.security-item svg { width: 15px; height: 15px; }
.security-item strong, .security-item small { display: block; }
.security-item strong { font-size: 12px; }
.security-item small { margin-top: 2px; color: var(--text-muted); font-size: 11px; }

.table-card { overflow: hidden; }
.table-tools { min-height: 65px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 12px; }
.table-tools > span:last-child { margin-left: auto; }
.search-box { position: relative; width: min(380px, 100%); display: block; }
.search-box svg { position: absolute; top: 12px; left: 11px; width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
.search-box input { min-height: 42px; padding-left: 38px; font-size: 13px; }
.table-tools select { width: 132px; min-height: 42px; font-size: 13px; }
#license-software-filter { width: 220px; max-width: 100%; }
.license-count-link { white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { height: 42px; padding: 9px 16px; text-align: left; white-space: nowrap; color: var(--text-muted); background: #f8fafc; border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 650; }
td { min-height: 60px; padding: 13px 16px; border-bottom: 1px solid #edf1f6; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdff; }
td strong, td small { display: block; }
td strong { font-size: 13px; }
td small { margin-top: 3px; color: var(--text-muted); }
.code { font-family: Consolas, "SFMono-Regular", monospace; color: #334155; font-size: 12px; font-variant-numeric: tabular-nums; }
.action-column { width: 95px; text-align: right; }
td.action-column .text-button { min-height: 34px; padding: 5px 7px; font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 3px 8px; border-radius: 12px; white-space: nowrap; font-size: 11px; font-weight: 650; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.active { color: #166534; background: #ecfdf5; }
.status.disabled, .status.revoked { color: #6b7280; background: #f1f5f9; }
.status.suspended, .status.expired { color: #991b1b; background: #fef2f2; }
.status.scheduled { color: #854d0e; background: #fefce8; }
.empty-state { padding: 56px 20px; text-align: center; color: var(--text-muted); }
.empty-state svg { width: 32px; height: 32px; margin-bottom: 8px; color: #94a3b8; }
.empty-state strong { display: block; color: var(--text-secondary); }
.empty-state p { margin: 5px 0 0; font-size: 13px; }
.integrity-badge { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 8px; color: #166534; background: #ecfdf5; font-size: 12px; font-weight: 650; }
.integrity-badge.failed { color: #991b1b; background: #fef2f2; }
.audit-action { display: inline-block; padding: 3px 7px; border-radius: 5px; color: #334155; background: #f1f5f9; font: 600 11px/1.5 Consolas, monospace; }

.modal { width: min(600px, calc(100vw - 28px)); max-height: calc(100vh - 40px); border: 0; border-radius: 14px; padding: 0; color: var(--text); box-shadow: 0 28px 90px rgba(15, 23, 42, .28); }
.modal.wide { width: min(760px, calc(100vw - 28px)); }
.modal.small { width: min(480px, calc(100vw - 28px)); }
.status-form > label, .status-form > .form-grid { margin-top: 16px; }
.client-preview { margin-top: 16px; padding: 14px; border: 1px solid #fde68a; border-radius: 8px; background: var(--warning-soft); color: var(--warning); overflow-wrap: anywhere; }
.client-preview strong { font-size: 12px; }
.client-preview p { margin: 6px 0 0; white-space: pre-wrap; }
#license-table .client-note { max-width: 260px; min-width: 120px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--warning); }
#license-table .action-column { min-width: 112px; }
.danger-text { color: var(--danger); }
.modal::backdrop { background: rgba(7, 16, 30, .58); backdrop-filter: blur(2px); }
.modal form { padding: 0 24px 22px; }
.modal-head { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-head .icon-button { margin-right: -8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.form-grid.compact { margin-top: 17px; }
.span-2 { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
.step-note { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; margin-bottom: 13px; }
.step-note > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--primary); background: var(--primary-soft); font: 700 12px Consolas, monospace; }
.step-note strong, .step-note small { display: block; }
.step-note strong { font-size: 13px; }
.step-note small { color: var(--text-muted); font-size: 11px; }
.divider { height: 1px; margin: 20px 0; background: var(--border); }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
fieldset { min-width: 0; display: grid; gap: 8px; border: 0; margin: 0; padding: 0; }
legend { margin-bottom: 8px; font-size: 13px; font-weight: 650; color: #334155; }
.choice { min-height: 58px; display: grid; grid-template-columns: 18px 1fr; align-items: center; gap: 10px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 9px 11px; cursor: pointer; }
.choice:hover { border-color: #7dd3fc; background: #f8fcff; }
.choice:has(input:checked) { border-color: #0ea5e9; background: #f0f9ff; box-shadow: 0 0 0 1px #0ea5e9; }
.choice input { width: 16px; min-height: 16px; margin: 0; accent-color: var(--primary); }
.choice strong, .choice small { display: block; }
.choice strong { color: var(--text); font-size: 12px; }
.choice small { margin-top: 1px; color: var(--text-muted); font-size: 10px; font-weight: 400; }
.warning-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 15px; padding: 11px 12px; border: 1px solid #fde68a; border-radius: 8px; color: #854d0e; background: var(--warning-soft); font-size: 12px; }
.warning-note svg { width: 18px; height: 18px; flex: 0 0 auto; }
.key-modal { padding: 30px; }
.key-success { text-align: center; }
.key-success > span { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 50%; color: var(--accent); background: #ecfdf5; }
.key-success > span svg { width: 25px; height: 25px; }
.key-success h2 { margin: 0; font-size: 21px; }
.key-success > p:last-child { margin: 7px 0 18px; color: var(--text-secondary); font-size: 13px; }
.key-box { padding: 16px; border: 1px solid #bae6fd; border-radius: 10px; background: #f0f9ff; }
.key-box small { display: block; margin-bottom: 8px; color: var(--text-muted); font: 600 11px Consolas, monospace; }
.key-box code { display: block; overflow-wrap: anywhere; color: #0c4a6e; font: 700 14px/1.65 Consolas, monospace; }
.key-box .button { width: 100%; margin-top: 13px; }
.key-box code + small { margin-top: 18px; }
#software-form > .form-grid + .form-grid { margin-top: 17px; }
.activation-fields { margin-bottom: 17px; }
.activation-fields > label, #software-form > .form-grid:first-of-type > label { align-content: start; }
.key-modal > .button { margin-top: 20px; }

.toast-region { position: fixed; z-index: 100; right: 22px; bottom: 22px; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 260px; max-width: 420px; display: flex; align-items: center; gap: 9px; padding: 12px 14px; border: 1px solid #bbf7d0; border-radius: 9px; color: #166534; background: #f0fdf4; box-shadow: 0 14px 40px rgba(15, 23, 42, .15); font-size: 13px; animation: toast-in .2s ease-out; }
.toast.error { border-color: #fecaca; color: #991b1b; background: #fef2f2; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(7, 16, 30, .5); }
.mobile-only { display: none; }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric:nth-child(4), .metric:nth-child(5) { grid-column: span 1; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease-out; }
  .sidebar.open { transform: translateX(0); }
  .content-shell { margin-left: 0; }
  .mobile-only { display: grid; }
  .topbar { height: 76px; justify-content: flex-start; padding: 12px 18px; }
  .topbar-meta { margin-left: auto; }
  .topbar-meta span { display: none; }
  .main-content { padding: 22px 18px 40px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recent-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 80px; }
  .recent-row > :nth-child(3) { display: none; }
}

@media (max-width: 560px) {
  .auth-panel { padding: 28px 22px; }
  .auth-panel h1 { font-size: 23px; }
  .topbar { padding: 10px 12px; }
  .topbar h1 { font-size: 18px; }
  .topbar-meta b { display: none; }
  .main-content { padding: 18px 12px 34px; }
  .hero-row, .section-toolbar { align-items: stretch; flex-direction: column; gap: 14px; }
  .hero-row .button, .section-toolbar .button { width: 100%; }
  .hero-row h2, .section-toolbar h2 { font-size: 22px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric { min-height: 105px; padding: 14px; }
  .metric strong { font-size: 23px; }
  .metric:last-child { grid-column: 1 / -1; }
  .card-head { padding: 14px; }
  .recent-row { grid-template-columns: 1fr 80px; padding: 12px 14px; }
  .recent-row > :nth-child(2), .recent-row > :nth-child(3) { display: none; }
  .table-tools { align-items: stretch; flex-wrap: wrap; padding: 12px; }
  .search-box { width: 100%; }
  .table-tools > span:last-child { margin-left: 0; align-self: center; }
  th, td { padding-left: 12px; padding-right: 12px; }
  .form-grid, .choice-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .modal { max-height: calc(100vh - 18px); }
  .modal form { padding: 0 18px 18px; }
  .modal-head { position: sticky; top: 0; z-index: 2; margin-bottom: 17px; background: #fff; }
  .modal-actions { position: sticky; bottom: 0; margin-left: -18px; margin-right: -18px; margin-bottom: -18px; padding: 14px 18px; background: #fff; }
  .modal-actions .button { flex: 1; }
  .key-modal { padding: 24px 18px; }
  .toast-region { inset: auto 12px 12px; }
  .toast { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* Console account management uses the existing form and table visual language. */
.settings-card { max-width: 760px; padding: 28px; }
.settings-card label { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.form-help { color: var(--muted, #64748b); line-height: 1.7; font-size: 14px; }
.device-list { display: grid; gap: 16px; margin: 20px 0; }
.device-entry { border: 1px solid #dce5ef; border-radius: 10px; padding: 16px; overflow-wrap: anywhere; }
.device-entry small { display: block; margin-top: 8px; color: #64748b; }
.device-entry .modal-actions { justify-content: flex-start; flex-wrap: wrap; }
.sidebar nav { overflow-y: auto; min-height: 0; }
@media (max-width: 600px) { .settings-card { padding: 18px; } }
.device-dialog { padding: 24px; }
.offline-permit-note { color: #8a5200; }
.readiness-alert { margin-bottom: 18px; line-height: 1.7; }
.content-shell { display: flex; flex-direction: column; }
.main-content { flex: 1; width: 100%; }
.topbar { min-height: 88px; height: auto; }
.topbar > div:first-of-type { min-width: 0; overflow-wrap: anywhere; }
.sidebar-brand > div:last-child, .sidebar-user > div { min-width: 0; }
.sidebar-brand strong { overflow-wrap: anywhere; }
.brand-mark, .avatar { flex-shrink: 0; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.auth-shell { position: relative; isolation: isolate; grid-template-rows: 1fr auto; gap: 24px; }
.auth-panel { position: relative; margin: auto 0; overflow-wrap: anywhere; }
.auth-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; pointer-events: none; }
.auth-background.fit-contain { object-fit: contain; }
.auth-shell.login-left .auth-panel { justify-self: start; margin-left: max(0px, calc((100vw - 1280px) / 2)); }
.auth-shell.login-right .auth-panel { justify-self: end; margin-right: max(0px, calc((100vw - 1280px) / 2)); }
.site-footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 24px; padding: 18px 24px; font-size: 12px; color: var(--text-secondary); line-height: 1.7; overflow-wrap: anywhere; }
.site-footer > span { white-space: pre-line; }
.site-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 18px; }
.site-footer a { color: var(--primary); display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.auth-shell > .site-footer { position: relative; width: min(100%, 1100px); color: #fff; border-radius: 9px; background: rgba(7, 16, 30, .88); }
.auth-shell > .site-footer a { color: #bae6fd; }
.appearance-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .9fr); gap: 22px; align-items: start; }
.appearance-layout .settings-card { width: 100%; max-width: none; }
.appearance-preview-card { padding: 24px; position: sticky; top: 20px; min-width: 0; }
.appearance-preview-card h3, .settings-card h3 { margin: 0 0 12px; font-size: 17px; }
.field-title { font-weight: inherit; }
.field-title span { color: #b42318; }
#branding-form > h3:not(:first-child) { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.image-setting { display: flex; align-items: center; gap: 18px; }
.image-setting > div:last-child { flex: 1; min-width: 0; }
.image-setting .image-preview, .profile-avatar { width: 72px; height: 72px; font-size: 24px; }
.settings-card input[type="file"] { width: 100%; max-width: 100%; min-height: 44px; height: auto; padding: 8px; font-size: 12px; }
.settings-card input[type="file"]::file-selector-button { cursor: pointer; padding: 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); margin-right: 8px; }
.profile-details-card { margin-bottom: 22px; }
.settings-card .button, .danger-text { min-height: 44px; }
.settings-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.save-status { color: var(--primary); font-size: 13px; min-height: 22px; margin: 18px 0 0; }
.footer-link-row { display: grid; grid-template-columns: minmax(90px, .7fr) minmax(130px, 1.3fr) auto; gap: 10px; align-items: end; padding: 10px 0; border-top: 1px solid var(--border); }
.footer-link-row label { margin: 0; }
.branding-preview { display: flex; justify-content: center; align-items: center; position: relative; isolation: isolate; min-height: 340px; border-radius: 10px; padding: 22px 16px; background: var(--nav); overflow: hidden; }
.branding-preview.login-left { justify-content: flex-start; }
.branding-preview.login-right { justify-content: flex-end; }
.preview-login { width: 230px; max-width: 100%; padding: 20px; border-radius: 8px; background: var(--surface); overflow-wrap: anywhere; }
.preview-login strong { display: block; margin-top: 14px; font-size: 15px; white-space: pre-line; }
.preview-login p { color: var(--text-secondary); font-size: 11px; white-space: pre-line; }
.preview-field { margin-top: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--text-secondary); }
.preview-submit { margin-top: 16px; background: var(--primary); color: white; padding: 9px; text-align: center; border-radius: 6px; font-size: 12px; }
.appearance-preview-card .site-footer { padding: 12px 0 0; }
.auth-description { white-space: pre-line; }
.danger-text { color: #b42318; }
.deleted-note { color: var(--text-secondary); }
.delete-confirm { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; line-height: 1.7; }
.delete-confirm input { width: 20px; height: 20px; flex-shrink: 0; margin-top: 3px; }
.deletion-reasons { padding-left: 22px; color: #92400e; line-height: 1.8; }
.user-identity { display: flex; gap: 10px; align-items: center; }
.user-identity .avatar { width: 32px; height: 32px; }
.profile-readout dt { font-size: 12px; color: var(--text-secondary); margin-top: 16px; }
.profile-readout dd { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .appearance-layout { grid-template-columns: 1fr; } .appearance-preview-card { position: static; } }
@media (max-width: 600px) {
  .auth-shell.login-left .auth-panel, .auth-shell.login-right .auth-panel { justify-self: center; margin-left: 0; margin-right: 0; }
  .topbar { min-height: 76px; }
  .footer-link-row { grid-template-columns: 1fr; }
  .footer-link-row .button { justify-self: end; }
  .settings-actions { flex-direction: column-reverse; }
  .settings-actions .button { width: 100%; }
  .image-setting { flex-wrap: wrap; }
  .image-setting > div:last-child { min-width: 190px; }
  .site-footer { padding: 14px 12px; text-align: center; }
  .appearance-preview-card { padding: 18px; }
}
#refresh-status { min-height: 44px; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .sidebar, .page.active, .toast { transition: none; animation: none; }
}
