:root {
  color-scheme: dark;
  --bg: #071622;
  --panel: #102538;
  --panel-2: #142d43;
  --panel-3: #1b3850;
  --line: rgba(160, 194, 218, 0.24);
  --line-strong: rgba(180, 212, 232, 0.36);
  --text: #f2f8ff;
  --muted: #a8bccd;
  --quiet: #7790a5;
  --blue: #0f77d7;
  --blue-2: #145da2;
  --green: #25d321;
  --green-deep: #098a17;
  --aqua: #29b9d8;
  --gold: #ffd93d;
  --red: #ff4037;
  --shadow: 0 16px 45px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-width: 1180px;
  overflow: hidden;
  color: var(--text);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(19, 105, 145, 0.28), transparent 38%),
    linear-gradient(135deg, #081521 0%, #0d2335 48%, #071522 100%);
  letter-spacing: 0;
}

button {
  font: inherit;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-shell {
  display: grid;
  grid-template-columns: 210px minmax(970px, 1fr);
  width: 100vw;
  height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 14px 12px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(18, 44, 65, 0.96), rgba(8, 22, 34, 0.98)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 38px);
  box-shadow: inset -1px 0 rgba(255, 255, 255, 0.04);
}

.system-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  margin-bottom: 14px;
  padding: 0 6px;
}

.system-mark strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.system-mark small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.mark-lines {
  position: relative;
  width: 30px;
  height: 36px;
}

.mark-lines span {
  position: absolute;
  bottom: 0;
  width: 8px;
  border-radius: 8px 8px 2px 2px;
  background: linear-gradient(180deg, #4fe0ff, #17aa49 60%, #0b6e41);
  box-shadow: 0 0 18px rgba(48, 216, 120, 0.4);
}

.mark-lines span:nth-child(1) {
  left: 0;
  height: 26px;
}

.mark-lines span:nth-child(2) {
  left: 13px;
  height: 40px;
}

.mark-lines span:nth-child(3) {
  right: 0;
  height: 31px;
}

.side-nav {
  display: grid;
  gap: 9px;
}

.nav-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  min-height: 54px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(37, 70, 96, 0.78), rgba(17, 42, 63, 0.72));
  cursor: default;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
}

.nav-item svg {
  width: 26px;
  height: 26px;
}

.nav-item span {
  font-size: 17px;
  font-weight: 700;
}

.nav-item.active {
  border-color: rgba(65, 166, 255, 0.72);
  background: linear-gradient(135deg, #0d87ef, #075196);
  box-shadow: 0 0 24px rgba(18, 125, 219, 0.34), inset 0 1px rgba(255, 255, 255, 0.18);
}

.nav-item:hover,
.nav-item:focus-visible {
  color: #fff;
  border-color: rgba(91, 201, 255, 0.9);
  background: linear-gradient(135deg, #18a9ff, #0f77d7);
  box-shadow: 0 0 0 1px rgba(69, 200, 255, 0.34), 0 0 18px rgba(24, 169, 255, 0.24), inset 0 1px rgba(255, 255, 255, 0.22);
  outline: 0;
}

.nav-item b {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef2b27;
  font-size: 12px;
}

.collapse-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: auto;
  padding: 10px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(9, 23, 35, 0.62);
}

.collapse-button svg {
  width: 20px;
  height: 20px;
}

.main-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
}

.topbar {
  display: grid;
  grid-template-columns: 220px minmax(620px, 1fr) 230px;
  align-items: center;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 16, 26, 0.48);
}

.header-title {
  padding: 0 18px;
}

.header-title p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.header-title h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  height: 100%;
}

.summary-strip article {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 0 7px;
  border-left: 1px solid var(--line);
}

.summary-strip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.summary-strip strong {
  display: block;
  margin-top: 5px;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 500;
}

.summary-strip b {
  font-size: 19px;
}

.usage-article strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-bar {
  width: 64px;
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
}

.mini-bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), #6bed4b);
}

.user-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 8px;
  border-left: 1px solid var(--line);
}

.user-tools time {
  white-space: nowrap;
  color: var(--text);
  font-size: 12px;
}

.icon-button,
.profile-button,
.primary-action {
  color: var(--text);
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(38, 74, 104, 0.72), rgba(18, 41, 62, 0.78));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.07);
}

.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.icon-button span {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  font-size: 12px;
  line-height: 20px;
}

.profile-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 104px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.profile-button svg {
  width: 21px;
  height: 21px;
}

.content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 50px;
  padding: 8px 18px 6px;
}

.page-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-heading svg {
  width: 24px;
  height: 24px;
  color: #d6f2ff;
}

.page-heading h2 {
  margin: 0;
  font-size: 22px;
}

.page-heading p {
  display: none;
}

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

