:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --line: #d9e0e8;
  --text: #17202a;
  --muted: #637083;
  --brand: #0f7b72;
  --brand-dark: #0a5f59;
  --danger: #c23b37;
  --warn: #a66b00;
  --shadow: 0 8px 26px rgba(24, 39, 75, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  min-height: 36px;
  padding: 0 14px;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
}

button:hover {
  background: var(--brand-dark);
}

button.secondary {
  color: var(--text);
  background: #e9eef3;
}

button.secondary:hover {
  background: #dce4ec;
}

button.danger {
  background: var(--danger);
}

button.icon {
  width: 36px;
  padding: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 76px;
  resize: vertical;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: #f8fafc;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef6f5 0%, #f7f8fb 46%, #f2f4ec 100%);
}

.login-box {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand {
  display: grid;
  gap: 6px;
  margin-bottom: 24px;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
}

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

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.sidebar {
  background: #15202b;
  color: #eef5f7;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-title {
  padding: 6px 8px;
  font-size: 18px;
  font-weight: 800;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  justify-content: flex-start;
  width: 100%;
  color: #eaf1f4;
  background: transparent;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: #213140;
}

.side-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 8px;
  color: #b7c6cf;
  font-size: 13px;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar h2 {
  margin: 0;
  font-size: 20px;
}

.content {
  padding: 22px 24px 32px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

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

.panel-head h3 {
  margin: 0;
  font-size: 16px;
}

.panel-body {
  padding: 16px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.split.wide {
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.75fr);
}

.search {
  width: min(360px, 100%);
}

.form-section-title {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.form-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.compact-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.report-block {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.report-block h3 {
  margin: 0;
  font-size: 15px;
}

.checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

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

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #0d4d48;
  background: #dff3f0;
  font-size: 12px;
  font-weight: 700;
}

.badge.disabled {
  color: #6b3f00;
  background: #fff1d8;
}

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

.error {
  color: var(--danger);
  min-height: 22px;
}

.notice {
  min-height: 22px;
  color: var(--brand-dark);
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric strong {
  display: block;
  font-size: 28px;
}

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

.metric.inline {
  display: inline-block;
  min-width: 180px;
  box-shadow: none;
}

.result-box {
  margin-top: 16px;
  min-height: 78px;
}

.schema-table {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.schema-table:first-child {
  padding-top: 0;
}

.schema-table:last-child {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  margin: 3px 4px 3px 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef4f6;
  color: var(--text);
  font-size: 12px;
}

.pill em {
  color: var(--muted);
  font-style: normal;
}

.wide-report {
  min-width: 1180px;
}

.wide-report th {
  background: #c7e8f6;
  color: #06151b;
  font-size: 15px;
}

.wide-report th:nth-child(4),
.wide-report th:nth-child(5),
.wide-report th:nth-child(6) {
  background: #c8ead6;
}

.wide-report td {
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.wow-row td:first-child {
  background: #f8d9be;
}

.positive {
  color: #29965a;
}

.negative {
  color: #d93b3b;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

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