/* ============================================================================
   orio-hr 设计系统（V8，北森式侧边栏 + 沉稳专业蓝）
   单文件分区：
   1.Tokens 2.Reset 3.Layout(sidebar/topbar/content) 4.Page-header
   5.Card 6.Buttons 7.Forms 8.Table 9.Badge/Pill 10.Filters/Toolbar
   11.Desc-list 12.Tabs 13.Timeline 14.Uploader 15.Modal/Panel
   16.Empty/Notes 17.Pagination 18.Messages/Toast 19.Collapse 20.Utilities
   21.Responsive
   页面专属样式在各自 page_style 块、本文件之后加载，可覆盖。
   ============================================================================ */

/* ---- 1. Tokens ---- */
:root {
  /* 品牌主色（沉稳靛蓝） */
  --c-primary: #2b4c9e;
  --c-primary-hover: #243f85;
  --c-primary-active: #1d3472;
  --c-primary-soft: #eef2fb;
  --c-primary-border: #c9d5ef;

  /* 中性灰阶（冷调） */
  --c-text: #1d2129;
  --c-text-2: #4e5969;
  --c-text-muted: #86909c;
  --c-text-faint: #a9b0bc;
  --c-bg: #f5f6f8;
  --c-bg-soft: #f7f8fa;
  --c-border: #e5e6eb;
  --c-border-soft: #f0f1f3;

  /* 语义色（低饱和） */
  --c-ok: #1a875b;      --c-ok-bg: #e8f6ef;
  --c-err: #c2382d;     --c-err-bg: #fdecea;
  --c-warn: #b8741a;    --c-warn-bg: #fdf5e6;
  --c-info: #2b4c9e;    --c-info-bg: #eef2fb;
  --c-purple: #6a4c9b;  --c-purple-bg: #f1edf8;

  /* 圆角 */
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;

  /* 阴影（专业感靠边不靠投影） */
  --sh-1: 0 1px 2px rgba(29, 33, 41, .05);
  --sh-2: 0 4px 16px rgba(29, 33, 41, .08);
  --sh-3: 0 8px 28px rgba(29, 33, 41, .14);

  /* 间距 */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;

  /* 字号 */
  --fs-xs: 12px; --fs-sm: 13px; --fs: 14px; --fs-md: 15px;
  --fs-lg: 18px; --fs-xl: 22px;

  /* 布局 */
  --sidebar-w: 232px;
  --sidebar-w-collapsed: 64px;
  --content-w: 1280px;
  --topbar-h: 56px;
}

/* ---- 2. Reset / Base ---- */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: var(--fs);
  line-height: 1.55;
  background: var(--c-bg);
  color: var(--c-text);
  -webkit-font-smoothing: antialiased;
}

body.is-bare { padding: 0; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-hover); }

/* ---- 3. Layout：sidebar / topbar / content ---- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--c-border);
  z-index: 60;
}

/* 品牌区 */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 18px;
  color: var(--c-text);
  border-bottom: 1px solid var(--c-border-soft);
  flex-shrink: 0;
}
.brand:hover { color: var(--c-text); }
.brand-mark {
  width: 28px; height: 28px; flex-shrink: 0;
  color: var(--c-primary);
}
.brand-mark svg { display: block; width: 100%; height: 100%; }
.brand-name {
  font-size: 16px; font-weight: 700; letter-spacing: .2px;
}

/* 分组导航 */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 16px;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--c-border); border-radius: 3px;
}

.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 4px; }
.nav-group-title {
  padding: 0 10px 6px;
  font-size: var(--fs-xs);
  color: var(--c-text-faint);
  letter-spacing: .6px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  margin-bottom: 2px;
  border-radius: var(--r);
  color: var(--c-text-2);
  font-size: var(--fs);
}
.nav-item:hover {
  background: var(--c-bg-soft);
  color: var(--c-text);
}
.nav-item.is-active {
  background: var(--c-primary-soft);
  color: var(--c-primary);
  font-weight: 600;
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 2px 2px 0;
  background: var(--c-primary);
}
.nav-icon {
  display: inline-flex;
  width: 20px; height: 20px;
  flex-shrink: 0;
}
.nav-icon svg { width: 100%; height: 100%; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-badge {
  flex-shrink: 0;
  min-width: 20px;
  padding: 0 6px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--c-primary);
  background: var(--c-primary-border);
  border-radius: 9px;
}

