:root {
  color-scheme: light;
  --bg-a: #edf5f2;
  --bg-b: #f7f8fb;
  --bg-c: #f7f0e6;
  --surface: rgba(255, 255, 255, 0.66);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --surface-soft: rgba(255, 255, 255, 0.48);
  --ink: #102033;
  --muted: #657486;
  --line: rgba(124, 145, 166, 0.26);
  --green: #147f68;
  --green-dark: #0d5d4d;
  --blue: #316fd0;
  --amber: #a66521;
  --red: #be4545;
  --shadow: 0 18px 48px rgba(22, 35, 48, 0.14);
  --blur: blur(22px) saturate(1.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-a);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(237, 245, 242, 0.98) 0%, rgba(247, 248, 251, 0.96) 42%, rgba(247, 240, 230, 0.98) 100%),
    linear-gradient(90deg, rgba(49, 111, 208, 0.12), rgba(20, 127, 104, 0.08), rgba(166, 101, 33, 0.12));
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.is-hidden {
  display: none !important;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  padding: 24px;
}

.auth-card h1,
.glass-toolbar h1,
.panel h2,
.entry-modal h2 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

.auth-card h1 {
  margin-bottom: 18px;
  font-size: 32px;
}

.auth-mark,
.modal-icon,
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--blue));
  box-shadow: 0 14px 28px rgba(20, 127, 104, 0.24);
}

.auth-mark.warning {
  background: linear-gradient(135deg, var(--amber), var(--blue));
}

.auth-mark {
  margin-bottom: 14px;
}

.app-shell {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  min-height: 100vh;
}

.app-frame {
  position: relative;
}

.glass-rail,
.bottom-nav,
.glass-toolbar,
.liquid-panel,
.metric-card,
.entry-modal .modal-card,
.toast {
  border: 1px solid rgba(255, 255, 255, 0.64);
  background: var(--surface);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: var(--blur);
}

.glass-rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 104px;
  height: 100vh;
  padding: 16px 12px;
}

.brand-lockup {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin-bottom: 14px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
}

.rail-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: var(--muted);
  background: transparent;
}

.rail-button {
  flex-direction: column;
  gap: 6px;
  min-height: 66px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.rail-button:hover,
.rail-button.is-active {
  color: var(--green-dark);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 0 0 1px rgba(20, 127, 104, 0.1);
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.bottom-nav {
  display: none;
}

.content {
  width: min(1480px, 100%);
  padding: 24px 36px 42px;
}

.glass-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 78px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 8px;
}

.glass-toolbar h1 {
  font-size: 34px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.top-actions,
.panel-head,
.modal-actions,
.status-strip {
  display: flex;
  align-items: center;
}

.top-actions,
.modal-actions {
  gap: 10px;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 900;
  white-space: nowrap;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  box-shadow: 0 12px 24px rgba(20, 127, 104, 0.22);
}

.primary-button:hover {
  filter: brightness(0.96);
}

.ghost-button {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface-strong);
}

.ghost-button:hover,
.icon-button:hover {
  border-color: rgba(20, 127, 104, 0.28);
  background: #fff;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface-strong);
  outline: none;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(20, 127, 104, 0.22);
  outline-offset: 2px;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--green);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.status-strip {
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  backdrop-filter: var(--blur);
}

.status-pill.is-good {
  color: var(--green-dark);
  border-color: rgba(20, 127, 104, 0.26);
  background: rgba(226, 244, 238, 0.76);
}

.status-pill.is-warn {
  color: #75470b;
  border-color: rgba(166, 101, 33, 0.28);
  background: rgba(255, 242, 220, 0.78);
}

.section-view {
  display: none;
}

.section-view.is-visible {
  display: block;
}

.console-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.72fr);
  gap: 16px;
  margin-bottom: 16px;
}

.quick-entry-panel {
  min-height: 438px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.metric-card,
.panel {
  border-radius: 8px;
}

.panel,
.metric-card {
  padding: 18px;
}

.metric-card {
  min-height: 150px;
}

.electric-card {
  background:
    linear-gradient(135deg, rgba(20, 127, 104, 0.14), rgba(49, 111, 208, 0.08)),
    var(--surface);
}

.gas-card {
  background:
    linear-gradient(135deg, rgba(166, 101, 33, 0.16), rgba(49, 111, 208, 0.07)),
    var(--surface);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 900;
}

.metric-card strong {
  display: block;
  margin-top: 34px;
  font-size: 36px;
  line-height: 1;
  letter-spacing: 0;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}

.records-layout,
.forecast-layout,
.settings-layout {
  display: grid;
  gap: 16px;
}

.records-layout {
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.5fr);
}

.forecast-layout {
  grid-template-columns: minmax(0, 1.7fr) minmax(290px, 0.8fr);
}

