:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --line: #e4e8eb;
  --line-soft: #edf1f3;
  --text: #1c2b2e;
  --text-2: #5a6b70;
  --text-3: #8b9ba0;
  --brand: #0f766e;
  --brand-dark: #0b5d57;
  --brand-soft: #e6f4f2;
  --danger: #c2410c;
  --danger-soft: #fdeee7;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --ok: #15803d;
  --ok-soft: #e8f5ec;
  --info: #1d4ed8;
  --info-soft: #eef2fd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22, 40, 44, .06), 0 8px 24px rgba(22, 40, 44, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

a { color: var(--brand); }

/* ---------------- 布局 ---------------- */

.shell {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  min-height: 100vh;
}

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

.brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .5px;
}

.brand-title { font-size: 15px; font-weight: 600; letter-spacing: .3px; }
.brand-sub { font-size: 11.5px; color: var(--text-3); margin: 6px 0 0 40px; letter-spacing: .5px; }

.nav { padding: 10px 8px; flex: 1; }

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
}

.nav a:hover { background: #f2f6f6; color: var(--text); }

.nav a.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}

.nav a svg { width: 16px; height: 16px; flex: 0 0 16px; opacity: .75; }
.nav a.active svg { opacity: 1; }

.side-foot {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.7;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: .3px; }
.topbar .sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.top-right { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
#top-date { white-space: nowrap; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}

.content { padding: 22px 28px 60px; }

/* ---------------- 通用组件 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}

.btn:hover { background: #f7faf9; border-color: #d3dcdd; }
.btn:active { transform: translateY(.5px); }

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: #f2f6f6; }

.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }

.btn.danger { color: var(--danger); border-color: #f0d6ca; background: #fff; }
.btn.danger:hover { background: var(--danger-soft); }

.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  border: 0; background: transparent; cursor: pointer; color: var(--text-3);
  padding: 4px; border-radius: 6px; line-height: 1;
}
.icon-btn:hover { background: #f2f6f6; color: var(--text); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.card-head h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-body { padding: 16px 18px; }

.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }

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

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat .label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 24px; font-weight: 650; margin-top: 8px; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.stat .foot { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.stat.alarm .value { color: var(--danger); }
.stat.warn .value { color: var(--warn); }

.stat::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--brand);
  opacity: .8;
}
.stat.alarm::after { background: var(--danger); }
.stat.warn::after { background: var(--warn); }

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

table.data th {
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  background: #fafcfc;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 12.5px;
}

table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  white-space: nowrap;
}

.table-note, .note-cell {
  white-space: normal !important;
  min-width: 120px;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

table.data tbody tr:hover { background: #f8fbfb; }
table.data tr:last-child td { border-bottom: 0; }

.cell-company { font-weight: 550; color: var(--text); white-space: normal; min-width: 170px; max-width: 260px; }
.cell-company .tag { margin-left: 6px; }

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  line-height: 18px;
  white-space: nowrap;
}

.pill.red { background: var(--danger-soft); color: var(--danger); }
.pill.amber { background: var(--warn-soft); color: var(--warn); }
.pill.green { background: var(--ok-soft); color: var(--ok); }
.pill.blue { background: var(--info-soft); color: var(--info); }
.pill.gray { background: #f1f4f5; color: var(--text-2); }
.pill.teal { background: var(--brand-soft); color: var(--brand-dark); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.input, .select, .textarea {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  outline: none;
  font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .1);
}

.input.search { width: 240px; }
.textarea { width: 100%; resize: vertical; min-height: 66px; line-height: 1.6; }
.select { cursor: pointer; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.field .input, .field .select, .field .textarea { width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.5; }

.tabs { display: flex; gap: 4px; padding: 12px 18px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.tab {
  padding: 7px 12px 9px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  font-size: 12.5px;
  color: var(--text-3);
  border-top: 1px solid var(--line-soft);
}

.pager .pages { display: flex; gap: 6px; align-items: center; }

/* ---------------- 弹窗 ---------------- */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(18, 30, 32, .38);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 40px;
  z-index: 100;
  overflow-y: auto;
}

.modal {
  width: 560px;
  max-width: 100%;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(10, 25, 28, .22);
  animation: pop .16s ease-out;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(-6px) scale(.99); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 18px 20px; max-height: 62vh; overflow-y: auto; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  background: #fbfcfc;
  border-radius: 0 0 12px 12px;
}

/* ---------------- 登录 ---------------- */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 50% -10%, #e6f2f0 0%, rgba(246, 249, 250, 0) 60%),
    var(--bg);
  padding: 24px;
}

.auth-card {
  width: 380px;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px 30px 26px;
  box-shadow: 0 18px 50px rgba(20, 45, 48, .1);
}

.auth-logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-weight: 600; font-size: 19px; margin-bottom: 16px;
}

.auth-card h2 { margin: 0 0 4px; font-size: 19px; font-weight: 650; }
.auth-card p.sub { margin: 0 0 22px; font-size: 12.5px; color: var(--text-3); }
.auth-card .field { margin-bottom: 13px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 9px; margin-top: 6px; }
.auth-msg { color: var(--danger); font-size: 12.5px; margin-top: 10px; min-height: 18px; }

/* ---------------- 详情页 ---------------- */

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.detail-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-title h2 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -.2px; }
.detail-meta { margin-top: 7px; font-size: 12.5px; color: var(--text-3); display: flex; gap: 14px; flex-wrap: wrap; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 20px;
  padding: 18px;
}

.info-grid .k { font-size: 12px; color: var(--text-3); }
.info-grid .v { font-size: 13.5px; margin-top: 4px; word-break: break-all; }

.section { margin-top: 18px; }

.fee-box {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

.fee-box .item { border-left: 3px solid var(--brand-soft); padding-left: 12px; }
.fee-box .k { font-size: 12px; color: var(--text-3); }
.fee-box .v { font-size: 15px; font-weight: 600; margin-top: 5px; }
.fee-box .v .unit { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 2px; }

.note-box {
  padding: 14px 18px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ---------------- 导入向导 ---------------- */

.drop-zone {
  border: 1.5px dashed #cfdadb;
  border-radius: 10px;
  padding: 30px 20px;
  text-align: center;
  color: var(--text-2);
  background: #fafcfc;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.drop-zone:hover { border-color: var(--brand); background: var(--brand-soft); }
.drop-zone strong { display: block; font-size: 14px; margin-bottom: 6px; color: var(--text); }

.map-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 12px;
  align-items: center;
  font-size: 13px;
}

.preview-wrap { overflow: auto; max-height: 240px; border: 1px solid var(--line); border-radius: 8px; }
.preview-wrap table { font-size: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  background: #14302f;
  color: #fff;
  padding: 10px 18px;
  border-radius: 22px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  z-index: 200;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.err { background: #7f2410; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-grid, .fee-box { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