/* 底部用户区 */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--c-border-soft);
  flex-shrink: 0;
}
.user-avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  font-size: var(--fs-md);
}
.user-meta {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.user-name {
  font-size: var(--fs-sm); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-num {
  font-size: var(--fs-xs); color: var(--c-text-muted);
}
.logout-form { margin: 0; flex-shrink: 0; }
.logout-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
  color: var(--c-text-muted);
  border-radius: var(--r-sm);
}
.logout-btn svg { width: 18px; height: 18px; }
.logout-btn:hover { background: var(--c-err-bg); color: var(--c-err); }

/* 移动端遮罩 */
.nav-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(29, 33, 41, .42);
  z-index: 50;
}

/* 右侧主区 */
.layout-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶栏（仅窄屏显示） */
.topbar {
  display: none;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 14px;
  background: #fff;
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; z-index: 40;
}
.nav-toggle {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
  color: var(--c-text-2); border-radius: var(--r-sm);
}
.nav-toggle svg { width: 22px; height: 22px; }
.nav-toggle:hover { background: var(--c-bg-soft); }
.topbar-brand { font-size: var(--fs-md); font-weight: 700; }

/* 内容区 */
.content {
  flex: 1;
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 24px;
}

/* ---- 4. Page header（页面标题 + 描述 + 操作区） ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page-title { font-size: var(--fs-xl); line-height: 1.3; }
.page-desc {
  margin-top: 6px;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  max-width: 760px;
}
.page-actions {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}

/* ---- 5. Card / Grid ---- */
.card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-title { font-size: var(--fs-md); }
.card-body { min-width: 0; }
.card + .card { margin-top: 14px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ---- 6. Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 18px;
  font-size: var(--fs);
  font-family: inherit;
  border: 1px solid var(--c-primary);
  border-radius: var(--r-sm);
  background: var(--c-primary);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover {
  background: var(--c-primary-hover);
  border-color: var(--c-primary-hover);
  color: #fff;
}
.btn:active { background: var(--c-primary-active); border-color: var(--c-primary-active); }

.btn-ghost {
  background: #fff;
  border-color: var(--c-border);
  color: var(--c-text-2);
}
.btn-ghost:hover {
  background: var(--c-bg-soft);
  border-color: var(--c-text-faint);
  color: var(--c-text);
}

.btn-danger {
  background: var(--c-err);
  border-color: var(--c-err);
  color: #fff;
}
.btn-danger:hover { background: #a82f25; border-color: #a82f25; color: #fff; }

.btn-text {
  height: auto; padding: 2px 6px;
  background: none; border: none;
  color: var(--c-primary);
}
.btn-text:hover { background: none; color: var(--c-primary-hover); }

.btn-sm { height: 30px; padding: 0 12px; font-size: var(--fs-sm); }
.btn-lg { height: 42px; padding: 0 26px; font-size: var(--fs-md); }

/* ---- 7. Forms ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}
.form-item { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-item.col-wide { grid-column: 1 / -1; }
.form-label {
  font-size: var(--fs-sm);
  color: var(--c-text-2);
  font-weight: 500;
}
.form-label .req { color: var(--c-err); margin-left: 2px; }

.form-control,
input, select, textarea {
  font-family: inherit;
  font-size: var(--fs);
  color: var(--c-text);
}
.form-control {
  width: 100%;
  height: 36px;
  padding: 6px 11px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: #fff;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
textarea.form-control { height: auto; min-height: 88px; resize: vertical; }

.form-control:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(43, 76, 158, .12);
}
.form-control::placeholder { color: var(--c-text-faint); }
.form-control[disabled], .form-control[readonly] {
  background: var(--c-bg-soft); color: var(--c-text-muted);
}
.form-control.is-error, .form-error {
  border-color: var(--c-err);
}
.form-error-text { font-size: var(--fs-xs); color: var(--c-err); }
.form-hint { font-size: var(--fs-xs); color: var(--c-text-muted); }

/* 未挂 .form-control 的裸 input/select/textarea 也获得统一控件外观
   （但避开按钮类与筛选区——筛选区在第 10 段自行控制） */
form input:not([type]):not(.btn):not(.form-control):not([type="submit"]):not([type="button"]):not([type="radio"]):not([type="checkbox"]):not([type="search"]):not([type="date"]):not([type="file"]),
form input[type="text"]:not(.btn):not(.form-control),
form select:not(.form-control):not(.filters select),
form textarea:not(.form-control) {
  height: 36px;
  padding: 6px 11px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: #fff;
  outline: none;
}
form input:focus, form select:focus, form textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(43, 76, 158, .12);
}

/* ---- 8. Table ---- */
.table-box { overflow-x: auto; border-radius: var(--r); }
.table { border-collapse: collapse; width: 100%; }
.table th, .table td,
table th, table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border-soft);
  text-align: left;
  vertical-align: middle;
}
.table th, table th {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--c-text-muted);
  background: var(--c-bg-soft);
  white-space: nowrap;
}
.table td, table td { font-size: var(--fs); }
.table tbody tr:hover, table tbody tr:hover { background: var(--c-bg-soft); }
.table-sm th, .table-sm td { padding: 7px 10px; font-size: var(--fs-sm); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---- 9. Badge / Pill ---- */
.pill {
  display: inline-block;
  font-size: var(--fs-xs);
  padding: 1px 10px;
  border-radius: 10px;
  background: var(--c-bg-soft);
  color: var(--c-text-muted);
  border: 1px solid var(--c-border-soft);
  white-space: nowrap;
  line-height: 1.7;
}
.pill.ok, .pill.active { background: var(--c-ok-bg); color: var(--c-ok); border-color: transparent; }
.pill.err, .pill.inactive { background: var(--c-err-bg); color: var(--c-err); border-color: transparent; }
.pill.info { background: var(--c-info-bg); color: var(--c-info); border-color: transparent; }
.pill.warn { background: var(--c-warn-bg); color: var(--c-warn); border-color: transparent; }
.pill.purple { background: var(--c-purple-bg); color: var(--c-purple); border-color: transparent; }

/* ---- 10. Filters / Toolbar ---- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}
.filters input, .filters select {
  height: 34px;
  font-size: var(--fs-sm);
  padding: 5px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: #fff;
  min-width: 0;
  outline: none;
}
.filters input:focus, .filters select:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(43, 76, 158, .12);
}
.filters button {
  height: 34px;
  font-size: var(--fs-sm);
  padding: 0 18px;
  background: var(--c-primary);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.filters button:hover { background: var(--c-primary-hover); }
.filters a.clear {
  font-size: var(--fs-sm); color: var(--c-text-muted);
  padding: 7px 4px;
}
.filters a.clear:hover { color: var(--c-primary); }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; margin-bottom: 16px;
}
.toolbar .spacer { margin-left: auto; }

/* ---- 11. Description list（详情描述） ---- */
.desc-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
  margin: 0;
}
.desc-list dt {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.desc-list dd {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--c-text);
  min-width: 0; overflow-wrap: anywhere;
}