.primary-action {
  min-width: 104px;
  height: 32px;
  border-radius: 5px;
  background: linear-gradient(180deg, #0d74ce, #0b4f90);
  font-weight: 700;
}

.refresh-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.refresh-state svg {
  width: 18px;
  height: 18px;
}

.equipment-board {
  min-height: 0;
  padding: 0 18px 8px;
  overflow: hidden;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  height: 100%;
}

.meter-card {
  position: relative;
  display: grid;
  grid-template-rows: 30px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(21, 47, 70, 0.96), rgba(9, 26, 42, 0.94)),
    repeating-linear-gradient(90deg, transparent 0 42px, rgba(255, 255, 255, 0.018) 42px 43px);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05), var(--shadow);
}

.meter-card.detail-enabled {
  cursor: pointer;
}

.meter-card.detail-enabled:hover,
.meter-card.detail-enabled:focus-visible {
  border-color: rgba(81, 182, 255, 0.86);
  box-shadow: 0 0 0 2px rgba(27, 127, 232, 0.28), 0 18px 48px rgba(0, 0, 0, 0.34);
  outline: 0;
}

.meter-card.detail-enabled .card-title h4::after {
  content: "  詳細";
  color: #6fd1ff;
  font-size: 10px;
  font-weight: 900;
}

.meter-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(49, 193, 255, 0.07), transparent 28%, rgba(41, 211, 33, 0.05));
}

.card-title {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 0;
  padding: 4px 7px;
  border-bottom: 1px solid var(--line);
}

.card-title h4 {
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title span {
  display: none;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid rgba(90, 220, 95, 0.45);
  border-radius: 999px;
  color: #bfffc0;
  background: rgba(18, 119, 37, 0.18);
  font-size: 10px;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

.meter-layout {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  min-height: 0;
}

.gauge-panel,
.metric-panel,
.alarm-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.alarm-panel {
  border-right: 0;
}

.gauge-panel {
  grid-column: 1;
}

.metric-panel {
  grid-column: 2;
  border-right: 0;
}

.panel-label {
  margin: 4px 0 0;
  text-align: center;
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
}

.gauge-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  place-items: center;
}

.gauge {
  position: relative;
  width: 54px;
  height: 54px;
  margin-top: 0;
}

.gauge::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 58%, #1a3750 0 28%, transparent 29%),
    conic-gradient(from 270deg, var(--green-deep) 0deg, var(--green) 154deg, var(--red) 155deg 180deg, transparent 181deg 360deg);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.4), 0 0 14px rgba(27, 205, 46, 0.26);
}

.gauge::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 270deg, rgba(255, 255, 255, 0.95) 0 3deg, transparent 3deg 87deg, rgba(255, 255, 255, 0.52) 87deg 93deg, transparent 93deg 177deg, rgba(255, 255, 255, 0.72) 177deg 180deg, transparent 180deg);
  mask: radial-gradient(circle, transparent 0 21px, #000 22px 24px, transparent 25px);
}

.needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 24px;
  border-radius: 999px;
  background: #f4f7fb;
  transform: translate(-50%, -100%) rotate(var(--needle-angle, -90deg));
  transform-origin: 50% 100%;
  box-shadow: 0 0 7px rgba(255, 255, 255, 0.68);
  transition: transform 900ms ease;
}

.needle::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f1f4f7;
  transform: translateX(-50%);
}

.gauge-scale {
  position: absolute;
  inset: 0;
  color: var(--text);
  font-size: 8px;
}

.gauge-scale span {
  position: absolute;
  bottom: 1px;
}

.gauge-scale span:first-child {
  left: 3px;
}

.gauge-scale span:last-child {
  right: -4px;
}

.gauge-value {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
}

.metric-panel {
  display: grid;
  grid-template-rows: repeat(5, 15px) 18px;
  align-content: start;
  padding: 4px 3px 2px 5px;
}

.metric-row {
  display: grid;
  grid-template-columns: minmax(70px, 0.92fr) minmax(72px, 1fr);
  gap: 3px;
  min-height: 15px;
  color: var(--text);
  font-size: 11.7px;
  line-height: 1.03;
}

.metric-row span:first-child {
  color: #d5e7f3;
  font-weight: 700;
  white-space: nowrap;
}

.metric-row span:last-child {
  overflow: visible;
  text-align: left;
  text-overflow: clip;
  white-space: nowrap;
}

.metric-row[data-metric="voltage"],
.metric-row[data-metric="current"] {
  grid-template-columns: 38px minmax(92px, 1fr);
}

.metric-status-row {
  display: grid;
  grid-template-columns: minmax(70px, 0.92fr) minmax(72px, 1fr);
  align-items: center;
  min-height: 18px;
  padding-top: 1px;
}

.metric-status-row .status-pill {
  grid-column: 2;
  justify-self: center;
  align-self: center;
}

.status-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 18px;
  border-top: 1px solid var(--line);
  background: rgba(5, 14, 24, 0.55);
}

