:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #17202c;
  --muted: #667085;
  --line: #dde4ee;
  --nav-dark: #121926;
  --nav-dark-2: #1d2939;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --green: #16a34a;
  --green-soft: #eaf8ef;
  --yellow: #b7791f;
  --yellow-soft: #fff7df;
  --red: #dc2626;
  --red-soft: #fff0f0;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

button {
  font: inherit;
}

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

.admin-shell .sidebar {
  background: var(--nav-dark);
  color: #eef5ff;
}

.studio-shell {
  grid-template-columns: 226px minmax(0, 1fr);
}

.studio-shell .sidebar {
  background: #ffffff;
  color: var(--ink);
  border-right: 1px solid var(--line);
}

.sidebar {
  padding: 22px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 22px;
  font-size: 19px;
  font-weight: 800;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #ffffff;
}

.studio-shell .brand-mark {
  background: var(--green);
}

.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 10px 12px;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
}

.admin-shell .nav-item {
  color: #c8d5e4;
}

.nav-item.active {
  color: #ffffff;
  background: var(--blue);
}

.studio-shell .nav-item.active {
  color: #14532d;
  background: var(--green-soft);
}

.content {
  padding: 24px 28px 36px;
  max-width: 1260px;
}

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

.page-header h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.summary {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 820px;
  line-height: 1.55;
}

.env-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 12px;
  color: #344054;
  white-space: nowrap;
}

.env-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

.notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--yellow-soft);
  border: 1px solid #f0d58c;
  color: #7a4b00;
}

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

.studio-shell .metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-height: 124px;
}

.metric-label,
.metric-hint {
  display: block;
  color: var(--muted);
  line-height: 1.4;
}

.metric-value {
  display: block;
  margin: 10px 0 8px;
  font-size: 27px;
  line-height: 1.1;
}

.metric-card.blue {
  border-top: 3px solid var(--blue);
}

.metric-card.green {
  border-top: 3px solid var(--green);
}

.metric-card.yellow {
  border-top: 3px solid var(--yellow);
}

.dashboard-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.9fr);
  gap: 16px;
}

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

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.25;
}

.trend-bars {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  align-items: end;
  min-height: 160px;
  padding-top: 8px;
}

.bar-column {
  display: grid;
  gap: 8px;
  align-content: end;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.bar {
  min-height: 24px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #60a5fa, var(--blue));
}

.donut-wrap {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.donut {
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0 82%, #eab308 82% 95%, var(--red) 95% 100%);
  display: grid;
  place-items: center;
}

.donut-core {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.legend {
  display: grid;
  gap: 9px;
}

.legend-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 7px;
}

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

.table-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.9fr 0.8fr 1.1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 11px 12px;
  min-height: 48px;
}

.studio-shell .table-row {
  grid-template-columns: 1.1fr 1fr 0.8fr 0.9fr 0.9fr;
}

.table-head {
  color: var(--muted);
  font-size: 13px;
  background: transparent;
  border: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.status-chip {
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--blue-soft);
  color: #1d4ed8;
  font-weight: 700;
  width: fit-content;
}

.status-chip.warn {
  background: var(--yellow-soft);
  color: #92400e;
}

.status-chip.good {
  background: var(--green-soft);
  color: #166534;
}

.status-chip.bad {
  background: var(--red-soft);
  color: #991b1b;
}

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

.quick-action {
  text-align: left;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
}

.quick-action strong,
.quick-action span {
  display: block;
}

.quick-action span {
  color: var(--muted);
  margin-top: 5px;
}

.announcement {
  background: var(--green-soft);
  color: #14532d;
  border: 1px solid #bbf7d0;
}

.boundary-panel {
  margin-top: 16px;
  background: #fff;
  border: 1px dashed #f0c36b;
  border-radius: 8px;
  padding: 14px;
  color: #7a4b00;
}

.details {
  margin-top: 12px;
}

.details summary {
  cursor: pointer;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .metric-grid,
  .studio-shell .metric-grid,
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .shell,
  .studio-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: block;
    padding: 16px;
  }

  .nav-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .content {
    padding: 18px;
  }

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

  .metric-grid,
  .studio-shell .metric-grid,
  .quick-grid {
    grid-template-columns: 1fr;
  }

  .table-row,
  .studio-shell .table-row {
    grid-template-columns: 1fr;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
  }
}
