:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #17201b;
  --muted: #66736d;
  --line: #ded8cc;
  --line-strong: #c8bdad;
  --accent: #0d6b57;
  --accent-dark: #094c3f;
  --accent-soft: #dcece4;
  --danger: #b42318;
  --danger-soft: #f8ded8;
  --shadow: 0 20px 60px rgb(42 35 25 / 10%);
  font-family: "LXGW WenKai Screen", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  box-shadow: 0 10px 24px rgb(13 107 87 / 18%);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.admin-user-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.admin-user-form button {
  align-self: end;
}

.mobile-app {
  background:
    linear-gradient(180deg, #eef5f1 0%, #f7faf8 48%, #eef3f8 100%);
}

.mobile-shell {
  margin: 0 auto;
  max-width: 520px;
  min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
}

.mobile-header {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mobile-header.compact {
  margin-bottom: 12px;
}

.mobile-header h1 {
  font-size: 21px;
  margin-bottom: 4px;
}

.mobile-header p {
  font-size: 12px;
}

.mobile-header-actions {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
  width: 78px;
}

.mobile-header-button {
  align-items: center;
  background: var(--surface-strong);
  border: 1px solid #d5ded9;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgb(28 40 36 / 7%);
  color: #24352f;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: center;
  min-height: 36px;
  padding: 0 8px;
  text-decoration: none;
  white-space: nowrap;
}

.mobile-header-button:hover:not(:disabled) {
  background: #f5faf7;
  border-color: #b8d1c7;
  box-shadow: 0 10px 24px rgb(13 107 87 / 12%);
  color: #0d6b57;
}

.mobile-icon-button {
  align-items: center;
  background: var(--surface-strong);
  border: 1px solid #d5ded9;
  border-radius: 50%;
  box-shadow: 0 8px 20px rgb(28 40 36 / 7%);
  color: #24352f;
  display: inline-flex;
  font-weight: 900;
  justify-content: center;
  min-height: 42px;
  padding: 0;
  width: 42px;
}

.mobile-icon-button:hover:not(:disabled) {
  background: #f5faf7;
  border-color: #b8d1c7;
  box-shadow: 0 10px 24px rgb(13 107 87 / 12%);
}

.mobile-app button,
.mobile-app .mobile-header-button {
  transition:
    background 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease;
}

.mobile-app button:hover:not(:disabled) {
  transform: none;
}

.mobile-app button:active:not(:disabled) {
  opacity: 0.82;
}

.mobile-power-card,
.mobile-settings-card,
.mobile-card {
  background: rgb(255 255 255 / 92%);
  border: 1px solid #d9e4df;
  border-radius: 8px;
  box-shadow: 0 18px 48px rgb(30 45 40 / 8%);
  margin-bottom: 12px;
  padding: 16px;
}

.hero-power {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 39vh;
  padding: 24px 18px 18px;
  text-align: center;
}

.mobile-power-ring {
  --power-level: 0%;
  align-items: center;
  background:
    radial-gradient(circle at center, #ffffff 0 57%, transparent 58%),
    conic-gradient(#0d6b57 0 var(--power-level), #dfe8e3 var(--power-level) 100%);
  border-radius: 50%;
  display: grid;
  height: clamp(184px, 56vw, 238px);
  place-items: center;
  transition: background 180ms ease;
  width: clamp(184px, 56vw, 238px);
}

.mobile-power-ring > div {
  display: grid;
  justify-items: center;
  max-width: 82%;
  min-width: 0;
}

.mobile-power-ring.is-low {
  background:
    radial-gradient(circle at center, #ffffff 0 57%, transparent 58%),
    conic-gradient(#b42318 0 var(--power-level), #f1d9d6 var(--power-level) 100%);
}

.mobile-power-card .mobile-power-value {
  align-items: flex-end;
  display: flex;
  gap: 4px;
  justify-content: center;
  line-height: 0.94;
  margin: 8px 0 9px;
  max-width: 100%;
  overflow-wrap: normal;
  white-space: nowrap;
}

#mobilePowerValue {
  color: var(--ink);
  display: inline-block;
  font-size: clamp(46px, 13vw, 66px);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

#mobilePowerUnit {
  color: var(--ink);
  display: inline-block;
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 900;
  line-height: 1;
  margin-bottom: 6px;
}

.power-size-wide #mobilePowerValue {
  font-size: clamp(36px, 10.5vw, 54px);
}

.power-size-compact #mobilePowerValue {
  font-size: clamp(30px, 9vw, 46px);
}

.mobile-power-value.low-power #mobilePowerValue,
.mobile-power-value.low-power #mobilePowerUnit {
  color: var(--danger);
}

.mobile-power-note {
  color: #5d6b65;
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.mobile-warning {
  background: var(--danger-soft);
  border: 1px solid #e7b7ae;
  border-radius: 8px;
  color: var(--danger);
  font-weight: 700;
  margin-top: 12px;
  padding: 9px 10px;
  width: 100%;
}

.mobile-status-pill {
  background: #edf4f1;
  border: 1px solid #cfe0d8;
  border-radius: 999px;
  color: #38554b;
  font-size: 13px;
  font-weight: 800;
  margin-top: 12px;
  padding: 8px 12px;
}

.mobile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.mobile-report-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 16px 14px;
}

.mobile-report-actions button {
  min-width: 0;
  padding-inline: 8px;
}

.mobile-report-panel {
  border-top: 1px solid #d8e2ef;
  padding: 0 16px 16px;
}

.mobile-feedback-overlay,
.mobile-overlay {
  --feedback-keyboard-inset: 0px;
  background: #ffffff;
  display: grid;
  inset: 0;
  overflow: hidden;
  padding: 0;
  position: fixed;
  touch-action: pan-y;
  z-index: 20;
}

.mobile-feedback-overlay[hidden],
.mobile-overlay[hidden] {
  display: none;
}

.mobile-feedback-sheet {
  background: #ffffff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: none;
  min-height: 0;
  overscroll-behavior: contain;
  overflow: hidden;
  padding: max(14px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  scroll-padding-bottom: calc(var(--feedback-keyboard-inset) + 120px);
  touch-action: pan-y;
  width: 100%;
}

.feedback-open {
  height: 100%;
  overflow: hidden;
}

.sheet-handle {
  background: #cfd9d4;
  border-radius: 999px;
  height: 4px;
  margin: 0 auto 12px;
  width: 44px;
}

.sheet-title-row {
  align-items: flex-start;
  background: #ffffff;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.sheet-title-row h2 {
  font-size: 21px;
  line-height: 1.2;
  margin: 0 0 8px;
}

.sheet-title-row p {
  font-size: 13px;
  line-height: 1.65;
}

.feedback-form {
  display: grid;
  gap: 13px;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: calc(var(--feedback-keyboard-inset) + 28px);
  scroll-padding-bottom: calc(var(--feedback-keyboard-inset) + 96px);
  touch-action: pan-y;
}

.feedback-type-group {
  border: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
}

.feedback-type-group legend {
  color: #3e4b44;
  font-size: 14px;
  font-weight: 800;
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.feedback-type-group label {
  color: #2a3d36;
  cursor: pointer;
  display: block;
  font-size: 13px;
  font-weight: 900;
}

.feedback-type-group input {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.feedback-type-group span {
  align-items: center;
  background: #f4f7f6;
  border: 1px solid #d8e3de;
  border-radius: 999px;
  display: flex;
  justify-content: center;
  min-height: 38px;
  padding: 0 10px;
}

.feedback-type-group input:checked + span {
  background: #e4f1ec;
  border-color: #0d6b57;
  color: #0d6b57;
}

textarea {
  width: 100%;
  min-height: 112px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--ink);
  line-height: 1.55;
  padding: 11px;
  resize: vertical;
  outline: none;
  scroll-margin-bottom: calc(var(--feedback-keyboard-inset) + 96px);
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(13 107 87 / 14%);
}

.feedback-form input {
  scroll-margin-bottom: calc(var(--feedback-keyboard-inset) + 96px);
}

.feedback-status {
  min-height: 20px;
  color: #38554b;
  font-size: 13px;
  font-weight: 800;
}

.report-panel-title {
  padding-inline: 0;
}

.chart {
  display: grid;
  gap: 14px;
  overflow-x: auto;
  padding-top: 4px;
}

.line-chart-wrap {
  min-width: max-content;
  padding: 3px 0 0;
}

.line-chart {
  display: block;
  height: 172px;
  min-width: 320px;
}

.line-chart-grid {
  stroke: #dce7e1;
  stroke-dasharray: 4 5;
  stroke-width: 1;
}

.line-chart-area {
  fill: rgb(13 107 87 / 10%);
}

.line-chart-line {
  fill: none;
  stroke: #0d6b57;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.line-chart-point {
  fill: #ffffff;
  stroke: #0d6b57;
  stroke-width: 2.5;
}

.line-chart-x-label,
.line-chart-y-label {
  fill: #64746d;
  font-size: 11px;
  font-weight: 800;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.report-metrics div {
  background: #f3f7f5;
  border: 1px solid #dce7e1;
  border-radius: 8px;
  min-width: 0;
  padding: 10px 9px;
}

.report-metrics dt {
  color: #64746d;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 5px;
}

.report-metrics dd {
  color: #15221d;
  font-size: 15px;
  font-weight: 900;
  margin: 0;
  overflow-wrap: anywhere;
}

.mobile-report-table-wrap {
  border: 1px solid #dce7e1;
  border-radius: 8px;
  overflow-x: auto;
}

.mobile-report-table {
  min-width: 560px;
}

.mobile-report-table th {
  background: #f3f7f5;
  color: #43554e;
  font-size: 12px;
  padding: 10px;
}

.mobile-report-table td {
  background: #ffffff;
  border-bottom: 1px solid #edf2ef;
  color: #23342e;
  font-size: 13px;
  padding: 11px 10px;
  white-space: nowrap;
}

.mobile-report-table td strong {
  color: #18251f;
  display: block;
  font-size: 14px;
}

.mobile-report-table td span:not(.status-badge) {
  color: #6a7872;
  display: block;
  font-size: 11px;
  margin-top: 3px;
}

.status-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: center;
  min-width: 64px;
  padding: 5px 8px;
}

.status-complete {
  background: #e5f3ed;
  color: #0d6b57;
}

.status-partial,
.status-insufficient {
  background: #f4efe2;
  color: #80631d;
}

.status-possible_recharge {
  background: #fbe7e2;
  color: #a83b28;
}

.status-pending,
.status-upcoming {
  background: #eef2f6;
  color: #647386;
}

.download-body {
  background:
    radial-gradient(circle at 20% 10%, rgb(255 255 255 / 70%), transparent 32%),
    linear-gradient(145deg, #eef4fb 0%, #f8f1e7 100%);
  color: #17201b;
}

.download-shell {
  margin: 0 auto;
  max-width: 560px;
  min-height: 100vh;
  padding: 28px 16px 36px;
}

.download-hero,
.download-card {
  background: rgb(255 255 255 / 92%);
  border: 1px solid #d9ded9;
  border-radius: 8px;
  box-shadow: 0 18px 46px rgb(39 52 45 / 10%);
}

.download-hero {
  padding: 30px 22px 24px;
}

.download-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid #bfd4ca;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef7f2;
  color: #0d6b57;
  font-size: 13px;
  font-weight: 800;
}

.download-hero h1 {
  margin: 18px 0 10px;
  font-size: 42px;
  line-height: 1.05;
}

.download-hero p,
.download-card p,
.download-card li {
  color: #58665f;
  line-height: 1.7;
}

.download-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  margin-top: 22px;
  border-radius: 7px;
  background: #0d6b57;
  color: white;
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.download-button:hover {
  background: #094c3f;
  box-shadow: 0 12px 28px rgb(13 107 87 / 20%);
  transform: translateY(-1px);
}

.download-meta {
  margin-bottom: 0;
  font-size: 13px;
}

.download-card {
  margin-top: 14px;
  padding: 18px 20px;
}

.download-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.download-card ol {
  margin: 0;
  padding-left: 22px;
}

.download-card code {
  border-radius: 5px;
  padding: 2px 5px;
  background: #f0ede6;
  color: #17201b;
}

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

.secondary-button:hover:not(:disabled) {
  background: #f7f3ea;
  border-color: var(--line-strong);
  box-shadow: none;
}

.page-shell,
.settings-page {
  width: min(1440px, calc(100vw - 40px));
  margin: 24px auto;
}

.app-shell {
  min-width: 0;
}

.summary > div,
.progress-card,
.table-section,
.settings-card,
.login-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-title h2,
.section-title h2 {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.25;
}

.eyebrow {
  color: var(--accent);
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.settings-card {
  display: grid;
  gap: 16px;
  max-width: 560px;
  padding: 18px;
}

.setting-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.checkbox-row {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 9px;
}

.checkbox-row input {
  min-height: auto;
  width: 18px;
}

.input-with-unit {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

label {
  display: grid;
  gap: 7px;
  color: #3e4b44;
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--ink);
  padding: 0 11px;
  outline: none;
  scroll-margin-bottom: 160px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(13 107 87 / 14%);
}

select:disabled {
  background: #eee8dc;
  color: #8a8175;
  cursor: not-allowed;
}

.toolbar {
  align-items: start;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 6px 0;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
}

.icon-link,
.secondary-link {
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink);
  display: inline-flex;
  font-size: 14px;
  font-weight: 800;
  justify-content: center;
  min-height: 44px;
  padding: 0 12px;
  text-decoration: none;
}

.icon-link {
  min-width: 44px;
}

.icon-link:hover,
.secondary-link:hover {
  background: #f7f3ea;
}

h1 {
  margin: 4px 0 6px;
  font-size: 31px;
  line-height: 1.16;
}

p {
  margin: 0;
  color: var(--muted);
}

.mobile-brief {
  display: none;
}

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

.summary {
  display: grid;
  grid-template-columns: 1.45fr 0.8fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.summary > div {
  min-width: 0;
  padding: 16px;
}

.label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

strong {
  color: var(--ink);
  display: block;
  font-size: 25px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.scan-actions,
.room-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.room-actions button {
  background: #29443d;
  border-color: #29443d;
}

.progress-card {
  margin-bottom: 14px;
  padding: 14px 16px;
}

.progress-meta {
  color: #3e4b44;
  display: flex;
  font-size: 14px;
  font-weight: 700;
  justify-content: space-between;
  margin-bottom: 10px;
}

progress {
  width: 100%;
  height: 14px;
  accent-color: var(--accent);
}

.progress-card p {
  margin-top: 10px;
}

.table-section {
  overflow: hidden;
}

.section-title {
  align-items: end;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 16px 12px;
}

.section-title h2 {
  font-size: 18px;
}

.section-title p {
  font-size: 13px;
}

.table-wrap,
.report-table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-strong);
}

th,
td {
  border-bottom: 1px solid #ece5d9;
  padding: 12px;
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}

th {
  background: #f6f1e8;
  color: #3e4b44;
  font-weight: 800;
  position: sticky;
  top: 0;
  z-index: 1;
}

.sort-button {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: inherit;
  cursor: pointer;
  min-height: auto;
  padding: 0;
  text-align: left;
}

.sort-button:hover:not(:disabled) {
  background: transparent;
  box-shadow: none;
  color: var(--accent);
  transform: none;
}

.sort-button span {
  color: var(--accent);
  font-size: 12px;
  margin-left: 6px;
}

.empty {
  color: #7a7368;
  text-align: center;
}

.bad,
.low-power {
  color: var(--danger);
  font-weight: 800;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgb(23 32 27 / 24%);
  max-width: min(960px, calc(100vw - 32px));
  padding: 0;
  width: 100%;
}

dialog::backdrop {
  background: rgb(23 32 27 / 48%);
}

.dialog-shell {
  background: var(--surface);
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 18px;
}

.dialog-header {
  align-items: start;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.dialog-header h2 {
  font-size: 21px;
  margin: 0 0 6px;
}

.report-table-wrap {
  max-height: min(68vh, 620px);
}

.login-body {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
}

.login-shell {
  width: min(430px, 100%);
  margin: 0 auto;
}

.login-form {
  display: grid;
  gap: 18px;
  padding: 26px;
}

.login-form h1 {
  font-size: 29px;
}

.login-form p {
  line-height: 1.6;
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
}

@media (max-width: 900px) {
  body {
    background: var(--surface);
  }

  .page-shell,
  .settings-page {
    margin: 0;
    padding: 14px 12px 24px;
    width: 100%;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: auto 1fr auto;
  }

  h1 {
    font-size: 26px;
  }

  .mobile-brief {
    background: var(--accent-soft);
    border: 1px solid #b7d4c6;
    border-radius: 8px;
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
    padding: 12px;
  }

  .mobile-brief strong {
    font-size: 15px;
  }

  .mobile-brief span {
    color: #38554b;
    font-size: 13px;
    line-height: 1.5;
  }

  .filters,
  .summary,
  .admin-user-form {
    grid-template-columns: 1fr;
  }

  .summary > div,
  .progress-card,
  .table-section,
  .settings-card {
    border-radius: 8px;
    box-shadow: none;
  }

  strong {
    font-size: 22px;
  }

  .scan-actions,
  .room-actions {
    flex-direction: column;
  }

  .section-title {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .table-wrap {
    max-width: 100%;
  }

  table {
    min-width: 760px;
  }

  th,
  td {
    padding: 10px;
    white-space: nowrap;
  }

  dialog {
    border-radius: 0;
    height: 100dvh;
    max-width: 100vw;
    width: 100vw;
  }

  .dialog-shell {
    min-height: 100dvh;
  }

  .dialog-header {
    align-items: stretch;
    flex-direction: column;
  }

  .report-table-wrap {
    max-height: none;
  }
}
