/* Smart Valve console — self-hosted, no external fonts or dependencies. */
:root {
  --bg: #F4F6F8;
  --surface: #fff;
  --ink: #182C31;
  --muted: #7C8A91;
  --line: #E8EDF0;
  --green: #17856A;
  --green-soft: #EAF5F0;
  --nav: #132D2C;
  --red: #C25F4B;
  --amber: #BA8B39;
  --radius: 16px;
  --shadow: 0 4px 24px #213A4503
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif
}

button,
input,
select {
  font: inherit
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent
}

button {
  cursor: pointer
}

button:disabled {
  opacity: .45;
  cursor: not-allowed
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid #6DC4AA;
  outline-offset: 3px
}

input:focus,
select:focus {
  border-color: var(--green);
  outline: 3px solid #17856A12
}

button {
  transition: background .16s, box-shadow .16s, transform .16s
}

button:not(:disabled):active {
  transform: translateY(1px)
}

a {
  color: inherit;
  text-decoration: none
}

h1,
h2,
h3,
p {
  margin: 0
}

svg.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  vertical-align: middle
}

button svg {
  pointer-events: none
}

[hidden] {
  display: none !important
}

.mono {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums
}

.muted {
  color: var(--muted)
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 228px;
  background: var(--nav);
  color: #A5B7B4;
  padding: 34px 20px 22px;
  z-index: 70;
  display: flex;
  flex-direction: column
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  flex: 0 0 auto;
  padding: 0 8px 24px
}

.brand-logo {
  display: block;
  width: 160px;
  max-width: 100%;
  height: auto;
  flex: 0 0 auto
}

.brand-subtitle {
  display: block;
  color: #B4CCBC;
  font-size: 22px;
  font-weight: 600;
  line-height: 30px;
  letter-spacing: 2px;
  padding-left: 2px;
  white-space: nowrap
}

.nav-label {
  padding: 0 16px;
  margin: 18px 0 10px;
  font-size: 10px;
  letter-spacing: 2px;
  color: #64877B
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  color: #A5B7B4;
  padding: 13px 16px;
  border-radius: 9px;
  margin: 4px 0;
  font-size: 13px
}

.nav-link:hover {
  background: #FFFFFF07;
  color: #FFF
}

.nav-link.active {
  background: #D9E9CD;
  color: #213F32;
  font-weight: 600
}

.nav-link.active:after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #527855;
  margin-left: auto
}

.nav-link .icon {
  width: 19px;
  height: 19px
}

.sidebar-bottom {
  margin-top: auto
}

.side-status {
  padding: 18px 16px;
  border-top: 1px solid #2B4540;
  font-size: 11px;
  color: #779A8C
}

.side-status strong {
  display: block;
  font-weight: 500;
  color: #ACC5B4;
  margin-bottom: 6px
}

.side-status .dot {
  background: #719D85
}

.side-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 12px 0
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #315449;
  color: #C4D9C6;
  font-size: 12px
}

.side-footer b {
  display: block;
  color: #CBD9CE;
  font-size: 12px;
  font-weight: 500
}

.side-footer small {
  font-size: 10px;
  color: #739485
}

.side-version {
  margin-left: auto;
  font-size: 10px;
  color: #668679
}

.workspace {
  margin-left: 228px
}

.topbar {
  height: 82px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: #FFFFFFF5;
  border-bottom: 1px solid var(--line);
  padding: 0 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px
}

.breadcrumb {
  font-size: 12px;
  color: #91A0A4;
  display: flex;
  align-items: center;
  gap: 12px
}

.breadcrumb b {
  font-weight: 500;
  color: #496166
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 18px
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  background: #F9FAFB
}

.search .icon {
  width: 16px;
  height: 16px;
  color: #9AA6AB
}

.search input {
  border: 0;
  background: transparent;
  outline: none;
  width: 185px;
  font-size: 12px;
  padding: 0;
  color: #354C52
}

.kbd {
  font-size: 10px;
  color: #A3ADB1;
  border: 1px solid #E0E6E9;
  border-radius: 3px;
  width: 19px;
  text-align: center
}

.top-date {
  font-size: 12px;
  color: #7A8C92
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #FFF;
  color: #6C8487
}

.mobile-menu {
  display: none
}

.page-wrap {
  padding: 32px 38px 40px;
  max-width: 1850px;
  margin: auto
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 2.6px;
  font-weight: 600;
  color: #8B9A9C;
  margin-bottom: 7px
}

h1 {
  font-size: 27px;
  letter-spacing: .5px;
  font-weight: 650
}

