:root {
  --color-bg: #edf3f1;
  --color-surface: #ffffff;
  --color-surface-soft: #f4faf8;
  --color-text: #1f2a27;
  --color-text-muted: #66736f;
  --color-border: #dbe4e0;
  --color-primary: #167a63;
  --color-primary-hover: #0f604e;
  --color-primary-soft: #e7f4f0;
  --color-danger: #b8483d;
  --color-danger-soft: #fde7e2;
  --color-warning: #9a650e;
  --color-warning-soft: #fff2d9;
  --color-info: #526bbd;
  --color-focus: #167a63;
  --color-overlay: rgba(15, 31, 28, 0.42);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-control: 8px;
  --radius-panel: 12px;
  --radius-dialog: 14px;
  --radius-pill: 999px;
  --border-default: 1px solid var(--color-border);
  --shadow-panel: 0 8px 24px rgba(23, 44, 38, 0.08);
  --shadow-dialog: 0 24px 64px rgba(12, 34, 28, 0.24);
  --bg: #edf3f1;
  --panel: #fff;
  --ink: #1f2a27;
  --muted: #66736f;
  --line: #dbe4e0;
  --accent: #167a63;
  --accent2: #0f604e;
  --soft: #e7f4f0;
  --danger: #b8483d;
  --warn: #9a650e;
  --shadow: 0 16px 38px rgba(23, 44, 38, .10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}
button, input, select {
  font: inherit;
}
button {
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 9px 13px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover { background: var(--accent2); }
button.secondary {
  background: #fff;
  border: 1px solid var(--accent);
  color: var(--accent);
}
button.secondary:hover { background: var(--soft); }
button.ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,.26);
  color: #fff;
}
aside .aside-actions {
  display: grid;
  gap: 8px;
}
button.danger {
  background: #fff;
  border: 1px solid #e6bbb5;
  color: var(--danger);
}
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22,122,99,.12);
}
label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}
.hidden { display: none !important; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 18%, rgba(22,122,99,.16), transparent 34%),
    radial-gradient(circle at 82% 80%, rgba(47,125,112,.12), transparent 30%),
    linear-gradient(135deg, #eef6f3, #f8faf9);
  padding: 18px;
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px;
  display: grid;
  gap: 14px;
}
.login-card h1 { margin: 0; font-size: 24px; }
.login-card p { margin: -8px 0 4px; color: var(--muted); }
.login-card small { color: var(--muted); }

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}
aside {
  background: linear-gradient(180deg, #123d35, #0d2e29);
  color: #fff;
  padding: 18px 14px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: grid; gap: 5px; padding: 4px 6px 10px; }
.brand strong { font-size: 18px; }
.brand span { color: rgba(255,255,255,.72); font-size: 12px; }
.brand .app-version { color: rgba(255,255,255,.55); font-size: 11px; }
nav { display: grid; gap: 6px; align-content: start; }
nav button {
  text-align: left;
  background: transparent;
  color: rgba(255,255,255,.82);
  padding: 10px 11px;
}
nav button:hover, nav button.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}
main {
  min-width: 0;
  padding: 22px;
  display: grid;
  gap: 18px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
}
.topbar h1 { margin: 0 0 4px; font-size: 25px; }
.topbar p { margin: 0; color: var(--muted); }
.month-box { width: 190px; }
.month-box.multi-date {
  width: min(420px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px;
}

.page { display: none; }
.page.active { display: grid; gap: 18px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}
.panel h2 { margin: 0 0 14px; font-size: 18px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.panel-head h2 { margin: 0; }
.panel-head label { width: 210px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  align-items: end;
}
.wide { grid-column: span 2; }
.checkline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.checkline input { width: auto; }
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--ink);
}
.checks label {
  display: inline-flex;
  align-items: center;
  grid-template-columns: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--ink);
}
.checks input { width: auto; margin: 0; }

.salary-input {
  width: 86px;
  min-width: 86px;
  max-width: none;
  display: inline-block;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}

.salary-input[data-field="ratio"] {
  width: 96px;
  min-width: 96px;
}
.permission-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.hint { color: var(--muted); margin: 0 0 12px; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 100%;
  max-height: 440px;
  background: #fff;
}
.table-wrap.table-tall {
  max-height: 560px;
}
table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  background: #fff;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  line-height: 1.35;
}
th {
  background: #eef5f2;
  color: #2e403b;
  position: sticky;
  top: 0;
  z-index: 2;
}
td.num, th.num { text-align: right; }
#salaryTable table { min-width: 1900px; }
tr:last-child td { border-bottom: 0; }
.seq-col {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 54px;
  min-width: 54px;
  background: #fff;
  text-align: center;
}
th.seq-col {
  background: #eef5f2;
  z-index: 5;
}
.sticky-col {
  position: sticky;
  left: 54px;
  z-index: 3;
  background: #fff;
  min-width: 116px;
}
th.sticky-col {
  background: #eef5f2;
  z-index: 5;
}
.actions { display: flex; justify-content: flex-end; gap: 6px; }
.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--soft);
  color: var(--accent2);
  font-size: 12px;
}
.warn { color: var(--warn); font-weight: 700; }
.ok { color: var(--accent2); font-weight: 700; }

.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}
.kpis.kpis-many {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.kpis div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.kpis span { color: var(--muted); }
.kpis b { display: block; font-size: 26px; margin: 5px 0; }
.kpis small { color: var(--muted); }
.charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(360px, 1fr));
  gap: 14px;
  align-items: start;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}
canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfc;
  display: block;
}
.charts canvas {
  height: 300px;
  min-height: 300px;
  aspect-ratio: auto;
}
.compact-filter {
  box-shadow: none;
  display: flex;
  justify-content: flex-end;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}
