* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --pri: #165dff;
  --pri-dark: #0e42d2;
  --pri-light: #eef4ff;
  --pri-border: #d2e1ff;
  --ok: #0d9459;
  --ok-bg: #e8f8f0;
  --warn: #d97706;
  --warn-bg: #fef5e7;
  --bad: #dc2626;
  --bad-bg: #feecec;
  --tx: #1d2939;
  --tx2: #475467;
  --tx3: #86909c;
  --bd: #e5ebf2;
  --bg: #f4f7fb;
  --white: #ffffff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--tx);
  font-size: 14px;
  line-height: 1.5;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--tx);
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* 登录页 */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #eef4ff 0%, #f4f7fb 50%, #ffffff 100%);
  padding: 24px;
}

.login-box {
  width: 400px;
  background: var(--white);
  border: 1px solid #e2eaf6;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 12px 36px rgba(22, 93, 255, 0.08);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-logo-img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.side-head .brand-logo-img {
  width: 36px;
  height: 36px;
}

.nav-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.nav-ico {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.login-brand h1 {
  font-size: 19px;
  font-weight: 700;
  color: var(--tx);
}

.login-brand p {
  font-size: 13px;
  color: var(--tx3);
  margin-top: 2px;
}

.form-item {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--tx2);
  margin-bottom: 6px;
}

.inp, .sel, .ta {
  width: 100%;
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: 9px 12px;
  background: #f9fbfe;
  outline: none;
  transition: border-color 0.15s;
}

.inp:focus, .sel:focus, .ta:focus {
  border-color: var(--pri);
  background: #fff;
}

.ta {
  min-height: 76px;
  resize: vertical;
}

/* 主布局 */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 224px;
  background: #ffffff;
  border-right: 1px solid var(--bd);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-head {
  padding: 20px 18px;
  border-bottom: 1px solid #f0f4f9;
  display: flex;
  align-items: center;
  gap: 10px;
}

.side-head .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: 15px;
}

.side-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--tx);
}

.side-sub {
  font-size: 12px;
  color: var(--tx3);
}

.nav-list {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--tx2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: #f3f7fe;
  color: var(--pri);
}

.nav-item.active {
  background: var(--pri);
  color: #ffffff;
  font-weight: 600;
}

.nav-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--bad);
  color: #fff;
}

.nav-item.active .nav-badge {
  background: rgba(255, 255, 255, 0.25);
}

.side-foot {
  padding: 14px 16px;
  border-top: 1px solid #f0f4f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.me-name {
  font-size: 14px;
  font-weight: 600;
}

