/* =====================================================================
   电械模科技 · 内部 OA 系统 样式
   主题：logo 深蓝灰 #37485a + 米白 #f5f2ee
   字体：Saira / Saira Condensed（标题）+ Noto Sans SC（正文）+ JetBrains Mono（数字）
   ===================================================================== */

:root {
  --primary: #37485a;
  --primary-light: #4a5f75;
  --primary-dark: #2a3847;
  --accent: #6b7f93;
  --accent-light: #8a9cad;
  --accent-warm: #8a9cad;
  --accent-soft: #e2e6e8;
  --steel: #5e6d7c;
  --steel-light: #8a9cad;
  --bg: #f5f2ee;
  --bg-elevated: #ffffff;
  --bg-soft: #e8e3da;
  --surface-muted: #f2efea;
  --text: #2a3847;
  --text-muted: #5e6d7c;
  --text-inverse: #f2eee8;
  --border: #d5cdc1;
  --border-strong: #bbb4a9;
  --negative: #dc2626;
  --success: #16a34a;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(55,72,90,0.06), 0 1px 2px rgba(55,72,90,0.04);
  --shadow-md: 0 4px 12px rgba(55,72,90,0.08), 0 2px 6px rgba(55,72,90,0.05);
  --shadow-lg: 0 18px 40px rgba(55,72,90,0.12), 0 6px 14px rgba(55,72,90,0.07);
  --sidebar-w: 232px;
  --topbar-h: 60px;
  --font-display: "Saira Condensed","Saira","Noto Sans SC","Microsoft YaHei",sans-serif;
  --font-head: "Saira","Noto Sans SC","Microsoft YaHei",sans-serif;
  --font-body: "Noto Sans SC","Saira","Microsoft YaHei","PingFang SC",sans-serif;
  --font-mono: "JetBrains Mono","Consolas",monospace;
  --font-serif: "Noto Serif SC","SimSun",serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; min-height: 100%; }