.page-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 7px
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0
}

.live-indicator {
  font-size: 11px;
  color: #7E9191;
  display: flex;
  align-items: center;
  gap: 7px
}

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #AAB6B9;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle
}

.dot.on {
  background: #36A183
}

.dot.off {
  background: #C88E70
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 16px;
  min-height: 38px;
  background: var(--green);
  color: #FFF;
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap
}

.btn:hover {
  background: #116D57
}

.btn .icon {
  width: 16px;
  height: 16px
}

.btn.gray,
.btn.secondary {
  color: #57716F;
  background: #FFF;
  border-color: #DDE6E5
}

.btn.gray:hover,
.btn.secondary:hover {
  background: #F1F6F3
}

.btn.red {
  background: #FBEEEA;
  color: #B96550
}

.btn.red:hover {
  background: #F7DED5
}

.btn.small {
  padding: 5px 11px;
  min-height: 30px;
  font-size: 11px
}

.btn.ghost {
  background: #EAF4ED;
  color: #568163;
  border-color: transparent
}

.text-link {
  border: 0;
  padding: 4px 0;
  background: none;
  color: var(--green);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px
}

.text-link .icon {
  width: 14px;
  height: 14px
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 24px
}

.stat-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  background: #FFF;
  min-height: 155px;
  box-shadow: var(--shadow)
}

.stat-card.primary {
  background: #1A433C;
  color: #FFF;
  border-color: #1A433C;
  overflow: hidden
}

.stat-card.primary:after {
  content: "";
  position: absolute;
  right: -33px;
  bottom: -50px;
  width: 170px;
  height: 170px;
  border: 1px solid #3A6052;
  border-radius: 50%;
  pointer-events: none
}

.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #798F92;
  font-size: 12px
}

.stat-card.primary .stat-top {
  color: #BCD0C4
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 9px;
  background: #F2F7F5;
  color: #5C9480
}

.primary .stat-icon {
  background: #315D4E;
  color: #C6E0BC
}

.stat-number {
  margin: 12px 0 7px;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums
}

.stat-number small {
  font-size: 12px;
  font-weight: 400;
  color: #94A7A4;
  letter-spacing: 0;
  margin-left: 7px
}

.primary .stat-number small {
  color: #A3BEAC
}

.stat-bottom {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  color: #96A6A7
}

.primary .stat-bottom {
  color: #A3C4AE
}

.stat-change {
  color: #388466
}

.stat-bottom .offline-count {
  color: #AC8F71
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr);
  gap: 24px;
  margin-bottom: 24px
}

/* ---- 控制台:两张并排的趋势图（4G / WiFi） ---- */
.trend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  min-width: 0
}

@media(max-width:1100px) {
.trend-grid {
    grid-template-columns: 1fr
  }
}

.panel {
  min-width: 0;
  background: #FFF;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow)
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px
}

.panel-head h2,
.section-title h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .3px
}

.panel-head p {
  font-size: 11px;
  color: #94A0A4;
  margin-top: 5px
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px
}

.period {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #849299;
  font-size: 10px;
  padding: 5px 9px
}

.chart-meta {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 8px
}

.chart-meta strong {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -.6px
}

.chart-meta span {
  font-size: 11px;
  color: #8B9C9E
}

.chart {
  height: 180px;
  position: relative;
  display: flex;
  padding-left: 28px;
  margin-top: 12px
}

.chart-grid {
  position: absolute;
  inset: 0 0 25px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between
}

.gridline {
  border-top: 1px dashed #E7ECEB;
  position: relative
}

.gridline span {
  position: absolute;
  right: calc(100% + 10px);
  top: -8px;
  font-size: 9px;
  color: #A0ACAF
}

.chart-columns {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 12px;
  width: 100%;
  z-index: 1
}

.chart-column {
  flex: 1;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  position: relative;
  padding-bottom: 25px
}

.chart-bar {
  width: 54%;
  max-width: 45px;
  min-height: 2px;
  border-radius: 6px 6px 0 0;
  background: #B7D6BC;
  transition: height .3s
}

.chart-column:last-child .chart-bar {
  background: #3C876C
}

.chart-column label {
  position: absolute;
  bottom: 0;
  white-space: nowrap;
  font-size: 10px;
  color: #9AABAC
}

.chart-column b {
  font-size: 9px;
  color: #79958B;
  margin-bottom: 5px;
  font-weight: 500
}

.chart-note {
  font-size: 10px;
  color: #A0AEAF;
  margin-top: 16px
}

.health-summary {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 8px 0 20px;
  border-bottom: 1px solid var(--line)
}