.compact-filter label { width: 240px; }
.dashboard-filter {
  justify-content: space-between;
}
.dashboard-filter label { width: 180px; }
.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  background: #fff;
}
.segmented button {
  background: transparent;
  color: var(--accent);
}
.segmented button.active {
  background: var(--accent);
  color: #fff;
}
.allocation-box {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  align-self: stretch;
}
.split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.import-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 7px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: #fff;
  padding: 9px 13px;
  cursor: pointer;
}
.import-picker input { display: none; }
.filters-inline {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filters-inline label { width: 180px; }
.actions-left {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 9px 13px;
  text-decoration: none;
}
.button-link:hover { background: var(--accent2); }
.store-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.store-tabs button {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--line);
}
.store-tabs button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #1f2a27;
  color: #fff;
  padding: 10px 12px;
  border-radius: 7px;
  opacity: 0;
  transform: translateY(8px);
  transition: .18s;
  z-index: 60;
}
#toast.show { opacity: 1; transform: none; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 31, 28, .42);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 20;
}
.modal-card {
  width: min(960px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 28px 70px rgba(12, 34, 28, .25);
  padding: 18px;
}
.modal-card.small-modal {
  width: min(460px, 94vw);
}
.modal-card img {
  display: block;
  width: 100%;
  max-width: 900px;
  margin: 12px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

body.drawer-open { overflow: hidden; }
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  justify-content: flex-end;
  background: rgba(14, 31, 27, .38);
}
.drawer-panel {
  width: min(540px, 100vw);
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 50px rgba(12, 34, 28, .18);
  display: grid;
  grid-template-rows: auto 1fr auto;
  animation: drawer-in .18s ease-out;
}
@keyframes drawer-in {
  from { transform: translateX(28px); }
  to { transform: translateX(0); }
}
.drawer-head {
  min-height: 82px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.drawer-head h2 { margin: 2px 0 0; font-size: 21px; }
.drawer-kicker { color: var(--accent); font-size: 12px; font-weight: 700; }
.drawer-body {
  overflow-y: auto;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 14px;
}
.drawer-body .drawer-wide { grid-column: 1 / -1; }
.drawer-actions {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: #fbfcfc;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.drawer-actions button { min-height: 42px; }

@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  aside {
    position: static;
    height: auto;
    grid-template-rows: auto auto auto;
  }
  nav {
    grid-template-columns: repeat(3, 1fr);
  }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .charts canvas { height: 320px; }
}
@media (max-width: 620px) {
  main { padding: 12px; }
  .topbar { display: grid; }
  .month-box { width: 100%; }
  nav { grid-template-columns: 1fr 1fr; }
  .form-grid, .kpis { grid-template-columns: 1fr; }
  .wide { grid-column: span 1; }
  .drawer-body { grid-template-columns: 1fr; }
  .drawer-body .drawer-wide { grid-column: auto; }
}


/* v7.6 会员卡余额明细增加独立滚动区域 */
.cards-balance-detail .table-wrap { max-height: 420px; overflow: auto; }
.cards-tx-detail .table-wrap { max-height: 620px; overflow: auto; }

.inline-toolbar { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.inline-toolbar button { width: auto; padding: 8px 14px; }
.inline-toolbar span { color: #345; font-weight: 600; }

/* 数据工具：将导入、导出、打印和备份放回各自业务页面。 */
.page-utility {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #d6e3de;
  border-radius: 12px;
  background: linear-gradient(135deg, #fbfdfc, #f3f8f6);
}
.page-utility h2,
.page-utility h3 { margin: 0; color: var(--color-primary); }
.page-utility h3 { font-size: 16px; }
.page-utility p { margin: 4px 0 0; }
.utility-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  align-items: end;
  gap: 12px;
}
.utility-controls-wide { grid-template-columns: repeat(6, minmax(145px, 1fr)); }
.utility-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.utility-actions button,
.utility-actions .button-link { width: auto; min-width: 112px; }
.secondary-link {
  background: #fff;
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.secondary-link:hover { background: var(--color-primary-soft); }
.utility-status { min-height: 20px; }

.data-import-panel { max-width: 1040px; }
.data-import-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 2px 0 20px;
  padding: 0;
  list-style: none;
}
.data-import-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d7e5df;
  border-radius: 10px;
  background: #f7fbf9;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 700;
}
.data-import-steps b,
.data-import-icon,
.maintenance-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
}
.data-import-list { display: grid; gap: 14px; }
.data-import-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #d5e3de;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(24, 69, 57, .05);
}
.data-import-card-head { display: flex; align-items: flex-start; gap: 11px; }
.data-import-icon { width: 36px; height: 36px; border-radius: 10px; font-size: 15px; }
.data-import-card h3 { margin: 0; color: var(--color-primary); font-size: 17px; }
.data-import-card p { margin: 3px 0 0; }
.data-import-actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.data-import-actions > * { width: auto; }
.import-preview,
.import-result {
  min-height: 22px;
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed #c7d9d2;
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--color-text-muted);
  font-size: 13px;
}
.import-preview.ready { border-style: solid; border-color: #a9cfbf; background: #eef8f3; color: #17634f; }
.import-preview.warning { border-style: solid; border-color: #e7ca89; background: #fff9eb; color: #875b0f; }
.import-preview.error { border-style: solid; border-color: #e7b1aa; background: #fff4f2; color: #a53e32; }
.import-result:empty { display: none; }
.import-danger {
  padding: 11px 12px;
  border: 1px solid #ecd2cc;
  border-radius: 9px;
  background: #fff8f7;
}
.import-danger summary { cursor: pointer; color: #9a4035; font-weight: 700; }
.import-danger .filters-inline { margin-top: 12px; }
.import-danger p { margin: 10px 0 0; }
.maintenance-panel { max-width: 980px; }
.maintenance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.maintenance-grid article { display: flex; align-items: flex-start; gap: 13px; min-height: 148px; padding: 18px; border: 1px solid #d5e3de; border-radius: 12px; background: linear-gradient(145deg, #fff, #f5faf7); }
.maintenance-icon { width: 42px; height: 42px; border-radius: 11px; font-size: 12px; font-weight: 800; }
.maintenance-grid h3 { margin: 0 0 5px; color: var(--color-primary); font-size: 17px; }
.maintenance-grid p { margin: 0; color: var(--color-text-muted); font-size: 13px; }
.maintenance-grid button { width: auto; margin-top: 13px; }
.maintenance-details { display: grid; gap: 7px; margin: 12px 0 0; }
.maintenance-details div { display: flex; justify-content: space-between; gap: 14px; padding-top: 7px; border-top: 1px solid #dce7e3; font-size: 12px; }
.maintenance-details dt { color: var(--color-text-muted); }
.maintenance-details dd { margin: 0; color: var(--color-primary); font-weight: 700; text-align: right; }

/* v1.4 门店数据仪表盘优化 */
.dashboard-kpis {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  margin-bottom: 14px;
}
.dashboard-kpis div {
  position: relative;
  min-height: 112px;
  border-radius: 16px;
  padding: 18px 20px;
}
.dashboard-kpis b {
  font-size: 30px;
  line-height: 1.1;
  color: #153b34;
}
.kpi-badge {
  position: absolute;
  right: 18px;
  top: 46px;
  min-width: 76px;
  text-align: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #7f928d;
}
.kpi-badge.good { background: #12866f; }
.kpi-badge.bad { background: #e67261; }
.kpi-badge.warn { background: #f5a642; }
.kpi-badge.neutral { background: #6e82d4; }
.dashboard-panel h2,
.dashboard-insights-panel h2 { font-size: 20px; }
.dashboard-charts {
  grid-template-columns: repeat(2, minmax(420px, 1fr));
  max-height: none;
  overflow: visible;
}
.dashboard-charts canvas {
  aspect-ratio: 2.15 / 1;
  min-height: 260px;
  max-height: none;
  border-radius: 16px;
}
.dashboard-insights {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.insight-row {
  display: grid;
  grid-template-columns: 18px 130px 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f4faf8;
}
.insight-row i {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #12866f;
}
.insight-row strong { color: #153b34; }
.insight-row span { color: #6f827e; }
.insight-row.good i { background: #12866f; }
.insight-row.warn i { background: #f5a642; }
.insight-row.bad i { background: #e67261; }
.insight-row.neutral i { background: #6e82d4; }
.operations-filter {
  justify-content: flex-start;
}
.operations-filter button {
  align-self: end;
}
.operations-kpis b {
  padding-right: 92px;
  word-break: break-word;
}
.op-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 700;
  font-size: 12px;
  background: #eef3f6;
  color: #4b6270;
}
.op-status.good {
  background: #e2f4ef;
  color: #0f604e;
}
.op-status.warn {
  background: #fff2d9;
  color: #8a5b0c;
}
.op-status.bad {
  background: #fde7e2;
  color: #a33e34;
}
.subsection-title {
  margin: 16px 0 10px;
  font-size: 15px;
  color: #153b34;
}
@media (max-width: 1200px) {
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .dashboard-charts, .dashboard-insights { grid-template-columns: 1fr; }
}

/* v9.1 UI foundations */
html { min-width: 0; }
body {
  overflow-x: hidden;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}
button,
.button-link,
input,
select {
  min-height: 40px;
  border-radius: var(--radius-control);
}
input[type="checkbox"],
input[type="radio"] {
  min-height: auto;
}
button:focus-visible,
.button-link:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
.table-wrap:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
button:active,
.button-link:active {
  filter: brightness(.94);
}
button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: .58;
}
button.danger:hover {
  background: var(--color-danger-soft);
  border-color: var(--color-danger);
}
.app {
  grid-template-columns: 220px minmax(0, 1fr);
}
aside {
  overflow-y: auto;
  scrollbar-width: thin;
}
.brand {
  grid-template-columns: minmax(0, 1fr);
}
.brand-copy {
  display: grid;
  gap: 5px;
}
.nav-toggle {
  display: none;
  width: 100%;
  min-height: 40px;
}
nav {
  gap: var(--space-4);
}
.nav-group {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.nav-group[hidden] {
  display: none;
}
.nav-group-label {
  padding: 2px 8px;
  color: rgba(255,255,255,.56);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
}
nav button {
  min-height: 40px;
  border-radius: var(--radius-control);
}
nav button[aria-current="page"] {
  box-shadow: inset 3px 0 0 #8ed8c4;
}
main {
  width: 100%;
  max-width: 1600px;
  margin-inline: auto;
  padding: var(--space-6);
  overflow: visible;
}
.panel,
.kpis div,
.chart-panel {
  border: var(--border-default);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
}
.panel {
  padding: var(--space-5);
}
.panel h2 {
  font-size: 18px;
  line-height: 1.35;
}
.topbar h1 {
  font-size: clamp(24px, 2.2vw, 26px);
}
.kpis b,
.num,
.salary-input,
.dashboard-kpis b {
  font-variant-numeric: tabular-nums;
}
.filters-inline,
.actions,
.actions-left,
.inline-toolbar {
  flex-wrap: wrap;
}
.table-scroll-shell {
  min-width: 0;
  max-width: 100%;
}
.table-scroll-hint {
  display: none;
  margin: 0 0 var(--space-2);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 600;
}
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: #8ea69f #e6eeeb;
  scrollbar-width: auto;
}
.table-wrap::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
.table-wrap::-webkit-scrollbar-track {
  background: #e6eeeb;
  border-radius: var(--radius-pill);
}
.table-wrap::-webkit-scrollbar-thumb {
  background: #8ea69f;
  border: 3px solid #e6eeeb;
  border-radius: var(--radius-pill);
}
.table-wrap.has-sticky .sticky-col {
  box-shadow: 8px 0 12px -12px rgba(16, 54, 45, .8);
}
tbody tr:hover td {
  background-color: var(--color-surface-soft);
}
tbody tr:hover .seq-col,
tbody tr:hover .sticky-col {
  background-color: #edf7f4;
}
.empty-state,
.loading-state,
.error-state {
  min-height: 112px;
  display: grid;
  place-items: center;
  padding: var(--space-6);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface-soft);
  color: var(--color-text-muted);
  text-align: center;
}
.error-state {
  border-color: #e6bbb5;
  background: var(--color-danger-soft);
  color: #8f352d;
}
#toast {
  max-width: min(420px, calc(100vw - 24px));
  min-height: 40px;
  padding: 10px 14px;
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-dialog);
  pointer-events: none;
}
.modal {
  background: var(--color-overlay);
  padding: var(--space-4);
}
.modal-card {
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border-radius: var(--radius-dialog);
  box-shadow: var(--shadow-dialog);
  padding: var(--space-5);
  overscroll-behavior: contain;
}
.modal-card.small-modal {
  width: min(460px, calc(100vw - 32px));
}
.modal-card > .panel-head {
  position: sticky;
  top: calc(-1 * var(--space-5));
  z-index: 2;
  margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border-bottom: var(--border-default);
}
.drawer-panel {
  max-width: 100vw;
  box-shadow: var(--shadow-dialog);
}

@media (max-width: 1199px) {
  main {
    padding: var(--space-4);
  }
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid > * {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 1000px) {
  aside {
    overflow: visible;
  }
  nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  .nav-group {
    padding: var(--space-2);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: var(--radius-panel);
  }
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-charts,
  .dashboard-insights {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    min-width: 0;
  }
  aside,
  main,
  .topbar,
  .page,
  .panel,
  .table-scroll-shell {
    min-width: 0;
    max-width: 100%;
  }
  aside,
  main {
    width: 100%;
  }
  aside {
    padding: var(--space-3);
    gap: var(--space-3);
  }
  .brand {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
    padding-bottom: 0;
  }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 44px;
  }
  nav {
    grid-template-columns: 1fr;
    max-height: min(58vh, 480px);
    overflow-y: auto;
    padding-right: 4px;
  }
  nav[data-collapsed="true"] {
    display: none;
  }
  .nav-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nav-group-label {
    grid-column: 1 / -1;
  }
  nav button,
  button,
  .button-link,
  input,
  select {
    min-height: 44px;
  }
  main {
    padding: var(--space-3);
    gap: var(--space-4);
  }
  .topbar {
    display: grid;
    align-items: stretch;
  }
  .topbar > *,
  .month-box.multi-date,
  .month-box.multi-date label,
  .month-box.multi-date input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .month-box.multi-date {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-grid,
  .kpis,
  .dashboard-kpis,
  .permission-checks {
    grid-template-columns: 1fr;
  }
  .wide {
    grid-column: span 1;
  }
  .panel {
    padding: var(--space-4);
  }
  .panel-head,
  .filters-inline,
  .inline-toolbar {
    align-items: stretch;
  }
  .panel-head {
    flex-wrap: wrap;
  }
  .panel-head label {
    width: 100%;
  }
  .form-grid > button[type="submit"],
  .drawer-actions button[type="submit"] {
    width: 100%;
  }
  .actions {
    justify-content: flex-start;
  }
  .table-scroll-hint {
    display: block;
  }
  .modal {
    padding: var(--space-3);
  }
  .modal-card,
  .modal-card.small-modal {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: var(--space-4);
  }
  .modal-card > .panel-head {
    top: calc(-1 * var(--space-4));
    margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) var(--space-3);
    padding: var(--space-3) var(--space-4);
  }
  .drawer-panel {
    width: 100vw;
  }
  .drawer-body {
    grid-template-columns: 1fr;
    padding: var(--space-4);
  }
  .drawer-body .drawer-wide {
    grid-column: auto;
  }
  .drawer-actions {
    grid-template-columns: 1fr;
    padding: var(--space-3) var(--space-4);
  }
  #toast {
    right: 12px;
    bottom: 12px;
  }
}

/* v9.2 支出管理：台账、固定支出和月度核对。 */
.expense-page { gap: 12px; }
.expense-tabs { display: flex; align-items: center; align-self: start; width: fit-content; max-width: 100%; height: fit-content; min-height: 0; gap: 4px; padding: 4px; overflow-x: auto; border: 1px solid #d5e1dd; border-radius: 11px; background: #eef4f1; box-shadow: none; scrollbar-width: thin; }
.expense-tabs button { flex: 0 0 auto; min-width: 0; min-height: 38px; padding: 7px 15px; border: 0; border-radius: 8px; background: transparent; color: var(--color-text-muted); font-weight: 700; white-space: nowrap; box-shadow: none; }
.expense-tabs button:hover { background: rgba(255,255,255,.72); color: var(--color-primary); }
.expense-tabs button.active { background: #fff; color: var(--color-primary); box-shadow: 0 1px 5px rgba(25,75,62,.13); }
.expense-tab-panel { min-width: 0; }
.expense-reminders { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.expense-reminder-heading { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; color: var(--color-primary); font-weight: 700; }
.expense-reminder-heading span { padding: 3px 9px; border-radius: var(--radius-pill); background: var(--color-warning-soft); color: #885500; font-size: 12px; }
.expense-reminder-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 14px; border: 1px solid #ead49e; border-left: 4px solid #d89d25; border-radius: 10px; background: #fffaf0; }
.expense-reminder-card strong, .expense-reminder-card small { display: block; }.expense-reminder-card small { margin-top: 3px; color: var(--color-text-muted); }.expense-reminder-card p { grid-column: 1 / -1; margin: 0; color: #70551a; font-size: 13px; }.expense-reminder-card button { align-self: center; width: auto; min-height: 36px; padding: 6px 10px; }
.expense-form { display: grid; gap: 16px; max-width: 1480px; }.expense-form-basic { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: end; }.expense-form-basic > label:nth-of-type(1), .expense-form-basic > label:nth-of-type(2) { grid-column: span 3; }.expense-form-basic > label:nth-of-type(3), .expense-form-basic > label:nth-of-type(4), .expense-form-basic > label:nth-of-type(5) { grid-column: span 2; }.expense-form label, .expense-plan-form label, .expense-filter-grid label { min-width: 0; }
.expense-cost-center { grid-column: 1 / -1; min-width: 0; margin: 2px 0 0; padding: 12px 14px; border: 1px solid #dbe5e1; border-radius: 9px; background: #f9fbfa; }.expense-cost-center legend { padding: 0 5px; color: var(--color-text-muted); font-size: 13px; }.expense-center-checks { min-height: 36px; align-items: center; }.expense-center-checks label { cursor: pointer; transition: .16s ease; }.expense-center-checks label:has(input:checked) { border-color: var(--color-primary); background: var(--color-primary-soft); color: var(--color-primary); font-weight: 700; }
.expense-fx-fields { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(160px, 1fr) minmax(200px, 1.2fr); gap: 12px; padding: 13px; border: 1px solid #bddbd3; border-radius: 9px; background: #f4fbf8; }.expense-converted-preview { display: grid; align-content: center; padding: 4px 12px; border-left: 3px solid var(--color-primary); }.expense-converted-preview span { color: var(--color-text-muted); font-size: 12px; }.expense-converted-preview strong { color: var(--color-primary); font-size: 20px; }.expense-converted-preview small { color: var(--color-text-muted); font-size: 11px; }
.expense-advanced { border: var(--border-default); border-radius: 9px; background: #fbfdfc; }.expense-advanced summary { padding: 12px 14px; cursor: pointer; color: var(--color-primary); font-weight: 700; }.expense-advanced[open] summary { border-bottom: var(--border-default); }.expense-form-advanced { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; padding: 14px; }.expense-note { grid-column: span 2; }.expense-note textarea { min-height: 76px; resize: vertical; }
.allocation-box, .expense-allocation-preview, .expense-attachments { grid-column: 1 / -1; }.allocation-box { padding: 12px; border-radius: 8px; background: #f5f8f7; }.allocation-box .hint { margin: 0; }.expense-allocation-preview { display: grid; gap: 4px; padding: 12px; border-left: 3px solid var(--color-primary); background: #f4f9f7; }.expense-allocation-preview span { font-size: 14px; }.expense-allocation-preview small { color: var(--color-text-muted); }.expense-allocation-preview .good { color: var(--color-primary); }.expense-allocation-preview .bad { color: var(--color-danger); font-weight: 700; }
.expense-attachments { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(280px, 1.3fr); gap: 12px; align-items: start; padding-top: 4px; }.expense-attachments > div:first-child small { display: block; margin-top: 4px; color: var(--color-text-muted); font-size: 12px; }.expense-dropzone { display: grid; place-items: center; min-height: 112px; padding: 12px; border: 2px dashed #9ec8bb; border-radius: 9px; background: #f8fcfa; color: var(--color-primary); cursor: pointer; text-align: center; }.expense-dropzone:hover, .expense-dropzone.dragging { border-color: var(--color-primary); background: var(--color-primary-soft); }.expense-dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }.expense-attachment-list { grid-column: 2; display: grid; gap: 6px; }.expense-attachment-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px 10px; border: var(--border-default); border-radius: 7px; background: #fff; }.expense-attachment-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.expense-attachment-item small { color: var(--color-text-muted); }.expense-attachment-item.has-error small { color: var(--color-danger); }.expense-attachment-item a { color: var(--color-primary); font-size: 13px; }
.expense-form-actions { display: flex; align-items: center; gap: 12px; }.expense-form-actions button { min-width: 160px; }.expense-form-actions small { color: var(--color-text-muted); }
.expense-filter-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 11px; align-items: end; margin-bottom: 16px; }.expense-filter-actions { display: flex; gap: 8px; }.expense-filter-actions button { flex: 1; }
.expense-office-kpi { border-color: #b9bfd7 !important; background: #f6f7fd; }.expense-ledger-cards { display: none; }.expense-ledger-card { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 14px; border: var(--border-default); border-radius: 10px; background: #fff; }.expense-ledger-card > div:first-child strong, .expense-ledger-card > div:first-child span { display: block; }.expense-ledger-card > div:first-child span, .expense-ledger-card p, .expense-ledger-card small { color: var(--color-text-muted); font-size: 13px; }.expense-ledger-card > b { color: var(--color-primary); font-size: 19px; }.expense-ledger-card p, .expense-ledger-card small, .expense-ledger-card > div:last-child { grid-column: 1 / -1; margin: 0; }.expense-ledger-card.voided { opacity: .62; background: #fafafa; }.expense-ledger-card .actions { justify-content: flex-end; }
.expense-plan-form { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin: 0 0 18px; padding: 15px; border: 1px solid #b9d9cf; border-radius: 10px; background: #f6fbf9; }.expense-plan-actions { display: flex; grid-column: 1 / -1; gap: 9px; }.expense-plan-actions button { min-width: 140px; }.expense-plan-list { display: grid; gap: 10px; }.expense-plan-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 14px; border: var(--border-default); border-radius: 9px; }.expense-plan-card strong { font-size: 16px; }.expense-plan-card > div:first-child span { margin-left: 8px; color: var(--color-text-muted); }.expense-plan-card p, .expense-plan-card small { grid-column: 1 / -1; margin: 0; color: var(--color-text-muted); }.expense-plan-card .actions { justify-content: flex-end; }.expense-plan-card.paused { opacity: .65; background: #fafafa; }
.expense-category-panel { max-width: 1120px; }.expense-category-form, .expense-category-child-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; margin: 0 0 12px; padding: 14px; border: 1px solid #b9d9cf; border-radius: 10px; background: #f6fbf9; }.expense-category-child-form { grid-template-columns: minmax(180px, .45fr) minmax(0, 1fr) auto; }.expense-category-form label, .expense-category-child-form label { min-width: 0; }.expense-category-form button, .expense-category-child-form button { min-width: 130px; min-height: 44px; }.expense-category-list { display: grid; gap: 9px; }.expense-category-table-wrap { max-height: min(64vh, 720px); overflow: auto; border: var(--border-default); border-radius: 10px; background: #fff; }.expense-category-table { width: 100%; min-width: 880px; border-collapse: separate; border-spacing: 0; }.expense-category-table th, .expense-category-table td { padding: 10px 12px; border-bottom: 1px solid #e4ece8; text-align: left; vertical-align: middle; }.expense-category-table th { position: sticky; top: 0; z-index: 2; background: #e9f4ef; color: #31564b; font-weight: 700; white-space: nowrap; box-shadow: 0 1px 0 #d5e5de; }.expense-category-table tbody tr:last-child td { border-bottom: 0; }.expense-category-group-row td { background: #f5f9f7; font-weight: 600; }.expense-category-child-row td { background: #fff; }.expense-category-child-row td:nth-child(2) { padding-left: 30px; }.expense-category-table input, .expense-category-table select { width: 100%; min-width: 120px; min-height: 36px; padding: 6px 8px; font-size: 14px; }.expense-category-table td:nth-child(5) { color: var(--color-text-muted); white-space: nowrap; font-size: 13px; }.expense-category-table .paused { opacity: .68; }.category-kind { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--color-primary-soft); color: var(--color-primary); font-size: 12px; white-space: nowrap; }.category-kind.child { background: #f0f3f2; color: #5b6d66; }.category-order-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; white-space: nowrap; }.category-order-actions button { min-height: 34px; }.category-order-actions .icon-button { min-width: 34px; padding: 4px 8px; font-size: 17px; line-height: 1; }.category-locked-note { color: var(--color-text-muted); font-size: 13px; }.expense-category-sort-tip { margin: 10px 2px 0; }.expense-category-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; align-items: center; padding: 13px 14px; border: var(--border-default); border-radius: 9px; background: #fff; }.expense-category-card > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }.expense-category-card strong { overflow-wrap: anywhere; font-size: 16px; }.expense-category-card p { grid-column: 1 / -1; margin: 0; color: var(--color-text-muted); font-size: 13px; }.expense-category-card .actions { justify-content: flex-end; }.expense-category-card.paused { background: #fafafa; opacity: .74; }.expense-category-state { display: inline-flex; align-items: center; min-height: 23px; padding: 2px 8px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }.expense-category-state.active { background: var(--color-primary-soft); color: var(--color-primary); }.expense-category-state.inactive { background: #eef0ef; color: #67736f; }
.expense-export-panel { max-width: 1120px; }.expense-export-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin-top: 4px; }.expense-export-grid label { min-width: 0; }.expense-export-summary { margin: 14px 0; padding: 10px 12px; border-radius: 8px; background: #f3f7f5; color: var(--color-text-muted); font-size: 13px; }.expense-export-summary.error { background: #fff3f1; color: var(--color-danger); }.expense-export-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }.expense-export-options article { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 13px; align-items: center; min-height: 132px; padding: 18px; border: 1px solid #d5e3de; border-radius: 12px; background: linear-gradient(145deg, #fff, #f7fbf9); }.expense-export-options article:hover { border-color: #9fc7bb; box-shadow: 0 8px 22px rgba(25,75,62,.08); }.expense-export-options strong { display: block; margin-bottom: 5px; font-size: 17px; }.expense-export-options p { margin: 0; color: var(--color-text-muted); font-size: 13px; }.expense-export-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--color-primary-soft); color: var(--color-primary); font-size: 12px; font-weight: 800; letter-spacing: .04em; }.expense-export-options .button-link { min-width: 105px; }.expense-export-options .button-link.disabled { pointer-events: none; opacity: .5; }.expense-export-permission { grid-column: 1 / -1; margin: -3px 0 0; }
.expense-review-summary { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }.expense-review-summary > div { display: grid; gap: 5px; padding: 12px; border: var(--border-default); border-radius: 9px; background: #fbfdfc; }.expense-review-summary span, .expense-review-summary small { color: var(--color-text-muted); font-size: 12px; }.expense-review-summary b { font-size: 17px; }.expense-review-summary .is-locked { border-color: #82b8a8; background: var(--color-primary-soft); color: var(--color-primary); }.expense-review-blockers { margin: 12px 0; padding: 13px 16px; border: 1px solid #edc9c4; border-radius: 8px; background: #fff7f5; color: #8c362d; }.expense-review-blockers ul { margin: 7px 0 0; padding-left: 19px; }.expense-review-ready { margin: 12px 0; padding: 12px; border-radius: 8px; background: var(--color-primary-soft); color: var(--color-primary); }.expense-review-actions { display: flex; justify-content: flex-end; gap: 10px; }.expense-review-actions button { min-width: 140px; }
.expense-tab-count { display: inline-grid; min-width: 18px; height: 18px; place-items: center; margin-left: 3px; padding: 0 4px; border-radius: 999px; background: var(--color-danger); color: #fff; font-size: 11px; line-height: 1; }.expense-tabs button.active .expense-tab-count { background: #e86b5d; }#expenseQuickEntry.active { border-color: var(--color-primary); background: var(--color-primary-soft); color: var(--color-primary); }
.expense-todo-panel { max-width: 1050px; }.expense-todo-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; padding: 14px; border: 1px solid #b9d9cf; border-radius: 10px; background: #f6fbf9; }.expense-todo-form .wide { grid-column: 1 / -1; }.expense-todo-list { display: grid; gap: 18px; }.expense-todo-section { display: grid; gap: 10px; }.expense-todo-section-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; padding: 0 2px; }.expense-todo-section-head h3 { margin: 0; font-size: 16px; }.expense-todo-section-head p { margin: 4px 0 0; color: var(--color-text-muted); font-size: 13px; }.expense-todo-section-head > span { flex: 0 0 auto; padding: 3px 8px; border-radius: var(--radius-pill); background: #edf5f1; color: var(--color-primary); font-size: 12px; font-weight: 700; }.expense-todo-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; padding: 14px; border: var(--border-default); border-left: 4px solid #d89d25; border-radius: 9px; background: #fffdf7; }.expense-todo-card > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }.expense-todo-card p, .expense-todo-card small { grid-column: 1 / -1; margin: 0; color: var(--color-text-muted); }.expense-todo-card .actions { justify-content: flex-end; }.expense-todo-card-auto { border-left-color: var(--color-primary); background: #f7fcfa; }.expense-todo-card-auto > p { color: var(--color-text); font-weight: 700; }.expense-todo-details { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-column: 1 / -1; gap: 8px; margin: 3px 0 1px; }.expense-todo-details > div { min-width: 0; padding: 8px 9px; border: 1px solid #dce8e3; border-radius: 7px; background: #fff; }.expense-todo-details dt { color: var(--color-text-muted); font-size: 11px; }.expense-todo-details dd { overflow-wrap: anywhere; margin: 3px 0 0; font-size: 13px; font-weight: 700; }.expense-todo-card.closed { border-left-color: #a5afa9; background: #fafbfa; opacity: .72; }.expense-todo-state { display: inline-flex; padding: 2px 8px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }.expense-todo-state.open { background: #fff0ca; color: #8a5b00; }.expense-todo-card-auto .expense-todo-state.open { background: var(--color-primary-soft); color: var(--color-primary); }.expense-todo-state.closed { background: #e9efec; color: #62716a; }
.expense-todo-current-empty { margin: 0; }.expense-todo-history { overflow: hidden; border: var(--border-default); border-radius: 9px; background: #fafbfa; }.expense-todo-history summary { padding: 12px 14px; color: var(--color-text-muted); cursor: pointer; font-size: 13px; font-weight: 700; }.expense-todo-history[open] summary { border-bottom: var(--border-default); }.expense-todo-history-list { display: grid; gap: 9px; padding: 10px; }.expense-todo-history .expense-todo-card { margin: 0; }
.expense-category-group { overflow: hidden; border: var(--border-default); border-radius: 10px; background: #fff; }.expense-category-group + .expense-category-group { margin-top: 10px; }.expense-category-group summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 14px; cursor: pointer; background: #f5f9f7; list-style: none; }.expense-category-group summary::-webkit-details-marker { display: none; }.expense-category-group summary > span:first-child { display: grid; gap: 3px; }.expense-category-group summary small { color: var(--color-text-muted); font-size: 12px; }.expense-category-group-actions { display: flex; gap: 8px; padding: 10px 14px 0; }.expense-category-group .expense-category-list { padding: 10px 14px 14px; }.expense-category-group .expense-category-card { border-radius: 8px; }.expense-category-group .expense-category-card + .expense-category-card { margin-top: 8px; }
.expense-attachment-modal-card { width: min(980px, calc(100vw - 28px)); }.expense-attachment-viewer { display: grid; min-height: 360px; place-items: center; margin: 10px 0 16px; overflow: hidden; border: var(--border-default); border-radius: 10px; background: #f5f7f6; }.expense-attachment-viewer img { display: block; max-width: 100%; max-height: min(68vh, 680px); object-fit: contain; }.expense-attachment-viewer iframe { display: block; width: 100%; height: min(68vh, 680px); border: 0; background: #fff; }.expense-attachment-download { display: grid; gap: 7px; max-width: 420px; padding: 24px; text-align: center; color: var(--color-text-muted); }.expense-attachment-item > div { display: flex; align-items: center; gap: 7px; }.expense-attachment-item a, .expense-attachment-item button { white-space: nowrap; }
.expense-import-box { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; margin-top: 16px; padding: 16px; border: 1px solid #b8d8ce; border-radius: 12px; background: linear-gradient(145deg, #f8fcfa, #edf7f3); }.expense-import-box strong { display: block; }.expense-import-box p { margin: 5px 0 0; color: var(--color-text-muted); font-size: 13px; }.expense-import-file { display: grid; gap: 4px; min-width: 220px; color: var(--color-text-muted); font-size: 12px; }.expense-import-file input { max-width: 270px; }.expense-import-preview { grid-column: 1 / -1; min-height: 0; padding: 0; color: var(--color-text-muted); }.expense-import-preview:not(:empty) { padding: 12px; border: 1px solid #d6e6df; border-radius: 8px; background: #fff; }.expense-import-preview > strong { color: var(--color-text); }.expense-import-counts { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; }.expense-import-counts span { padding: 4px 8px; border-radius: 999px; background: #edf5f1; font-size: 13px; }.expense-import-warning { margin: 9px 0 0 !important; color: #8a5b00 !important; }.expense-import-errors { margin: 9px 0 0; padding-left: 18px; color: var(--color-danger); font-size: 13px; }.expense-import-box #confirmExpenseImport { justify-self: end; }
.expense-form-basic > label:nth-of-type(1), .expense-form-basic > label:nth-of-type(2), .expense-form-basic > label:nth-of-type(3), .expense-form-basic > label:nth-of-type(4), .expense-form-basic > label:nth-of-type(5), .expense-form-basic > label:nth-of-type(6) { grid-column: span 2; }

@media (max-width: 1000px) { .expense-form-basic { grid-template-columns: repeat(6, minmax(0, 1fr)); }.expense-form-basic > label:nth-of-type(1), .expense-form-basic > label:nth-of-type(2), .expense-form-basic > label:nth-of-type(3), .expense-form-basic > label:nth-of-type(4) { grid-column: span 3; }.expense-form-basic > label:nth-of-type(5) { grid-column: span 6; }.expense-cost-center { grid-column: 1 / -1; }.expense-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }.expense-review-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }.expense-plan-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }.expense-export-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }.expense-export-options { grid-template-columns: 1fr; } }
@media (max-width: 1000px) { .expense-form-basic > label:nth-of-type(1), .expense-form-basic > label:nth-of-type(2), .expense-form-basic > label:nth-of-type(3), .expense-form-basic > label:nth-of-type(4), .expense-form-basic > label:nth-of-type(5), .expense-form-basic > label:nth-of-type(6) { grid-column: span 3; } }
@media (max-width: 767px) { .expense-tabs { position: sticky; top: 4px; z-index: 3; width: 100%; flex-wrap: nowrap; padding: 4px; border-radius: 9px; }.expense-tabs button { flex: 0 0 auto; padding-inline: 13px; font-size: 13px; }.expense-form-basic, .expense-form-advanced, .expense-fx-fields, .expense-filter-grid, .expense-plan-form, .expense-review-summary, .expense-export-grid { grid-template-columns: minmax(0, 1fr); }.expense-form-basic > label:nth-of-type(n) { grid-column: 1; }.expense-cost-center, .expense-note { grid-column: 1; }.expense-cost-center { margin-top: 2px; padding: 10px; }.expense-center-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }.expense-center-checks label { justify-content: center; min-height: 42px; }.expense-fx-fields { gap: 10px; }.expense-converted-preview { min-height: 65px; border-top: 3px solid var(--color-primary); border-left: 0; }.expense-attachments { grid-template-columns: 1fr; }.expense-attachment-list { grid-column: 1; }.expense-dropzone { min-height: 100px; }.expense-form-actions { position: sticky; bottom: 6px; z-index: 2; padding: 10px; margin: 0 -2px; border: var(--border-default); border-radius: 9px; background: rgba(255,255,255,.96); box-shadow: 0 -5px 16px rgba(30,58,49,.09); }.expense-form-actions button { width: 100%; min-height: 48px; }.expense-form-actions small { display: none; }.expense-ledger-desktop { display: none; }.expense-ledger-cards { display: grid; gap: 10px; }.expense-plan-actions, .expense-review-actions { display: grid; grid-template-columns: 1fr; }.expense-plan-actions button, .expense-review-actions button { width: 100%; }.expense-reminder-card { grid-template-columns: 1fr; }.expense-reminder-card button { width: 100%; }.expense-filter-actions { grid-column: auto; }.expense-tabs .admin-only[style*="none"] { display: none !important; }.expense-category-form, .expense-category-child-form { grid-template-columns: minmax(0, 1fr); align-items: stretch; }.expense-category-form button, .expense-category-child-form button { width: 100%; }.expense-category-table-wrap { max-height: 62vh; margin-inline: -2px; }.expense-category-table { min-width: 760px; }.expense-category-table th, .expense-category-table td { padding: 9px 8px; }.expense-category-table input, .expense-category-table select { min-width: 116px; min-height: 40px; }.expense-category-table th:nth-child(5), .expense-category-table td:nth-child(5) { display: none; }.category-order-actions { gap: 4px; }.category-order-actions button { min-height: 40px; }.expense-category-card { grid-template-columns: minmax(0, 1fr); }.expense-category-card .actions { justify-content: stretch; }.expense-category-card .actions button { width: 100%; min-height: 44px; }.expense-export-options article { grid-template-columns: auto minmax(0, 1fr); min-height: 0; padding: 15px; }.expense-export-options article .button-link { grid-column: 1 / -1; width: 100%; }.expense-export-summary { margin: 11px 0; } }
@media (max-width: 767px) { .expense-todo-form, .expense-import-box { grid-template-columns: minmax(0, 1fr); }.expense-todo-section-head { align-items: start; flex-direction: column; gap: 5px; }.expense-todo-card { grid-template-columns: minmax(0, 1fr); }.expense-todo-card .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }.expense-todo-card-auto .actions { grid-template-columns: 1fr; }.expense-todo-card .actions button { width: 100%; min-height: 42px; }.expense-todo-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }.expense-category-group summary { padding: 12px; }.expense-category-group-actions { display: grid; grid-template-columns: 1fr 1fr; padding: 10px 12px 0; }.expense-category-group-actions button { width: 100%; }.expense-attachment-modal-card { width: calc(100vw - 18px); padding: 14px; }.expense-attachment-viewer { min-height: 250px; }.expense-attachment-viewer iframe { height: 58vh; }.expense-import-box #confirmExpenseImport { justify-self: stretch; width: 100%; }.expense-import-file input { max-width: 100%; }.expense-attachment-item { grid-template-columns: minmax(0, 1fr) auto; }.expense-attachment-item > div { grid-column: 1 / -1; flex-wrap: wrap; } }

@media (max-width: 767px) {
  .page-utility { margin-top: 14px; padding: 14px; }
  .utility-controls,
  .utility-controls-wide,
  .data-import-steps,
  .maintenance-grid { grid-template-columns: minmax(0, 1fr); }
  .utility-actions,
  .utility-actions button,
  .utility-actions .button-link,
  .data-import-actions,
  .data-import-actions > * { width: 100%; }
  .utility-controls .checkline { min-height: 40px; }
  .data-import-steps { gap: 6px; margin-bottom: 14px; }
  .data-import-steps li { min-height: 42px; }
  .data-import-card { padding: 14px; }
  .data-import-actions .import-picker { display: flex; align-items: center; justify-content: center; }
  .maintenance-grid article { min-height: 0; padding: 15px; }
  .maintenance-grid button { width: 100%; }
}

@media (max-width: 380px) {
  .nav-group {
    grid-template-columns: 1fr;
  }
  .nav-group-label {
    grid-column: auto;
  }
  .login-card {
    padding: var(--space-5);
  }
  th,
  td {
    padding: 9px 8px;
  }
}

/* 门店流水打印：屏幕预览与打印版式共用同一份报表 DOM。 */
.store-flow-print-filters .checkline {
  width: auto;
  align-self: end;
  min-height: 38px;
}
.store-flow-print-filters .checkline input {
  width: auto;
  min-height: auto;
}
#storeFlowPrintStatus[data-state="error"] { color: var(--color-danger); font-weight: 700; }
#storeFlowPrintStatus[data-state="warning"] { color: var(--color-warning); font-weight: 700; }
#storeFlowPrintStatus[data-state="success"] { color: var(--color-primary); font-weight: 700; }
.store-flow-preview-card {
  width: min(1020px, calc(100vw - 32px));
  max-width: 1020px;
  min-width: 0;
  box-sizing: border-box;
  background: #d9d9d9;
}
.store-flow-preview-head {
  align-items: flex-start;
  background: #fff;
}
.store-flow-preview-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.store-flow-preview-head .actions-left {
  justify-content: flex-end;
}
.store-flow-print-document {
  display: grid;
  justify-items: center;
  gap: 20px;
  padding: 20px 0 4px;
  width: 100%;
  min-width: 0;
}
.store-flow-print-page {
  width: min(190mm, 100%);
  max-width: 100%;
  min-width: 0;
  min-height: 277mm;
  display: flex;
  flex-direction: column;
  padding: 9mm;
  box-sizing: border-box;
  background: #fff;
  color: #000;
  border: 1px solid #161616;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .18);
  break-after: page;
  page-break-after: always;
}
.store-flow-print-page:last-child {
  break-after: auto;
  page-break-after: auto;
}
.store-flow-page-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 7px;
  margin-bottom: 9px;
  border-bottom: 2px solid #000;
}
.store-flow-page-header > div {
  display: grid;
  gap: 2px;
}
.store-flow-page-header > div:last-child {
  text-align: right;
}
.store-flow-page-header strong {
  font-size: 16px;
  line-height: 1.35;
}
.store-flow-page-header span,
.store-flow-page-header em {
  font-size: 12px;
  font-style: normal;
}
.store-flow-page-header em {
  font-weight: 700;
  letter-spacing: .03em;
}
.store-flow-detail-table,
.store-flow-summary table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border-collapse: collapse;
  color: #000;
  table-layout: fixed;
}
.store-flow-detail-table th,
.store-flow-detail-table td,
.store-flow-summary th,
.store-flow-summary td {
  padding: 6px 8px;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  line-height: 1.35;
}
.store-flow-detail-table tbody tr:last-child td,
.store-flow-summary tbody tr:last-child td {
  border-bottom: 1px solid #000;
}
.store-flow-detail-table th,
.store-flow-summary th {
  font-weight: 700;
  text-align: center;
}
.store-flow-detail-table thead th,
.store-flow-summary thead th {
  border-top: 1px solid #000 !important;
}
.store-flow-detail-table th:nth-child(1) { width: 15%; }
.store-flow-detail-table th:nth-child(2) { width: 35%; }
.store-flow-detail-table th:nth-child(3),
.store-flow-detail-table th:nth-child(4) { width: 25%; }
.store-flow-detail-table .num,
.store-flow-summary .num { text-align: right; font-variant-numeric: tabular-nums; }
.store-flow-empty { padding: 14px !important; text-align: center; }
.store-flow-summary {
  margin-top: 10px;
  padding-top: 10px;
  break-inside: avoid;
  page-break-inside: avoid;
}
.store-flow-summary h3 {
  margin: 0 0 6px;
  font-size: 15px;
}
.store-flow-total-line {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
}

/* 工资核对与批量工资条：独立于现有工资图片和门店流水打印。 */
.salary-review-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7fbf9;
}
.salary-review-main {
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
}
.salary-review-heading { min-width: 0; }
.salary-review-kicker { display: block; color: var(--muted); font-size: 12px; }
.salary-review-status { display: inline-flex; margin-top: 2px; font-size: 18px; color: var(--ink); }
.salary-review-status[data-state="confirmed"] { color: var(--color-primary); }
.salary-review-status[data-state="invalidated"] { color: var(--color-danger); }
.salary-review-status[data-state="unconfirmed"] { color: #8a6421; }
.salary-review-heading .hint { margin: 3px 0 0; }
.salary-review-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.salary-review-metrics span {
  display: grid;
  gap: 2px;
  min-width: 104px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #dce8e3;
  color: var(--muted);
  font-size: 12px;
}
.salary-review-metrics b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.salary-review-actions { flex: 0 0 auto; justify-content: flex-end; }

.salary-print-select-card,
.salary-print-preview-card {
  width: min(1040px, calc(100vw - 32px));
  max-width: 1040px;
  min-width: 0;
}
.salary-print-modal-head { align-items: flex-start; }
.salary-print-modal-head p { margin: 4px 0 0; }
.salary-print-selection-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}
.salary-print-search { width: min(360px, 100%); }
.salary-print-candidate-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: min(54vh, 520px);
  overflow: auto;
  padding: 2px 2px 4px;
}
.salary-print-candidate {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}
.salary-print-candidate:hover { border-color: #77ad9d; background: #f4faf7; }
.salary-print-candidate input { width: 18px; height: 18px; min-height: 0; }
.salary-print-candidate span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.salary-print-candidate strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.salary-print-empty { grid-column: 1 / -1; margin: 12px 0; text-align: center; }
.salary-print-selection-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 14px -18px -18px;
  padding: 12px 18px 18px;
  background: #fff;
  border-top: 1px solid var(--line);
}
.salary-print-selection-footer .hint { margin: 0; }
.salary-print-document {
  display: grid;
  justify-items: center;
  gap: 22px;
  padding: 18px 0 4px;
  overflow: auto;
  background: #dce1df;
}
.salary-print-page {
  display: flex;
  flex-direction: column;
  width: min(285mm, 100%);
  height: 198mm;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0;
  background: #fff;
  border: 1px solid #bac4c0;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .18);
  color: #18231f;
}
.salary-print-cut-line {
  position: relative;
  flex: 0 0 3mm;
}
.salary-print-cut-line::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  border-top: 1px dashed #9aa39f;
}
.salary-print-slip {
  display: grid;
  grid-template-rows: 5.8mm 4.8mm minmax(0, 1fr);
  flex: 0 0 37.2mm;
  min-height: 0;
  box-sizing: border-box;
  border: .35mm solid #000;
  color: #000;
  background: #fff;
  overflow: hidden;
  break-inside: avoid;
  page-break-inside: avoid;
}
.salary-print-slip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4mm;
  padding: 0 2.5mm;
  border-bottom: .25mm solid #000;
  background: #e9ebeb;
  color: #000;
}
.salary-print-slip-title,
.salary-print-slip-employee { display: flex; align-items: center; min-width: 0; }
.salary-print-slip-title { gap: 2.5mm; }
.salary-print-slip-title strong { font-size: 9pt; letter-spacing: .08em; white-space: nowrap; }
.salary-print-slip-title span { font-size: 6.2pt; white-space: nowrap; }
.salary-print-slip-employee { justify-content: flex-end; gap: 2.4mm; overflow: hidden; }
.salary-print-slip-employee span { font-size: 6.2pt; font-weight: 700; white-space: nowrap; }
.salary-print-slip-employee b { font-size: 8.5pt; font-variant-numeric: tabular-nums; white-space: nowrap; }
.salary-print-slip-employee strong { overflow: hidden; font-size: 8.5pt; text-overflow: ellipsis; white-space: nowrap; }
.salary-print-slip-meta {
  display: flex;
  align-items: center;
  gap: 5mm;
  padding: 0 2.5mm;
  border-bottom: .2mm solid #000;
  background: #fff;
  color: #000;
  font-size: 6.5pt;
  font-variant-numeric: tabular-nums;
}
.salary-print-slip-body {
  display: grid;
  grid-template-columns: 1fr 1.08fr .96fr .96fr;
  gap: 2mm;
  padding: 1mm 1.2mm;
  min-height: 0;
}
.salary-print-detail,
.salary-print-slip-total {
  display: grid;
  grid-template-rows: 3.8mm repeat(7, minmax(0, 1fr));
  min-width: 0;
  min-height: 0;
  border-left: .15mm solid #c7cccc;
  border-right: .15mm solid #c7cccc;
}
.salary-print-detail h3,
.salary-print-slip-total h3 {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 0 1.2mm;
  background: #e9ebeb;
  color: #000;
  font-size: 6.7pt;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.salary-print-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8mm;
  min-width: 0;
  padding: 0 1.2mm;
  border-bottom: .12mm solid #d4d7d7;
  font-size: 5.8pt;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.salary-print-detail-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.salary-print-detail-row b { flex: 0 0 auto; font-size: 5.8pt; font-weight: 700; white-space: nowrap; }
.salary-print-detail-row--empty { justify-content: center; color: #a9aeac; }
.salary-print-detail-row--empty b { display: none; }
.salary-print-slip-total {
  grid-template-rows: 3.8mm minmax(0, 1fr);
  background: #f0f1f1;
}
.salary-print-slip-total strong {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border-top: .12mm solid #c7cccc;
  font-size: 17pt;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .salary-review-panel,
  .salary-review-main,
  .salary-print-selection-tools,
  .salary-print-selection-footer { align-items: stretch; }
  .salary-review-panel,
  .salary-review-main,
  .salary-print-selection-tools { flex-direction: column; }
  .salary-review-actions { width: 100%; }
  .salary-review-actions button { flex: 1; }
  .salary-print-select-card,
  .salary-print-preview-card { width: calc(100vw - 24px); padding: 12px; }
  .salary-print-candidate-list { grid-template-columns: 1fr; }
  .salary-print-selection-footer { margin: 12px -12px -12px; padding: 12px; }
  .salary-print-selection-footer button { width: 100%; }
  .salary-print-preview-actions { width: 100%; }
  .salary-print-preview-actions button { flex: 1; }
  .salary-print-document { justify-items: start; padding: 12px 0; }
  .salary-print-page { min-width: 285mm; transform-origin: top left; }
  .store-flow-print-filters .checkline {
    width: 100%;
    min-height: 44px;
  }
  .store-flow-preview-card {
    width: calc(100vw - 24px);
    padding: 12px;
  }
  .store-flow-preview-head .actions-left {
    width: 100%;
  }
  .store-flow-preview-head .actions-left button {
    flex: 1;
  }
  .store-flow-print-document {
    padding-top: 12px;
    gap: 12px;
  }
  .store-flow-print-page {
    width: 100%;
    min-height: auto;
    padding: 14px;
  }
  .store-flow-page-header {
    display: grid;
  }
  .store-flow-page-header > div:last-child { text-align: left; }
  .store-flow-detail-table th,
  .store-flow-detail-table td,
  .store-flow-summary th,
  .store-flow-summary td { padding: 6px 4px; font-size: 12px; }
}

@media print {
  @page { size: A4 portrait; margin: 6mm; }
  @page salaryPayslip { size: A4 landscape; margin: 6mm; }
  html, body {
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: #fff !important;
    color: #000 !important;
    font: 10pt/1.35 "Microsoft YaHei", "Yu Gothic", Arial, sans-serif;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body > * { display: none !important; }
  body:not(.printing-salary-payslips) #storeFlowPrintModal {
    display: block !important;
    position: static !important;
    inset: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
  }
  body:not(.printing-salary-payslips) #storeFlowPrintModal .store-flow-preview-card {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }
  .store-flow-preview-head,
  .store-flow-print-controls { display: none !important; }
  #storeFlowPrint {
    display: block !important;
    padding: 0 !important;
    background: #fff !important;
  }
  .store-flow-print-page {
    width: 198mm !important;
    min-height: 285mm !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    color: #000 !important;
    break-after: page;
    page-break-after: always;
  }
  .store-flow-print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
  .store-flow-page-header { margin-top: 0; }
  .store-flow-detail-table thead,
  .store-flow-summary thead { display: table-header-group; }
  .store-flow-detail-table tr,
  .store-flow-summary tr { break-inside: avoid; page-break-inside: avoid; }
  .store-flow-summary {
    margin-top: 5mm;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  body.printing-salary-payslips #storeFlowPrintModal { display: none !important; }
  body.printing-salary-payslips #salaryPrintPreviewModal {
    display: block !important;
    position: static !important;
    inset: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
  }
  body.printing-salary-payslips #salaryPrintPreviewModal .salary-print-preview-card {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }
  body.printing-salary-payslips .salary-print-modal-head { display: none !important; }
  body.printing-salary-payslips #salaryPrintDocument {
    display: block !important;
    padding: 0 !important;
    background: #fff !important;
    overflow: visible !important;
  }
  body.printing-salary-payslips .salary-print-page {
    page: salaryPayslip;
    width: 285mm !important;
    height: 198mm !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    break-after: page;
    page-break-after: always;
  }
  body.printing-salary-payslips .salary-print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
  body.printing-salary-payslips .salary-print-slip {
    flex-basis: 37.2mm !important;
    height: 37.2mm !important;
    color: #000 !important;
  }
  body.printing-salary-payslips .salary-print-cut-line { flex-basis: 3mm !important; }
}

/* 员工自助端：独立的移动优先壳层，不复用管理端侧栏和宽表。 */
.employee-app { min-height: 100dvh; background: #f4f8f6; color: var(--ink); padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
.employee-header { position: sticky; top: 0; z-index: 4; min-height: 62px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; background: linear-gradient(135deg, #123d35, #167a63); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.employee-header strong { display: block; font-size: 18px; }
.employee-header span { display: block; margin-top: 2px; color: rgba(255,255,255,.76); font-size: 12px; }
.employee-menu { position: relative; }
.employee-menu-popover { position: absolute; z-index: 5; top: calc(100% + 8px); right: 0; width: 136px; padding: 6px; border: var(--border-default); border-radius: 10px; background: #fff; box-shadow: var(--shadow-dialog); }
.employee-menu-popover button { width: 100%; margin: 2px 0; text-align: left; }
.employee-main { display: block; width: min(100%, 640px); min-width: 0; padding: 16px 16px 24px; margin: 0 auto; }
.employee-page { display: none; }
.employee-page.active { display: block; }
.employee-heading { margin: 4px 0 16px; }
.employee-heading h1 { margin: 0 0 4px; font-size: 22px; }
.employee-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.employee-sale-form { display: grid; gap: 14px; padding: 16px; border: var(--border-default); border-radius: var(--radius-panel); background: #fff; box-shadow: var(--shadow-panel); }
.employee-sale-form label { font-size: 14px; }
.employee-sale-form input, .employee-sale-form select { min-height: 48px; padding: 11px 12px; font-size: 16px; }
.employee-readonly input { background: #f0f5f3; color: var(--muted); }
.employee-short-fields, .employee-more-fields { display: grid; grid-template-columns: 1fr; gap: 14px; }
.employee-more { border-top: var(--border-default); padding-top: 12px; }
.employee-more summary { padding: 8px 0; cursor: pointer; color: var(--color-primary); font-weight: 700; }
.employee-more-fields { padding-top: 10px; }
.employee-submit { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 2; min-height: 52px; font-size: 16px; box-shadow: 0 6px 18px rgba(22,122,99,.24); }
.employee-bottom-nav { position: fixed; z-index: 5; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(3, 1fr); min-height: calc(62px + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom); border-top: var(--border-default); background: rgba(255,255,255,.97); box-shadow: 0 -4px 18px rgba(20,45,38,.08); }
.employee-bottom-nav button { min-height: 48px; padding: 6px 4px; background: transparent; color: var(--muted); font-size: 13px; }
.employee-bottom-nav button.active { color: var(--color-primary); font-weight: 700; }
.employee-card-list, .employee-event-list { display: grid; gap: 12px; }
.employee-submission-card { padding: 15px; border: var(--border-default); border-radius: var(--radius-panel); background: #fff; box-shadow: 0 3px 12px rgba(23,44,38,.06); }
.employee-card-head, .employee-card-actions, .employee-amounts { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.employee-card-head strong { font-size: 16px; }.employee-card-head span, .employee-submission-card small { color: var(--muted); }
.employee-amounts { margin: 13px 0 8px; align-items: end; }.employee-amounts b { font-size: 19px; }.employee-amounts span { color: var(--muted); }
.employee-card-actions { justify-content: flex-end; margin-top: 13px; }.employee-card-actions button { min-height: 44px; }
.submission-status { display: inline-flex; align-items: center; min-height: 26px; padding: 3px 9px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; background: #edf1f0; color: #52615d; }
.submission-status.matched { background: var(--color-primary-soft); color: var(--color-primary); }.submission-status.different, .submission-status.difference, .submission-status.ambiguous, .submission-status.changed { background: var(--color-warning-soft); color: var(--color-warning); }.submission-status.resolved { background: #e8edf9; color: var(--color-info); }
.employee-event { position: relative; padding: 0 0 16px 18px; border-left: 2px solid #cfe0db; }.employee-event:last-child { padding-bottom: 0; }.employee-event::before { content: ""; position: absolute; top: 4px; left: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--color-primary); }.employee-event time { display: block; color: var(--muted); font-size: 12px; }.employee-event strong { display: block; margin: 3px 0; }.employee-event p { margin: 0; color: var(--muted); white-space: pre-line; }
.employee-accounts-panel { border-top: 4px solid var(--color-primary-soft); }
.employee-account-events { margin-top: 18px; padding-top: 16px; border-top: var(--border-default); }.employee-account-events h3 { margin: 0 0 10px; }
.reconciliation-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }.reconciliation-summary span { padding: 6px 10px; border-radius: var(--radius-pill); background: var(--soft); color: var(--color-primary); }
.reconciliation-list { display: grid; gap: 14px; }.reconciliation-item { padding: 16px; border: var(--border-default); border-radius: var(--radius-panel); background: #fff; }.reconciliation-item.has-difference { border-color: #edc87d; }.reconciliation-item.is-ambiguous { border-color: #efc46b; background: #fffaf0; }
.reconciliation-columns { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }.reconciliation-column { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }.reconciliation-column h3 { margin: 0 0 8px; font-size: 14px; }.reconciliation-field { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dashed #e4ece9; }.reconciliation-field:last-child { border: 0; }.reconciliation-field strong { font-weight: 500; text-align: right; word-break: break-word; }.reconciliation-field.diff { margin: 0 -6px; padding: 5px 6px; border-radius: 5px; background: var(--color-warning-soft); color: #754c05; }.reconciliation-actions { display:flex; justify-content:flex-end; gap:8px; margin-top: 12px; }
@media (min-width: 375px) and (max-width: 767px) { .employee-short-fields { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 374px) { .employee-main { padding-right: 12px; padding-left: 12px; }.employee-header { padding-right: 12px; padding-left: 12px; }.employee-sale-form { padding: 13px; }.employee-card-head { align-items: flex-start; flex-direction: column; }.employee-card-actions button { flex: 1; }.reconciliation-columns { grid-template-columns: 1fr; } }
@media (max-width: 767px) { .reconciliation-columns { grid-template-columns: 1fr; }.reconciliation-actions button { flex: 1; } }

/* 员工申报日期筛选与按日汇总。 */
.employee-submission-filter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; }
.employee-filter-actions { display: flex; grid-column: 1 / -1; gap: 8px; }.employee-filter-actions button { min-height: 44px; flex: 1; }
.employee-submission-day { display: grid; gap: 10px; }.employee-submission-day + .employee-submission-day { margin-top: 10px; }.employee-submission-day h2 { display: grid; gap: 3px; margin: 8px 0 0; font-size: 16px; }.employee-submission-day h2 small { color: var(--muted); font-size: 12px; font-weight: 400; }

/* 核对明细默认收起，避免管理端被大量字段淹没。 */
.reconciliation-item-summary { width: 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 13px; padding: 0; background: transparent; color: var(--ink); text-align: left; }.reconciliation-item-summary:hover { background: transparent; color: var(--ink); }.reconciliation-summary-person { font-weight: 700; }.reconciliation-item-summary > span:not(.submission-status):not(.reconciliation-expand-icon) { color: var(--muted); }.reconciliation-expand-icon { margin-left: auto; color: var(--color-primary); font-size: 13px; }.reconciliation-detail { margin-top: 14px; }.reconciliation-official-link { width: 100%; background: #f9fcfb; color: var(--ink); text-align: left; white-space: normal; }.reconciliation-official-link:hover { background: var(--color-primary-soft); color: var(--ink); }.reconciliation-official-link h3 small { color: var(--color-primary); font-weight: 400; }
.sale-row-highlight td { background: #fff2c8 !important; animation: sale-row-highlight-pulse 2.2s ease-out; }
@keyframes sale-row-highlight-pulse { 0%, 55% { background: #ffe69a !important; } 100% { background: #fff2c8 !important; } }

/* 员工端 320–430px 始终单列，表单控件不因网格或内容产生横向溢出。 */
@media (max-width: 767px) {
  .employee-main, .employee-sale-form, .employee-sale-form label, .employee-sale-form input, .employee-sale-form select, .employee-short-fields, .employee-more-fields, .employee-more, .employee-submit, .employee-submission-filter { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
  .employee-short-fields, .employee-more-fields { grid-template-columns: minmax(0, 1fr) !important; }
  .employee-sale-form input, .employee-sale-form select { min-height: 48px; }
  .employee-submit { position: static; bottom: auto; min-height: 52px; margin-top: 2px; }
  .employee-submission-filter { grid-template-columns: minmax(0, 1fr); }
}

/* Inventory V2: shared desktop/mobile inventory workspace. */
.inventory-v2-overview .summary-grid { margin-top: 14px; }
.inventory-store-checks { min-width: 0; margin: 0; padding: 10px 12px; border: var(--border-default); border-radius: var(--radius-panel); }
.inventory-store-checks legend { padding: 0 4px; color: var(--muted); font-size: 13px; }
.inventory-store-checks .checks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.inventory-lookup { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.inventory-lookup .hint { min-width: 180px; }
.inventory-scanner-modal { position: fixed; z-index: 10020; inset: 0; display: grid; place-items: center; padding: 14px; overflow: auto; background: rgba(10, 22, 19, .7); }
.inventory-scanner-modal.hidden { display: none; }
.inventory-scanner-card { width: min(100%, 640px); max-height: calc(100dvh - 28px); padding: 16px; overflow: auto; border-radius: 16px; background: #fff; box-shadow: var(--shadow-dialog); }
.inventory-scanner-card .panel-head { gap: 12px; }
.inventory-scanner-tabs { display: flex; gap: 8px; margin: 10px 0; }
.inventory-scanner-tabs button { flex: 1; }
#inventoryScannerReader { min-height: 150px; overflow: hidden; border-radius: 12px; background: #111; }
#inventoryScannerReader video { max-height: min(54dvh, 440px); object-fit: cover; }
#inventoryScannerStatus { min-height: 1.4em; margin: 10px 0 0; }
.inventory-scan-success { color: var(--color-primary); font-weight: 700; }
.inventory-scan-error { color: #b42318; font-weight: 700; }
.inventory-scanner-result { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin-top: 8px; text-align: left; }
.inventory-scanner-result small { display: block; color: var(--muted); }
.inventory-mobile-card { display: grid; gap: 10px; padding: 14px; border: var(--border-default); border-radius: var(--radius-panel); background: #fff; box-shadow: 0 3px 12px rgba(23,44,38,.05); }
.inventory-mobile-card + .inventory-mobile-card { margin-top: 10px; }
.inventory-mobile-card-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.inventory-mobile-card-head strong { display: block; }
.inventory-mobile-card small { color: var(--muted); }
.inventory-qty-stepper, .inventory-fraction-chips, .inventory-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.inventory-qty-stepper input { width: 72px; min-height: 42px; text-align: center; }
.inventory-fraction-chips button { min-height: 38px; padding: 7px 9px; }
.inventory-closure-summary { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 2; display: grid; gap: 8px; margin-top: 14px; padding: 12px; border: var(--border-default); border-radius: 12px; background: rgba(255,255,255,.97); box-shadow: 0 -4px 15px rgba(20,45,38,.09); }
.inventory-closure-summary button { min-height: 52px; }
.inventory-closure-offline { padding: 8px 10px; border-radius: 8px; background: var(--color-warning-soft); color: #754c05; }
.inventory-closure-draft { margin-top: 12px; }
.inventory-closure-draft .inventory-mobile-card { border-left: 4px solid var(--color-primary); }
.inventory-photo-required { color: #b42318; font-size: 13px; }
.inventory-review-status { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; background: var(--color-warning-soft); color: #754c05; }
.inventory-review-status.approved { background: var(--color-primary-soft); color: var(--color-primary); }

@media (max-width: 767px) {
  .employee-bottom-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .employee-bottom-nav button { min-width: 0; font-size: 12px; }
  .employee-inventory-workspace, #employeeClosureWorkspace { min-width: 0; }
  .inventory-scanner-modal { padding: 0; place-items: end stretch; }
  .inventory-scanner-card { width: 100%; max-height: min(88dvh, 760px); border-radius: 18px 18px 0 0; }
  .inventory-scanner-card input, .inventory-mobile-card input, .inventory-mobile-card select, .inventory-mobile-card textarea { width: 100%; min-width: 0; box-sizing: border-box; }
  .inventory-lookup > button { flex: 1; min-width: 0; }
  .inventory-lookup .hint { flex-basis: 100%; min-width: 0; }
  .inventory-closure-summary { bottom: calc(70px + env(safe-area-inset-bottom)); }
}