html { background: var(--bg); }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1,h2,h3,h4 { margin: 0; font-weight: 700; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
b { font-weight: 700; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

.muted { color: var(--text-muted); font-size: 12px; }
.muted b { color: var(--primary); font-family: var(--font-mono); }
.req { color: var(--negative); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn--primary { background: var(--primary); color: var(--text-inverse); border-color: var(--primary); }
.btn--primary:hover { background: var(--primary-light); }
.btn--accent { background: var(--accent); color: var(--primary-dark); border-color: var(--accent); font-weight: 600; }
.btn--accent:hover { background: var(--accent-light); }
.btn--ghost { background: transparent; color: var(--primary); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--bg-soft); border-color: var(--primary); }
.btn--block { width: 100%; justify-content: center; }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--lg { padding: 12px 22px; font-size: 14px; }
.btn--link { background: none; border: none; color: var(--accent-warm); padding: 4px 8px; font-size: 12px; }
.btn--link.danger { color: var(--negative); }
.btn--link:hover { text-decoration: underline; }

/* ================ 登录 / 注册页 ================ */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}
.auth__hero {
  position: relative;
  padding: 56px 48px;
  background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.auth__brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; }
.auth__logo { width: 56px; height: 56px; object-fit: contain; background: #fff; border-radius: 10px; padding: 5px; box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
.auth__brand-name { font-family: var(--font-head); font-size: 18px; font-weight: 700; letter-spacing: 0.02em; }
.auth__brand-sub { font-size: 11px; opacity: 0.7; letter-spacing: 0.18em; text-transform: uppercase; }
.auth__hero-body { position: relative; z-index: 1; }
.auth__hero-title { font-family: var(--font-display); font-size: 38px; font-weight: 700; line-height: 1.15; letter-spacing: 0.01em; margin-bottom: 18px; }
.auth__hero-title .grad { background: linear-gradient(90deg, var(--accent-light), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth__hero-desc { font-size: 14px; line-height: 1.85; opacity: 0.82; max-width: 460px; }
.auth__hero-foot { position: relative; z-index: 1; font-size: 12px; opacity: 0.6; }

.auth__main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth__card { width: 100%; max-width: 400px; }
.auth__tabs { display: flex; gap: 6px; background: var(--bg-soft); padding: 5px; border-radius: var(--radius); margin-bottom: 24px; }
.auth__tab { flex: 1; padding: 10px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); transition: all 0.15s; }
.auth__tab.is-active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }
.auth__form { display: none; flex-direction: column; gap: 16px; }
.auth__form.is-active { display: flex; }
.auth__field { display: grid; gap: 6px; }
.auth__field label { font-size: 12px; font-weight: 500; color: var(--text); }
.auth__field input { width: 100%; padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: 13px; font-family: inherit; background: #fff; transition: border-color 0.15s, box-shadow 0.15s; }
.auth__field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth__msg { font-size: 12px; min-height: 16px; color: var(--negative); }
.auth__msg.ok { color: var(--success); }
.auth__hint { font-size: 12px; color: var(--text-muted); background: var(--bg-soft); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 10px 12px; line-height: 1.7; }
.auth__hint b { color: var(--primary); }
.auth__downloads { margin-top: 2px; padding-top: 14px; border-top: 1px solid var(--border); }
.auth__downloads-title { margin-bottom: 8px; color: var(--text-muted); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; }
.auth__download { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px 11px; color: var(--primary); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; }
.auth__download:hover { border-color: var(--accent); background: #fff; box-shadow: var(--shadow); }
.auth__download-icon { display: inline-grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 9px; color: #fff; background: var(--primary); font-family: var(--font-head); font-size: 10px; font-weight: 700; letter-spacing: 0.02em; }
.auth__download b, .auth__download small { display: block; }
.auth__download b { font-size: 12px; line-height: 1.4; }
.auth__download small { margin-top: 2px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }
.auth__download-arrow { margin-left: auto; color: var(--accent-warm); font-size: 22px; line-height: 1; }
.auth__divider { height: 1px; background: var(--border); margin: 4px 0; }
.auth__back { text-align: center; }
.auth__back a { font-size: 12px; color: var(--accent-warm); }
.auth__back a:hover { text-decoration: underline; }

@media (max-width: 1024px) {
  .auth { grid-template-columns: 1fr; }
  .auth__hero { display: none; }
}

@media (max-width: 480px) {
  .auth__main { padding: 24px 16px; align-items: flex-start; }
  .auth__card { max-width: 100%; }
  .auth__brand-name { font-size: 16px; }
  .auth__hero-title { font-size: 28px; }
  .auth__field input { padding: 10px 12px; font-size: 14px; }
}

/* ================ OA 主框架 ================ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; min-height: 100dvh; }

/* 侧边栏 */
.sidebar {
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: var(--text-inverse);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  border-right: 1px solid rgba(107,127,147,0.18);
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid rgba(242,238,232,0.08); }
.sidebar__logo { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.sidebar__brand-name { font-family: var(--font-head); font-size: 14px; font-weight: 700; line-height: 1.2; }
.sidebar__brand-sub { font-size: 10px; opacity: 0.6; letter-spacing: 0.14em; text-transform: uppercase; }
.sidebar__nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.sidebar__nav-title { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(242,238,232,0.4); padding: 10px 10px 6px; }
.nav__item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; color: rgba(242,238,232,0.78); transition: all 0.15s; }
.nav__item:hover { background: rgba(242,238,232,0.06); color: var(--text-inverse); }
.nav__item.is-active { background: rgba(107,127,147,0.16); color: var(--text-inverse); box-shadow: inset 3px 0 0 var(--accent); }
.nav__item .ic { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.9; }
.sidebar__foot { padding: 12px 16px; border-top: 1px solid rgba(242,238,232,0.08); font-size: 10px; color: rgba(242,238,232,0.4); }

/* 主区 */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 30; }
.topbar__title { font-family: var(--font-head); font-size: 15px; font-weight: 600; color: var(--primary); }
.topbar__crumb { font-size: 11px; color: var(--text-muted); }
.topbar__user { display: flex; align-items: center; gap: 12px; }
.topbar__avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: var(--text-inverse); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.topbar__uname { font-size: 13px; font-weight: 600; color: var(--text); }
.topbar__urole { font-size: 11px; color: var(--accent-warm); font-weight: 600; }
.topbar__urole.admin { color: var(--accent-warm); }

.content { flex: 1; padding: 22px 24px 40px; overflow-x: hidden; }
.view { display: none; }
.view.is-active { display: block; }

/* 仪表盘 */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card { background: var(--bg-elevated); border-radius: var(--radius-lg); padding: 20px 22px; box-shadow: var(--shadow-md); border: 1px solid var(--border); position: relative; overflow: hidden; }
.stat-card::before { content: ""; position: absolute; right: -20px; top: -20px; width: 80px; height: 80px; border-radius: 50%; background: var(--accent-soft); opacity: 0.5; }
.stat-card__label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; position: relative; z-index: 1; }
.stat-card__num { font-family: var(--font-mono); font-size: 26px; font-weight: 700; color: var(--primary); position: relative; z-index: 1; }
.stat-card__num .unit { font-size: 13px; color: var(--text-muted); margin-left: 3px; }
.stat-card__delta { font-size: 11px; color: var(--success); margin-top: 6px; position: relative; z-index: 1; }
.panel { background: var(--bg-elevated); border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; margin-bottom: 22px; }
.panel__head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--surface-muted); }
.panel__head h2 { font-size: 15px; color: var(--primary); }
.panel__body { padding: 18px 20px; }

.page-head { margin-bottom: 18px; }
.page-head h1 { font-family: var(--font-head); font-size: 20px; color: var(--primary); }
.page-head p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ================ 费用清单模块 ================ */
.card { background: var(--bg-elevated); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px; }
.card__head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-muted); }
.card__head h2 { font-size: 15px; color: var(--primary); }
.card__head--row { }