/* ---- 12. Tabs ---- */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 16px;
}
.tab, .tab-item {
  padding: 8px 16px;
  font-size: var(--fs);
  color: var(--c-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover, .tab-item:hover { color: var(--c-text); }
.tab.on, .tab.is-active, .tab-item.is-active {
  color: var(--c-primary); font-weight: 600;
  border-bottom-color: var(--c-primary);
}

/* ---- 13. Timeline ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item {
  position: relative;
  padding: 0 0 18px 22px;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: 5px; top: 6px; bottom: -2px;
  width: 1px; background: var(--c-border);
}
.tl-item:last-child::before { display: none; }
.tl-item::after {
  content: "";
  position: absolute;
  left: 1px; top: 5px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--c-primary-border);
}
.tl-item.is-current::after { border-color: var(--c-primary); background: var(--c-primary); }
.tl-title { font-size: var(--fs-sm); font-weight: 600; }
.tl-time { font-size: var(--fs-xs); color: var(--c-text-muted); }
.tl-body { font-size: var(--fs-sm); color: var(--c-text-2); margin-top: 2px; }

/* ---- 14. Uploader ---- */
.uploader {
  display: flex; flex-direction: column; gap: 6px;
  border: 1px dashed var(--c-text-faint);
  border-radius: var(--r-sm);
  padding: 14px;
  background: var(--c-bg-soft);
}
.uploader-name { font-size: var(--fs-sm); }
.uploader-hint { font-size: var(--fs-xs); color: var(--c-text-muted); }
.uploader.is-error { border-color: var(--c-err); background: var(--c-err-bg); }

/* ---- 15. Modal / Panel ---- */
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(29, 33, 41, .42);
  z-index: 80; padding: 20px;
}
.modal-card {
  background: #fff; border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  width: 100%; max-width: 460px;
  padding: 22px 24px;
}
.modal-title { font-size: var(--fs-md); margin-bottom: 10px; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px;
}

.panel {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  box-shadow: var(--sh-2);
  padding: 14px;
}

/* ---- 16. Empty / Notes ---- */
.empty, .empty-note {
  text-align: center;
  padding: 44px 20px;
  color: var(--c-text-faint);
  font-size: var(--fs-sm);
}
.empty a, .empty-note a { color: var(--c-primary); }

.snapshot-note {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  margin: 0 0 14px;
}
.snapshot-note strong { color: var(--c-text-2); font-weight: 600; }

.count-note {
  font-size: var(--fs-sm); color: var(--c-text-muted); margin: 0 0 12px;
}
.count-note a { color: var(--c-primary); }

/* ---- 17. Pagination ---- */
.pagination {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center;
  font-size: var(--fs-sm); color: var(--c-text-muted);
  margin: 16px 0 4px;
}
.pagination a, .pagination span.page {
  min-width: 30px;
  padding: 4px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  color: var(--c-primary);
  background: #fff;
  text-align: center;
}
.pagination a:hover { background: var(--c-primary-soft); border-color: var(--c-primary-border); }
.pagination .current {
  border-color: var(--c-primary);
  background: var(--c-primary); color: #fff;
}
.pagination .disabled {
  color: var(--c-text-faint); background: var(--c-bg-soft);
}

/* ---- 18. Messages / Toast ---- */
.messages { margin-bottom: 16px; }
.message {
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: var(--fs-sm);
  margin-bottom: 8px;
  border: 1px solid transparent;
}
.message.ok { background: var(--c-ok-bg); color: var(--c-ok); }
.message.err { background: var(--c-err-bg); color: var(--c-err); }
.message.warn { background: var(--c-warn-bg); color: var(--c-warn); }

.toast-region {
  position: fixed; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 100;
}
.toast {
  min-width: 240px; max-width: 380px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: #fff;
  box-shadow: var(--sh-3);
  font-size: var(--fs-sm);
  border-left: 3px solid var(--c-primary);
  animation: toast-in .18s ease-out;
}
.toast.ok { border-left-color: var(--c-ok); }
.toast.err { border-left-color: var(--c-err); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---- 19. Collapse（低频操作收纳） ---- */
details.collapse {
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  margin-bottom: 14px;
}
details.collapse > summary {
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--c-text-2);
}

/* busy 态（防重复提交） */
[disabled], .busy { cursor: default; }

/* ---- 20. Utilities ---- */
.muted { color: var(--c-text-muted); }
.faint { color: var(--c-text-faint); }
.fw-600 { font-weight: 600; }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.flex { display: flex; } .items-center { align-items: center; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.w-full { width: 100%; }

/* ---- 21. Responsive ---- */

/* 中屏：可折叠图标栏 */
@media (max-width: 1100px) {
  body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
  body.sidebar-collapsed .layout-main { margin-left: var(--sidebar-w-collapsed); }
  body.sidebar-collapsed .brand { justify-content: center; padding: 0; }
  body.sidebar-collapsed .brand-name,
  body.sidebar-collapsed .nav-group-title,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .user-meta,
  body.sidebar-collapsed .logout-form { display: none; }
  body.sidebar-collapsed .nav-item {
    justify-content: center; padding: 0;
  }
  body.sidebar-collapsed .nav-item.is-active::before { display: none; }
  body.sidebar-collapsed .nav-badge {
    position: absolute; top: 3px; right: 8px;
    min-width: 8px; height: 8px; padding: 0;
    border-radius: 50%;
  }
  body.sidebar-collapsed .sidebar-user { justify-content: center; padding: 12px 0; }

  /* 未手动折叠时：顶栏出现以便切换 */
  .topbar { display: flex; }
}

/* 小屏：侧边栏 off-canvas 抽屉 */
@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .layout-main { margin-left: 0; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-backdrop { display: block; }

  /* off-canvas 时即使 sidebar-collapsed 也恢复完整宽度内容 */
  body.sidebar-collapsed .brand,
  body.sidebar-collapsed .nav-item { justify-content: flex-start; padding: 0 10px; }
  body.sidebar-collapsed .brand { padding: 0 18px; justify-content: flex-start; }
  body.sidebar-collapsed .brand-name,
  body.sidebar-collapsed .nav-group-title,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .user-meta { display: block; }
  body.sidebar-collapsed .nav-badge {
    position: static; min-width: 20px; height: 18px; padding: 0 6px;
    border-radius: 9px;
  }
  body.sidebar-collapsed .logout-form { display: block; }

  .content { padding: 16px; }
  .form-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .desc-list { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
}