.health-ring {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border: 7px solid #E5F0E5;
  border-top-color: #629970;
  border-right-color: #629970;
  border-radius: 50%;
  color: #45865D;
  flex-shrink: 0
}

.health-ring .icon {
  width: 28px;
  height: 28px
}

.health-summary h3 {
  font-size: 17px;
  font-weight: 600
}

.health-summary p {
  font-size: 11px;
  color: #8E9F9C;
  margin-top: 5px
}

.connection-list {
  display: grid;
  gap: 16px;
  margin-top: 20px
}

.connection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #80928F
}

.connection-item b {
  font-size: 10px;
  color: #5B8B6D;
  font-weight: 500
}

.connection-item b.bad {
  color: #BC876C
}

.health-summary.warning .health-ring,
.health-summary.critical .health-ring {
  border-color: #F5E8CE;
  color: #BC9451
}

.health-summary.critical .health-ring {
  border-color: #F5DFD7;
  color: #BC6C52
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 28px 0 17px
}

.section-title p {
  font-size: 11px;
  color: #91A09E;
  margin-top: 4px
}

.section-tools {
  display: flex;
  align-items: center;
  gap: 12px
}

.filter-chips {
  display: flex;
  gap: 5px;
  background: #EAEFEE;
  border: 1px solid #E5ECE8;
  border-radius: 8px;
  padding: 3px
}

.filter-chip {
  border: 0;
  background: none;
  border-radius: 5px;
  color: #7B9088;
  font-size: 11px;
  padding: 5px 13px
}

.filter-chip.active {
  background: #FFF;
  color: #3C6F58;
  box-shadow: 0 2px 5px #12352208
}

.device-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px
}

.device-group {
  min-width: 0
}

.device-group-head {
  font-size: 11px;
  letter-spacing: .6px;
  color: #91A09B;
  display: flex;
  justify-content: space-between;
  margin: 0 2px 10px
}

.device-group-head small {
  font-size: 10px;
  color: #799487
}

.device-symbol {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 12px;
  background: #EEF4ED;
  color: #638D69;
  flex-shrink: 0
}

.device-symbol .icon {
  width: 23px;
  height: 23px
}

.badge {
  font-size: 10px;
  border-radius: 20px;
  padding: 4px 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  margin-left: auto;
  background: #F2F4F2;
  color: #8C9C91
}

.badge:before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor
}

.badge.on {
  color: #35855F;
  background: #EDF6ED
}

.badge.off {
  color: #A58D6B;
  background: #F7F2E8
}

.badge.fault {
  color: #BF6953;
  background: #FBEDE7
}

.badge.executing {
  color: #A28B43;
  background: #FAF3DF
}

/* ---- 设备列表：一行一台，点整行进详情抽屉（控制项都在抽屉里） ---- */
.ball-list {
  display: flex;
  flex-direction: column;
  gap: 10px
}

.ball-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: #FFF;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  min-width: 0;
  transition: border-color .15s, box-shadow .15s
}

.ball-row:hover {
  border-color: #C6DBCF;
  box-shadow: 0 4px 14px rgba(25, 63, 52, .07)
}

.ball-row:focus-visible {
  outline: 2px solid #17856A;
  outline-offset: 2px
}

.ball-row .device-symbol {
  width: 38px;
  height: 38px
}

.row-main {
  flex: 1;
  min-width: 0
}

.row-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere
}

.row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 4px;
  font-size: 11px;
  color: #97A7A2
}

.row-meta .mono {
  letter-spacing: .6px
}

.row-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #799487;
  min-width: 0
}

.row-link .sig {
  display: inline-flex;
  margin: 0
}

.row-state {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0
}

.row-metric {
  font-size: 11px;
  color: #799487
}

.row-metric.bad {
  color: #BF6953;
  font-weight: 500
}

.row-arrow {
  display: grid;
  place-items: center;
  color: #C3D0C9;
  flex-shrink: 0
}

.row-arrow .icon {
  width: 15px;
  height: 15px
}

/* ---- 告警与历史页筛选（改版新增） ---- */
.rec-device {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 11px
}

.rec-device:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px #17856A12
}

.fault-name {
  margin-left: 6px;
  color: var(--muted)
}

/* ---- 设备详情抽屉（改版新增，复用现有面板/徽标/按钮 token） ---- */
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: #0F241F33;
  z-index: 40
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: 0 30px 100px #17371C33;
  z-index: 41;
  display: flex;
  flex-direction: column
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line)
}

.drawer-head h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink)
}

