:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #152033;
  --muted: #667085;
  --line: #d8dee8;
  --line-soft: #edf1f6;
  --brand: #0f766e;
  --brand-strong: #115e59;
  --accent: #c27803;
  --good: #166534;
  --bad: #b42318;
  --soft-brand: #e6f4f1;
  --soft-accent: #fff7df;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 800;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

.status-pill {
  min-width: 110px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.status-pill.ok {
  border-color: #86d4bf;
  background: var(--soft-brand);
  color: var(--brand-strong);
}

.status-pill.error {
  border-color: #f3a6a1;
  background: #fff0ef;
  color: var(--bad);
}

.control-band,
.panel {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.control-band {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(120px, 0.5fr) minmax(110px, 0.5fr) minmax(240px, 1fr);
  gap: 12px;
  align-items: end;
}

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

input,
select,
button {
  height: 38px;
  border-radius: 6px;
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

input:focus,
select:focus {
  outline: 2px solid #9adbcf;
  outline-offset: 1px;
  border-color: var(--brand);
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding-top: 18px;
}

.checkline input {
  width: 16px;
  height: 16px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

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

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.message-line {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #f0d794;
  border-radius: 8px;
  background: var(--soft-accent);
  color: #7a4b00;
  font-size: 13px;
}

.message-line.ok {
  border-color: #9bd8c7;
  background: var(--soft-brand);
  color: var(--brand-strong);
}

.message-line.error {
  border-color: #f3a6a1;
  background: #fff0ef;
  color: var(--bad);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-grid article {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.kpi-grid span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpi-grid strong {
  display: block;
  font-size: 24px;
  line-height: 1;
  white-space: nowrap;
}

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

.panel-head p,
.subtle {
  color: var(--muted);
  font-size: 13px;
}

.trend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 8px;
  min-height: 90px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfcfe;
}

.trend:empty {
  display: none;
}

.trend-bar {
  display: grid;
  align-content: end;
  gap: 6px;
  min-height: 72px;
}

.trend-fill {
  width: 100%;
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #15a897, var(--brand));
}

.trend-label {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  white-space: nowrap;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--brand-strong);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

th:first-child,
td:first-child,
td.text,
th.text {
  text-align: left;
}

tbody tr:hover {
  background: #f7fbfa;
}

a {
  color: var(--brand-strong);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.compact table {
  min-width: 780px;
}

@media (max-width: 1080px) {
  .control-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 1480px);
    padding-top: 16px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .control-band,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .button-row {
    width: 100%;
  }

  button {
    flex: 1 1 140px;
  }
}
