/* Visual style target: discovery/customer-app/PM App Screenshots.pdf -- light background, white
   rounded cards with soft drop shadows, teal "PURE MEASURE" branding header, green primary action
   buttons, a small colored status dot for online/offline, bottom icon nav bar. A close visual
   match, not a pixel reproduction -- exact hex values are this build's own judgment call within
   that described palette, not extracted from the source image. */

:root {
  --teal: #0f6e6e;
  --teal-dark: #0b5555;
  --green: #1e8e5a;
  --green-dark: #166a44;
  --bg: #eef5f4;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e9e8;
  --online: #22c55e;
  --offline: #9ca3af;
  --alert: #f59e0b;
  --shadow: 0 2px 10px rgba(15, 110, 110, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 72px; /* clears the fixed bottom nav */
}

header.app-header {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #ffffff;
  padding: 20px 20px 28px;
  border-radius: 0 0 20px 20px;
}

header.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.5px;
}

header.app-header .brand .logo-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  font-weight: 800;
  font-size: 13px;
}

header.app-header .subtitle {
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.85;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 15px;
  margin: 0 0 12px;
  color: var(--text);
}

.card .hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

/* Login card / claim-a-meter form -- same input treatment, shared rather than duplicated per form. */
#login-card label,
#claim-meter-form label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

#login-card input[type="email"],
#claim-meter-form input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 15px;
  margin-bottom: 12px;
}

.form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 10px;
}

.form-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 10px;
}

button.primary {
  width: 100%;
  background: var(--green);
  color: #ffffff;
  border: none;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

button.primary:hover {
  background: var(--green-dark);
}

button.secondary {
  width: 100%;
  background: transparent;
  color: var(--teal);
  border: 1px solid var(--teal);
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

.security-note {
  background: #fff7ed;
  border: 1px solid #fde8c8;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: #92400e;
  margin-top: 14px;
  line-height: 1.5;
}

/* Bar chart -- plain CSS bars, no chart library, consistent with "no build step, no framework" */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding-top: 10px;
  margin-bottom: 8px;
}

.bar-chart .bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}

.bar-chart .bar {
  width: 100%;
  max-width: 28px;
  background: linear-gradient(180deg, var(--teal) 0%, var(--green) 100%);
  border-radius: 6px 6px 2px 2px;
  min-height: 2px;
}

.bar-chart .bar.alert {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
}

.bar-chart .bar-label {
  font-size: 9px;
  color: var(--muted);
  margin-top: 6px;
  writing-mode: horizontal-tb;
}

/* Table */
table.readings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.readings-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}

table.readings-table td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}

table.readings-table td.value {
  text-align: right;
  font-weight: 600;
}

table.readings-table tr:last-child td {
  border-bottom: none;
}

.footnote {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}

/* States */
.state-message {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
}

.state-message .icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.hidden {
  display: none !important;
}

/* Row-cards -- a vertical list of individually-bordered row-cards (icon + label + value), matching
   discovery/customer-app/PM App Screenshots.pdf's own wireframe screens directly, shared by both
   Electricity (renderElectricityBlocks()) and Water (renderWaterBlocks()) in app.js. */
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 4px 4px 12px;
}

.row-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.row-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.row-card.alert-card {
  background: #fffbeb;
  border-color: #fde68a;
}

.row-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e6f4f1;
  color: var(--teal);
}

.row-icon svg {
  width: 19px;
  height: 19px;
}

.row-icon.trend-down svg {
  transform: scaleY(-1);
}

.row-icon--blue {
  background: #e7f0fb;
  color: #2563eb;
}

.row-icon--amber {
  background: #fef3e2;
  color: #d97706;
}

.row-body {
  flex: 1;
  min-width: 0;
}

.row-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 3px;
}

.row-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.row-value .unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}

.row-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 500;
}

.row-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  background: var(--offline);
}

.row-status-dot.online {
  background: var(--online);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

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

.alert-days-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-day-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding-top: 6px;
  border-top: 1px dashed #fde68a;
}

.alert-day-row .date {
  color: #92400e;
}

.alert-day-row .amount {
  font-weight: 700;
  color: #92400e;
}

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

/* Vending/Wallet -- added 2026-10-18 as a STATIC/DUMMY visual mockup only (see index.html's own
   comment above the markup, and README.md's "out of scope" framing, unchanged by this addition).
   Reuses the .row-card/.row-icon/.row-label/.row-value/.row-sub system already established above
   rather than inventing a parallel visual language; only genuinely new pieces are the balance
   card, the demo captions/badge, and the purchase form fields. */
.wallet-balance-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px 18px;
  margin-bottom: 20px;
  text-align: center;
}

.wallet-balance-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.wallet-balance-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  margin: 6px 0 14px;
}

.wallet-add-money {
  width: auto;
  display: inline-block;
  padding: 11px 28px;
}

.wallet-demo-caption {
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  letter-spacing: 0.3px;
  margin-top: 10px;
}

.wallet-utility-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.wallet-utility-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.wallet-utility-stats {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-bottom: 14px;
}

.wallet-utility-card button.secondary {
  margin-top: 8px;
}

.wallet-utility-card button.secondary:first-of-type {
  margin-top: 0;
}

/* Picker/purchase subheader -- back arrow + title, same card/palette conventions as the rest of
   the page (not a copy of the mockup's own native-nav-bar chrome). */
.wallet-subheader {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.wallet-subheader h2 {
  font-size: 17px;
  margin: 0;
  color: var(--text);
}

.wallet-back-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--teal);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}

.wallet-screen-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}

/* Picker row-cards reuse .row-card as a reset <button> (keyboard/semantic-accessible, unlike a
   plain clickable <div>) plus a right-aligned chevron. */
button.wallet-row-link {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.row-chevron {
  align-self: center;
  color: var(--muted);
  font-size: 22px;
  flex-shrink: 0;
}

.row-icon--red {
  background: #fde8e4;
  color: #dc4f33;
}

/* Purchase screen */
.wallet-purchase-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.wallet-purchase-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.wallet-demo-badge {
  display: inline-block;
  background: #fff7ed;
  border: 1px solid #fde8c8;
  color: #92400e;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.wallet-field-label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 16px 0 6px;
}

#wallet-meter-select,
#wallet-amount-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 15px;
  background: var(--card);
  color: var(--text);
}

.wallet-purchase-card button.primary {
  margin-top: 22px;
}

.wallet-confirm-message {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 14px;
  line-height: 1.5;
}

.wallet-purchase-caption {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin: 14px 0 0;
  line-height: 1.5;
}

/* Bottom nav -- adapted from the mockup's Home/Wallet/Meters/Profile bar; "Meters"/"Profile" stay
   out of scope (no separate meter-list/account-profile screen exists), so this is a three-item
   bar: Home (serial entry), Wallet (static/dummy Vending mockup, see above), and About (what this
   is / the security note, surfaced again for visibility). */
nav.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(15, 110, 110, 0.06);
}

nav.bottom-nav button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 16px;
}

nav.bottom-nav button.active {
  color: var(--teal);
  font-weight: 700;
}

nav.bottom-nav button .nav-icon {
  font-size: 18px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#about-panel ul {
  padding-left: 18px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