.status-footer p,
.status-line {
  margin: 0;
  color: var(--text);
  font-size: 12px;
}

.status-footer p {
  color: var(--muted);
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.dot.normal {
  background: var(--green);
}

.dot.warn {
  background: var(--gold);
}

.dot.danger {
  background: var(--red);
}

.dot.offline {
  background: #bbc3ca;
}

.dot.comm {
  background: #26c6ff;
}

.detail-body {
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 0%, rgba(27, 127, 232, 0.16), transparent 34%),
    linear-gradient(180deg, #020a12, #06121c);
}

.power-detail-page {
  --power-line: #183f62;
  --power-blue: #1b7fe8;
  --power-cyan: #45c8ff;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0;
  width: 100%;
  height: 100vh;
  min-height: 0;
  padding: 0 0 8px;
  overflow: hidden;
  color: #eaf7ff;
}

.trend-detail-header {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding: 14px 16px;
  border: 1px solid #d5e0e8;
  border-radius: 8px;
  background: #fff;
}

.power-detail-header {
  grid-template-columns: minmax(390px, 1fr) minmax(330px, 360px) 84px 110px 74px 90px 90px;
  grid-template-rows: auto auto;
  gap: 6px 8px;
  align-items: center;
  min-width: 0;
  padding: 7px 18px 8px;
  border: 0;
  border-bottom: 1px solid var(--power-line);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(2, 13, 22, 0.99), rgba(4, 18, 28, 0.99));
  box-shadow: inset 0 0 0 1px rgba(69, 200, 255, 0.05), 0 12px 28px rgba(0, 0, 0, 0.24);
}

.power-detail-header .detail-title-block {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(300px, max-content) minmax(0, 1fr);
  align-items: end;
  column-gap: 18px;
  min-width: 0;
}

.power-detail-header h1 {
  display: grid;
  grid-template-columns: 38px auto;
  grid-template-rows: auto auto auto;
  align-items: center;
  column-gap: 10px;
  margin: 0;
  color: #f2fbff;
  font-size: clamp(22px, 1.8vw, 30px);
  line-height: 1.15;
  min-width: 0;
}

.power-detail-header .title-main,
.power-detail-header .title-device {
  grid-column: 2;
  display: block;
  min-width: 0;
}

.power-detail-header .title-main {
  font-size: 1em;
}

.power-detail-header .title-device {
  margin-top: 2px;
  color: #d8f4ff;
  font-size: 0.72em;
  line-height: 1.18;
}

.power-detail-header h1::before {
  content: "";
  grid-row: 1 / 4;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(69, 200, 255, 0.72);
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(69, 200, 255, 0.88) 0 3px, transparent 4px),
    conic-gradient(from 200deg, transparent 0 18%, rgba(69, 200, 255, 0.9) 18% 46%, transparent 46% 100%),
    rgba(69, 200, 255, 0.06);
  box-shadow: 0 0 16px rgba(69, 200, 255, 0.2);
}

.power-detail-header h1::after {
  content: "POWER MONITORING CENTER";
  grid-column: 2;
  grid-row: 3;
  display: block;
  margin-top: 2px;
  color: #8fbdd7;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.power-detail-header p {
  margin: 0;
  color: #8fbdd7;
  font-weight: 800;
}

#powerTrendRangeText {
  display: none;
}

#powerTrendRefreshText {
  margin-top: 0;
  align-self: end;
  text-align: left;
  color: var(--power-cyan);
  font-size: 14px;
}

.trend-detail-actions {
  display: grid;
  grid-template-columns: 210px 210px 84px 110px;
  gap: 10px;
  min-width: 0;
  align-items: end;
}

.trend-mode-switch {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.power-detail-header .trend-mode-switch {
  grid-column: 2 / 5;
  grid-row: 1;
  grid-template-columns: repeat(3, minmax(0, 150px));
  justify-self: end;
  align-self: center;
  width: min(510px, 100%);
  gap: 6px;
}

.power-detail-actions {
  display: contents;
}

.trend-detail-actions label {
  display: grid;
  gap: 5px;
  color: #415064;
  font-size: 13px;
  font-weight: 900;
}

.power-detail-header label {
  display: grid;
  grid-template-columns: 72px minmax(240px, 270px);
  align-items: center;
  gap: 8px;
  color: #a8c7d1;
}

.power-start-field {
  grid-column: 1;
  grid-row: 2;
}

.power-end-field {
  grid-column: 2;
  grid-row: 2;
}

.trend-detail-actions input,
.trend-detail-actions select {
  height: 40px;
  padding: 0 10px;
  border: 1px solid #b9c8d3;
  border-radius: 6px;
  background: #fff;
  color: #172333;
}

.power-detail-header input {
  width: 270px;
  max-width: 100%;
  height: 34px;
  min-width: 0;
  padding: 0 42px 0 12px;
  border-color: #15526a;
  border-radius: 5px;
  background: #06131d;
  color: #e4fbff;
  font-size: 14px;
}

.power-detail-header input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  width: 22px;
  height: 22px;
  margin-left: 8px;
}

