:root {
  --bg: #eef3f6;
  --surface: #ffffff;
  --surface-soft: #f7fbfc;
  --line: #cddce3;
  --ink: #102d3a;
  --muted: #607684;
  --teal: #177d8b;
  --teal-dark: #0f6570;
  --blue: #3068d9;
  --green: #16805b;
  --orange: #c66b2f;
  --red: #bb3f39;
  --nav: #123844;
  --shadow: 0 14px 30px rgba(20, 62, 75, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 1240px;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  height: 34px;
  border: 1px solid #b7ced8;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  background: var(--nav);
  color: #eaf5f7;
}

.nav-brand {
  display: grid;
  gap: 5px;
  padding: 4px 2px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.nav-brand span {
  color: #9ccbd3;
  font-size: 12px;
  font-weight: 900;
}

.nav-brand strong {
  font-size: 20px;
}

.side-nav nav {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.side-nav a {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #eaf5f7;
  padding: 10px 11px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 900;
}

.side-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.side-nav a.active {
  border-color: rgba(255, 255, 255, 0.46);
  background: #eaf5f7;
  color: var(--nav);
  box-shadow: inset 4px 0 0 #e3a835;
}

.side-nav a span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  color: #b7dde3;
  font-size: 12px;
  font-weight: 1000;
}

.side-nav a.active span {
  background: #123844;
  color: #fff;
}

.side-nav a strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-note {
  position: absolute;
  right: 16px;
  bottom: 18px;
  left: 16px;
  color: #a9cbd1;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.shell {
  min-width: 0;
  padding: 22px;
}

.topbar,
.identity-panel,
.control-panel,
.upload-panel,
.panel,
.kpi-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 82px;
  padding: 16px 20px;
}

.topbar p,
.panel-head p,
.upload-panel p,
.identity-copy span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.topbar h1 {
  margin: 5px 0 0;
  font-size: 28px;
  line-height: 1.1;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.identity-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 320px) minmax(220px, 320px) 110px;
  align-items: end;
  gap: 14px;
  margin-top: 14px;
  padding: 14px;
  border-left: 4px solid var(--teal);
}

.identity-copy {
  display: grid;
  gap: 5px;
}

.identity-copy strong,
.upload-panel strong {
  font-size: 17px;
}

label {
  display: grid;
  gap: 6px;
  color: #355769;
  font-size: 12px;
  font-weight: 900;
}

input,
select {
  width: 100%;
  height: 34px;
  min-width: 0;
  border: 1px solid #bad0da;
  border-radius: 5px;
  background: #fff;
  padding: 0 10px;
  color: var(--ink);
}

.control-panel {
  display: grid;
  grid-template-columns: 86px 86px 132px repeat(7, minmax(126px, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
}

.control-panel .wide {
  grid-column: span 2;
  min-width: 0;
}

.upload-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
}

.workspace-view {
  display: none;
}

.workspace-view.active {
  display: block;
}

.module-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid #e3a835;
  background: linear-gradient(90deg, #ffffff, #f7fbfc);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.module-intro div {
  display: grid;
  gap: 4px;
}

.module-intro strong {
  font-size: 18px;
}

.module-intro span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.module-intro b {
  border-radius: 4px;
  background: #123844;
  padding: 7px 12px;
  color: #fff;
  font-size: 13px;
}

.upload-panel article {
  display: grid;
  gap: 8px;
  border: 1px solid #d7e5eb;
  background: var(--surface-soft);
  padding: 14px;
}

.upload-panel small {
  color: var(--muted);
  font-weight: 800;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.kpi-card {
  min-height: 188px;
  padding: 16px;
  border-top: 4px solid var(--teal);
}

.kpi-card.blue {
  border-top-color: var(--blue);
}

.kpi-card.orange {
  border-top-color: var(--orange);
}

.kpi-card.green {
  border-top-color: var(--green);
}

.kpi-card.red {
  border-top-color: var(--red);
}

.kpi-card span {
  display: block;
  color: #31596c;
  font-size: 14px;
  font-weight: 900;
}

.kpi-card strong {
  display: block;
  margin-top: 9px;
  font-size: 32px;
  line-height: 1;
}

.metric-lines {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.metric-row {
  display: grid;
  gap: 5px;
  border-top: 1px solid #d8e8ee;
  padding-top: 8px;
}

.metric-row p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
}

.metric-row span {
  color: #31596c;
  font-size: 14px;
  font-weight: 1000;
}

.metric-row b {
  color: var(--ink);
  font-size: 15px;
  white-space: nowrap;
}

.metric-row i {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2edf1;
}

.metric-row em {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: var(--teal);
}

.metric-row.budget em {
  background: var(--blue);
}

.metric-row.mtd em {
  background: var(--orange);
}

.metric-row.re em {
  background: var(--green);
}

.panel {
  margin-top: 14px;
  overflow: hidden;
  scroll-margin-top: 16px;
}

.mini-panel {
  margin-top: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: #f2f9fb;
  padding: 13px 16px;
}

.panel-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
  line-height: 1.15;
}

.panel-head strong {
  color: #496777;
  font-size: 12px;
}

.fill-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 260px)) 78px;
  align-items: end;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfe;
  padding: 12px 16px;
}