.settings-layout {
  grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.2fr);
}

.location-panel {
  grid-column: 2;
}

.panel-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel h2,
.entry-modal h2 {
  font-size: 20px;
}

.chart-panel {
  position: relative;
  min-height: 438px;
}

canvas {
  display: block;
  width: 100%;
  height: 360px;
  min-height: 260px;
}

.empty-state {
  position: absolute;
  inset: 96px 18px 18px;
  display: none;
  place-items: center;
  border: 1px dashed rgba(101, 116, 134, 0.44);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  text-align: center;
  font-weight: 900;
}

.empty-state.is-visible {
  display: grid;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  min-width: 148px;
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.segmented button {
  min-width: 66px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.segmented button.is-selected {
  color: var(--green-dark);
  background: #fff;
  box-shadow: 0 4px 12px rgba(20, 40, 60, 0.08);
}

.insight-list,
.entry-form,
.settings-stack,
.location-actions {
  display: grid;
  gap: 14px;
}

.insight-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 66px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.insight-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: var(--green-dark);
  background: rgba(226, 244, 238, 0.9);
}

.insight-item strong {
  display: block;
  margin-bottom: 3px;
}

.insight-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.address-grid,
.coordinate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form-message.is-error {
  color: var(--red);
}

.table-panel {
  min-width: 0;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 740px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 900;
}

td {
  font-weight: 800;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--green-dark);
  background: rgba(226, 244, 238, 0.9);
  font-size: 12px;
  font-weight: 900;
}

.badge.gas {
  color: #6d410f;
  background: rgba(255, 239, 216, 0.92);
}

.table-action {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--red);
  background: var(--surface-strong);
}

.table-action:disabled {
  color: var(--muted);
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.46);
}

.forecast-total {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 16px;
  padding: 15px;
  border: 1px solid rgba(20, 127, 104, 0.24);
  border-radius: 8px;
  background: rgba(226, 244, 238, 0.76);
}

.forecast-total span,
.forecast-total small {
  color: var(--green-dark);
  font-weight: 900;
}

.forecast-total strong {
  font-size: 36px;
  line-height: 1;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(106px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.forecast-card {
  min-height: 178px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.forecast-card time,
.forecast-card span,
.forecast-card small {
  display: block;
}

.forecast-card time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.forecast-card .forecast-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 12px 0;
  border-radius: 8px;
  color: var(--blue);
  background: rgba(225, 237, 252, 0.9);
}

.forecast-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 24px;
}

.forecast-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.forecast-card small {
  margin-top: 10px;
  color: var(--amber);
  font-weight: 900;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.setting-row span {
  color: var(--muted);
  font-weight: 900;
}

.setting-row strong {
  max-width: 68%;
  text-align: right;
  overflow-wrap: anywhere;
}

.entry-modal {
  width: min(440px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.entry-modal::backdrop {
  background: rgba(16, 28, 38, 0.58);
  backdrop-filter: blur(5px);
}

.modal-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 24px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 44px));
  padding: 13px 15px;
  border-radius: 8px;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  font-weight: 900;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .console-grid,
  .records-layout,
  .forecast-layout,
  .settings-layout {
    grid-template-columns: 1fr 1fr;
  }

  .chart-panel,
  .table-panel,
  .forecast-main,
  .location-panel {
    grid-column: 1 / -1;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    padding-bottom: 84px;
  }

  .glass-rail {
    display: none;
  }

  .bottom-nav {
    position: fixed;
    z-index: 12;
    inset: auto 12px 12px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px;
    border-radius: 8px;
  }

  .bottom-nav .rail-button {
    min-height: 54px;
  }

  .content {
    padding: 14px 12px 28px;
  }

  .glass-toolbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .glass-toolbar h1 {
    font-size: 28px;
  }

  .top-actions,
  .top-actions .primary-button,
  .top-actions .ghost-button,
  .segmented,
  .quick-entry-panel .primary-button,
  .location-actions .primary-button,
  .location-actions .ghost-button {
    width: 100%;
  }

  .console-grid,
  .metric-grid,
  .records-layout,
  .forecast-layout,
  .settings-layout,
  .address-grid,
  .coordinate-grid {
    grid-template-columns: 1fr;
  }

  .forecast-grid {
    grid-template-columns: repeat(7, 132px);
  }

  .toast {
    right: 12px;
    bottom: 92px;
    max-width: calc(100vw - 24px);
  }
}

@media (max-width: 420px) {
  .auth-shell {
    padding: 14px;
  }

  .auth-card,
  .panel,
  .metric-card,
  .modal-card {
    padding: 16px;
  }

  .metric-card strong,
  .forecast-total strong {
    font-size: 30px;
  }
}