.trend-detail-actions button,
.detail-return-link {
  display: inline-grid;
  place-items: center;
  height: 40px;
  border: 1px solid #1b7fe8;
  border-radius: 6px;
  background: #1976df;
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.trend-detail-actions .trend-mode-switch button {
  height: 36px;
  border-color: #176176;
  background: linear-gradient(180deg, #061d2b, #04111d);
  color: #e4fbff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.power-detail-header .trend-mode-switch button {
  height: 32px;
  padding: 0 10px;
  font-size: 14px;
}

.trend-detail-actions .trend-mode-switch button.active,
.trend-detail-actions button:not(.secondary):not(:disabled) {
  border-color: var(--power-cyan);
  background: linear-gradient(180deg, #45c8ff, #0f77d7);
  color: #fff;
}

.trend-detail-actions button.secondary,
.detail-return-link.secondary {
  border-color: #17495d;
  background: #071927;
  color: #d0edf4;
}

#loadPowerTrendDetail {
  grid-column: 3;
  grid-row: 2;
  align-self: center;
  height: 34px;
}

.detail-return-link {
  grid-column: 4;
  grid-row: 2;
  align-self: center;
  height: 34px;
}

.power-report-label {
  grid-column: 5;
  grid-row: 2;
  align-self: center;
  justify-self: end;
  color: #a8c7d1;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.report-export-button {
  align-self: center;
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

#exportPowerTrendExcel {
  grid-column: 6;
  grid-row: 2;
}

#exportPowerTrendImage {
  grid-column: 7;
  grid-row: 2;
}

.trend-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.power-detail-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 5px 18px;
  border-bottom: 1px solid rgba(24, 63, 98, 0.72);
  background: rgba(2, 12, 20, 0.54);
}

.trend-detail-stats article {
  display: grid;
  align-content: center;
  gap: 5px;
  min-height: 78px;
  padding: 12px 16px;
  border: 1px solid #d5e0e8;
  border-radius: 8px;
  background: linear-gradient(180deg, #141f2a, #07121b);
  color: #d8e9f5;
}

.power-detail-stats article {
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  min-height: 44px;
  gap: 0 10px;
  padding: 6px 12px;
  border-color: #15506a;
  border-radius: 7px;
  background:
    radial-gradient(circle at 16% 50%, rgba(69, 200, 255, 0.12), transparent 28%),
    linear-gradient(180deg, #071a25, #05111d);
  box-shadow: inset 0 0 0 1px rgba(69, 200, 255, 0.03);
}

.power-detail-stats article::before {
  content: "";
  grid-row: 1 / 3;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(69, 200, 255, 0.42);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, rgba(69, 200, 255, 0.2) 0 36%, transparent 37%),
    rgba(69, 200, 255, 0.06);
  box-shadow: 0 0 16px rgba(69, 200, 255, 0.16);
}

.trend-detail-stats span {
  color: #a7c6d0;
  font-size: 14px;
  font-weight: 800;
}

.power-detail-stats span,
.power-detail-stats strong {
  grid-column: 2;
}

.power-detail-stats span {
  font-size: 13px;
}

.trend-detail-stats strong {
  color: var(--power-cyan);
  font-size: 27px;
  line-height: 1.1;
  font-weight: 900;
}

.power-detail-stats strong {
  font-size: clamp(18px, 2vw, 22px);
  white-space: nowrap;
}

.trend-detail-chart {
  position: relative;
  min-height: 0;
  padding: 14px;
  border: 1px solid #d5e0e8;
  border-radius: 8px;
  background: #fff;
}

.power-detail-chart {
  min-height: 0;
  margin: 0 18px;
  padding: 8px;
  border-color: rgba(69, 243, 255, 0.72);
  border-radius: 8px;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(69, 243, 255, 0.18), 0 0 22px rgba(69, 243, 255, 0.12);
}

.trend-detail-chart canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

@media (min-width: 2200px) and (min-height: 1200px) {
  .power-detail-page {
    --large-detail-width: min(calc(100% - 24px), 2600px);
    padding: 4px 0 10px;
  }

  .power-detail-header,
  .power-detail-stats,
  .power-detail-chart {
    width: var(--large-detail-width);
    justify-self: center;
  }

  .power-detail-header {
    grid-template-columns: minmax(620px, 1fr) minmax(340px, 380px) 90px 112px 78px 94px 94px;
    border: 1px solid rgba(24, 63, 98, 0.72);
    border-bottom: 1px solid var(--power-line);
    border-radius: 8px 8px 0 0;
  }

  .power-detail-stats {
    border-right: 1px solid rgba(24, 63, 98, 0.72);
    border-left: 1px solid rgba(24, 63, 98, 0.72);
  }

  .power-detail-chart {
    align-self: start;
    height: min(calc(100vh - 240px), 1420px);
  }
}

@media (max-width: 1280px) {
  body {
    min-width: 1180px;
  }

  .app-shell {
    grid-template-columns: 210px minmax(970px, 1fr);
  }

  .topbar {
    grid-template-columns: 220px minmax(620px, 1fr) 230px;
  }

  .user-tools {
    grid-column: auto;
    justify-content: flex-end;
    min-height: auto;
    border-top: 0;
  }

  .summary-strip {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .power-detail-header {
    grid-template-columns: minmax(310px, 1fr) minmax(286px, 310px) 74px 96px 58px 76px 76px;
    grid-template-rows: auto auto;
    gap: 5px 8px;
    padding: 4px 6px 7px;
  }

  .power-detail-header .detail-title-block {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-columns: minmax(280px, max-content) minmax(0, 1fr);
    column-gap: 12px;
  }

  .power-detail-actions {
    display: contents;
  }

  .power-detail-header h1 {
    font-size: 21px;
  }

  #powerTrendRefreshText {
    justify-self: start;
  }

  .power-detail-header .trend-mode-switch {
    grid-column: 2 / 5;
    grid-row: 1;
    grid-template-columns: repeat(3, minmax(0, 128px));
    justify-self: end;
    width: 408px;
    gap: 6px;
  }

  .power-detail-header .trend-mode-switch button {
    height: 30px;
    font-size: 13px;
  }

  .power-detail-header label {
    grid-template-columns: 66px minmax(210px, 230px);
    gap: 6px;
  }

  .power-detail-header input {
    width: 230px;
    padding-right: 38px;
    font-size: 12px;
  }

  .power-start-field {
    grid-column: 1;
    grid-row: 2;
  }

  .power-end-field {
    grid-column: 2;
    grid-row: 2;
  }

  #loadPowerTrendDetail {
    grid-column: 3;
    grid-row: 2;
  }

  .detail-return-link {
    grid-column: 4;
    grid-row: 2;
  }

  .power-report-label {
    grid-column: 5;
    grid-row: 2;
    font-size: 11px;
  }

  #exportPowerTrendExcel {
    grid-column: 6;
    grid-row: 2;
  }

  #exportPowerTrendImage {
    grid-column: 7;
    grid-row: 2;
  }

  .report-export-button {
    padding: 0 6px;
    font-size: 12px;
  }

  .power-detail-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 4px 6px;
  }

  .power-detail-chart {
    margin: 0 6px;
  }
}