.drawer-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 24px 30px
}

.drawer-sec {
  padding: 18px 0;
  border-bottom: 1px solid var(--line)
}

.drawer-sec:last-child {
  border-bottom: 0
}

.drawer-sec h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink)
}

.drawer-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px
}

.drawer-kvs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin-top: 12px
}

.drawer-kv {
  min-width: 0
}

.drawer-kv span {
  display: block;
  font-size: 10px;
  color: #9AAA9D;
  margin-bottom: 4px
}

.drawer-kv b {
  font-size: 12px;
  font-weight: 500;
  color: #47674F;
  overflow-wrap: anywhere
}

.drawer-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 20px;
  background: #F2F4F2;
  color: #8C9C91;
  font-size: 10px;
  font-weight: 600
}

.drawer-badge.g4 {
  background: var(--green-soft);
  color: var(--green)
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #708774
}

.drawer-link svg.icon {
  width: 15px;
  height: 15px;
  flex: none
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px
}

.drawer-actions .btn {
  text-decoration: none
}

/* 开度调节：原来挂在设备卡片上，改成列表后收进抽屉（全局 input 规则会把控件撑到 38px） */
.drawer-opening-label {
  align-self: center;
  font-size: 11px;
  color: #7B907A
}

.drawer-opening input[type=number] {
  width: 78px;
  min-height: 33px;
  padding: 7px 10px;
  font-size: 11px
}

.drawer-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px
}

.drawer-form input {
  flex: 1;
  min-width: 90px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  color: var(--ink)
}

.drawer-form input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px #17856A12
}

.drawer-empty {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted)
}

.drawer-hist {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 11px;
  color: #708774;
  border-bottom: 1px dashed var(--line)
}

.drawer-hist:last-child {
  border-bottom: 0
}

.drawer-hist .bad {
  color: var(--red)
}

.link-toggle {
  border: 0;
  background: transparent;
  color: var(--green);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 0
}

/* ---- 设备卡片:产品徽标 + 链路行（改版新增，复用现有 token） ---- */
.product-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 20px;
  background: #F2F4F2;
  color: #8C9C91;
  font-size: 10px;
  font-weight: 600;
  vertical-align: middle
}

.product-tag.g4 {
  background: var(--green-soft);
  color: var(--green)
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 11px;
  color: #92A094;
  margin-top: 12px
}

.kv b {
  font-size: 11px;
  color: #708774;
  font-weight: 400;
  text-align: right;
  overflow-wrap: anywhere
}

.valve-btn {
  border: 0;
  border-radius: 7px;
  padding: 8px 13px;
  background: #EAF2E5;
  color: #548058;
  font-size: 11px;
  white-space: nowrap
}

.valve-btn.open {
  color: #17856A;
  background: #E4F4ED
}

.valve-btn:disabled {
  background: #F0F3ED;
  color: #91A18B
}

.irr {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 16px
}

.irr select {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  padding: 7px 10px
}

.irr .btn {
  font-size: 11px;
  min-height: 33px
}

.bar {
  height: 5px;
  border-radius: 4px;
  background: #ECF1E8;
  overflow: hidden
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: #74A985
}

.bar i.warn {
  background: #CBA259
}

.bar i.low {
  background: #C4775C
}

.sig {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px
}

.sig i {
  width: 3px;
  background: #E0E9DC;
  border-radius: 1px
}

.sig i.on {
  background: #83AA7A
}

.sig i:nth-child(1) {
  height: 4px
}

.sig i:nth-child(2) {
  height: 8px
}

.sig i:nth-child(3) {
  height: 12px
}

.bottom-overview {
  display: grid;
  grid-template-columns: 1.75fr 1fr;
  gap: 24px;
  margin-top: 24px
}

.activity-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid #EFF3ED
}

.activity-row:last-child {
  border: 0
}

.activity-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #EFF5E9;
  color: #78A075;
  display: grid;
  place-items: center
}

.activity-mark .icon {
  width: 16px;
  height: 16px
}

.activity-copy {
  flex: 1;
  min-width: 0
}

.activity-copy b {
  font-size: 12px;
  font-weight: 500
}

.activity-copy p {
  font-size: 10px;
  color: #9DAAA1;
  margin-top: 3px
}

.activity-time {
  font-size: 10px;
  color: #96A59B;
  text-align: right
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px
}

.quick-action {
  border: 1px solid #E8EFE4;
  border-radius: 10px;
  background: #FAFCF7;
  padding: 18px 12px;
  text-align: left;
  color: #557B58;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  font-size: 11px
}