.form-grid { padding: 18px 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 18px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field--grow { flex: 1; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 500; color: var(--text); }
.field input, .field select, .field textarea {
  width: 100%; min-width: 0; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: inherit; background: var(--bg-elevated); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
/* iOS Safari 日期输入框默认用 intrinsic 宽度，会撑破 grid 容器，必须强制覆盖 */
.field input[type="date"] {
  -webkit-appearance: none; appearance: none;
  min-width: 0 !important; width: 100% !important; max-width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { resize: vertical; }

.table-wrap { padding: 0 20px; overflow-x: auto; }
.add-btn { width: 28px; height: 28px; border: none; border-radius: 50%; background: var(--success); color: var(--text-inverse); font-size: 18px; line-height: 28px; text-align: center; padding: 0; vertical-align: middle; transition: background 0.15s, transform 0.1s, box-shadow 0.15s; box-shadow: 0 2px 6px rgba(22,163,74,0.35); }
.add-btn:hover { background: #15803d; transform: scale(1.1); }
.add-btn:active { transform: scale(0.92); }
.add-btn--sm { width: 22px; height: 22px; font-size: 14px; line-height: 22px; box-shadow: none; }

.itable { width: 100%; border-collapse: collapse; font-size: 13px; }
.itable th { text-align: left; padding: 10px 8px; background: var(--surface-muted); color: var(--text-muted); font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.itable td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.itable tbody tr:hover { background: var(--surface-muted); }
.itable .c { text-align: center; }
.itable .r { text-align: right; }
.itable input.cell { width: 100%; border: 1px solid transparent; background: transparent; padding: 7px 8px; border-radius: 4px; font-size: 13px; font-family: inherit; color: var(--text); }
.itable input.cell:focus { outline: none; border-color: var(--accent); background: var(--bg-elevated); box-shadow: 0 0 0 2px var(--accent-soft); }
.itable input.cell.num { text-align: right; font-family: var(--font-mono); }
.amount-cell { font-family: var(--font-mono); font-weight: 500; text-align: right; color: var(--primary); }
.row-no { color: var(--text-muted); font-size: 12px; text-align: center; }
.empty-row { text-align: center; padding: 32px; color: var(--text-muted); font-size: 13px; }
.itable tfoot td { font-weight: 700; background: var(--surface-muted); border-top: 2px solid var(--primary); color: var(--primary); padding: 12px 8px; }
.itable tfoot .total-cell { font-family: var(--font-mono); font-size: 15px; color: var(--negative); }

.footer-grid { padding: 18px 20px 20px; display: flex; gap: 20px; align-items: stretch; border-top: 1px solid var(--border); }
.total-box { width: 300px; flex-shrink: 0; background: var(--surface-muted); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--border); }
.total-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-muted); }
.total-row b { font-family: var(--font-mono); font-size: 18px; color: var(--primary); }
.total-row--cap b { font-family: var(--font-serif); font-size: 15px; }
.total-box .btn { margin-top: 4px; }

/* 抽屉（历史） */
.drawer { position: fixed; inset: 0; z-index: 100; }
.drawer__mask { position: absolute; inset: 0; background: rgba(55,72,90,0.45); }
.drawer__panel { position: absolute; top: 0; right: 0; bottom: 0; width: 440px; max-width: 90vw; background: var(--bg-elevated); box-shadow: -10px 0 30px rgba(0,0,0,0.15); display: flex; flex-direction: column; animation: slideIn 0.25s ease; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer__head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--surface-muted); }
.drawer__head h3 { font-size: 15px; color: var(--primary); }
.drawer__body { flex: 1; overflow-y: auto; padding: 12px 16px; }
.hist-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.hist-item:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(107,127,147,0.15); }
.hist-item__no { font-family: var(--font-mono); font-size: 12px; color: var(--accent-warm); }
.hist-item__name { font-size: 14px; color: var(--text); margin: 4px 0; }
.hist-item__meta { font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; }
.hist-item__amt { font-family: var(--font-mono); font-weight: 700; color: var(--negative); }
.hist-item__del { margin-top: 8px; }