.fill-filters label {
  font-size: 13px;
}

.fill-filters input {
  height: 36px;
  border-color: #8fbfca;
  background: #fafdff;
  font-size: 14px;
}

.ghost-button {
  height: 36px;
  border-color: #9fc4ce;
  background: #edf7f9;
  color: #245666;
}

.field-guide {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfe;
  padding: 10px 16px;
}

.field-guide span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.field-guide strong {
  border: 1px solid #bfd8df;
  border-radius: 999px;
  background: #edf7f9;
  padding: 4px 10px;
  color: #245666;
  font-size: 12px;
}

.region-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  padding: 14px;
}

.region-card {
  border: 1px solid #d3e2e8;
  border-top: 4px solid var(--teal);
  background: #fff;
  padding: 14px;
}

.region-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #d8e8ee;
  padding-bottom: 10px;
}

.region-card-head strong {
  font-size: 17px;
}

.region-card-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.region-card-metrics {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.table-wrap {
  max-height: 390px;
  overflow: auto;
}

.table-wrap.tall {
  max-height: 540px;
}

.table-wrap.small {
  max-height: 260px;
}

table {
  width: 100%;
  min-width: 1280px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.detail-table {
  min-width: 1960px;
}

th,
td {
  border-right: 1px solid #d8e6ec;
  border-bottom: 1px solid #d8e6ec;
  padding: 9px 11px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--teal);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

th.group-session {
  background: #1e6f95;
}

th.group-pos {
  background: #1f806f;
}

th.group-fee {
  background: #9a6a17;
}

td {
  background: rgba(255, 255, 255, 0.96);
}

tbody tr:nth-child(even) td {
  background: #f8fbfc;
}

td.group-session-cell {
  background: #eef7fd;
}

td.group-pos-cell {
  background: #eefbf7;
}

td.group-fee-cell {
  background: #fff8e9;
}

tbody tr:nth-child(even) td.group-session-cell {
  background: #e5f2fa;
}

tbody tr:nth-child(even) td.group-pos-cell {
  background: #e4f6f0;
}

tbody tr:nth-child(even) td.group-fee-cell {
  background: #fff1d2;
}

.total-row td.group-session-cell {
  background: #c7e4f5;
}

.total-row td.group-pos-cell {
  background: #c9eadf;
}

.total-row td.group-fee-cell {
  background: #f4ddb1;
}

.detail-table td.group-session-cell .edit-input {
  border-color: #6caed0;
  background: #f8fdff;
}

.detail-table td.group-pos-cell .edit-input {
  border-color: #63baa5;
  background: #f7fffc;
}

.total-row td {
  border-top: 2px solid #6aa9b6;
  background: #c9e4ea;
  font-weight: 1000;
}

.num {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.status {
  display: inline-flex;
  min-width: 62px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.status.done {
  background: var(--green);
}

.status.wait {
  background: var(--orange);
}

.status.lock {
  background: #7a8d98;
}

.edit-input {
  width: 116px;
  height: 30px;
  border-color: #9cc8d1;
  background: #fafdff;
}

.edit-input:disabled {
  background: #edf2f4;
  color: #83939b;
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: static;
    height: auto;
  }

  .side-nav nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-note {
    position: static;
    margin-top: 14px;
  }

  .shell {
    padding: 12px;
  }

  .topbar,
  .identity-panel,
  .panel-head {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .control-panel,
  .fill-filters,
  .upload-panel,
  .hero-grid,
  .region-card-grid {
    grid-template-columns: 1fr;
  }

  .control-panel .wide {
    grid-column: auto;
  }
}