.quick-action:hover {
  background: #F0F6E9;
  border-color: #CEDEC5
}

.quick-action .icon {
  width: 21px;
  height: 21px
}

.quick-note {
  font-size: 10px;
  color: #98A88E;
  margin-top: 16px
}

.panel-stack {
  display: grid;
  gap: 24px
}

.table-scroll {
  width: 100%;
  overflow-x: auto
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap
}

th {
  font-size: 11px;
  color: #91A19A;
  font-weight: 400;
  background: #F8FAF6
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #EDF2E9
}

td {
  color: #617668
}

td b {
  color: #355743;
  font-weight: 500
}

tr:hover td {
  background: #FBFDF8
}

tr:last-child td {
  border-bottom: 0
}

td .btn+.btn {
  margin-left: 5px
}

.time {
  font-size: 10px;
  color: #97A697
}

.tag {
  display: inline-block;
  font-size: 10px;
  border-radius: 5px;
  padding: 3px 8px
}

.tag.manual {
  background: #EDF3F8;
  color: #7591A6
}

.tag.plan {
  background: #F6F1E4;
  color: #AB9661
}

.tag.published {
  background: #EAF4E6;
  color: #599352
}

.tag.draft {
  background: #F0F3EC;
  color: #97A087
}

.form {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  padding: 22px;
  background: #F8FAF6;
  border: 1px solid #EDF1E8;
  border-radius: 12px;
  margin-bottom: 24px
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px
}

.field label {
  font-size: 11px;
  color: #7B907A
}

.field.grow {
  flex: 1;
  min-width: 200px
}

select,
input {
  border: 1px solid #DDE7D8;
  border-radius: 7px;
  padding: 9px 12px;
  background: #FFF;
  color: #426345;
  min-height: 38px
}

input[type=number] {
  width: 110px
}

.input-unit {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  color: #95A38A
}

.file-drop {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px dashed #C7D8BF;
  border-radius: 12px;
  padding: 26px;
  background: #F8FBF3;
  cursor: pointer
}

.file-drop .upload-symbol {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: #EAF3E1;
  color: #79A36B;
  display: grid;
  place-items: center
}

.file-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #567C4F
}

.file-copy span {
  display: block;
  font-size: 11px;
  color: #9AA68C;
  margin-top: 5px
}

.file-input {
  max-width: 100%;
  font-size: 11px;
  margin-top: 16px;
  width: 100%
}

.file-input::file-selector-button {
  border: 0;
  background: #EAF2E1;
  color: #5C7F4E;
  padding: 6px 12px;
  border-radius: 5px;
  margin-right: 12px;
  cursor: pointer
}

.firmware-layout {
  display: grid;
  grid-template-columns: minmax(280px, .85fr) minmax(0, 1.8fr);
  gap: 24px
}

.upload-fields {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 22px
}

.upload-fields .field {
  flex: 1;
  min-width: 0
}

.upload-fields input {
  width: 100%
}

.upload-note {
  font-size: 11px;
  color: #9AA88D;
  margin-top: 18px;
  line-height: 1.8
}

.empty {
  padding: 45px 20px;
  text-align: center;
  color: #9EADA0;
  font-size: 12px
}

.empty-symbol {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border: 1px solid #E5ECE0;
  border-radius: 13px;
  background: #F6F9F1;
  color: #95AF88
}

.empty strong {
  display: block;
  font-size: 13px;
  color: #7C9571;
  font-weight: 500
}

.empty p {
  font-size: 11px;
  margin-top: 7px
}

.empty.compact {
  padding: 16px
}

.monitor-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap
}

.monitor-head strong {
  font-size: 16px;
  font-weight: 600
}

.monitor-head .btn {
  margin-left: auto
}

.health-pill {
  font-size: 10px;
  border-radius: 20px;
  padding: 4px 10px;
  background: #EFF3EA;
  color: #8A9B80
}

.health-pill.healthy {
  background: #EAF5E4;
  color: #66934D
}

.health-pill.warning {
  background: #FAF1DA;
  color: #B29346
}

.health-pill.critical {
  background: #FBEAE2;
  color: #BD7153
}

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px
}

.monitor-item {
  padding: 22px;
  border: 1px solid #E8EEE2;
  border-radius: 12px;
  background: #FEFFFC
}

.monitor-item .title {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #8F9D87
}

.monitor-item .value {
  font-size: 23px;
  font-weight: 600;
  margin: 12px 0 8px;
  color: #41653D
}

.monitor-item .desc {
  font-size: 11px;
  color: #9CA78F;
  line-height: 1.8;
  overflow-wrap: anywhere
}