/* 交付状态徽标 */
.badge { display: inline-block; font-size: 11px; line-height: 1; padding: 4px 8px; border-radius: 999px; vertical-align: middle; font-family: inherit; }
button.badge { cursor: pointer; background: transparent; }
.badge--done { background: rgba(66,152,103,0.12); color: var(--positive, #2e7d4f); border: 1px solid rgba(66,152,103,0.35); }
.badge--done:hover { background: rgba(66,152,103,0.22); }
.badge--pending { background: rgba(107,127,147,0.1); color: var(--text-muted); border: 1px solid var(--border); }
.badge--pending:hover { background: rgba(107,127,147,0.2); }
.hist-item__del .badge { margin-right: 8px; }

/* 主列表清单条目 */
.all-quote-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 10px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: var(--radius); transition: background 0.15s; }
.all-quote-item:hover { background: rgba(107,127,147,0.07); }
.all-quote-item.is-current { background: rgba(107,127,147,0.12); }
.all-quote-item__title { font-size: 13px; color: var(--text); }
.all-quote-item__amt { font-family: var(--font-mono); font-weight: 700; color: var(--negative); white-space: nowrap; }
.all-quote-item__title .badge { margin-left: 6px; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--primary); color: var(--text-inverse); padding: 11px 22px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all 0.3s; z-index: 1000; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--negative); }

/* 打印区（屏幕隐藏） */
.print-only { display: none; }

