:root {
  color-scheme: light;
  --canvas: #f4f8fb;
  --surface: #ffffff;
  --surface-soft: #f8fbfc;
  --ink: #12304a;
  --ink-strong: #0c2438;
  --muted: #718398;
  --muted-light: #94a5b5;
  --line: #dde7ef;
  --line-strong: #cbdbe6;
  --teal: #087f8c;
  --teal-dark: #076a75;
  --teal-soft: #e7f6f6;
  --green: #1f9d6b;
  --green-soft: #e9f7f0;
  --amber: #bd7c20;
  --amber-soft: #fff5df;
  --red: #c45c5c;
  --red-soft: #fff0f0;
  --shadow: 0 12px 35px rgba(18, 48, 74, 0.06);
  --shadow-small: 0 5px 16px rgba(18, 48, 74, 0.08);
  --radius: 16px;
  --font: Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 75% -15%, rgba(218, 242, 244, 0.7), transparent 34rem),
    var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(8, 127, 140, 0.24);
  outline-offset: 2px;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 34px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  border-bottom: 1px solid rgba(203, 219, 230, 0.68);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink-strong);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff;
  background: var(--teal);
  border-radius: 11px;
  box-shadow: 0 6px 14px rgba(8, 127, 140, 0.19);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted-light);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--muted-light);
  border-radius: 50%;
}

.status-dot.is-online {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(31, 157, 107, 0.11);
}

.status-dot.is-loading {
  background: var(--amber);
  animation: pulse 1.2s ease-in-out infinite;
}