.service-state {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #C4896D;
  margin-top: 5px
}

.service-state.on {
  background: #80A864;
  box-shadow: 0 0 0 3px #EDF5E2
}

.meter {
  height: 5px;
  border-radius: 5px;
  background: #ECF2E5;
  overflow: hidden;
  margin-top: 15px
}

.meter i {
  display: block;
  height: 100%;
  background: #81A968;
  border-radius: 5px
}

.meter i.warn {
  background: #CBA465
}

.meter i.danger {
  background: #C57E65
}

#resourceMonitor {
  grid-template-columns: repeat(3, minmax(0, 1fr))
}

.alerts {
  display: grid;
  gap: 10px;
  margin-top: 20px
}

.alert,
.all-good {
  padding: 12px 16px;
  border-radius: 9px;
  font-size: 12px;
  background: #F0F6E8;
  color: #769260;
  margin-top: 16px
}

.alert.warning {
  background: #FBF3DF;
  color: #AA8C4A
}

.alert.critical {
  background: #FCEEE6;
  color: #B17156
}

.log-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px
}

.log-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 15px;
  color: #57704D;
  display: flex;
  align-items: center;
  gap: 8px
}

.mlog {
  height: 540px;
  overflow: auto;
  border-radius: 11px;
  background: #172B2B;
  color: #9DB8A8;
  font: 11px/1.85 Consolas, "Courier New", monospace;
  padding: 20px;
  overflow-wrap: anywhere
}

.mlog>div {
  padding: 6px 0;
  border-bottom: 1px solid #29423A
}

.mlog .t {
  color: #628C77
}

.mlog .up {
  color: #96C7A3
}

.mlog .down {
  color: #D7BC80
}

.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  border-top: 1px solid #E5EBE6;
  padding-top: 18px;
  color: #A0ADA5;
  font-size: 10px
}

.page-footer span:last-child {
  letter-spacing: 1.5px
}

.page-footer a {
  color: inherit;
  text-decoration: none;
  letter-spacing: .5px
}

.page-footer a:hover {
  text-decoration: underline
}

.global-error {
  border: 1px solid #EDD6C8;
  background: #FCF0E8;
  color: #B77D5D;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 12px;
  margin-bottom: 20px;
  display: flex;
  gap: 14px;
  align-items: center
}

.global-error button {
  border: 0;
  background: none;
  color: inherit;
  text-decoration: underline;
  margin-left: auto;
  white-space: nowrap
}

.toast-stack {
  position: fixed;
  right: 28px;
  top: 96px;
  z-index: 150;
  display: grid;
  gap: 10px;
  max-width: min(440px, calc(100vw - 40px))
}

.toast {
  background: #FFF;
  border: 1px solid #DEE9D8;
  box-shadow: 0 10px 40px #1E422719;
  padding: 15px 20px;
  border-radius: 12px;
  font-size: 12px;
  color: #537445;
  white-space: pre-wrap
}

.modal {
  border: 1px solid #E4ECD9;
  border-radius: 18px;
  padding: 28px;
  width: 420px;
  max-width: calc(100vw - 36px);
  color: #3D5E36;
  box-shadow: 0 30px 100px #17371C33
}

.modal::backdrop {
  background: #102F2555;
  backdrop-filter: blur(3px)
}

.modal-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #EFF5E5;
  color: #85A56A;
  display: grid;
  place-items: center;
  margin-bottom: 18px
}

.modal h2 {
  font-size: 18px;
  font-weight: 600
}

.modal p {
  font-size: 13px;
  color: #8A9B79;
  line-height: 1.9;
  margin: 14px 0 26px;
  white-space: pre-wrap
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end
}

.modal-actions .btn {
  min-width: 90px
}

.no-results {
  grid-column: 1/-1;
  margin-bottom: 18px
}

.menu-scrim {
  display: none
}

.loading-line {
  height: 7px;
  width: 75%;
  background: #EDF2E9;
  border-radius: 5px;
  margin: 12px auto;
  animation: pulse 1.4s ease infinite
}

@keyframes pulse {
50% {
    opacity: .4
  }
}

@media(prefers-reduced-motion:reduce) {
*,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important
  }
}

@media(min-width:1700px) {
.page-wrap {
    padding-top: 40px
  }

  .stats-grid {
    gap: 24px
  }

  .stat-card {
    min-height: 172px;
    padding: 26px
  }

  .stat-number {
    font-size: 40px
  }

  .chart {
    height: 220px
  }

  .panel {
    padding: 28px
  }
}

