* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --faint: #9ca3af;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --danger: #dc2626;
  --green: #0b8457;
  --green-bg: #e7f6ef;
  --red-bg: #fdeaea;
  --gray-bg: #f1f3f5;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #eef2f9 0%, #f7f8fa 60%, #eef4f1 100%);
}
.login-card {
  width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 34px;
  box-shadow: 0 10px 40px rgba(20,40,80,.08);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.login-logo, .logo {
  width: 44px; height: 44px; border-radius: 11px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600; flex-shrink: 0;
}
.login-title { font-size: 19px; font-weight: 600; }
.login-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.field-label { display: block; font-size: 13px; color: #374151; margin: 16px 0 6px; font-weight: 500; }
.field-label.inline { display: inline; margin: 0 8px 0 0; font-weight: 400; color: var(--muted); }
.input {
  width: 100%; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 7px;
  font-size: 14px; font-family: inherit; color: var(--text); background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,.1); }
.input-sm { width: auto; padding: 6px 10px; font-size: 13px; }
.select { cursor: pointer; }
.login-err { color: var(--danger); font-size: 13px; min-height: 22px; margin-top: 10px; }
.login-hint { text-align: center; color: var(--faint); font-size: 12px; margin-top: 16px; }

.btn {
  border: 1px solid transparent; border-radius: 7px; padding: 9px 16px;
  font-size: 14px; font-family: inherit; cursor: pointer; font-weight: 500;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: #fff; color: #374151; border-color: #d1d5db; }
.btn-ghost:hover { background: #f9fafb; }
.btn-block { width: 100%; margin-top: 6px; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-text { background: none; border: none; color: var(--primary); padding: 2px 6px; }
.btn-text:hover { text-decoration: underline; }
.btn-text.danger { color: var(--danger); }

/* ---------- 布局 ---------- */
.app { min-height: 100vh; }
.topbar {
  height: 62px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.logo { width: 36px; height: 36px; font-size: 19px; border-radius: 9px; }
.brand-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.brand-sub { font-size: 11px; color: var(--faint); }
.link-status { display: flex; align-items: center; gap: 8px; margin-left: 12px; }
.link-node { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.link-node i { width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; }
.link-node.ok i { background: #16a34a; }
.link-node.bad i { background: var(--danger); }
.link-line { width: 26px; height: 1px; background: #d1d5db; }
.user-box { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-label { font-size: 13px; color: var(--muted); }

.layout { display: flex; min-height: calc(100vh - 62px); }
.sidebar {
  width: 208px; background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 12px; flex-shrink: 0; display: flex; flex-direction: column;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border: none; background: none; border-radius: 7px;
  font-size: 14px; color: #4b5563; cursor: pointer; text-align: left; font-family: inherit;
}
.nav-item:hover { background: #f3f4f6; }
.nav-item.active { background: #eaf0fe; color: var(--primary); font-weight: 500; }
.nav-item.locked { color: var(--faint); }
.nav-icon { width: 18px; text-align: center; font-size: 15px; }
.nav-tag { margin-left: auto; font-size: 10px; background: var(--gray-bg); color: var(--muted); padding: 1px 6px; border-radius: 4px; }
.sidebar-foot { margin-top: auto; padding: 0 8px; font-size: 11px; color: var(--faint); line-height: 1.8; }
.foot-line { height: 1px; background: var(--border); margin-bottom: 10px; }

.main { flex: 1; padding: 26px 30px 40px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.page-head h1 { font-size: 21px; font-weight: 600; }
.page-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head .card-title { margin-bottom: 0; }
.card-tools { display: flex; gap: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 20px; }
.form-item { position: relative; }
.form-item.span2 { grid-column: span 2; }
.req { color: var(--danger); }
.combo-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
  background: #fff; border: 1px solid #d1d5db; border-radius: 7px; margin-top: 3px;
  max-height: 230px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.combo-option { padding: 8px 12px; cursor: pointer; font-size: 13px; display: flex; gap: 10px; }
.combo-option:hover, .combo-option.active { background: #eaf0fe; }
.combo-option .opt-id { color: var(--faint); font-variant-numeric: tabular-nums; }
.combo-empty { padding: 12px; color: var(--faint); font-size: 13px; }
.selected-hint { font-size: 12px; color: var(--primary); margin-top: 6px; }
.form-err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 10px 12px; background: #f9fafb; color: #4b5563;
  font-weight: 500; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid #f0f1f3; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }
.empty { text-align: center; padding: 30px; color: var(--faint); font-size: 13px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag-reason { background: #eef2ff; color: #4338ca; }
.tag-dest { background: #f0f9ff; color: #0369a1; }
.tag-status { display: inline-flex; align-items: center; gap: 5px; }
.tag-status i { width: 6px; height: 6px; border-radius: 50%; }
.tag-out { background: var(--red-bg); color: #b91c1c; }
.tag-out i { background: #dc2626; }
.tag-in { background: var(--green-bg); color: var(--green); }
.tag-in i { background: #16a34a; }
.tag-rest { background: var(--gray-bg); color: #6b7280; }
.tag-rest i { background: #9ca3af; }

/* ---------- 看板 ---------- */
.date-picker { display: flex; align-items: center; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; box-shadow: var(--shadow); }
.stat-card .stat-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); }
.stat-card .stat-nums { display: flex; align-items: baseline; gap: 14px; margin-top: 10px; }
.stat-num { font-size: 26px; font-weight: 600; line-height: 1; }
.stat-num.in { color: var(--green); }
.stat-num.out { color: var(--danger); }
.stat-num.rest { color: #9ca3af; }
.stat-sub { font-size: 12px; color: var(--faint); }
.stat-bar { display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin-top: 13px; background: #f0f1f3; }
.stat-bar span { display: block; }
.bar-in { background: #16a34a; }
.bar-out { background: #dc2626; }
.bar-rest { background: #cbd5e1; }
.shift-badge { font-size: 12px; color: var(--muted); background: var(--gray-bg); padding: 3px 10px; border-radius: 5px; }
.reason-stats { display: flex; flex-direction: column; gap: 10px; }
.reason-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.reason-name { width: 64px; color: #4b5563; flex-shrink: 0; }
.reason-track { flex: 1; height: 9px; background: #f0f1f3; border-radius: 5px; overflow: hidden; }
.reason-fill { height: 100%; background: #3b82f6; border-radius: 5px; }
.reason-count { width: 28px; text-align: right; color: var(--muted); }

.placeholder { text-align: center; padding: 80px 20px; color: var(--muted); }
.placeholder-icon { font-size: 42px; color: #cbd5e1; margin-bottom: 12px; }
.placeholder h2 { font-size: 17px; color: #374151; margin-bottom: 8px; font-weight: 600; }
.placeholder p { font-size: 13px; }

/* ---------- 看板切换 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  padding: 9px 16px; border: none; background: none; cursor: pointer;
  font-size: 14px; color: var(--muted); font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* ---------- 网格看板（原表样式） ---------- */
.grid-card { padding: 0; overflow: hidden; }
.grid-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--border); background: #fafbfc;
}
.grid-title { font-size: 14px; font-weight: 600; }
.grid-hint { font-size: 12px; color: var(--faint); display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.grid-scroll { overflow: auto; touch-action: pan-x pan-y; }
.grid-table { border-collapse: collapse; font-size: 12px; width: 100%; min-width: 1020px; }
.grid-table th, .grid-table td { border: 1px solid #dfe3e8; padding: 0; text-align: center; height: 34px; }
.grid-table th { background: #f7f8fa; font-weight: 500; color: #374151; }
.grid-table .th-group { background: #eef2f7; font-weight: 600; }
.grid-table .th-leader { background: #fafbfc; color: var(--muted); font-weight: 400; font-size: 11px; }
.grid-table .th-team { background: #f4f6f9; font-weight: 600; }
.grid-table .th-stat { background: #fafbfc; width: 96px; }
.grid-table .row-no { background: #fafbfc; color: var(--muted); width: 38px; font-size: 11px; }
.row-insert { border:none; background:#eaf0fe; color:var(--primary); border-radius:3px; cursor:pointer; font-size:11px; margin-left:3px; padding:1px 4px; }
.row-insert:hover { background:var(--primary); color:#fff; }
.grid-table .th-duty-head { background: #fff7e6; color: #9c4a20; }
.grid-table .duty-cell { background: #fffdf7; color: #9c4a20; font-weight: 500; }
.grid-table .cell-blank { background: #fdfdfd; }
.grid-table .cell-add {
  border: none; background: none; color: #c7cbd1; cursor: pointer;
  font-size: 15px; line-height: 1; padding: 4px;
}
.grid-table .cell-add:hover { color: var(--primary); }
.auth-matrix td { height: 28px; font-variant-numeric: tabular-nums; }
.auth-matrix .row-no { text-align: center; }
.grid-table .person {
  position: relative; cursor: grab; font-weight: 500; color: #374151;
  transition: filter .15s, box-shadow .15s; user-select: none;
}
.grid-table .person:hover { filter: brightness(.96); box-shadow: inset 0 0 0 2px rgba(0,0,0,.08); }
.grid-table .blank-person { color: #b0b6bf; font-style: italic; background: #fafbfc; }
.grid-table .person.dragging { opacity: .4; }
.grid-table .person.drop-target { box-shadow: inset 0 0 0 2px var(--primary); }
.grid-table .person .drag-dot { color: rgba(0,0,0,.18); font-size: 10px; margin-right: 3px; }
.grid-table .stat-count { font-weight: 600; }
.grid-legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  padding: 12px 18px; border-top: 1px solid var(--border); background: #fafbfc; font-size: 12px; color: var(--muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 13px; height: 13px; border-radius: 3px; border: 1px solid rgba(0,0,0,.06); }

/* 离岗类型颜色 —— 与 Excel 原表一致 */
.lv-培训 { background: #fce4d6; color: #9c4a20; }
.lv-休假 { background: #cfe2f3; color: #1f4e79; }
.lv-出差 { background: #d9d2e9; color: #4b3d70; }
.lv-随机 { background: #f8cdd0; color: #933; }
.lv-专项 { background: #d9ead3; color: #365f27; }
.lv-技术处 { background: #fff2cc; color: #7f6000; }
.lv-病假 { background: #e6e6e6; color: #555; }
.lv-事假 { background: #f3e5e5; color: #7b4b4b; }
.lv-在岗 { background: #fff; }

/* ---------- 月度在岗 ---------- */
.group-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.group-tab {
  padding: 6px 14px; border: 1px solid #d1d5db; background: #fff; border-radius: 6px;
  font-size: 13px; cursor: pointer; font-family: inherit; color: #4b5563;
}
.group-tab:hover { border-color: var(--primary); }
.group-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.month-tip { font-size: 12px; color: var(--faint); }
.month-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.month-scroll { overflow-x: auto; max-height: 560px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.month-table { border-collapse: collapse; font-size: 11px; width: 100%; }
.month-table th, .month-table td { border: 1px solid #e5e7eb; padding: 0; text-align: center; height: 30px; min-width: 30px; }
.month-table th { background: #f7f8fa; font-weight: 500; position: sticky; top: 0; z-index: 2; }
.month-table th.thead-top { background: #eef2f7; }
.month-table .m-name { position: sticky; left: 0; z-index: 1; background: #fff; text-align: left; padding: 0 8px; min-width: 76px; font-weight: 500; }
.month-table th.m-name { z-index: 3; background: #f7f8fa; }
.month-table .m-cell { cursor: pointer; font-size: 10px; line-height: 1.25; }
.month-table .m-cell:hover { box-shadow: inset 0 0 0 2px var(--primary); }
.month-table .m-shift { display: block; color: #9ca3af; font-size: 9px; }
.month-table .rest-cell { background: #f5f5f5; }
.month-table .weekend-col { background: #fafafa; }

/* ---------- 人员选择弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: 520px; max-width: 100%; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-x { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 16px 20px; overflow: hidden; display: flex; flex-direction: column; }
.modal-body .input { width: 100%; margin-bottom: 12px; }
.picker-list { overflow-y: auto; flex: 1; min-height: 120px; max-height: 340px; border: 1px solid var(--border); border-radius: 6px; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #f0f1f3; font-size: 13px; }
.picker-item:hover { background: #f5f8ff; }
.picker-item .pk-id { color: var(--muted); font-size: 12px; min-width: 70px; }
.picker-item .pk-name { font-weight: 500; min-width: 64px; }
.picker-item .pk-team { margin-left: auto; color: var(--faint); font-size: 12px; }
.picker-empty { padding: 24px; text-align: center; color: var(--faint); font-size: 13px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--border); }

/* ---------- 系统维护 ---------- */
.cfg-list { padding: 14px 18px; }
.cfg-group { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1px solid #f0f1f3; align-items: flex-start; }
.cfg-group-name { min-width: 90px; font-weight: 600; font-size: 13px; padding-top: 4px; }
.cfg-team-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cfg-team { display:inline-flex; align-items:center; gap:4px; background:#f3f4f6; border-radius:5px; padding:4px 8px; font-size:12px; }
.cfg-dict-list { padding: 14px 18px; display:grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap:8px; }
.cfg-dict-row { display:flex; align-items:center; gap:8px; padding:8px 10px; border:1px solid var(--border); border-radius:6px; }
.cfg-dict-val { flex:1; font-size:13px; }
.cfg-shift-grid { padding: 12px 18px; display:grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap:6px; max-height:480px; overflow:auto; }
.cfg-shift-cell { display:flex; align-items:center; gap:6px; font-size:12px; }
.cfg-shift-cell span { min-width:74px; }
.cfg-shift-sel { flex:1; padding:3px 5px; border:1px solid var(--border); border-radius:4px; font-size:12px; }
.cfg-check { display:inline-flex; align-items:center; gap:5px; padding:6px 10px; font-size:13px; cursor:pointer; }

/* ---------- 表格缩放控件 ---------- */
.zoom-ctrl { display: inline-flex; align-items: center; gap: 3px; margin-left: 10px; vertical-align: middle; }
.zoom-btn {
  min-width: 24px; height: 24px; padding: 0 5px; border: 1px solid #d1d5db;
  background: #fff; border-radius: 5px; cursor: pointer; font-size: 13px;
  color: #4b5563; font-family: inherit; line-height: 1;
}
.zoom-btn:hover { border-color: var(--primary); color: var(--primary); }
.zoom-btn.zoom-reset { font-size: 11px; padding: 0 7px; }
.zoom-label { font-size: 12px; color: var(--muted); min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; }
.zoomable { transform-origin: 0 0; will-change: transform; }
.zoom-touch-hint { font-size: 11px; color: var(--faint); }

/* ---------- 授权管理 ---------- */
.row-move { border: 1px solid #d1d5db; background:#fff; color:#6b7280; border-radius:4px; width:20px; height:20px; cursor:pointer; font-size:11px; line-height:1; }
.row-move:hover { border-color: var(--primary); color: var(--primary); }
.cell-select { padding: 4px 7px; border:1px solid #d1d5db; border-radius:5px; font-size:12px; font-family:inherit; }
.person-name, .person-id { cursor:pointer; border-bottom:1px dashed #cbd5e1; }
.person-name:hover, .person-id:hover { color: var(--primary); }
.person-id { font-variant-numeric: tabular-nums; }
.person-year { cursor:pointer; border-bottom:1px dashed #cbd5e1; }
.person-year:hover { color:var(--primary); }
.auth-person-info { background:#eef2f7; padding:10px 14px; border-radius:6px; font-size:13px; margin-bottom:16px; }
.auth-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
.auth-cat { border:1px solid var(--border); border-radius:8px; padding:12px; }
.auth-cat-title { font-size:13px; font-weight:500; color:#374151; margin-bottom:10px; }
.auth-items { display:flex; flex-wrap:wrap; gap:6px; }
.auth-item {
  border:1px solid #d1d5db; background:#fff; border-radius:5px; padding:5px 8px;
  font-size:12px; font-family:inherit; cursor:pointer; color:#4b5563;
}
.auth-item b { margin-left:6px; color:#9ca3af; font-weight:400; }
.auth-item.granted { background:#e7f6ef; border-color:#a7d8c3; color:var(--green); }
.auth-item.granted b { color:var(--green); font-weight:600; }
.cat-count { font-size:11px; color:var(--faint); font-weight:400; margin-left:6px; }
.cat-block { border:1px solid var(--border); border-radius:8px; padding:12px 14px; margin-bottom:12px; }
.cat-head { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.cat-title { font-size:14px; font-weight:500; cursor:pointer; border-bottom:1px dashed #cbd5e1; }
.cat-title:hover { color:var(--primary); }
.cat-items { display:flex; flex-wrap:wrap; gap:6px; }
.cat-item {
  display:inline-flex; align-items:center; gap:4px; background:#f3f4f6;
  border-radius:5px; padding:4px 8px; font-size:12px; color:#374151;
}
.cat-item > span { cursor:pointer; }
.cat-item > span:hover { color:var(--primary); }
.item-del { border:none; background:none; color:#9ca3af; cursor:pointer; font-size:14px; line-height:1; padding:0 0 0 2px; }
.item-del:hover { color:var(--danger); }
.cat-add-item {
  border:1px dashed #cbd5e1; background:#fff; color:var(--muted);
  border-radius:5px; padding:4px 10px; font-size:12px; cursor:pointer; font-family:inherit;
}
.cat-add-item:hover { border-color:var(--primary); color:var(--primary); }

/* ---------- 授权矩阵 / 人员授权显示 宽表 ---------- */
.matrix-scroll { overflow: auto; max-height: 600px; border: 1px solid var(--border); border-radius: 6px; -webkit-overflow-scrolling: touch; }
.matrix-table { border-collapse: separate; border-spacing: 0; font-size: 11px; width: max-content; }
.matrix-table th, .matrix-table td { border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; padding: 0; text-align: center; height: 26px; }
.matrix-table .m-head1 th { height: 30px; font-weight: 600; font-size: 12px; }
.matrix-table .m-cat { color: #374151; border-right: 2px solid #b8bec7; }
.matrix-table .m-head2 .m-item { min-width: 40px; max-width: 70px; font-size: 10px; font-weight: 400; color: #4b5563; padding: 2px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.matrix-table .m-basic {
  position: sticky; background: #fff; z-index: 2; min-width: 46px; padding: 0 5px;
  box-shadow: 1px 0 0 #d1d5db; white-space: nowrap;
}
.matrix-table th.m-basic { background: #f7f8fa; z-index: 4; }
.matrix-table .m-basic:nth-child(1) { left: 0; min-width: 36px; }
.matrix-table .m-basic:nth-child(2) { left: 36px; min-width: 60px; }
.matrix-table .m-basic:nth-child(3) { left: 96px; min-width: 56px; }
.matrix-table .m-basic:nth-child(4) { left: 152px; min-width: 46px; }
.matrix-table .m-basic:nth-child(5) { left: 198px; min-width: 52px; }
.matrix-table .m-basic:nth-child(6) { left: 250px; min-width: 60px; }
.matrix-table .m-basic:nth-child(7) { left: 310px; min-width: 46px; }
.matrix-table th.m-basic { top: 0; }
.matrix-table .m-head2 .m-item { position: sticky; top: 30px; z-index: 3; }
.matrix-table .m-auth { cursor: pointer; color: #1f2937; font-weight: 500; font-size: 13px; }
.matrix-table .m-auth:hover { box-shadow: inset 0 0 0 2px var(--primary); }
.matrix-hint { font-size: 12px; color: var(--muted); margin-top: 10px; padding: 8px 10px; background: #f9fafb; border-radius: 5px; }
.matrix-table tr.row-highlight td { box-shadow: inset 0 2px 0 var(--primary), inset 0 -2px 0 var(--primary); }
.matrix-table tr.row-highlight td.m-basic { background: #eaf0fe !important; color: var(--primary); font-weight: 600; }

.toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 7px;
  font-size: 13px; z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.toast.error { background: var(--danger); }

/* ============ 响应式：平板 ============ */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-item.span2 { grid-column: span 1; }
  .link-status { display: none; }
}

/* ============ 响应式：手机 ============ */
@media (max-width: 768px) {
  /* 布局改为纵向，侧边栏变横向导航栏 */
  .layout { flex-direction: column; min-height: calc(100vh - 56px); }

  .topbar {
    height: 56px; padding: 0 14px; gap: 10px; position: sticky; top: 0; z-index: 30;
  }
  .brand-sub { display: none; }
  .brand-title { font-size: 14px; }
  .logo { width: 32px; height: 32px; font-size: 17px; border-radius: 8px; }
  .user-box { gap: 8px; }
  .user-label { font-size: 12px; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .sidebar {
    width: 100%; padding: 0; border-right: none;
    border-bottom: 1px solid var(--border); position: sticky; top: 56px; z-index: 20;
  }
  .nav { flex-direction: row; overflow-x: auto; padding: 8px 10px; gap: 6px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item {
    width: auto; flex-shrink: 0; padding: 8px 12px; gap: 6px;
    font-size: 13px; white-space: nowrap; border-radius: 20px;
  }
  .nav-icon { width: auto; font-size: 14px; }
  .nav-tag { display: none; }
  .sidebar-foot { display: none; }

  .main { padding: 18px 14px 32px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-head h1 { font-size: 19px; }
  .page-head .date-picker { width: 100%; }
  .page-head .date-picker .input { flex: 1; }

  .card { padding: 16px; margin-bottom: 14px; }
  .card-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .card-tools { width: 100%; }
  .card-tools .input { flex: 1; min-width: 0; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 12px; }
  .stat-num { font-size: 22px; }
  .stat-nums { gap: 8px; flex-wrap: wrap; }

  .grid-toolbar { flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; }
  .grid-title { font-size: 13px; }
  .grid-hint { font-size: 11px; }
  .grid-legend { padding: 10px 12px; gap: 6px 10px; font-size: 11px; }
  .grid-scroll { -webkit-overflow-scrolling: touch; }
  .grid-table { min-width: 900px; }

  .month-scroll { -webkit-overflow-scrolling: touch; }
  .group-tabs { gap: 6px; }
  .group-tab { padding: 5px 10px; font-size: 12px; }

  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; padding: 8px 12px; font-size: 13px; }

  .form-actions .btn { flex: 1; }
  .table th, .table td { padding: 9px 8px; font-size: 12px; }

  .auth-person-info { font-size: 12px; }
  .auth-item { font-size: 11px; padding: 4px 6px; }
  .toast { top: 70px; max-width: 90vw; text-align: center; }
}

@media (max-width: 480px) {
  .login-card { width: calc(100vw - 32px); padding: 28px 22px; }
  .login-title { font-size: 17px; }
  .user-label { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card .stat-nums { justify-content: space-between; }
  .form-actions { flex-direction: column; }
  .auth-grid { grid-template-columns: 1fr; }
  .card-tools { flex-direction: column; align-items: stretch; }
  .card-tools .input { width: 100%; }
  .page-head .date-picker { flex-wrap: wrap; }
  #saveOrder { width: 100%; margin-left: 0 !important; }
}