@media (max-width: 760px) {
  body {
    min-width: 0;
    overflow: visible;
  }

  .app-shell {
    display: block;
    width: 100%;
    height: auto;
  }

  .sidebar {
    min-height: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .system-mark {
    min-height: 46px;
    margin-bottom: 12px;
  }

  .system-mark strong {
    font-size: 20px;
  }

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

  .nav-item {
    grid-template-columns: 28px 1fr auto;
    min-height: 52px;
    padding: 0 10px;
  }

  .nav-item svg {
    width: 23px;
    height: 23px;
  }

  .nav-item span {
    font-size: 15px;
  }

  .collapse-button {
    display: none;
  }

  .main-panel {
    display: block;
  }

  .topbar {
    display: block;
  }

  .header-title {
    padding: 16px;
  }

  .header-title h1 {
    font-size: 24px;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--line);
  }

  .summary-strip article {
    min-height: 82px;
    padding: 0 14px;
    border-top: 1px solid var(--line);
  }

  .summary-strip strong,
  .summary-strip b {
    font-size: 19px;
  }

  .user-tools {
    justify-content: flex-start;
    min-height: 58px;
    padding: 8px 16px;
    border-left: 0;
  }

  .content-head {
    flex-direction: column;
    align-items: stretch;
    padding: 18px 16px 12px;
  }

  .toolbar {
    justify-content: space-between;
  }

  .equipment-board {
    overflow: visible;
    padding: 0 16px 18px;
  }

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

  .meter-layout {
    grid-template-columns: 1fr;
  }

  .gauge-panel,
  .metric-panel,
  .alarm-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .alarm-panel {
    border-bottom: 0;
  }

  .status-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
  }

  .detail-body {
    min-width: 0;
  }

  .power-detail-header {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 10px;
    padding: 12px 14px;
  }

  .power-detail-header .detail-title-block,
  .power-detail-actions {
    display: grid;
  }

  .power-detail-header h1,
  #powerTrendRefreshText,
  .power-detail-header .trend-mode-switch,
  .power-start-field,
  .power-end-field,
  #loadPowerTrendDetail,
  .detail-return-link,
  .power-report-label,
  #exportPowerTrendExcel,
  #exportPowerTrendImage {
    grid-column: auto;
    grid-row: auto;
  }

  .power-detail-actions,
  .power-detail-header .trend-mode-switch,
  .power-detail-stats {
    grid-template-columns: 1fr;
  }

  .power-detail-chart {
    margin: 0 14px;
  }
}

