:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-soft: #eef5f1;
  --ink: #15201b;
  --muted: #64706b;
  --line: #dce4e0;
  --accent: #0e7c66;
  --accent-dark: #075d4b;
  --warn: #b85f17;
  --danger: #b33939;
  --good: #16875f;
  --shadow: 0 18px 45px rgba(28, 43, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: #10231d;
  color: #eef7f1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #2dbb8f;
  color: #08251d;
  font-weight: 800;
}

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

.brand p,
.sidebar-card small,
.sidebar-card span {
  margin: 4px 0 0;
  color: rgba(238, 247, 241, 0.68);
  font-size: 12px;
}

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

.nav-item {
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(238, 247, 241, 0.76);
  text-align: left;
  padding: 0 14px;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.sidebar-card {
  position: absolute;
  right: 24px;
  bottom: 24px;
  left: 24px;
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-card strong {
  font-size: 22px;
}

.main {
  min-width: 0;
  padding: 26px 32px 40px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

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

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

select,
input {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input {
  width: 260px;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  padding: 0;
}

select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 124, 102, 0.12);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

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

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

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.metric small {
  display: block;
  margin-top: 6px;
  color: var(--good);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.query-layout {
  display: grid;
  gap: 18px;
}

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

.query-form label {
  display: grid;
  gap: 8px;
}

.query-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.query-form input,
.query-form select {
  width: 100%;
}

.checkline {
  align-content: end;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  min-height: 66px;
}

.checkline span {
  color: var(--ink) !important;
  font-size: 14px !important;
}

.action-button {
  align-self: end;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.action-button:hover {
  background: var(--accent-dark);
}

.query-metrics {
  margin-bottom: 0;
}

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

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

.panel-header h3 {
  margin: 0;
  font-size: 17px;
}

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

.table-wrap {
  overflow: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.muted-cell {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

tr:last-child td {
  border-bottom: none;
}

.program-name {
  font-weight: 750;
}

.tag,
.rank,
.delta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tag {
  background: var(--panel-soft);
  color: var(--accent-dark);
}

.rank {
  background: #15201b;
  color: #fff;
}

.delta.up {
  background: rgba(22, 135, 95, 0.12);
  color: var(--good);
}

.delta.down {
  background: rgba(179, 57, 57, 0.12);
  color: var(--danger);
}

.delta.new {
  background: rgba(184, 95, 23, 0.13);
  color: var(--warn);
}

.chart {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

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

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

.insight-list {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.insight {
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px 12px;
}

.insight strong {
  display: block;
  margin-bottom: 4px;
}

.insight p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
}

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

.program-card h3,
.report-card h3 {
  margin: 10px 0 8px;
  font-size: 18px;
}

.program-card p,
.report-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.report-body {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.empty {
  padding: 38px;
  color: var(--muted);
  text-align: center;
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  .sidebar-card {
    position: static;
    margin-top: 18px;
  }

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

  .content-grid,
  .metric-grid,
  .query-form,
  .cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main,
  .sidebar {
    padding: 14px;
  }

  .brand {
    margin-bottom: 16px;
  }

  .brand h1 {
    font-size: 16px;
  }

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

  .topbar h2 {
    font-size: 23px;
  }

  .topbar,
  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  input {
    width: 100%;
  }

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

  .nav-item {
    text-align: center;
  }

  .metric {
    min-height: 96px;
  }

  .metric strong {
    font-size: 24px;
  }

  th,
  td {
    padding: 10px;
    font-size: 13px;
  }
}
