:root {
  --page: #06100e;
  --page-soft: #091915;
  --panel: rgba(13, 31, 26, .82);
  --panel-strong: rgba(15, 38, 31, .94);
  --line: rgba(184, 229, 211, .15);
  --line-strong: rgba(184, 229, 211, .26);
  --text: #edf8f3;
  --muted: #8eaaa0;
  --green: #5de0a3;
  --green-soft: rgba(93, 224, 163, .13);
  --cyan: #76d7e4;
  --amber: #f4c46b;
  --red: #ff8585;
  --radius: 20px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); }
body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(90% 42% at 50% -6%, rgba(42, 133, 99, .18), transparent 70%),
    linear-gradient(180deg, #06110e 0%, #07100f 48%, #050b0a 100%);
  font-family: "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, select { font: inherit; }
button, a, select { touch-action: manipulation; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.page-shell { width: min(1180px, 100%); margin: 0 auto; padding: 0 18px 48px; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  min-height: 76px;
  padding: max(10px, env(safe-area-inset-top)) 0 10px;
  background: linear-gradient(180deg, rgba(6, 16, 14, .97) 62%, rgba(6, 16, 14, 0));
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}
.is-public-share .topbar {
  grid-template-columns: minmax(0, 1fr) 44px;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(19, 46, 38, .58);
  text-decoration: none;
  cursor: pointer;
}
.icon-button:active { transform: scale(.96); background: rgba(31, 70, 59, .72); }
.icon-button:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.refresh-button.is-loading svg { animation: refresh-spin .8s linear infinite; }
@keyframes refresh-spin { to { transform: rotate(360deg); } }
.title-block { min-width: 0; padding: 0 12px; }
.is-public-share .title-block { padding-left: 0; }
.title-block h1 { margin: 2px 0 0; font-size: clamp(20px, 5vw, 26px); line-height: 1.1; letter-spacing: -.03em; }
.title-block h1, .title-block .eyebrow {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.eyebrow, .section-kicker { color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }

main { display: grid; min-width: 0; gap: 16px; }
.hero-panel, .section-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(100% 120% at 0 0, rgba(111, 218, 173, .07), transparent 50%),
    var(--panel);
  box-shadow: 0 18px 44px rgba(0, 7, 5, .23), inset 0 1px rgba(255, 255, 255, .03);
}
.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 17px;
}
.live-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(244, 196, 107, .1);
}
.live-dot.is-live { background: var(--green); box-shadow: 0 0 0 5px rgba(93, 224, 163, .1); }
.live-dot.is-stale { background: var(--red); box-shadow: 0 0 0 5px rgba(255, 133, 133, .1); }
.hero-copy p { margin: 5px 0 0 16px; color: var(--muted); font-size: 11px; }
.interval-control {
  position: relative;
  display: grid;
  grid-template-columns: auto auto 15px;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 10px 0 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 13px;
  font-size: 11px;
}
.interval-control select {
  appearance: none;
  padding: 0 1px;
  color: var(--text);
  border: 0;
  outline: 0;
  background: transparent;
  font-weight: 700;
}
.interval-control select option { color: #102019; background: #eaf8f2; }
.interval-control svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.metric-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto auto;
  min-height: 118px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(19, 46, 38, .8), rgba(8, 22, 18, .82));
}
.metric-card::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -34px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--metric-glow, rgba(93, 224, 163, .08));
  filter: blur(10px);
}
.metric-card > svg { grid-row: 1 / 3; width: 25px; height: 25px; margin-top: 2px; fill: none; stroke: var(--metric-color, var(--green)); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.metric-label { color: var(--muted); font-size: 11px; }
.metric-card strong { font-size: clamp(24px, 5vw, 33px); line-height: 1.05; letter-spacing: -.04em; }
.metric-card small { grid-column: 2; margin-top: 4px; color: var(--muted); font-size: 10px; }
.metric-charging { --metric-color: var(--amber); --metric-glow: rgba(244, 196, 107, .12); }
.metric-idle { --metric-color: var(--green); }
.metric-power { --metric-color: var(--cyan); --metric-glow: rgba(118, 215, 228, .11); }
.metric-online { --metric-color: #a9d6c5; }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border-radius: 14px;
  font-size: 12px;
}
.notice[hidden] { display: none; }
.notice-error { color: #ffd1d1; border: 1px solid rgba(255, 133, 133, .2); background: rgba(124, 39, 39, .18); }
.notice svg { flex: 0 0 auto; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.section-block { padding: 18px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.section-heading h2 { margin: 3px 0 0; font-size: 17px; }
.legend, .chart-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 12px; color: var(--muted); font-size: 10px; }
.legend span, .chart-legend span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-dot.charging { background: var(--amber); }
.legend-dot.idle { background: var(--green); }
.legend-dot.offline { background: #65756f; }
.legend-line { width: 13px; height: 2px; border-radius: 2px; }
.legend-line.power { background: var(--cyan); }
.legend-line.occupancy { background: var(--amber); }

.device-list { display: grid; gap: 12px; }
.device-card { padding: 14px; border: 1px solid var(--line); border-radius: 17px; background: rgba(5, 17, 14, .46); }
.device-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.device-name { display: flex; align-items: center; gap: 9px; }
.device-name svg { width: 20px; height: 20px; fill: none; stroke: var(--green); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.device-name strong { display: block; font-size: 14px; }
.device-name small, .device-stats { color: var(--muted); font-size: 10px; }
.ports-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.port-card {
  position: relative;
  min-width: 0;
  min-height: 126px;
  padding: 12px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(13, 31, 26, .7);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.port-card:hover { border-color: var(--line-strong); background-color: rgba(18, 43, 36, .82); transform: translateY(-1px); }
.port-card:active { transform: scale(.985); }
.port-card:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.port-card::before { content: ""; position: absolute; top: 0; left: 12px; right: 12px; height: 2px; border-radius: 0 0 3px 3px; background: var(--status-color, #65756f); opacity: .9; }
.port-card.charging { --status-color: var(--amber); border-color: rgba(244, 196, 107, .2); background: linear-gradient(160deg, rgba(92, 66, 20, .18), rgba(13, 31, 26, .76)); }
.port-card.idle { --status-color: var(--green); }
.port-card.offline { --status-color: #65756f; opacity: .68; }
.port-card.finishing { --status-color: var(--red); border-color: rgba(255, 133, 133, .22); }
.port-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.port-number { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.port-number svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.8; opacity: .62; }
.status-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 999px; color: var(--status-color); background: color-mix(in srgb, var(--status-color) 11%, transparent); font-size: 9px; font-weight: 700; white-space: nowrap; }
.status-pill i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.port-current { margin-top: 15px; font-size: clamp(21px, 5vw, 28px); font-weight: 760; letter-spacing: -.05em; white-space: nowrap; }
.port-current small { margin-left: 2px; color: var(--muted); font-size: 10px; letter-spacing: 0; }
.port-meta { display: flex; justify-content: space-between; gap: 6px; margin-top: 5px; color: var(--muted); font-size: 9px; }
.port-duration { display: flex; justify-content: space-between; gap: 5px; margin-top: 10px; overflow: hidden; color: var(--muted); font-size: 9px; white-space: nowrap; }
.port-duration strong { overflow: hidden; color: #c7dad3; font-size: 9px; text-overflow: ellipsis; }
.port-prediction { display: grid; gap: 3px; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(184, 229, 211, .08); }
.port-prediction span { color: var(--muted); font-size: 8px; }
.port-prediction strong { overflow: hidden; color: var(--green); font-size: 9px; line-height: 1.35; text-overflow: ellipsis; }
.port-prediction small { color: #b8cbc4; font-size: 8px; line-height: 1.35; }
.port-prediction.is-low strong, .port-prediction.is-learning strong { color: #d5c38e; }
.port-prediction.is-medium strong { color: #9ee2c1; }
.port-prediction.is-high strong { color: var(--green); }

.skeleton-device { padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: rgba(5, 17, 14, .46); }
.skeleton-device span, .skeleton-device div { display: block; border-radius: 10px; background: linear-gradient(90deg, rgba(129, 177, 159, .06), rgba(129, 177, 159, .15), rgba(129, 177, 159, .06)); background-size: 200% 100%; animation: skeleton 1.3s infinite; }
.skeleton-device span { width: 140px; height: 20px; }
.skeleton-device div { height: 112px; margin-top: 13px; }
@keyframes skeleton { to { background-position: -200% 0; } }

.chart-wrap, .chart-scroll { min-width: 0; max-width: 100%; }
.chart-wrap {
  position: relative;
  height: clamp(220px, 28vw, 320px);
  min-height: 0;
  overflow: hidden;
}
.chart-scroll {
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-behavior: auto;
  scrollbar-color: rgba(93, 224, 163, .42) rgba(3, 13, 10, .3);
  scrollbar-width: thin;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-overflow-scrolling: touch;
}
.chart-scroll.is-dragging { cursor: grabbing; }
#idle-chart {
  display: block;
  width: 400%;
  min-width: 400%;
  max-width: none;
  height: 100%;
  overflow: visible;
}
.chart-grid line { stroke: rgba(184, 229, 211, .08); stroke-width: 1; }
.chart-time-line { vector-effect: non-scaling-stroke; }
.chart-time-line.is-half { stroke: rgba(184, 229, 211, .055); stroke-width: 1; }
.chart-time-line.is-hour { stroke: rgba(184, 229, 211, .13); stroke-width: 1; }
.chart-time-label {
  fill: var(--muted);
  font-size: 5.8px;
  text-anchor: middle;
}
.chart-date-label {
  fill: rgba(176, 210, 197, .72);
  font-size: 5.2px;
  font-weight: 700;
  text-anchor: middle;
}
.chart-edge-label {
  fill: var(--muted);
  font-size: 5.6px;
}
.chart-area { fill: rgba(93, 224, 163, .075); }
.chart-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-line.idle { stroke: var(--green); }
.chart-peak line { stroke: rgba(93, 224, 163, .65); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-peak circle { fill: var(--green); stroke: #07130f; stroke-width: 4; }
.chart-peak rect { fill: rgba(7, 19, 15, .94); stroke: rgba(93, 224, 163, .38); stroke-width: 1; }
.chart-peak text { fill: #e7fff5; font-size: 18px; font-weight: 700; text-anchor: middle; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.chart-empty[hidden] { display: none; }
.legend-line.idle { background: var(--green); }

.accuracy-heading { align-items: center; }
.accuracy-period-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 15, 12, .55); }
.accuracy-period-tab { min-height: 32px; padding: 0 10px; color: var(--muted); border: 0; border-radius: 9px; background: transparent; font-size: 10px; font-weight: 700; cursor: pointer; }
.accuracy-period-tab.is-active { color: #07130f; background: var(--green); }
.accuracy-period-tab:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.accuracy-status-line { display: flex; align-items: center; gap: 8px; margin: -4px 0 13px; color: var(--muted); }
.accuracy-status-line svg { flex: 0 0 auto; width: 16px; height: 16px; fill: none; stroke: var(--green); stroke-width: 1.8; }
.accuracy-status-line p { margin: 0; font-size: 10px; }
.prediction-accuracy-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.prediction-accuracy-grid article { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 17, 14, .48); }
.prediction-accuracy-grid article.accuracy-highlight { border-color: rgba(93, 224, 163, .25); background: rgba(31, 83, 64, .22); }
.prediction-accuracy-grid span { display: block; color: var(--muted); font-size: 9px; }
.prediction-accuracy-grid strong { display: block; margin-top: 6px; overflow: hidden; font-size: clamp(16px, 3vw, 20px); letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.prediction-accuracy-grid .accuracy-highlight strong { color: var(--green); }

.analytics-heading { align-items: center; }
.period-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 15, 12, .55); }
.period-tab { min-height: 32px; padding: 0 11px; color: var(--muted); border: 0; border-radius: 9px; background: transparent; font-size: 10px; font-weight: 700; cursor: pointer; }
.period-tab.is-active { color: #07130f; background: var(--green); }
.period-tab:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.coverage-text { margin: -5px 0 13px; color: var(--muted); font-size: 10px; }
.analytics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.analytics-grid article { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 17, 14, .48); }
.analytics-grid span, .analytics-grid small { display: block; color: var(--muted); font-size: 9px; }
.analytics-grid strong { display: block; margin: 5px 0 3px; font-size: 20px; letter-spacing: -.04em; }
.smart-summary { display: grid; gap: 6px; margin-top: 12px; }
.smart-summary p { position: relative; margin: 0; padding-left: 13px; color: #cadbd5; font-size: 10px; line-height: 1.55; }
.smart-summary p::before { content: ""; position: absolute; top: .55em; left: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.idle-periods { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.idle-periods-title { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.idle-periods-title svg { width: 16px; height: 16px; fill: none; stroke: var(--green); stroke-width: 1.8; }
.idle-period-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.day-type-group { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 17, 14, .4); }
.day-type-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-type-heading strong { font-size: 11px; }
.day-type-heading small { color: var(--muted); font-size: 8px; }
.day-type-chips { display: grid; gap: 6px; margin-top: 8px; }
.idle-period-chip { display: grid; gap: 2px; min-width: 0; padding: 9px 10px; border: 1px solid rgba(93, 224, 163, .18); border-radius: 11px; background: var(--green-soft); }
.idle-period-chip strong { font-size: 11px; }
.idle-period-chip small, .idle-period-empty { color: var(--muted); font-size: 9px; }
.calendar-note { margin: 9px 0 0; color: var(--muted); font-size: 8px; line-height: 1.5; }

.fee-block { padding: 0; }
.fee-block summary { display: flex; align-items: center; justify-content: space-between; min-height: 70px; padding: 15px 18px; cursor: pointer; list-style: none; }
.fee-block summary::-webkit-details-marker { display: none; }
.fee-block summary strong { display: block; margin-top: 3px; font-size: 16px; }
.fee-block summary > svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .2s; }
.fee-block[open] summary > svg { transform: rotate(180deg); }
.fee-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 18px 18px; }
.fee-tier { padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(5, 17, 14, .43); }
.fee-tier strong { color: var(--green); font-size: 11px; }
.fee-tier span { display: block; margin-top: 5px; font-size: 11px; }
.fee-tier small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.fee-empty { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 11px; }

.method-note { display: flex; align-items: flex-start; gap: 9px; padding: 2px 5px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.method-note svg { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.method-note p { margin: 0; }

.port-detail-modal[hidden] { display: none; }
.has-port-modal { overflow: hidden; }
.port-detail-modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}
.port-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 8, 6, .74);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.port-detail-card {
  position: relative;
  width: min(760px, 100%);
  max-height: min(720px, calc(100dvh - 48px));
  padding: 22px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background:
    radial-gradient(100% 120% at 0 0, rgba(111, 218, 173, .09), transparent 52%),
    rgba(9, 25, 20, .97);
  box-shadow: 0 34px 90px rgba(0, 5, 4, .62), inset 0 1px rgba(255, 255, 255, .04);
}
.port-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.port-detail-header h2 { margin: 4px 0 0; font-size: clamp(20px, 4vw, 27px); letter-spacing: -.03em; }
.port-detail-close { flex: 0 0 auto; }
.port-power-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 19px;
}
.port-power-metrics article {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(5, 17, 14, .52);
}
.port-power-metrics span { display: block; color: var(--muted); font-size: 9px; }
.port-power-metrics strong { display: block; margin-top: 5px; overflow: hidden; font-size: clamp(16px, 4vw, 22px); text-overflow: ellipsis; white-space: nowrap; }
.port-power-chart-wrap {
  position: relative;
  min-height: 250px;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(3, 13, 10, .48);
}
#port-power-chart { display: block; width: 100%; min-height: 220px; }
.port-power-grid line { stroke: rgba(184, 229, 211, .075); stroke-width: 1; }
.port-session-boundary { stroke: rgba(244, 196, 107, .28); stroke-width: 1; stroke-dasharray: 4 5; }
.port-power-line { fill: none; stroke: var(--cyan); stroke-width: 2.7; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.port-power-sample-dot { fill: var(--cyan); }
.port-power-peak-line { stroke: rgba(244, 196, 107, .36); stroke-width: 1; stroke-dasharray: 3 4; }
.port-power-peak-dot { fill: var(--amber); stroke: #07130f; stroke-width: 4; vector-effect: non-scaling-stroke; }
.port-power-live-dot { fill: var(--green); stroke: #07130f; stroke-width: 3; vector-effect: non-scaling-stroke; }
.port-power-loading, .port-power-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.port-power-loading[hidden], .port-power-empty[hidden] { display: none; }
.port-power-axis { display: flex; justify-content: space-between; margin: 7px 4px 0; color: var(--muted); font-size: 9px; }
.port-power-status { min-height: 1.5em; margin: 8px 2px 0; color: var(--red); font-size: 10px; }

@media (max-width: 760px) {
  .page-shell { padding-inline: 12px; padding-bottom: max(34px, env(safe-area-inset-bottom)); }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 104px; padding: 13px; }
  .ports-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .port-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .fee-grid { grid-template-columns: 1fr 1fr; }
  .analytics-grid { grid-template-columns: 1fr 1fr; }
  .prediction-accuracy-grid { grid-template-columns: 1fr 1fr; }
  .idle-period-list { grid-template-columns: 1fr; }
  .section-block { padding: 14px; }
  .chart-time-label { font-size: 12px; }
  .chart-date-label { font-size: 10px; }
  .chart-edge-label { font-size: 11px; }
  .port-detail-modal {
    place-items: end stretch;
    padding: 0;
  }
  .port-detail-card {
    width: 100%;
    max-height: min(86dvh, 720px);
    padding: 18px 14px max(14px, env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 24px 24px 0 0;
  }
  .port-power-chart-wrap { min-height: 220px; }
  #port-power-chart { min-height: 200px; }
}

@media (max-width: 430px) {
  .hero-panel { align-items: flex-start; }
  .interval-control { grid-template-columns: auto 14px; }
  .interval-control > span { display: none; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .analytics-heading { gap: 12px; }
  .accuracy-heading { gap: 12px; }
  .accuracy-period-tabs { width: 100%; overflow-x: auto; }
  .accuracy-period-tab { flex: 1 0 auto; }
  .legend, .chart-legend { justify-content: flex-start; }
  .device-header { align-items: flex-start; }
  .device-stats { max-width: 125px; text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