.me-role {
  font-size: 12px;
  color: var(--tx3);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 58px;
  background: #ffffff;
  border-bottom: 1px solid var(--bd);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h2 {
  font-size: 17px;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-body {
  padding: 20px 24px 36px;
  max-width: 1400px;
  width: 100%;
}

/* 卡片与栅格 */
.card {
  background: #ffffff;
  border: 1px solid #e7edf6;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(22, 93, 255, 0.025);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::before {
  content: "";
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: var(--pri);
}

.hero-banner {
  background: linear-gradient(135deg, #165dff, #2f75ff);
  color: #ffffff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.hero-metrics {
  display: flex;
  gap: 28px;
}

.hm-item .hm-v {
  font-size: 24px;
  font-weight: 700;
}

.hm-item .hm-l {
  font-size: 12px;
  opacity: 0.86;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #e7edf6;
  border-radius: 12px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.stat-card.active {
  border-color: var(--pri);
  background: var(--pri-light);
}

.stat-card .n {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card .l {
  font-size: 13px;
  color: var(--tx3);
  margin-top: 4px;
}

/* 按钮与标签 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--pri);
  color: #ffffff;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
}

.btn:hover {
  background: var(--pri-dark);
}

.btn-soft {
  background: var(--pri-light);
  color: var(--pri);
}

.btn-soft:hover {
  background: #dce8ff;
}

.btn-ghost {
  background: #ffffff;
  color: var(--tx2);
  border: 1px solid var(--bd);
}

.btn-ghost:hover {
  border-color: var(--pri);
  color: var(--pri);
}

.btn-ok {
  background: var(--ok);
  color: #fff;
}

.btn-bad {
  background: var(--bad);
  color: #fff;
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  background: #f1f5f9;
  color: var(--tx2);
  white-space: nowrap;
}

.chip-pri { background: var(--pri-light); color: var(--pri); }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }

/* 工具栏与表格 */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar .inp,
.toolbar .sel {
  width: auto;
  min-width: 140px;
  padding: 7px 10px;
}

.toolbar-grow {
  flex: 1;
}

.tabs {
  display: inline-flex;
  background: #f1f5fb;
  padding: 4px;
  border-radius: 9px;
  gap: 4px;
}

.tabs button {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--tx2);
}

.tabs button.active {
  background: var(--pri);
  color: #ffffff;
  font-weight: 600;
}

.tbl-wrap {
  width: 100%;
  overflow-x: auto;
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tbl th, .tbl td {
  padding: 11px 12px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: middle;
}

.tbl th {
  background: #f7faff;
  color: var(--tx2);
  font-weight: 600;
  white-space: nowrap;
}

.tbl tbody tr:hover {
  background: #f9fbff;
}

.tbl td.center, .tbl th.center {
  text-align: center;
}

/* 拆分布局（分组管理） */
.split-grid {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 16px;
  align-items: start;
}

.group-list-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 4px;
}

.group-list-item:hover {
  background: #f6f9ff;
}

.group-list-item.active {
  background: var(--pri-light);
  border-color: var(--pri-border);
}

.wd-btns {
  display: inline-flex;
  gap: 5px;
}

.wd-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--tx3);
  font-size: 12px;
  font-weight: 500;
}

.wd-btn.on {
  background: var(--pri);
  color: #fff;
}

/* 照片网格 */
.photo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.photo-thumb {
  width: 96px;
  height: 76px;
  border-radius: 8px;
  border: 1px solid #dce6f5;
  overflow: hidden;
  cursor: pointer;
  background: #eef4ff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
  font-size: 11px;
  color: var(--pri);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-thumb.img-only {
  padding: 0;
}

/* 弹窗与抽屉 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 680px;
  max-width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid #eef2f7;
  margin-bottom: 16px;
}

.modal-head h3 {
  font-size: 16px;
  font-weight: 600;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 20px;
  margin-bottom: 14px;
  font-size: 13px;
}

.kv-grid .k {
  color: var(--tx3);
  margin-right: 8px;
}

.timeline {
  border-left: 2px solid var(--pri-border);
  padding-left: 14px;
  margin-left: 6px;
}

.tl-item {
  position: relative;
  padding-bottom: 12px;
  font-size: 13px;
}

.tl-item::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--pri);
}

.tl-time {
  font-size: 12px;
  color: var(--tx3);
}

.sign-canvas {
  width: 100%;
  height: 180px;
  border: 1px solid var(--pri-border);
  border-radius: 10px;
  background: #ffffff;
  cursor: crosshair;
  display: block;
}

/* 报表纸张 */
.rpt-sheet {
  background: #ffffff;
  border: 1px solid #e2eaf6;
  border-radius: 12px;
  padding: 28px 32px;
}

.rpt-sheet h2 {
  text-align: center;
  font-size: 20px;
  margin-bottom: 4px;
}

.rpt-sheet .rpt-sub {
  text-align: center;
  color: var(--tx3);
  font-size: 13px;
  margin-bottom: 20px;
}

.rpt-sheet h4 {
  font-size: 14px;
  color: var(--pri-dark);
  border-left: 3px solid var(--pri);
  padding-left: 8px;
  margin: 18px 0 10px;
}

.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #1d2939;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.muted { color: var(--tx3); font-size: 12px; }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-bad { color: var(--bad); }
.text-pri { color: var(--pri); }
.empty { text-align: center; padding: 40px 16px; color: var(--tx3); }