.status-dot.is-offline {
  background: var(--red);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.icon-button:hover {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: #b9e1e2;
}

.icon-button:active {
  transform: rotate(-20deg);
}

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

.page-content {
  padding-top: 42px;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.page-intro h1 {
  margin: 0;
  color: var(--ink-strong);
  font-size: clamp(30px, 3.7vw, 45px);
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.page-intro p {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.intro-note {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(221, 231, 239, 0.8);
  border-radius: 10px;
  font-size: 11px;
  white-space: nowrap;
}

.intro-note-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 50%;
}

.intro-note-icon svg {
  width: 14px;
  height: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(285px, 0.37fr) minmax(0, 0.63fr);
  align-items: stretch;
  gap: 18px;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(210, 225, 234, 0.88);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search-panel {
  display: flex;
  flex-direction: column;
  min-height: 640px;
  padding: 25px 23px 18px;
}

.panel-heading,
.result-heading,
.overview-heading,
.section-heading-row,
.field-label-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--teal);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.17em;
}

.panel-heading h2,
.result-heading h2,
.empty-state h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 20px;
  font-weight: 730;
  letter-spacing: -0.025em;
}

.panel-index {
  color: #9bb1bf;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.panel-description {
  max-width: 230px;
  margin: 9px 0 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.select-stack {
  display: grid;
  gap: 13px;
}

.field,
.room-search {
  display: grid;
  gap: 7px;
}

.field > span,
.field-label-row label {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.field select,
.search-input-wrap {
  width: 100%;
  height: 43px;
  color: var(--ink);
  background-color: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field select {
  padding: 0 34px 0 12px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #8ba1af 50%), linear-gradient(135deg, #8ba1af 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  font-size: 12px;
}

.field select:hover:not(:disabled),
.field select:focus,
.search-input-wrap:focus-within {
  background-color: #fff;
  border-color: #9ad1d3;
  box-shadow: 0 0 0 3px rgba(8, 127, 140, 0.08);
}

.field select:disabled,
.search-input-wrap:has(input:disabled) {
  color: #9eafbb;
  cursor: not-allowed;
  opacity: 0.82;
}

.room-search {
  margin-top: 25px;
}

.field-meta {
  color: var(--muted-light);
  font-size: 10px;
  font-weight: 600;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.search-input-wrap > svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--muted-light);
}

.search-input-wrap input {
  min-width: 0;
  flex: 1;
  height: 100%;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 12px;
}

.search-input-wrap input::placeholder {
  color: #9eafbb;
}

.clear-button {
  width: 22px;
  height: 22px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 19px;
  line-height: 1;
}

.clear-button:hover {
  color: var(--teal);
  background: var(--teal-soft);
}

.room-list-wrap {
  min-height: 0;
  flex: 1;
  margin-top: 17px;
  overflow: hidden;
}

.room-list {
  display: grid;
  align-content: start;
  gap: 5px;
  max-height: 320px;
  padding-right: 3px;
  overflow-y: auto;
  scrollbar-color: #c5d9e0 transparent;
  scrollbar-width: thin;
}

.room-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 41px;
  padding: 0 11px 0 13px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.room-option:hover {
  background: var(--surface-soft);
  border-color: var(--line);
  transform: translateX(2px);
}

.room-option.is-selected {
  color: var(--teal-dark);
  background: var(--teal-soft);
  border-color: #c7e8e9;
}

.room-option-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-option-id {
  margin-left: 10px;
  color: var(--muted-light);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.room-option.is-selected .room-option-id {
  color: #56a4aa;
}

.list-placeholder,
.list-empty {
  display: grid;
  place-items: center;
  min-height: 154px;
  padding: 22px;
  color: var(--muted-light);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 11px;
}

.list-placeholder p,
.list-empty p {
  margin: 10px 0 0;
  font-size: 11px;
}

.placeholder-icon,
.table-empty-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #8db5bd;
  background: var(--teal-soft);
  border-radius: 11px;
}

.placeholder-icon svg,
.table-empty-icon svg {
  width: 21px;
  height: 21px;
}

.panel-footnote {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 19px;
  color: var(--muted-light);
  font-size: 10px;
}

.footnote-dot {
  width: 5px;
  height: 5px;
  background: #8db5bd;
  border-radius: 50%;
}

.result-panel {
  min-height: 640px;
  padding: 30px 30px 28px;
}

.error-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 20px;
  padding: 11px 13px;
  color: #974949;
  background: var(--red-soft);
  border: 1px solid #f0d0d0;
  border-radius: 10px;
  font-size: 12px;
}

.error-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: #fff;
  background: var(--red);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.error-banner > span:nth-child(2) {
  flex: 1;
  line-height: 1.5;
}

.error-banner button {
  padding: 4px 8px;
  color: #974949;
  background: transparent;
  border: 1px solid #e7baba;
  border-radius: 6px;
  font-size: 11px;
}

.error-banner button:hover {
  background: #fff;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 574px;
  padding: 40px 20px;
  text-align: center;
}

.empty-illustration {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin-bottom: 22px;
}

.empty-illustration svg {
  width: 96px;
  height: 96px;
}

.empty-state h2 {
  font-size: 21px;
}

.empty-state p {
  max-width: 300px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.result-heading {
  align-items: flex-start;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--line);
}

.room-title-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.room-id {
  color: var(--muted-light);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.selected-location {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.meter-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.meter-status.is-online {
  color: #267b5a;
  background: var(--green-soft);
  border-color: #c7ead9;
}

.meter-status.is-warning {
  color: #9e681c;
  background: var(--amber-soft);
  border-color: #f1dcaa;
}

.meter-status.is-offline {
  color: #9c4c4c;
  background: var(--red-soft);
  border-color: #efd0d0;
}

.meter-overview {
  padding: 24px 0 28px;
  border-bottom: 1px solid var(--line);
}

.overview-heading h3,
.section-heading-row h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 15px;
  font-weight: 750;
}

.overview-heading p,
.section-heading-row p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.meter-number {
  color: var(--muted);
  font-size: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr;
  gap: 10px;
  margin-top: 20px;
}

.metric {
  position: relative;
  min-height: 116px;
  padding: 16px 17px;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.metric::after {
  position: absolute;
  right: -16px;
  bottom: -29px;
  width: 76px;
  height: 76px;
  content: "";
  border: 1px solid rgba(8, 127, 140, 0.12);
  border-radius: 50%;
}

.metric-primary {
  background: var(--teal-soft);
  border-color: #c6e6e7;
}

.metric-warning {
  background: var(--amber-soft);
  border-color: #f0dcae;
}

.metric-warning::after {
  border-color: rgba(189, 124, 32, 0.15);
}

.metric-label,
.metric-caption {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.metric strong {
  display: inline-block;
  margin-top: 13px;
  color: var(--ink-strong);
  font-size: 29px;
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-primary strong {
  color: var(--teal-dark);
}

.metric-warning strong {
  color: var(--amber);
}

.metric-unit {
  display: inline-block;
  margin-left: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.metric-caption {
  margin-top: 13px;
  color: var(--muted-light);
  font-size: 10px;
  font-weight: 500;
}

.metric-meta strong {
  display: block;
  max-width: 100%;
  margin-top: 14px;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-section {
  padding-top: 25px;
}

.record-count {
  padding-top: 2px;
  color: var(--muted-light);
  font-size: 10px;
  font-weight: 650;
}

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 11px;
}

th {
  padding: 12px 13px;
  color: var(--muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 14px 13px;
  color: var(--ink);
  border-bottom: 1px solid #edf2f5;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

tbody tr:hover td {
  background: #fbfdfe;
}

.table-number {
  font-weight: 650;
}

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

.delivery-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.delivery-status::before {
  width: 5px;
  height: 5px;
  content: "";
  background: var(--muted-light);
  border-radius: 50%;
}

.delivery-status.is-success {
  color: var(--green);
}

.delivery-status.is-success::before {
  background: var(--green);
}

.delivery-status.is-pending {
  color: var(--amber);
}

.delivery-status.is-pending::before {
  background: var(--amber);
}

.table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 174px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 11px;
  font-size: 11px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 3px 0;
  color: var(--muted-light);
  font-size: 10px;
}

.footer-separator {
  display: inline-block;
  margin: 0 5px;
  color: #bfd0da;
}

.is-loading {
  animation: pulse 1.2s ease-in-out infinite;
}

[hidden] {
  display: none !important;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    padding-right: 24px;
    padding-left: 24px;
  }

  .workspace {
    grid-template-columns: minmax(260px, 0.34fr) minmax(0, 0.66fr);
  }

  .result-panel {
    padding-right: 23px;
    padding-left: 23px;
  }

  .metric {
    padding-right: 13px;
    padding-left: 13px;
  }
}

@media (max-width: 820px) {
  .page-content {
    padding-top: 30px;
  }

  .page-intro {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 22px;
  }

  .intro-note {
    white-space: normal;
  }

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

  .search-panel,
  .result-panel {
    min-height: auto;
  }

  .search-panel {
    padding-bottom: 21px;
  }

  .room-list {
    max-height: 260px;
  }

  .panel-footnote {
    margin-top: 17px;
  }

  .empty-state {
    min-height: 460px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 0 15px 20px;
  }

  .topbar {
    min-height: 66px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand small {
    font-size: 8px;
  }

  .connection-status {
    max-width: 92px;
    font-size: 10px;
    line-height: 1.35;
    text-align: right;
  }

  .page-intro h1 {
    font-size: 31px;
  }

  .page-intro p {
    font-size: 12px;
  }

  .search-panel,
  .result-panel {
    padding: 21px 16px 18px;
    border-radius: 13px;
  }

  .result-heading {
    gap: 10px;
  }

  .result-heading h2 {
    font-size: 18px;
  }

  .meter-status {
    padding: 6px 7px;
    font-size: 9px;
  }

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

  .metric-meta {
    grid-column: 1 / -1;
    min-height: 92px;
  }

  .metric-meta strong {
    margin-top: 12px;
  }

  .footer {
    flex-direction: column;
    gap: 6px;
    font-size: 9px;
  }
}

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