/* Design tokens — Shell v2 (xem docs/design/03-PLAN-A-thiet-ke-shell-v2.md mục 2). Đổi --accent là đổi màu nhấn toàn app. */
:root {
  color-scheme: light dark;
  /* bề mặt */
  --bg: #f5f7f8; --surface: #ffffff; --surface-2: #fbfcfb; --hover: #f3f6f4;
  --line: #e3e9e6; --line-strong: #d4dcd8;
  /* chữ */
  --text: #12211a; --muted: #5b6f66; --faint: #64786c;
  /* màu nhấn */
  --accent: #0e6b45; --accent-hover: #0b5a3a; --accent-soft: #e7f2ec; --accent-line: #bfdccd; --on-accent: #ffffff;
  /* ngữ nghĩa */
  --danger: #a83226; --danger-soft: #fbeae8;
  --warn: #a15c07; --warn-soft: #fdf3e3;
  --info: #1e5f8a; --info-soft: #eaf2f8;
  --ok: #2f8a5b; --ok-soft: #e9f4ee;
  /* hình dạng */
  --r-card: 12px; --r-ctl: 8px; --r-tag: 5px;
  --shadow: 0 1px 2px rgba(16,24,20,.04);
  /* chữ */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-h1: 24px; --fs-h2: 20px; --fs-section: 13px; --fs-body: 14px; --fs-sm: 12.5px; --fs-xs: 11px;
  --lh: 1.55;
  --banner-h: 32px; --topbar-h: 52px; --sidebar-w: 244px;
  /* bí danh cho tên biến cũ (module và trang khác còn dùng) */
  --brand: var(--accent); --brand-text: var(--on-accent); --brand-soft: var(--accent-soft); --field-line: var(--line-strong);
  --warn-bg: var(--warn-soft); --warn-text: var(--warn);
  --error-bg: var(--danger-soft); --error-text: var(--danger);
  --ok-bg: var(--ok-soft); --ok-text: #1f6b44;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1310; --surface: #121a15; --surface-2: #0f1612; --hover: #1a2620;
    --line: #22302a; --line-strong: #31443b;
    --text: #e6efe9; --muted: #9fb4a8; --faint: #82998b;
    --accent: #3dbb7e; --accent-hover: #4ccf8d; --accent-soft: #15301f; --accent-line: #2a5138; --on-accent: #06210f;
    --danger: #ff8f84; --danger-soft: #3a1a16;
    --warn: #f0b45a; --warn-soft: #3a2a0c;
    --info: #7ec0e8; --info-soft: #12283a;
    --ok: #5fcb95; --ok-soft: #12301f;
    --shadow: none;
    --ok-text: #5fcb95;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 var(--fs-body)/var(--lh) var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body.nav-open { overflow: hidden; }
a { color: var(--accent); }
h1 { font-size: var(--fs-h1); font-weight: 600; letter-spacing: -.015em; margin: 0 0 1rem; line-height: 1.25; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 .5rem; }
.icon { width: 18px; height: 18px; flex: none; }
.skip-link { position: absolute; left: .75rem; top: -4rem; z-index: 100; padding: .6rem 1rem; background: var(--accent); color: var(--on-accent); border-radius: var(--r-ctl); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: .75rem; }
/* Băng demo dính trên cùng: menu trái và thanh trên điện thoại nằm ngay dưới nó. */
.demo-banner { position: sticky; top: 0; z-index: 40; height: var(--banner-h); padding: 0 1rem; line-height: calc(var(--banner-h) - 1px); background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--line); text-align: center; font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body:has(.demo-banner) .sidebar { top: var(--banner-h); height: calc(100vh - var(--banner-h)); height: calc(100dvh - var(--banner-h)); }

/* Khung: thanh bên + nội dung */
.layout { display: flex; align-items: flex-start; min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; gap: 22px; width: var(--sidebar-w); height: 100vh; height: 100dvh; flex: none; padding: 14px 12px; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 2px 6px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: var(--text); text-decoration: none; border-radius: var(--r-ctl); }
.brand-mark { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; background: var(--accent); color: var(--on-accent); border-radius: var(--r-ctl); }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-name { font-size: 13.5px; font-weight: 600; }
.brand-sub { color: var(--faint); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-section { margin-bottom: 18px; }
.nav-section:last-child { margin-bottom: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar li a, .admin-link { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--r-ctl); color: var(--muted); font-size: 13.5px; font-weight: 500; text-decoration: none; }
.sidebar li a:hover, .admin-link:hover { background: var(--hover); color: var(--text); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.admin-link { height: 34px; font-size: 13px; font-weight: 400; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.user-card form { margin: 0; }
.avatar { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: none; background: var(--accent-soft); color: var(--accent); border-radius: 50%; font-size: 11.5px; font-weight: 700; }
.user-info { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.user-name { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { color: var(--faint); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; padding: 0; background: none; border: 0; border-radius: var(--r-ctl); color: var(--muted); }
.icon-button:hover { background: var(--hover); color: var(--text); }
.user-card .icon-button { width: 30px; height: 30px; color: var(--faint); }
.topbar, .sidebar-close, .backdrop { display: none; }
.content { flex: 1; min-width: 0; max-width: 72rem; padding: 26px 32px 40px; }
.content > h1 { margin-bottom: 1.25rem; }
/* Đầu trang: ngày/đường dẫn nhỏ, tiêu đề, mô tả */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin: 0; line-height: 1.2; }
.crumb { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--faint); font-size: 11.5px; }
.sub { margin: 5px 0 0; color: var(--muted); font-size: var(--fs-sm); }

/* Tổng quan: thẻ KPI, khung nội dung, hoạt động gần đây */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { position: relative; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { margin: 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi-icon { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: none; background: var(--hover); color: var(--muted); border-radius: 7px; }
.kpi-icon .icon { width: 14px; height: 14px; }
.kpi-value { display: block; margin-top: 6px; color: var(--text); font-size: 25px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; font-variant-numeric: tabular-nums; text-decoration: none; }
.kpi-value::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-card); }
.kpi-value:focus-visible { outline: none; }
.kpi-value:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }
.kpi:has(.kpi-value:hover) { border-color: var(--line-strong); }
.kpi-value.is-danger { color: var(--danger); }
.kpi-note { margin-top: 2px; color: var(--faint); font-size: 11.5px; }
.kpi-note.warn { color: var(--warn); }
.kpi-note.danger { color: var(--danger); }
.cols { display: grid; grid-template-columns: minmax(0, 2.05fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); }
.panel-wide, .cols > .panel:only-child { grid-column: 1 / -1; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 6px 16px; border-bottom: 1px solid var(--line); }
.panel-title { margin: 0; font-size: var(--fs-section); font-weight: 600; }
.panel-link { display: inline-flex; align-items: center; min-height: 24px; color: var(--accent); font-size: 12px; font-weight: 500; text-decoration: none; }
.panel-link:hover { text-decoration: underline; }
.panel-empty { margin: 0; padding: 16px; color: var(--muted); font-size: var(--fs-sm); }
.panel-foot { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--faint); font-size: 12px; }
.act { list-style: none; margin: 0; padding: 4px 0; }
.act li { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 7px 16px; }
.act li:hover { background: var(--hover); }
.act .avatar { width: 26px; height: 26px; font-size: 10px; }
.act-text { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.35; overflow-wrap: anywhere; }
.act-text strong { font-weight: 600; }
.act-time { flex: none; color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
@media (max-width: 1100px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
}

/* Thẻ, lưới, biểu mẫu */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: .65rem; margin-bottom: .75rem; }
.card-head h2 { margin: 0; font-size: var(--fs-section); }
.card-icon { display: flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; flex: none; background: var(--accent-soft); color: var(--accent); border-radius: var(--r-ctl); }
.card-icon .icon { width: 1.1rem; height: 1.1rem; }
.narrow { width: 100%; max-width: 26rem; }
.center-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem 1rem; }
.stack { display: flex; flex-direction: column; gap: .85rem; }
.stack h1 { margin-bottom: 0; }
.section-title { margin: 1.75rem 0 .75rem; font-size: 1rem; }
label { display: block; font-weight: 600; font-size: var(--fs-sm); margin-bottom: .3rem; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"], input[type="search"], select, textarea { width: 100%; min-height: 40px; padding: 0 12px; font: inherit; font-size: var(--fs-body); color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-ctl); transition: border-color .15s ease; }
textarea { padding: 8px 12px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; cursor: pointer; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; height: 36px; padding: 0 14px; background: var(--accent); color: var(--on-accent); border: 1px solid transparent; border-radius: var(--r-ctl); font-size: 13px; font-weight: 600; text-decoration: none; transition: background-color .15s ease; }
.primary:hover { background: var(--accent-hover); }
.secondary, .btn-secondary { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; height: 36px; padding: 0 14px; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-ctl); font-size: 13px; font-weight: 600; text-decoration: none; transition: background-color .15s ease; }
.secondary:hover, .btn-secondary:hover { background: var(--hover); }
.block, .block .primary { width: 100%; }
.link-button { min-height: 40px; background: none; border: 0; border-radius: var(--r-ctl); color: var(--muted); padding: .25rem .75rem; font-size: var(--fs-sm); text-decoration: none; }
.link-button:hover { color: var(--accent); }
.secondary-form { margin: .25rem 0 0; text-align: center; }
.muted { color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.message { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--info); border-radius: var(--r-ctl); background: var(--info-soft); color: var(--text); margin: 0 0 1rem; font-weight: 500; font-size: var(--fs-sm); }
.message .icon { margin-top: .1rem; width: 16px; height: 16px; color: var(--info); }
.stack .message { margin: 0; }
.message-success { background: var(--ok-soft); border-left-color: var(--ok); }
.message-success .icon { color: var(--ok); }
.message-error { background: var(--danger-soft); border-left-color: var(--danger); }
.message-error .icon { color: var(--danger); }
.message-warning { background: var(--warn-soft); border-left-color: var(--warn); }
.message-warning .icon { color: var(--warn); }
.plain-list { list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.plain-list li { padding: .25rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.plain-list li:last-child { border-bottom: 0; }
.helptext { font-size: 12px; color: var(--faint); }
.errorlist { font-size: 12px; color: var(--danger); list-style: none; padding: 0; margin: .25rem 0; font-weight: 600; }
.helptext ul { margin: .25rem 0 0; padding-left: 1.1rem; }
/* Form Django (as_div): đưa ô nhập lên ngay dưới nhãn, lỗi và gợi ý nằm bên dưới ô. */
.stack > div { display: flex; flex-direction: column; }
.stack > div > input, .stack > div > select, .stack > div > textarea { order: 1; }
.stack > div > .errorlist { order: 2; }
.stack > div > .helptext { order: 3; margin-top: .4rem; }
.stack > div:has(> input[type="checkbox"]) { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: .6rem; padding: .75rem .9rem; background: var(--warn-soft); color: var(--text); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: var(--r-ctl); }
.stack > div > input[type="checkbox"] { order: -1; width: 1.25rem; height: 1.25rem; min-height: 0; margin: .1rem 0 0; flex: none; accent-color: var(--accent); }
.stack > div:has(> input[type="checkbox"]) > label { flex: 1; margin: 0; font-weight: 400; }
/* Đổi mật khẩu */
.pw-card { max-width: 480px; }
.pw-body { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.pw-body .message { margin: 0; }
.pw-field-row { display: flex; flex-direction: column; }
.pw-field-row .errorlist { margin: .35rem 0 0; }
.pw-field-row .helptext { margin: .4rem 0 0; color: var(--muted); }
.pw-field-row .password-toggle { color: var(--muted); }
.pw-field-row .password-toggle:hover { color: var(--accent); }
.pw-field-row .password-toggle:focus-visible { outline-color: var(--accent); }
.pw-xacnhan { display: flex; align-items: flex-start; gap: .6rem; padding: .75rem .9rem; background: var(--warn-soft); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: var(--r-ctl); }
.pw-xacnhan input { width: 1.25rem; height: 1.25rem; min-height: 0; margin: .1rem 0 0; flex: none; accent-color: var(--accent); }
.pw-xacnhan label { flex: 1; margin: 0; font-weight: 400; }
.pw-gui { align-self: flex-start; }
@media (max-width: 520px) { .pw-gui { align-self: stretch; height: 40px; } }
/* Trang tổng quan */
.checklist { list-style: none; margin: 0 0 1.25rem; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.checklist li { display: flex; align-items: flex-start; gap: .6rem; line-height: 1.5; }
.checklist .icon { width: 16px; height: 16px; flex: none; margin-top: .25rem; color: var(--accent); }
/* Quy chế và trang lỗi */
.terms-card { width: 100%; max-width: 640px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); }
.terms-card h1 { margin: 0 0 1rem; }
.terms-body { max-height: min(60vh, 480px); overflow-y: auto; margin-bottom: 1rem; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-ctl); }
.terms-list { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .6rem; line-height: 1.5; }
.terms-accept .primary, .terms-accept + .secondary-form .link-button { width: 100%; height: 40px; }
.error-card { width: 100%; max-width: 440px; padding: 28px 24px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); }
.error-card > .icon { width: 28px; height: 28px; margin-bottom: 10px; color: var(--muted); }
.error-card h1 { margin: 0 0 .5rem; font-size: 18px; font-weight: 600; }
.error-card p { margin: 0 0 1.25rem; font-size: 13px; color: var(--muted); line-height: 1.5; }
.error-card .primary { min-height: 40px; }
/* Trang đăng nhập — phương án A: card tối giản (biến đặt ở :root để nền body cũng dùng được) */
:root {
  --lg-bg: #f5f7f8; --lg-surface: #ffffff; --lg-line: #e3e9e6; --lg-line-strong: #c9d3ce;
  --lg-accent: #0e6b45; --lg-accent-hover: #0b5a3a; --lg-accent-text: #ffffff; --lg-ring: rgba(14,107,69,.16);
  --lg-text: #12211a; --lg-muted: #5b6f66; --lg-faint: #64786c; --lg-shadow: 0 1px 2px rgba(16,24,20,.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --lg-bg: #0d1310; --lg-surface: #121a15; --lg-line: #22302a; --lg-line-strong: #3a4f45;
    --lg-accent: #3dbb7e; --lg-accent-hover: #4ccf8d; --lg-accent-text: #06210f; --lg-ring: rgba(61,187,126,.22);
    --lg-text: #e6efe9; --lg-muted: #9fb4a8; --lg-faint: #8aa093; --lg-shadow: none;
  }
}
body:has(.login-page) { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; background: var(--lg-bg); }
.login-page { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 2rem 1rem; background: var(--lg-bg); color: var(--lg-text); font-size: 14px; }
.login-card { width: 100%; max-width: 400px; padding: 32px; background: var(--lg-surface); border: 1px solid var(--lg-line); border-radius: 12px; box-shadow: var(--lg-shadow); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.login-logo { display: flex; align-items: center; justify-content: center; flex: none; width: 30px; height: 30px; background: var(--lg-accent); color: var(--lg-accent-text); border-radius: 8px; }
.login-logo svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.login-name { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.3; }
.login-hospital { margin: 0; color: var(--lg-faint); font-size: 11px; line-height: 1.3; }
.login-head h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
.login-form .field { display: flex; flex-direction: column; gap: 6px; }
.login-form label { font-size: 12.5px; font-weight: 600; }
.input-wrap { position: relative; }
.login-form input[type="text"], .login-form input[type="password"] { width: 100%; height: 40px; padding: 0 12px; font-size: 14px; color: var(--lg-text); background: var(--lg-surface); border: 1px solid var(--lg-line-strong); border-radius: 8px; transition: border-color .15s ease, box-shadow .15s ease; }
.login-form input[type="text"]:focus, .login-form input[type="password"]:focus { border-color: var(--lg-accent); outline: none; box-shadow: 0 0 0 3px var(--lg-ring); }
.login-form input[aria-invalid="true"] { border-color: var(--error-text); }
.password-field input { padding-right: 44px; }
.password-toggle { position: absolute; top: 2px; right: 2px; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; background: none; border: 0; border-radius: 6px; color: var(--lg-muted); }
.password-toggle:hover { color: var(--lg-accent); }
.password-toggle:focus-visible, .login-forgot summary:focus-visible { outline: 2px solid var(--lg-accent); outline-offset: 2px; border-radius: 6px; }
.password-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle[aria-pressed="true"] .eye-open, .password-toggle[aria-pressed="false"] .eye-closed { display: none; }
.password-toggle[hidden] { display: none; }
.login-submit { height: 40px; margin-top: 4px; background: var(--lg-accent); color: var(--lg-accent-text); border: 0; border-radius: 8px; font-size: 13.5px; font-weight: 600; transition: background-color .15s ease; }
.login-submit:hover { background: var(--lg-accent-hover); }
.login-submit[aria-disabled="true"] { opacity: .7; cursor: wait; }
.login-submit:focus-visible { outline: 2px solid var(--lg-accent); outline-offset: 2px; }
.login-forgot { text-align: center; }
.login-forgot summary { display: inline-block; list-style: none; cursor: pointer; color: var(--lg-muted); font-size: 12.5px; padding: 6px 4px; }
.login-forgot summary::-webkit-details-marker { display: none; }
.login-forgot summary:hover { color: var(--lg-accent); }
.login-forgot p { margin: 4px 0 0; color: var(--lg-muted); font-size: 12.5px; }
@media (prefers-reduced-motion: reduce) { .login-form input, .login-submit { transition: none; } }
@media (max-width: 480px) {
  .login-page { padding: 1.5rem 1rem; }
  .login-card { padding: 24px; }
}
@media (max-width: 860px) {
  .layout { display: block; }
  body:has(.demo-banner) .topbar { top: var(--banner-h); }
  .topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .topbar .brand { gap: 8px; font-weight: 600; font-size: 13.5px; }
  body:has(.demo-banner) .sidebar { top: 0; height: auto; }
  .sidebar { position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(260px, 85vw); height: auto; visibility: hidden; transform: translateX(-100%); transition: transform .15s ease, visibility 0s linear .15s; }
  body.nav-open .sidebar { visibility: visible; transform: none; transition: transform .15s ease, visibility 0s; }
  .sidebar-close { display: inline-flex; }
  .user-card .icon-button { width: 40px; height: 40px; }
  .backdrop { display: block; position: fixed; z-index: 45; inset: 0; background: rgba(5,20,12,.5); opacity: 0; visibility: hidden; transition: opacity .15s ease, visibility 0s linear .15s; }
  body.nav-open .backdrop { opacity: 1; visibility: visible; transition: opacity .15s ease, visibility 0s; }
  .content { max-width: none; padding: 16px 16px 32px; }
  h1 { font-size: 20px; }
  .page-head { flex-direction: column; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
