:root {
  --bg: #0b0d0f;
  --panel: #14171a;
  --panel-2: #1a1e22;
  --line: #282d32;
  --text: #edf0f2;
  --dim: #8a9299;
  --blue: #73a7ff;
  --aqua: #49d1bb;
  --ok: #40d98b;
  --warn: #ffb340;
  --bad: #ff6666;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 90% -10%, rgba(73, 209, 187, 0.11), transparent 26rem),
    radial-gradient(circle at 0 45%, rgba(115, 167, 255, 0.07), transparent 32rem),
    var(--bg);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
.wrap { width: min(1120px, calc(100% - 36px)); margin: 0 auto; padding: 36px 0 24px; }
header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.eyebrow, .card-label { color: var(--aqua); font-size: 10px; font-weight: 800; letter-spacing: 0.15em; }
.eyebrow { margin: 0 0 8px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font: 500 clamp(31px, 5vw, 48px)/1.1 Georgia, "Microsoft YaHei", serif; letter-spacing: -0.035em; }
h2 { margin-bottom: 0; font-size: 20px; font-weight: 500; }
.subtitle { margin-bottom: 0; color: var(--dim); }
.connection { display: flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--dim); background: rgba(20, 23, 26, 0.86); font-size: 12px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 4px rgba(255, 179, 64, 0.12); }
.connection.online .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(64, 217, 139, 0.12); }
.connection.offline .dot { background: var(--bad); box-shadow: 0 0 0 4px rgba(255, 102, 102, 0.12); }
.toprow { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; color: var(--dim); font-size: 12px; }
.toprow label { color: var(--text); font-weight: 700; }
.toprow span:last-child { margin-left: auto; }
select, input, button { font: inherit; }
select, input { color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; outline: none; }
select { padding: 7px 30px 7px 10px; }
input { width: 100%; padding: 7px 9px; font-variant-numeric: tabular-nums; }
select:focus, input:focus { border-color: rgba(115, 167, 255, 0.7); box-shadow: 0 0 0 3px rgba(115, 167, 255, 0.08); }

.card { padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: rgba(20, 23, 26, 0.92); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.card-label { margin-bottom: 5px; }
.hero-grid { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 14px; }
.current { min-height: 294px; }
.headline { margin: 16px 0 5px; font: 400 clamp(48px, 8vw, 76px)/1 -apple-system, "Segoe UI", sans-serif; letter-spacing: -0.055em; font-variant-numeric: tabular-nums; }
.unit { margin-left: 8px; color: var(--dim); font-size: 17px; letter-spacing: 0; }
.water-state { color: var(--ok); font-size: 12px; }
.mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 25px; padding-top: 16px; border-top: 1px solid var(--line); }
.mini-grid span { display: block; color: var(--dim); font-size: 10px; }
.mini-grid b { display: block; margin-top: 4px; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--dim); background: var(--panel-2); font-size: 10px; white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: rgba(64, 217, 139, 0.25); background: rgba(64, 217, 139, 0.06); }
.pill.warn { color: var(--warn); border-color: rgba(255, 179, 64, 0.25); background: rgba(255, 179, 64, 0.06); }
.pill.bad { color: var(--bad); border-color: rgba(255, 102, 102, 0.25); background: rgba(255, 102, 102, 0.06); }
.field { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 11px 0; }
.field label { color: var(--dim); font-size: 12px; }
.field > div { display: flex; align-items: center; gap: 7px; width: 155px; }
.field input { width: 88px; text-align: right; }
.field > div span { color: var(--dim); font-size: 10px; min-width: 40px; }
.hint { margin: 13px 0 0; color: var(--dim); font-size: 11px; line-height: 1.75; }

.trend { margin-top: 14px; }
.segmented { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.segmented button { border: 0; border-radius: 5px; padding: 5px 8px; color: var(--dim); background: transparent; font-size: 10px; cursor: pointer; }
.segmented button.active { color: var(--text); background: #2a3035; }
.chart-wrap { position: relative; height: 235px; }
canvas { width: 100%; height: 100%; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-size: 12px; }
.chart-caption { display: flex; justify-content: space-between; gap: 15px; margin-top: 7px; color: var(--dim); font-size: 10px; }
.chart-caption a { color: var(--blue); text-decoration: none; }

.control-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 11px; }
.times input { min-width: 0; padding: 7px 5px; text-align: center; }
button.primary, button.secondary { width: 100%; padding: 8px 12px; border-radius: 7px; font-size: 12px; font-weight: 700; cursor: pointer; }
button.primary { margin-top: 15px; border: 0; color: #07151a; background: var(--aqua); }
button.primary:hover { filter: brightness(1.08); }
button.secondary { margin-top: 12px; border: 1px solid var(--line); color: var(--text); background: var(--panel-2); }
button.secondary:hover { border-color: #414950; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.key-row { display: flex; gap: 7px; margin-top: 14px; }
.key-row input { min-width: 0; }
.key-row button { width: auto; margin: 0; white-space: nowrap; }
.small { padding-inline: 12px !important; }
.key-state { display: block; margin-top: 9px; color: var(--dim); font-size: 10px; }
.key-state.ok { color: var(--ok); }
.activity { margin-top: 14px; }
.activity-list { max-height: 170px; overflow: auto; color: var(--dim); font-size: 12px; }
.activity-item { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); }
.activity-item:first-child { border-top: 0; }
.activity-item b { color: var(--text); font-weight: 500; }
.empty { max-width: 560px; margin: 110px auto; text-align: center; }
.ripple { margin-bottom: 18px; color: var(--aqua); font: 80px/1 Georgia, serif; }
.empty p { color: var(--dim); }
footer { display: flex; justify-content: space-between; gap: 15px; margin-top: 24px; color: #5b6268; font-size: 10px; }

@media (max-width: 850px) {
  .hero-grid, .control-grid { grid-template-columns: 1fr; }
  .current { min-height: 0; }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - 24px); padding-top: 22px; }
  header { flex-direction: column; }
  .toprow { flex-wrap: wrap; }
  .toprow span:last-child { width: 100%; margin-left: 0; }
  .mini-grid { grid-template-columns: 1fr 1fr; }
  .card-head { align-items: flex-start; flex-direction: column; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .field > div { width: 145px; }
  footer { flex-direction: column; }
}

