:root {
  --ink: #14201c;
  --muted: #5a6a63;
  --line: #d5ddd8;
  --surface: #ffffff;
  --bg: #e9eee9;
  --rail: #16352c;
  --rail-ink: #e7f2ec;
  --rail-muted: #9bb5a9;
  --accent: #1f7a4d;
  --accent-2: #c9f07a;
  --accent-soft: #e8f5ee;
  --danger: #b42318;
  --warn: #9a6700;
  --shadow: 0 10px 30px rgba(20, 32, 28, 0.08);
  --font: "DM Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "DM Sans", "Noto Sans SC", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.35), transparent 180px),
    repeating-linear-gradient(
      -18deg,
      transparent,
      transparent 22px,
      rgba(22, 53, 44, 0.03) 22px,
      rgba(22, 53, 44, 0.03) 23px
    ),
    radial-gradient(900px 420px at 100% -10%, #d7e8dc 0%, transparent 55%),
    var(--bg);
}

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

.rail {
  background:
    radial-gradient(420px 280px at 20% 0%, rgba(201, 240, 122, 0.18), transparent 60%),
    linear-gradient(180deg, #1a4035 0%, var(--rail) 55%, #102820 100%);
  color: var(--rail-ink);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.rail-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, var(--accent-2), #6dbf8a 45%, transparent 46%),
    linear-gradient(315deg, #2a8f5d, #16352c);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}

.rail-title {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
}

.rail-sub {
  color: var(--rail-muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

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

.nav-item {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--rail-ink);
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
}

.nav-item.active {
  background: rgba(201, 240, 122, 0.14);
  border-color: rgba(201, 240, 122, 0.35);
  box-shadow: inset 3px 0 0 var(--accent-2);
}

.rail-foot {
  margin-top: auto;
  color: var(--rail-muted);
  font-size: 0.75rem;
  line-height: 1.4;
  padding: 0 4px;
}

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

.bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.bar h1 {
  margin: 0 0 4px;
  font-size: clamp(1.45rem, 2vw, 1.85rem);
  letter-spacing: -0.03em;
}

.desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.bar-controls, .toolbar-right, .toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 12px;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 150px;
}

.field.wide { min-width: 180px; }
.field.compact { min-width: 120px; }

.field span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

select, input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

select:focus, input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, white);
  border-color: var(--accent);
}

.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.ghost {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 18%, white);
}

.panel {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 14px 12px;
  animation: rise 0.28s ease;
}

.panel.active { display: block; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.status {
  margin-bottom: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.88rem;
}

.status.error {
  background: #fef3f2;
  color: var(--danger);
}

.status.warn {
  background: #fff7e8;
  color: var(--warn);
}

.table-shell {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

table.fit {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: clamp(0.68rem, 0.85vw, 0.82rem);
}

table.fit thead th {
  background: #f2f6f3;
  color: var(--muted);
  font-weight: 700;
  text-align: right;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  line-height: 1.2;
  word-break: break-all;
}

table.fit thead th:first-child,
table.fit tbody td:first-child {
  text-align: left;
  width: 5.6%;
  font-weight: 650;
}

table.fit tbody td {
  text-align: right;
  padding: 8px 4px;
  border-bottom: 1px solid #eef3ef;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

table.fit tbody tr:hover td {
  background: #f7fbf8;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

.cards.empty-hint {
  display: block;
  color: var(--muted);
  padding: 18px 4px;
  font-size: 0.92rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background:
    linear-gradient(180deg, #fcfefc 0%, #f4f8f5 100%);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.card .label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 7px;
  line-height: 1.25;
}

.card .value {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.ab-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.ab-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.ab-head h3 {
  margin: 0;
  font-size: 1rem;
}

.pager {
  align-items: center;
}

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
  }
  .nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    width: 100%;
  }
  .rail-foot { display: none; }
  .main { padding: 14px; }
}