/* Current project overrides: homepage pages, analysis pages, and stronger gauge warning band. */
.hidden {
  display: none !important;
}

.main-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.page-view {
  min-height: 0;
}

.page-view.active {
  display: grid;
}

.page-view[data-page-view="overview"] {
  grid-template-rows: auto minmax(0, 1fr);
}

.gauge::before {
  background:
    radial-gradient(circle at 50% 58%, #1a3750 0 28%, transparent 29%),
    conic-gradient(from 270deg, var(--green-deep) 0deg, var(--green) 150deg, #ffb11f 151deg 163deg, var(--red) 164deg 180deg, transparent 181deg 360deg);
}

.meter-card.detail-enabled .card-title h4::after {
  content: "";
}

.alarm-panel .panel-label {
  align-self: center;
  color: #9ff0b4;
}

.analysis-page {
  grid-template-rows: auto auto minmax(0, 1fr) minmax(92px, 118px) auto;
  gap: 8px;
  padding: 10px 18px 8px;
  overflow: hidden;
}

.analysis-head {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(0, auto);
  gap: 14px;
  align-items: center;
  min-height: 74px;
  padding: 10px 12px;
  border: 1px solid rgba(69, 200, 255, 0.26);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(9, 28, 42, 0.92), rgba(5, 18, 30, 0.96));
}

.analysis-head h2 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.1;
}

.analysis-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.analysis-actions {
  display: grid;
  grid-template-columns: auto 150px 150px 118px 84px;
  gap: 8px;
  align-items: end;
}

.analysis-head.cost-analysis-head {
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 10px;
  min-height: 0;
}

.cost-analysis-head > div:first-child {
  min-width: 0;
}

.cost-analysis-head #costRangeText {
  overflow-wrap: anywhere;
}

.cost-actions {
  width: 100%;
  max-width: none;
  grid-template-columns: minmax(178px, 0.82fr) minmax(178px, 0.82fr) minmax(190px, 1fr) minmax(190px, 1fr) 96px;
  grid-template-areas:
    "mode mode start end query"
    "peak peak off off query";
  align-items: stretch;
}

.cost-actions .analysis-mode-switch {
  grid-area: mode;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cost-start-field {
  grid-area: start;
}

.cost-end-field {
  grid-area: end;
}

.tou-rate-group {
  display: grid;
  grid-template-columns: 48px minmax(98px, 1fr) minmax(98px, 1fr) minmax(82px, 0.9fr);
  gap: 6px;
  align-items: end;
  padding: 6px;
  border: 1px solid rgba(69, 200, 255, 0.18);
  border-radius: 6px;
  background: rgba(4, 18, 28, 0.72);
}

.tou-rate-group[data-rate-period="peak"] {
  grid-area: peak;
}

.tou-rate-group[data-rate-period="off-peak"] {
  grid-area: off;
}

.tou-rate-title {
  align-self: center;
  color: #e4fbff;
  font-size: 13px;
  font-weight: 900;
}

.tou-rate-group label {
  gap: 4px;
}

.tou-rate-group input {
  height: 30px;
  padding: 0 7px;
  font-size: 12px;
  min-width: 0;
}

.cost-query-button {
  grid-area: query;
  align-self: stretch;
  height: 100%;
  min-height: 72px;
}

.report-actions {
  grid-template-columns: 150px 150px 96px;
}

.analysis-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, 150px);
  gap: 6px;
}

.analysis-actions label {
  display: grid;
  gap: 5px;
  color: #a8c7d1;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.analysis-actions input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #15526a;
  border-radius: 5px;
  background: #06131d;
  color: #e4fbff;
  font-size: 14px;
  font-weight: 800;
}

.analysis-actions button,
.analysis-mode-switch button {
  height: 34px;
  border: 1px solid #176176;
  border-radius: 6px;
  color: #e4fbff;
  background: linear-gradient(180deg, #061d2b, #04111d);
  font-weight: 900;
  cursor: pointer;
}

.analysis-actions > button,
.analysis-mode-switch button.active {
  border-color: #45c8ff;
  background: linear-gradient(180deg, #45c8ff, #0f77d7);
  color: #fff;
}

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

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

.report-page {
  min-height: 0;
  padding: 12px 18px 8px;
  overflow: hidden;
  color: #172333;
  background: #edf4f8;
}

.report-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  height: 100%;
  padding: 16px;
  overflow: auto;
  border: 1px solid #c7d5df;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 54px rgba(20, 36, 50, 0.16);
}

.report-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.report-panel h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
}

.report-panel button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #1b7fe8;
  border-radius: 6px;
  background: #1976df;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.report-panel button.secondary {
  border-color: #b9c8d3;
  background: #fff;
  color: #172333;
}

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

