:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --ink: #151922;
  --ink-soft: #303847;
  --muted: #6b7280;
  --line: #e5e9f0;
  --line-strong: #d4dae3;
  --accent: #0f6b5d;
  --accent-hover: #0b554a;
  --accent-soft: #e9f4f1;
  --amber: #a16207;
  --amber-soft: #fff7e6;
  --red: #b42318;
  --red-soft: #fff1f0;
  --blue: #255f99;
  --blue-soft: #edf5ff;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.text-link {
  color: var(--blue);
  font-weight: 720;
}

.text-link:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  padding: 0 32px;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 760;
  white-space: nowrap;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 800;
}

.brand-text {
  letter-spacing: 0;
}

.nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions form {
  margin: 0;
}

.nav a,
.button,
.primary-action,
.danger-button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.nav a {
  color: var(--muted);
  font-weight: 650;
}

.nav a.active,
.nav a:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-soft);
  font-weight: 650;
}

.primary-action {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 720;
}

.primary-action:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.danger-button {
  background: var(--red-soft);
  border-color: #ffd1cc;
  color: var(--red);
}

.page {
  width: min(1220px, calc(100% - 40px));
  margin: 30px auto 56px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 20px;
}

.heading-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.heading-actions input {
  width: auto;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  color: var(--ink);
  font-size: 28px;
  font-weight: 760;
}

h2 {
  color: var(--ink);
  font-size: 16px;
  font-weight: 720;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  display: grid;
  gap: 12px;
  min-height: 112px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  color: var(--ink);
  font-size: 25px;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}

.metric.warning strong {
  color: var(--amber);
}

.metric.danger strong {
  color: var(--red);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.panel,
.table-wrap,
.filter-bar,
.summary-line,
.inline-form,
.alert,
.form-grid {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  padding: 18px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 32px;
  margin-bottom: 14px;
}

.bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 96px 1fr 112px;
  align-items: center;
  gap: 12px;
}

.bar-row span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  background: #edf1f5;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.compact-list {
  display: grid;
  gap: 0;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child {
  border-bottom: 0;
}

.list-item span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.list-item strong,
.list-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item small {
  color: var(--muted);
  font-size: 12px;
}

.list-item b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.empty,
.empty-cell {
  color: var(--muted);
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  margin-bottom: 12px;
}

.compact-filter {
  grid-template-columns: minmax(160px, 260px) auto;
  justify-content: start;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid var(--accent-soft);
}

textarea {
  resize: vertical;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 650;
}

.summary-line strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1040px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  background: var(--surface-muted);
}

tbody tr {
  background: var(--surface);
}

tbody tr:hover {
  background: #fbfcfd;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-danger {
  background: var(--red-soft);
  border-color: #ffd1cc;
  color: var(--red);
}

.status-good {
  background: var(--accent-soft);
  border-color: #c9e2dc;
  color: var(--accent);
}

.strong-num {
  color: var(--ink);
  font-weight: 760;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.actions a,
.actions button {
  min-height: 30px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.actions a:hover,
.actions button:hover {
  background: var(--blue-soft);
  border-color: #c9dcf2;
}

.actions form {
  margin: 0;
}

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

.form-grid > * {
  min-width: 0;
}

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

.span-2 {
  grid-column: span 2;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.upload-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.upload-actions label {
  min-width: 0;
}

.upload-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.upload-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.alert {
  padding: 12px 14px;
  margin-bottom: 14px;
  color: var(--red);
  background: var(--red-soft);
  border-color: #ffd1cc;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  margin-bottom: 12px;
}

.stack-form {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.checkbox {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
}

.checkbox input {
  width: 16px;
  min-height: 16px;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.category-chip {
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.category-chip span {
  color: var(--muted);
  font-size: 12px;
}

.category-chip small {
  color: var(--muted);
  font-size: 12px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
}

.item-editor {
  display: block;
  min-width: 0;
  overflow: hidden;
  padding: 14px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.item-table {
  display: grid;
  gap: 8px;
  overflow-x: auto;
}

.item-head,
.item-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 70px 95px 95px 95px 95px;
  gap: 8px;
  min-width: 880px;
  align-items: center;
}

.item-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.item-row input {
  min-height: 34px;
  background: #fff;
}

.report-lower {
  margin-top: 16px;
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: var(--bg);
}

.login-shell {
  width: min(420px, calc(100% - 36px));
}

.login-panel {
  display: grid;
  gap: 18px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.login-brand h1 {
  font-size: 23px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form .primary-action {
  width: 100%;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.shortcut {
  display: grid;
  gap: 6px;
  min-height: 88px;
  padding: 14px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.shortcut strong {
  font-size: 15px;
}

.shortcut span {
  color: var(--muted);
  font-size: 12px;
}

.system-panel {
  margin-top: 16px;
}

.detail-panel {
  margin-bottom: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px 14px;
}

.detail-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.detail-grid strong {
  overflow: hidden;
  color: var(--ink);
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.approval-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.approval-card h2 {
  margin-top: 10px;
}

.approval-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.approval-card form {
  display: grid;
  gap: 10px;
}

.approval-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px 20px;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .brand-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .nav {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    gap: 4px;
  }

  .nav a {
    min-height: 32px;
    padding: 0 10px;
  }

  .topbar .primary-action {
    min-height: 34px;
  }

  .topbar-actions {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .topbar-actions .button {
    display: none;
  }

  .metric-grid,
  .two-column,
  .form-grid,
  .upload-actions,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .filter-bar,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .compact-filter,
  .compact-form {
    grid-template-columns: 1fr;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .heading-actions {
    width: 100%;
  }

  .heading-actions input,
  .heading-actions .button,
  .heading-actions .primary-action {
    width: 100%;
  }

  .bar-row {
    grid-template-columns: 82px 1fr;
  }

  .bar-row strong {
    grid-column: 2;
    text-align: left;
  }
}