/* 预览弹窗 */
.modal { position: fixed; inset: 0; z-index: 200; }
.modal__mask { position: absolute; inset: 0; background: rgba(55,72,90,0.55); animation: fadeIn 0.2s ease; }
.modal__panel { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 1080px; max-width: 96vw; max-height: 92vh; background: var(--bg-elevated); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,0.3); display: flex; flex-direction: column; overflow: hidden; animation: popIn 0.22s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.modal__head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--surface-muted); }
.modal__head h3 { font-size: 15px; color: var(--primary); }
.modal__actions { display: flex; align-items: center; flex-shrink: 0; }
.modal__actions > * + * { margin-left: 12px; }
.modal__body { flex: 1; overflow-y: auto; padding: 24px 28px; background: #f1f3f7; }
.preview-tools { display: flex; align-items: center; margin-right: 12px; min-width: 0; }
.preview-tools label { font-size: 13px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.preview-tools input[type="date"] { padding: 6px 10px; margin-left: 10px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 13px; font-family: inherit; color: var(--text); background: #fff; width: auto; max-width: 160px; min-width: 0; }

/* 预览分页 */
.pt-pages { display: flex; flex-direction: column; align-items: center; padding: 8px 0 4px; }
.pt-page + .pt-page { margin-top: 28px; }
.pt-page { width: 1000px; max-width: 100%; background: #fff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.12); position: relative; box-sizing: border-box; }
.pt-page__inner { padding: 28px 40px; min-height: 651px; box-sizing: border-box; }
.pt-page__no { text-align: center; font-size: 11px; color: #999; padding: 6px 0 10px; }

/* 打印区（#printArea 是 .print-only，屏幕隐藏、打印显示）：
   直接用容器选择器让打印区样式为打印样式，不依赖 @media print 是否生效。
   预览区 #previewBody 保留 min-height/padding 撑满 A4 视觉效果。 */
#printArea .pt-pages { display: block; gap: 0; padding: 0; align-items: stretch; }
#printArea .pt-page { width: 100%; max-width: 100%; background: transparent; box-shadow: none; border-radius: 0; page-break-after: always; }
#printArea .pt-page:last-child { page-break-after: auto; }
#printArea .pt-page__inner { padding: 0; min-height: 0; max-height: none; box-sizing: border-box; }
#printArea .pt-page__no { display: none; }

/* 账号视图 */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.info-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.info-card__label { font-size: 11px; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.info-card__value { font-size: 15px; color: var(--text); font-weight: 600; }

/* 打印：只显示打印区 */
@media print {
  .app, .topbar, .sidebar, .content, .toast, .drawer, .modal__head, .pt-page__no { display: none !important; }
  /* 隐藏预览弹窗（#previewModal 含 previewBody，与 #printArea 内容相同，必须隐藏避免重复打印） */
  #previewModal { display: none !important; }
  .print-only { display: block !important; }
  .modal { position: static !important; }
  .modal__mask { display: none !important; }
  .modal__panel { position: static !important; transform: none !important; width: 100% !important; max-width: 100% !important; max-height: none !important; box-shadow: none !important; border-radius: 0 !important; }
  .modal__body { background: transparent !important; padding: 0 !important; }
  /* 打印时让每个预览分页严格对应一个物理页：去掉撑高与间距，由 @page margin 提供边距 */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  html, body, .pt-pages, .pt-page, .pt-page__inner, .pt { background: transparent !important; }
  .pt { min-height: auto !important; height: auto !important; box-shadow: none !important; }
  .pt-pages { display: block !important; gap: 0 !important; padding: 0 !important; align-items: stretch !important; }
  .pt-page { width: 100% !important; max-width: 100% !important; background: transparent !important; box-shadow: none !important; border-radius: 0 !important; page-break-after: always !important; }
  .pt-page:last-child { page-break-after: auto !important; }
  .pt-page__inner { padding: 0 !important; min-height: 0 !important; max-height: none !important; background: transparent !important; }
  .ptab th { background: #37485a !important; color: var(--text-inverse) !important; }
}

@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -100%; width: var(--sidebar-w); z-index: 50; transition: left 0.25s; }
  .sidebar.is-open { left: 0; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}

/* ============ 移动端适配（平板 ≤768px / 手机 ≤480px） ============ */

/* 汉堡菜单按钮：桌面端隐藏，移动端显示 */
.topbar__menu-btn { display: none; }
/* 移动端侧边栏遮罩 */
.sidebar__mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 40; opacity: 0; transition: opacity 0.25s; }
.sidebar__mask.is-open { opacity: 1; }

@media (max-width: 768px) {
  .topbar__menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-elevated); color: var(--primary); cursor: pointer; }
  .topbar__menu-btn:active { background: var(--bg-soft); }
  .sidebar__mask.is-open { display: block; }

  /* 顶栏：缩小内边距，隐藏面包屑，按钮区域自适应 */
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar__title { font-size: 14px; }
  .topbar__crumb { display: none; }
  .topbar__user { gap: 8px; }
  .topbar__uname { font-size: 12px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar__avatar { width: 30px; height: 30px; font-size: 12px; }

  /* 内容区缩小内边距 */
  .content { padding: 14px 12px 32px; }

  /* 页面标题 */
  .page-head h1 { font-size: 17px; }
  .page-head p { font-size: 12px; }

  /* 仪表盘卡片：单列显示 */
  .dash-grid { grid-template-columns: 1fr; gap: 12px; }
  .stat-card { padding: 16px 18px; }
  .stat-card__num { font-size: 22px; }

  /* 面板 */
  .panel__head { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .panel__head h2 { font-size: 14px; }
  .panel__body { padding: 14px; }

  /* 清单卡片头：垂直排列 */
  .card__head { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .card__head h2 { font-size: 14px; }

  /* 表单网格：2列（部分1列） */
  .form-grid { grid-template-columns: 1fr 1fr; gap: 12px 14px; padding: 14px; }

  /* 表格外层缩进 */
  .table-wrap { padding: 0 12px; }

  /* 抽屉面板：占满全屏 */
  .drawer__panel { width: 100% !important; max-width: 100vw !important; }

  /* 预览弹窗：占满全屏 */
  .modal__panel { width: 100% !important; max-width: 100vw !important; max-height: 100vh !important; max-height: 100dvh !important; border-radius: 0 !important; }

  /* 预览页：手机上由 JS 使用 zoom 自适应屏幕宽度，这里不强制固定 A4 宽度 */
  #previewBody { padding: 12px; }
  #previewBody .pt-pages { align-items: center; padding: 0; }
  #previewBody .pt-page { width: 1000px; max-width: 100%; box-sizing: border-box; }

  /* 账号网格：单列 */
  .account-grid { grid-template-columns: 1fr; }

  /* 添加成员表单：单列 */
  .form-grid[style*="1fr 1fr 1fr auto auto"] { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 480px) {
  /* 手机：顶栏只保留必要元素，按钮简化 */
  .topbar { padding: 0 10px; }
  .topbar__uname, .topbar__urole { display: none; }
  .topbar__avatar { width: 32px; height: 32px; }
  .btn--sm { padding: 6px 10px; font-size: 11px; }

  /* 内容区最小内边距 */
  .content { padding: 10px 8px 24px; }

  /* 表单网格：单列 */
  .form-grid { grid-template-columns: 1fr !important; }

  /* 添加成员表单：单列 */
  .form-grid[style*="1fr 1fr"] { grid-template-columns: 1fr !important; }

  /* 仪表盘数字 */
  .stat-card__num { font-size: 20px; }

  /* 清单编号显示截断 */
  .card__head .muted { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* 明细表格：更小字号 */
  .itable { font-size: 12px; }
  .itable th, .itable td { padding: 6px 5px; }
  .itable input.cell { font-size: 12px; padding: 6px 5px; }

  /* 登录页缩小内边距 */
  .auth__card { padding: 20px 18px; }

  /* 抽屉/弹窗头按钮区可换行 */
  .drawer__head, .modal__head { flex-wrap: wrap; gap: 6px; }
}