.auto-report-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid #d8e2ea;
  border-radius: 8px;
  background: #f8fbfd;
}

.auto-report-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.auto-report-card h3,
.manual-report-section h3 {
  margin: 0;
  color: #172333;
  font-size: 18px;
}

.auto-report-card p {
  margin: 0;
  color: #5a6d80;
  font-size: 13px;
  font-weight: 800;
}

.auto-report-card label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #34485c;
  font-size: 13px;
  font-weight: 900;
}

.auto-report-card header label {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.auto-report-card input[type="time"],
.auto-report-card input[type="text"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #b9c8d3;
  border-radius: 6px;
  background: #fff;
  color: #172333;
  font-weight: 800;
}

.folder-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 8px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.folder-picker-row button {
  min-width: 76px;
  padding: 0 10px;
  white-space: nowrap;
}

.auto-report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.auto-report-actions-split {
  justify-content: space-between;
}

.auto-report-status {
  min-height: 38px;
  padding: 8px;
  border-radius: 6px;
  background: #edf4f8;
  color: #26384a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.auto-report-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #d8e2ea;
  border-radius: 8px;
  background: #fff;
}

.auto-report-toolbar span {
  color: #50677d;
  font-weight: 800;
}

.manual-report-section {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  padding-top: 8px;
}

.report-controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.report-controls label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.report-controls input {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #b9c8d3;
  border-radius: 6px;
  background: #fff;
  color: #172333;
  font-weight: 800;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.report-summary article {
  padding: 12px;
  border: 1px solid #d9e3eb;
  border-radius: 7px;
  background: #f8fbfd;
}

.report-summary span {
  display: block;
  color: #667789;
  font-size: 13px;
}

.report-summary strong {
  display: block;
  margin-top: 4px;
  color: #111d2a;
  font-size: 22px;
  white-space: nowrap;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.report-table th,
.report-table td {
  padding: 9px 10px;
  border: 1px solid #dce5ec;
  text-align: right;
  white-space: nowrap;
}

.report-table th:first-child,
.report-table td:first-child {
  text-align: left;
}

.report-table th {
  position: sticky;
  top: 0;
  background: #f3f7fa;
}

.analysis-stats article {
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  min-height: 68px;
  gap: 0 10px;
  padding: 8px 12px;
  border: 1px solid #15506a;
  border-radius: 8px;
  background:
    radial-gradient(circle at 16% 50%, rgba(69, 200, 255, 0.12), transparent 28%),
    linear-gradient(180deg, #071a25, #05111d);
}

.analysis-stats article::before {
  content: "";
  grid-row: 1 / 3;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(69, 200, 255, 0.42);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, rgba(69, 200, 255, 0.2) 0 36%, transparent 37%),
    rgba(69, 200, 255, 0.06);
}

.analysis-stats span,
.analysis-stats strong {
  grid-column: 2;
}

.analysis-stats span {
  color: #a7c6d0;
  font-size: 13px;
  font-weight: 800;
}

.analysis-stats strong {
  color: #45c8ff;
  font-size: clamp(20px, 2.1vw, 30px);
  line-height: 1.05;
  white-space: nowrap;
}

.analysis-chart {
  min-height: 0;
  padding: 8px;
  border: 1px solid rgba(69, 243, 255, 0.72);
  border-radius: 8px;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(69, 243, 255, 0.18), 0 0 22px rgba(69, 243, 255, 0.12);
}

.analysis-chart canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.analysis-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(69, 200, 255, 0.26);
  border-radius: 8px;
  background: rgba(4, 16, 27, 0.76);
}

.analysis-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.analysis-table-wrap th,
.analysis-table-wrap td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(160, 194, 218, 0.14);
  text-align: right;
  white-space: nowrap;
}

.analysis-table-wrap th:first-child,
.analysis-table-wrap td:first-child {
  text-align: left;
}

.analysis-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #dff7ff;
  background: #082033;
}

.analysis-message {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.settings-page {
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  padding: 10px 18px 8px;
  overflow: hidden;
  color: #172333;
  background: #f4f8fb;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 8px 0 10px;
  border-bottom: 1px solid #cdd9e4;
}

.settings-head h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
}

.settings-head p {
  margin: 8px 0 0;
  color: #50637a;
  font-size: 14px;
  font-weight: 800;
}

.settings-head button,
.settings-form button,
.settings-table-wrap button {
  border: 1px solid #1b7fe8;
  border-radius: 6px;
  background: #1976df;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.settings-head button {
  min-width: 86px;
  height: 42px;
}

