:root {
  --bg: #f3f6f3;
  --surface: #ffffff;
  --panel: #fbfdfb;
  --ink: #1d2823;
  --muted: #66736d;
  --line: #dae4dd;
  --green: #177a55;
  --leaf: #38a169;
  --gold: #d7962f;
  --red: #c34d43;
  --blue: #2d73b9;
  --violet: #6f64bd;
  --shadow: 0 16px 38px rgba(26, 54, 43, 0.09);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }

.side {
  position: fixed;
  inset: 0 auto 0 0;
  width: 270px;
  padding: 22px 16px;
  background: #17362a;
  color: #eef8f2;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #17362a;
  font-weight: 900;
  font-size: 20px;
}
.brand strong, .brand span { display: block; }
.brand span { margin-top: 3px; color: #c7d9cf; font-size: 13px; }
.nav { display: grid; gap: 7px; }
.nav-btn {
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cfe1d7;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}
.nav-btn svg { width: 18px; height: 18px; }
.nav-btn:hover, .nav-btn.active { background: #255744; color: #fff; }
.side-summary {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, .14);
  background: #224e3d;
  border-radius: 8px;
  padding: 16px;
}
.side-summary span, .side-summary small { color: #c7d9cf; display: block; }
.side-summary strong { display: block; margin: 8px 0; font-size: 34px; }

.main { margin-left: 270px; padding: 24px; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.kicker { margin: 0 0 4px; color: var(--green); font-size: 13px; font-weight: 700; }
h1 { margin: 0; font-size: 28px; letter-spacing: 0; }
h2 { margin: 0; font-size: 18px; letter-spacing: 0; }
p { margin: 0; }
.tools, .toolbar { display: flex; align-items: center; gap: 10px; }
.toolbar { justify-content: space-between; margin-bottom: 14px; }
.search {
  width: min(440px, 38vw);
  height: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}
.search svg { width: 18px; color: var(--muted); }
.search input { border: 0; outline: 0; width: 100%; background: transparent; color: var(--ink); }
.primary, .secondary, .icon {
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  white-space: nowrap;
}
.primary { background: var(--green); border-color: var(--green); color: #fff; }
.secondary, .icon { background: var(--surface); color: var(--ink); }
.icon { width: 42px; padding: 0; }
.primary svg, .secondary svg, .icon svg { width: 18px; height: 18px; }

.notice-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.notice-strip div {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  color: var(--muted);
  overflow: hidden;
}
.notice-strip svg { width: 18px; color: var(--green); flex: 0 0 auto; }
.notice-strip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.view { display: none; }
.view.active { display: block; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.metrics article, .panel, .table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metrics article { padding: 18px; min-height: 118px; }
.metrics span { color: var(--muted); font-size: 14px; }
.metrics strong { display: block; margin: 12px 0 6px; font-size: 30px; }
.metrics small { color: var(--green); }
.compact { margin-bottom: 14px; }

.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.two { grid-template-columns: minmax(0, 1.4fr) minmax(330px, .8fr); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.trace-grid { grid-template-columns: 360px 1fr; }
.panel { padding: 18px; min-width: 0; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.tabs {
  display: inline-flex;
  gap: 4px;
  background: #edf3ef;
  padding: 4px;
  border-radius: 8px;
}
.tabs button {
  height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}
.tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.06); }

.bar-chart {
  height: 282px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: end;
  gap: 10px;
  padding: 18px 8px 28px 12px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.bar {
  min-height: 26px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #63bd7b, var(--green));
  position: relative;
}
.bar::after {
  content: attr(data-hour);
  position: absolute;
  left: 50%;
  bottom: -23px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 12px;
}
.category-list, .status-list, .event-feed, .task-list, .alerts { display: grid; gap: 12px; }
.category {
  display: grid;
  grid-template-columns: 88px 1fr 70px;
  gap: 10px;
  align-items: center;
}
.track, .category .track { height: 12px; border-radius: 999px; background: #edf3ef; overflow: hidden; }
.fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--blue)); }
.status-list div { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
progress { grid-column: 1 / -1; width: 100%; height: 8px; accent-color: var(--green); }
.event {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #f1f6f2;
  border-radius: 8px;
}
.event time { color: var(--muted); font-size: 13px; }
.badge, .state {
  display: inline-flex;
  min-width: 62px;
  justify-content: center;
  align-items: center;
  height: 25px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  background: #e6f4ec;
  color: var(--green);
}
.badge.warn, .state.warn { background: #fff1d5; color: #91610f; }
.badge.bad, .state.bad { background: #fde7e4; color: var(--red); }
.badge.info { background: #e5f0fb; color: var(--blue); }
.task-list label {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 840px; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: #f8fbf8; color: var(--muted); }
td strong { display: block; }
.muted { color: var(--muted); font-size: 12px; }
.link { border: 0; padding: 0; background: transparent; color: var(--blue); }

.field { display: grid; gap: 8px; color: var(--muted); margin-top: 14px; }
.field input { height: 42px; border: 1px solid var(--line); border-radius: 8px; outline: 0; padding: 0 12px; color: var(--ink); }
.wide-btn { width: 100%; margin-top: 16px; }
.trace-line { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.trace-line div {
  min-height: 152px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.trace-line svg { width: 30px; color: var(--green); }
.trace-line span { color: var(--muted); font-size: 13px; }
.stall-map {
  display: grid;
  grid-template-columns: repeat(6, minmax(78px, 1fr));
  gap: 10px;
}
.stall {
  aspect-ratio: 1.12;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #f5fbf7;
}
.stall.hot { background: #e7f5ed; border-color: #abd8bd; }
.stall.busy { background: #fff3dc; border-color: #e6c177; }
.stall.offline { background: #f7eeee; border-color: #e5b9b5; }
.stall strong { font-size: 15px; }
.stall small { color: var(--muted); }
.alert {
  border: 1px solid var(--line);
  border-left: 5px solid var(--gold);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}
.alert.high { border-left-color: var(--red); }
.alert.low { border-left-color: var(--blue); }
.alert p { margin-top: 6px; color: var(--muted); font-size: 13px; }

@media (max-width: 1080px) {
  .side { position: static; width: 100%; min-height: auto; flex-direction: row; overflow-x: auto; align-items: center; }
  .main { margin-left: 0; }
  .brand { min-width: 220px; }
  .nav { display: flex; }
  .nav-btn { min-width: 116px; }
  .side-summary { display: none; }
  .top, .toolbar { align-items: stretch; flex-direction: column; }
  .tools { flex-wrap: wrap; }
  .search { width: 100%; }
  .notice-strip, .metrics, .two, .three, .trace-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .main { padding: 14px; }
  .metrics { grid-template-columns: 1fr; }
  .trace-line { grid-template-columns: 1fr; }
  .stall-map { grid-template-columns: repeat(2, 1fr); }
  .event { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
}