@media(max-width:1200px) {
.sidebar {
    width: 200px;
    padding-left: 14px;
    padding-right: 14px
  }

  .workspace {
    margin-left: 200px
  }

  .topbar {
    padding: 0 26px
  }

  .page-wrap {
    padding: 26px
  }

  .top-date {
    display: none
  }

  .stats-grid {
    gap: 14px
  }

  .stat-card {
    padding: 18px
  }

  .stat-top {
    font-size: 11px
  }

  .stat-number {
    font-size: 30px
  }

  .overview-grid,
  .bottom-overview {
    grid-template-columns: 1.4fr 1fr;
    gap: 18px
  }

  .panel {
    padding: 20px
  }

  .device-columns {
    gap: 18px
  }

  .firmware-layout {
    grid-template-columns: 1fr
  }

  .chart-columns {
    gap: 6px
  }

  .head-actions {
    gap: 8px
  }
}

@media(max-width:960px) {
.sidebar {
    width: 180px;
    padding-left: 10px;
    padding-right: 10px
  }

  .brand {
    gap: 11px;
    padding-left: 6px;
    padding-right: 6px
  }

  .brand-logo {
    width: 144px
  }

  .brand-subtitle {
    font-size: 20px;
    letter-spacing: 1.5px
  }

  .workspace {
    margin-left: 180px
  }

  .page-wrap {
    padding: 24px
  }

  .topbar {
    padding: 0 24px
  }

  .search input {
    width: 140px
  }

  .top-actions {
    gap: 10px
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  .overview-grid,
  .bottom-overview {
    grid-template-columns: 1fr
  }

  .device-columns {
    grid-template-columns: 1fr
  }

  .page-head {
    align-items: flex-start
  }

  .head-actions {
    flex-wrap: wrap;
    justify-content: flex-end
  }

  .live-indicator {
    display: none
  }

  .monitor-grid,
  #resourceMonitor {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  .log-grid {
    grid-template-columns: 1fr
  }

  .mlog {
    height: 380px
  }

  .section-tools {
    flex-wrap: wrap
  }

  .stat-card.primary:after {
    right: 0
  }

  .chart {
    height: 200px
  }

  .health-summary {
    padding-top: 0
  }

  .connection-list {
    grid-template-columns: 1fr 1fr
  }
}

@media(max-width:680px) {
.sidebar {
    transform: translateX(-100%);
    width: 228px;
    transition: transform .2s
  }

  .sidebar.open {
    transform: translateX(0)
  }

  .menu-scrim.open {
    display: block;
    position: fixed;
    inset: 0;
    background: #18382C66;
    z-index: 65
  }

  .workspace {
    margin-left: 0
  }

  .mobile-menu {
    display: grid
  }

  .topbar {
    height: 65px;
    padding: 0 18px;
    gap: 12px
  }

  .breadcrumb {
    margin-right: auto;
    font-size: 11px;
    gap: 8px
  }

  .breadcrumb>span,
  .breadcrumb>svg {
    display: none
  }

  .search {
    padding: 7px 9px
  }

  .search input {
    width: 98px;
    font-size: 11px
  }

  .kbd {
    display: none
  }

  .top-actions>.icon-button {
    display: none
  }

  .page-wrap {
    padding: 24px 16px
  }

  .page-head {
    margin-bottom: 22px;
    gap: 12px
  }

  .eyebrow {
    font-size: 8px
  }

  h1 {
    font-size: 23px
  }

  .page-subtitle {
    font-size: 11px;
    max-width: 220px
  }

  .head-actions .btn {
    font-size: 0;
    width: 37px;
    padding: 8px
  }

  .head-actions .btn .icon {
    width: 16px;
    height: 16px
  }

  .stats-grid {
    gap: 12px;
    margin-bottom: 18px
  }

  .stat-card {
    min-height: 142px;
    padding: 16px
  }

  .stat-icon {
    width: 27px;
    height: 27px
  }

  .stat-icon .icon {
    width: 16px;
    height: 16px
  }

  .stat-number {
    font-size: 30px
  }

  .stat-bottom {
    font-size: 9px;
    flex-wrap: wrap
  }

  .overview-grid,
  .bottom-overview {
    gap: 18px;
    margin-bottom: 18px
  }

  .panel {
    padding: 18px;
    border-radius: 13px
  }

  .panel-head {
    gap: 10px;
    margin-bottom: 20px
  }

  .panel-head h2,
  .section-title h2 {
    font-size: 14px
  }

  .panel-head p {
    font-size: 10px
  }

  .period {
    font-size: 9px;
    padding: 4px 6px
  }

  .chart {
    height: 170px
  }

  .section-title {
    margin-top: 24px;
    gap: 12px;
    flex-wrap: wrap
  }

  .section-tools {
    gap: 8px
  }

  .filter-chip {
    padding: 5px 10px
  }

  .device-columns {
    gap: 18px
  }

  .connection-list {
    grid-template-columns: 1fr
  }

  .monitor-grid,
  #resourceMonitor {
    grid-template-columns: 1fr
  }

  .monitor-head {
    gap: 8px
  }

  .monitor-head .time {
    flex-basis: 100%
  }

  .monitor-head .btn {
    margin-left: 0
  }

  .form {
    padding: 16px;
    gap: 16px
  }

  .form .field {
    flex: 1;
    min-width: 120px
  }

  .form .btn {
    width: 100%
  }

  .form input,
  .form select {
    width: 100%
  }

  .input-unit input {
    width: 100%
  }

  .firmware-layout {
    gap: 18px
  }

  .upload-fields {
    flex-wrap: wrap
  }

  .file-drop {
    padding: 18px;
    gap: 12px
  }

  .file-copy strong {
    font-size: 12px
  }

  .file-copy span {
    font-size: 10px
  }

  .page-footer {
    font-size: 9px;
    align-items: flex-start
  }

  .page-footer span:last-child {
    display: none
  }

  .toast-stack {
    top: 78px;
    right: 18px
  }

  .global-error {
    font-size: 11px
  }

  .activity-copy b {
    font-size: 11px
  }

  .activity-time {
    font-size: 9px
  }

  .quick-grid {
    gap: 10px
  }

  .quick-action {
    padding: 16px
  }

  .log-grid {
    gap: 18px
  }
}