.settings-tabs,
.settings-subtabs {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.settings-tabs button,
.settings-subtabs button {
  min-width: 118px;
  height: 38px;
  padding: 0 20px;
  border: 1px solid #b8c8d8;
  border-radius: 6px;
  color: #172333;
  background: #fff;
  font-weight: 900;
}

.settings-tabs button.active,
.settings-subtabs button.active {
  color: #fff;
  border-color: #083352;
  background: #082d47;
}

.settings-tabs button:disabled {
  color: #fff;
  border-color: #1b7fe8;
  background: #1f7fde;
  opacity: 0.95;
}

.settings-panel,
.settings-form,
.settings-table-wrap {
  border: 1px solid #cbd9e6;
  border-radius: 8px;
  background: #fff;
}

.settings-panel {
  padding: 14px 16px;
}

.settings-panel h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.settings-panel p {
  margin: 0;
  color: #52657d;
  font-size: 15px;
  font-weight: 800;
}

.settings-form {
  display: grid;
  grid-template-columns: 138px 108px minmax(142px, 1fr) minmax(142px, 1fr) 106px 106px 104px 104px;
  gap: 10px;
  align-items: end;
  padding: 12px 16px;
}

.settings-form label {
  display: grid;
  gap: 7px;
  color: #32465d;
  font-size: 13px;
  font-weight: 900;
}

.settings-form input,
.settings-form select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #b8c8d8;
  border-radius: 6px;
  background: #fff;
  color: #172333;
  font-size: 15px;
  font-weight: 800;
}

.settings-form input:disabled {
  color: #52657d;
  background: #eaf1f7;
}

.settings-form button {
  height: 40px;
  font-size: 16px;
}

.settings-table-wrap {
  min-height: 0;
  overflow: auto;
}

.settings-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.settings-table-wrap th,
.settings-table-wrap td {
  padding: 12px 14px;
  border-bottom: 1px solid #dfebf4;
  text-align: left;
  white-space: nowrap;
}

.settings-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #172333;
  background: #eaf3fa;
  font-size: 14px;
}

.settings-table-wrap td:nth-child(4),
.settings-table-wrap td:nth-child(5),
.settings-table-wrap th:nth-child(4),
.settings-table-wrap th:nth-child(5) {
  text-align: right;
}

.settings-table-wrap button {
  height: 34px;
  min-width: 70px;
  background: #fff;
  color: #0f65b8;
}

@media (max-width: 1280px) {
  .analysis-page {
    padding: 8px 10px;
    gap: 6px;
  }

  .analysis-head {
    grid-template-columns: 210px minmax(0, 1fr);
    min-height: 68px;
    padding: 8px 10px;
  }

  .analysis-head h2 {
    font-size: 20px;
  }

  .analysis-actions {
    grid-template-columns: auto 132px 132px 104px 72px;
    gap: 6px;
  }

  .cost-actions {
    grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) 76px;
    grid-template-areas:
      "mode mode query"
      "start end query"
      "peak peak query"
      "off off query";
    max-width: none;
  }

  .analysis-mode-switch {
    grid-template-columns: repeat(2, 128px);
  }

  .cost-actions .analysis-mode-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tou-rate-group {
    grid-template-columns: 42px minmax(92px, 1fr) minmax(92px, 1fr) minmax(78px, 0.9fr);
    gap: 5px;
    padding: 5px;
  }

  .cost-query-button {
    min-height: 126px;
  }

  .analysis-actions input,
  .analysis-actions button,
  .analysis-mode-switch button {
    height: 30px;
    font-size: 12px;
  }

  .analysis-stats article {
    min-height: 58px;
  }

  .analysis-stats strong {
    font-size: 21px;
  }

  .settings-page {
    padding: 8px 10px;
    gap: 6px;
  }

  .settings-head {
    min-height: 52px;
    padding: 5px 0 8px;
  }

  .settings-head h2 {
    font-size: 22px;
  }

  .settings-tabs,
  .settings-subtabs {
    min-height: 36px;
  }

  .settings-tabs button,
  .settings-subtabs button {
    min-width: 104px;
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
  }

  .settings-panel {
    padding: 10px 12px;
  }

  .settings-panel h3 {
    font-size: 19px;
  }

  .settings-panel p {
    font-size: 13px;
  }

  .settings-form {
    grid-template-columns: 124px 92px 132px 132px 94px 94px 94px 92px;
    gap: 8px;
    padding: 10px 12px;
  }

  .settings-form input,
  .settings-form select,
  .settings-form button {
    height: 34px;
    font-size: 13px;
  }

  .settings-table-wrap table {
    font-size: 13px;
  }

  .settings-table-wrap th,
  .settings-table-wrap td {
    padding: 8px 10px;
  }
}

@media (max-width: 900px) {
  .cost-actions {
    grid-template-columns: 1fr;
    grid-template-areas:
      "mode"
      "start"
      "end"
      "peak"
      "off"
      "query";
  }

  .cost-query-button {
    min-height: 36px;
  }

  .tou-rate-group {
    grid-template-columns: 48px repeat(3, minmax(78px, 1fr));
  }
}