/* ---- 球阀运行记录状态标签 ---- */
.tag.ok {
  color: #2F7D46;
  background: #E3F2DE;
}

.tag.fail {
  color: #AA7058;
  background: #F7E7DE;
}

.tag.warn {
  color: #8A7A3A;
  background: #F4EFD8;
}

.tag.muted {
  color: #7A8C71;
  background: #EDF1E7;
}

.logout-button{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;margin-top:12px;padding:8px;border:1px solid #36514a;border-radius:8px;background:transparent;color:#abc2b5;font:inherit;font-size:12px}.logout-button:hover{background:#ffffff08;color:#edf5e9}.logout-button svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.6}

/* ---- 系统页子标签（改版新增，复用现有 token） ---- */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px
}

.tab {
  padding: 8px 16px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer
}

.tab:hover {
  color: var(--ink)
}

.tab.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green)
}

.tab:focus-visible {
  outline: 3px solid #6DC4AA
}

/* ---- 章节标题旁的计数（改版新增） ---- */
.count-note {
  margin-left: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400
}

/* ---- 球阀定时页:周几多选与启用开关 ---- */
.week-days {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px
}

.week-days label,
.bs-enabled {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #7B907A
}

/* 全局 input 规则会把复选框撑成 38px,这里恢复实际尺寸 */
.week-days input[type=checkbox],
.bs-enabled input[type=checkbox] {
  width: 15px;
  height: 15px;
  min-height: 0;
  padding: 0;
  accent-color: #17856A
}

.bs-enabled {
  min-height: 38px
}

/* ---- 设备管理页:类型/状态两排筛选 chips,窄屏可换行 ---- */
.section-tools {
  flex-wrap: wrap
}

/* ---- 总览:设备类型入口卡 ---- */
.device-entries {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 18px
}

.device-entry {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  background: #FFF;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
  transition: border-color .16s, background .16s
}

.device-entry:hover {
  border-color: #C7D8BF;
  background: #FBFDF8
}

.device-entry-icon {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 12px;
  background: #EEF4ED;
  color: #638D69;
  flex-shrink: 0
}

.device-entry-icon .icon {
  width: 23px;
  height: 23px
}

.device-entry-copy {
  flex: 1;
  min-width: 0
}

.device-entry-copy b {
  display: block;
  font-size: 14px;
  font-weight: 600
}

.device-entry-copy small {
  display: block;
  font-size: 11px;
  color: #92A198;
  margin-top: 5px
}

.device-entry-copy small .off {
  color: #A58D6B;
  margin-left: 6px
}

.device-entry-copy small .bad {
  color: #BF6953;
  margin-left: 6px
}

.device-entry-arrow {
  color: #9DB2A5;
  flex-shrink: 0
}

.device-entry-arrow .icon {
  width: 18px;
  height: 18px
}