/* ==========================================================================
   PropertyVest Metering Solution — Design Tokens
   ========================================================================== */

:root {
  /* Color */
  --bg: #140A05;
  --bg-raised: #1F110A;
  --surface: #341F11;
  --surface-2: #432816;
  --border-hair: #704526;
  --border-hair-soft: #4E311C;

  --text-primary: #FFF9F3;
  --text-secondary: #E3C6AD;
  --text-tertiary: #BE9C82;

  --accent-green: #FF8A3D;
  --accent-green-dim: #FF9A55;
  --ok: #3DDC84;
  --ok-dim: #34C777;
  --accent-blue: #4FD6FF;
  --accent-amber: #FFB454;
  --accent-red: #FF5C72;

  --focus-ring: #FFB27A;

  /* Type */
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, "Liberation Mono", monospace;

  /* Layout */
  --app-max-width: 460px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --header-h: 60px;
  --tabbar-h: 72px;
}

/* ==========================================================================
   Reset
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background:
    radial-gradient(ellipse 900px 460px at 50% -8%, rgba(255, 138, 61, 0.08), transparent 60%),
    var(--bg);
}

h1, h2, h3, p, ul, fieldset, legend, input, button, form { margin: 0; padding: 0; }
fieldset { border: none; }
ul { list-style: none; }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font-family: inherit; color: inherit; }
button:focus-visible,
input:focus-visible,
.source-badge:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

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

/* ==========================================================================
   App Shell
   ========================================================================== */

#app {
  max-width: var(--app-max-width);
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  border-left: 1px solid var(--border-hair-soft);
  border-right: 1px solid var(--border-hair-soft);
}

.app-header {
  flex: 0 0 var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-hair);
  background: rgba(20, 10, 5, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-hair);
  padding: 4px;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 14.5px; font-weight: 650; letter-spacing: 0.01em; }
.brand-sub { font-size: 10.5px; color: var(--text-secondary); letter-spacing: 0.02em; }

.conn-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 5px 9px;
  border: 1px solid var(--border-hair);
  border-radius: 999px;
  background: var(--surface);
}
.conn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px 1px rgba(255, 138, 61, 0.7);
}

.app-main {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 16px calc(24px + var(--tabbar-h));
  -webkit-overflow-scrolling: touch;
}

.tab-panel { display: flex; flex-direction: column; gap: 16px; }
.tab-panel[hidden] { display: none; }

.tab-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  flex: 0 0 var(--tabbar-h);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border-top: 1px solid var(--border-hair);
  background: rgba(20, 10, 5, 0.9);
  backdrop-filter: blur(10px);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 0 8px;
  color: var(--text-tertiary);
  font-size: 9.5px;
  letter-spacing: 0.01em;
  transition: color 0.15s ease;
}
.tab-btn svg { transition: transform 0.15s ease; }
.tab-btn.is-active { color: var(--accent-green-dim); }
.tab-btn.is-active svg { transform: translateY(-1px); }
.tab-btn:active svg { transform: scale(0.92); }

/* ==========================================================================
   Dashboard — Readout
   ========================================================================== */

.readout-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-md);
  background: linear-gradient(155deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: 0 1px 2px rgba(16, 22, 31, 0.03), 0 16px 32px -12px rgba(16, 22, 31, 0.10);
  padding: 22px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.readout-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.readout-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.readout-digits {
  font-family: var(--font-mono);
  font-size: 46px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.readout-unit {
  font-family: var(--font-mono);
  font-size: 17px;
  color: var(--accent-blue);
  font-weight: 600;
}

.readout-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}

.readout-glow {
  position: absolute;
  right: -60px;
  top: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255, 138, 61, 0.14), transparent 70%);
  pointer-events: none;
}

/* Source badges */

.source-row { display: flex; gap: 8px; }

.source-badge {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 10px;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 550;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.source-badge .source-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

.source-badge.is-active {
  color: var(--text-primary);
  border-color: var(--accent-green-dim);
  background: rgba(255, 138, 61, 0.08);
}
.source-badge.is-active .source-dot {
  background: var(--accent-green);
  box-shadow: 0 0 6px 1px rgba(255, 138, 61, 0.65);
}

/* Metrics strip */

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}

.metric-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 6px;
  border-right: 1px solid var(--border-hair);
}
.metric-block:last-child { border-right: none; }

.metric-value {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 600;
  color: var(--accent-blue);
}
.metric-unit {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  min-height: 13px;
}
.metric-label {
  font-size: 10.5px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Panel card (key/value) */

.panel-card {
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.panel-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-hair-soft);
  font-size: 13px;
}
.panel-card-row:last-child { border-bottom: none; }

.panel-card-key { color: var(--text-secondary); }
.panel-card-val { font-family: var(--font-mono); color: var(--text-primary); font-size: 12.5px; }
.panel-card-val--active { color: var(--ok-dim); }

.app-footer-inline {
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
  padding-top: 6px;
}

/* ==========================================================================
   Shared panel headings
   ========================================================================== */

.panel-heading { font-size: 19px; font-weight: 650; }
.panel-subheading { font-size: 12.5px; color: var(--text-secondary); margin-top: -10px; }

/* ==========================================================================
   Token Vending
   ========================================================================== */

.vend-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 18px 16px;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

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

.voucher-chip {
  padding: 11px 4px;
  text-align: center;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-mono);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.voucher-chip--custom { grid-column: span 3; font-family: var(--font-ui); }

.voucher-chip.is-selected {
  color: #140A05;
  background: var(--accent-green);
  border-color: var(--accent-green);
  font-weight: 650;
}

.custom-amount-input,
.text-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-primary);
  font-size: 14px;
  margin-top: 10px;
}
.text-input { margin-top: 0; font-family: var(--font-mono); }
.custom-amount-input::placeholder,
.text-input::placeholder { color: var(--text-tertiary); }

.btn-primary {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  background: var(--accent-green);
  color: #140A05;
  font-size: 14px;
  font-weight: 650;
  text-align: center;
  transition: transform 0.1s ease, filter 0.15s ease;
}
.btn-primary:active { transform: scale(0.98); filter: brightness(0.94); }

.btn-secondary {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hair);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 550;
  text-align: center;
  transition: transform 0.1s ease, border-color 0.15s ease;
}
.btn-secondary:active { transform: scale(0.98); }

.token-result {
  border: 1px solid var(--accent-green-dim);
  border-radius: var(--radius-md);
  background: linear-gradient(155deg, rgba(255, 138, 61, 0.09), var(--surface) 60%);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: token-in 0.35s ease;
}

@keyframes token-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.token-result-label {
  font-size: 11.5px;
  color: var(--accent-green-dim);
  font-weight: 650;
  letter-spacing: 0.02em;
}

.token-digits {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  word-spacing: 4px;
  line-height: 1.6;
  white-space: pre-line; /* several tokens: one per line */
}

.token-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.token-disclaimer {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.45;
}

/* ==========================================================================
   Usage Analytics
   ========================================================================== */

.chart-card {
  position: relative;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 20px 16px 12px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  height: 140px;
}

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

.chart-bar {
  width: 100%;
  max-width: 26px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--accent-blue), rgba(10, 111, 192, 0.35));
  transition: filter 0.15s ease;
}
.chart-bar-col.is-selected .chart-bar {
  background: linear-gradient(180deg, var(--accent-green), rgba(255, 138, 61, 0.4));
}

.chart-bar-label {
  font-size: 10.5px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.chart-tooltip {
  position: absolute;
  top: 8px;
  right: 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.usage-log {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}

.usage-log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-hair-soft);
}
.usage-log-row:last-child { border-bottom: none; }

.usage-log-date { font-size: 12.5px; color: var(--text-primary); }
.usage-log-source { font-size: 10.5px; color: var(--text-tertiary); margin-top: 2px; }
.usage-log-figures { text-align: right; }
.usage-log-kwh { font-family: var(--font-mono); font-size: 13px; color: var(--accent-blue); }
.usage-log-cost { font-size: 10.5px; color: var(--text-tertiary); margin-top: 2px; }

/* ==========================================================================
   Scanner
   ========================================================================== */

.scanner-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-hair);
}

#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scanner-frame {
  position: absolute;
  inset: 14% 10%;
  pointer-events: none;
}
.corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 3px solid var(--accent-green);
  filter: drop-shadow(0 0 4px rgba(255, 138, 61, 0.6));
}
.corner-tl { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 4px 0 0 0; }
.corner-tr { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 4px 0 0; }
.corner-bl { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 4px; }
.corner-br { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 4px 0; }

.scanner-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: var(--surface);
  color: var(--text-tertiary);
}
.scanner-fallback svg { color: var(--text-tertiary); }
.scanner-fallback p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

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

.btn-capture {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-hair);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  justify-self: center;
}
.capture-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 14px 2px rgba(255, 138, 61, 0.45);
}
.btn-capture:active .capture-ring { transform: scale(0.9); }
.btn-capture:disabled { opacity: 0.4; }
.btn-capture:disabled .capture-ring { box-shadow: none; }

.scanner-count {
  font-size: 11.5px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  text-align: right;
}

.capture-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.capture-strip:empty::after {
  content: "Captured frames appear here.";
  font-size: 12px;
  color: var(--text-tertiary);
}

.capture-thumb {
  flex: 0 0 auto;
  width: 68px;
  height: 68px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hair);
  overflow: hidden;
}
.capture-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 360px) {
  .readout-digits { font-size: 38px; }
  .metric-value { font-size: 16px; }
}

/* ==========================================================================
   Prepay Wallet card
   ========================================================================== */

.wallet-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 16px;
}

.wallet-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.wallet-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.wallet-balance {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.wallet-currency { color: var(--accent-green-dim); font-size: 20px; margin-right: 1px; }
.wallet-balance-decimals { color: var(--text-tertiary); font-size: 16px; }

.wallet-sub {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.wallet-eye-btn {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-hair);
  color: var(--text-secondary);
  background: var(--surface-2);
}
.wallet-eye-btn:active { transform: scale(0.94); }

.wallet-actions { display: flex; gap: 10px; }
.wallet-action-btn { flex: 1; }

.wallet-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--border-hair-soft);
  animation: token-in 0.25s ease;
}

.wallet-form-actions { display: flex; gap: 10px; }
.wallet-form-actions .wallet-form-submit { flex: 1; }

.wallet-form-note {
  font-size: 11.5px;
  color: var(--accent-red);
}

.btn-ghost {
  padding: 12px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 550;
  text-align: center;
}
.btn-ghost:active { opacity: 0.7; }

/* ==========================================================================
   Vend — wallet warning
   ========================================================================== */

.vend-wallet-warning {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--accent-red);
  border-radius: var(--radius-md);
  background: rgba(224, 50, 76, 0.05);
  padding: 14px 16px;
}
.vend-wallet-warning p {
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ==========================================================================
   Ledger
   ========================================================================== */

.ledger-log {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}

.ledger-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-hair-soft);
}
.ledger-row:last-child { border-bottom: none; }

.ledger-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ledger-icon--credit { background: rgba(61, 220, 132, 0.12); color: var(--ok-dim); }
.ledger-icon--debit { background: rgba(224, 50, 76, 0.10); color: var(--accent-red); }

.ledger-main { flex: 1 1 auto; min-width: 0; }
.ledger-desc {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ledger-meta { font-size: 10.5px; color: var(--text-tertiary); margin-top: 2px; }

.ledger-amount {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}
.ledger-amount--credit { color: var(--ok-dim); }
.ledger-amount--debit { color: var(--accent-red); }

/* ==========================================================================
   Hub
   ========================================================================== */

.hub-section { display: flex; flex-direction: column; gap: 8px; }

.hub-section-title {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-left: 2px;
}

.hub-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}

.hub-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-hair-soft);
}
.hub-row:last-child { border-bottom: none; }
.hub-row:active { background: var(--bg-raised); }

.hub-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 138, 61, 0.12);
  color: var(--accent-green-dim);
}

.hub-row-label {
  flex: 1 1 auto;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-primary);
}

.hub-row-meta {
  flex: 0 0 auto;
  font-size: 11.5px;
  color: var(--text-tertiary);
}

.hub-chevron { flex: 0 0 auto; color: var(--text-tertiary); transition: transform 0.2s ease; }
.hub-row.is-open .hub-chevron { transform: rotate(90deg); color: var(--accent-green-dim); }

.hub-detail {
  padding: 12px 14px 16px 58px;
  border-bottom: 1px solid var(--border-hair-soft);
  background: var(--surface-2);
}
.hub-detail:last-child { border-bottom: none; }
.hub-detail p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

.hub-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hub-mini-list { display: flex; flex-direction: column; gap: 8px; }
.hub-mini-list li { display: flex; flex-direction: column; }
.hub-mini-title { font-size: 12px; color: var(--text-primary); }
.hub-mini-meta { font-size: 10.5px; color: var(--text-tertiary); margin-top: 1px; }

.hub-facility-card {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}
.hub-facility-card + .hub-facility-card { border-top: 1px solid var(--border-hair-soft); }
.hub-facility-name { font-size: 12.5px; color: var(--text-primary); font-weight: 550; }
.hub-facility-meta { font-size: 10.5px; color: var(--text-tertiary); margin-top: 2px; font-family: var(--font-mono); }


/* ==========================================================================
   Auth shell
   ========================================================================== */

#auth-shell {
  max-width: var(--app-max-width);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-hair-soft);
  border-right: 1px solid var(--border-hair-soft);
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 28px 18px 10px;
}

.auth-main {
  flex: 1 1 auto;
  padding: 10px 20px 32px;
  display: flex;
  flex-direction: column;
}

.auth-demo-hint {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-tertiary);
  background: var(--bg-raised);
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  margin-bottom: 16px;
}
.auth-demo-hint code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-secondary);
}

.auth-view { display: flex; flex-direction: column; }
.auth-view[hidden] { display: none; }

.auth-heading { font-size: 24px; font-weight: 650; margin-bottom: 4px; }
.auth-subheading { font-size: 13px; color: var(--text-secondary); margin-bottom: 18px; }

.auth-error {
  font-size: 12.5px;
  color: var(--accent-red);
  background: rgba(224, 50, 76, 0.06);
  border: 1px solid rgba(224, 50, 76, 0.35);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin-bottom: 14px;
}
.auth-error--info {
  color: var(--accent-green-dim);
  background: rgba(255, 138, 61, 0.07);
  border-color: var(--accent-green-dim);
}

.auth-form { display: flex; flex-direction: column; gap: 4px; }
.auth-form .field-label { margin-top: 10px; }
.auth-form .field-label:first-child { margin-top: 0; }
.auth-form .btn-primary { margin-top: 18px; }

.field-label-optional { color: var(--text-tertiary); font-weight: 400; }

.auth-link-btn {
  align-self: flex-start;
  font-size: 12.5px;
  color: var(--accent-blue);
  font-weight: 550;
  padding: 6px 0;
}
.auth-link-btn:active { opacity: 0.7; }

.auth-switch {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}
.auth-switch .auth-link-btn { display: inline; padding: 0; font-size: 13px; }

/* ==========================================================================
   Header badges
   ========================================================================== */

.header-badges { display: flex; align-items: center; gap: 8px; }

.env-badge {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--accent-amber);
  background: rgba(201, 115, 0, 0.1);
  border: 1px solid rgba(201, 115, 0, 0.35);
  border-radius: 999px;
  padding: 4px 9px;
}

.estate-badge {
  font-size: 10.5px;
  font-weight: 650;
  color: var(--accent-blue);
  background: rgba(10, 111, 192, 0.08);
  border: 1px solid rgba(10, 111, 192, 0.3);
  border-radius: 999px;
  padding: 4px 10px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.estate-badge:active { opacity: 0.7; }

/* ==========================================================================
   Quick actions
   ========================================================================== */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
  transition: transform 0.1s ease, border-color 0.15s ease;
}
.quick-action-btn:active { transform: scale(0.97); border-color: var(--accent-green-dim); }

.quick-action-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 138, 61, 0.12);
  color: var(--accent-green-dim);
}

/* ==========================================================================
   Multi-step flows (Fund Wallet / Buy Electricity / Bill Centre / Link Meter)
   ========================================================================== */

[data-step][hidden] { display: none; }

.flow-summary-line { font-size: 14px; color: var(--text-primary); line-height: 1.5; margin-bottom: 8px; }
.flow-summary-line strong { font-family: var(--font-mono); color: var(--accent-green-dim); }
.flow-summary-note { font-size: 11.5px; color: var(--text-tertiary); line-height: 1.5; margin-bottom: 4px; }

.flow-success-line { font-size: 14px; color: var(--ok-dim); font-weight: 600; line-height: 1.5; margin-bottom: 10px; }
.flow-held-line { font-size: 13.5px; color: var(--accent-amber); line-height: 1.55; margin-bottom: 12px; }
.flow-failure-line { font-size: 13.5px; color: var(--accent-red); line-height: 1.5; margin-bottom: 12px; }

.flow-pending {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 10px 0;
}

.flow-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-hair);
  border-top-color: var(--accent-green-dim);
  animation: flow-spin 0.7s linear infinite;
  flex: 0 0 auto;
}
@keyframes flow-spin { to { transform: rotate(360deg); } }

.flow-receipt {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 10px;
}
.flow-receipt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border-hair-soft);
}
.flow-receipt-row:last-child { border-bottom: none; }
.flow-receipt-row span:first-child { color: var(--text-secondary); }
.flow-receipt-row span:last-child { font-family: var(--font-mono); color: var(--text-primary); font-weight: 600; }

/* ==========================================================================
   Sheet overlay (Bill Centre / Link Meter)
   ========================================================================== */

body.sheet-lock { overflow: hidden; }

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(16, 22, 31, 0);
  transition: background 0.2s ease;
}
.sheet-overlay[hidden] { display: none; }
.sheet-overlay.is-open { background: rgba(16, 22, 31, 0.45); }

.sheet-panel {
  width: 100%;
  max-width: var(--app-max-width);
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--border-hair);
  border-bottom: none;
  box-shadow: 0 -12px 32px -12px rgba(16, 22, 31, 0.25);
  transform: translateY(100%);
  transition: transform 0.25s ease;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.sheet-overlay.is-open .sheet-panel { transform: translateY(0); }

.sheet-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border-hair-soft);
}
.sheet-title { font-size: 16px; font-weight: 650; }
.sheet-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-close-btn:active { opacity: 0.7; }

.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 18px 24px;
  -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Bill Centre
   ========================================================================== */

.bill-filter-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.bill-filter-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-hair);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 550;
}
.bill-filter-btn.is-active {
  color: var(--text-primary);
  border-color: var(--accent-green-dim);
  background: rgba(255, 138, 61, 0.08);
}

.bill-add-btn {
  margin-left: auto;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--accent-green-dim);
  background: rgba(255, 138, 61, 0.08);
  color: var(--accent-green-dim);
  font-size: 12px;
  font-weight: 650;
}
.bill-add-btn:active { opacity: 0.75; }

.bill-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}
.bill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-hair-soft);
}
.bill-row:last-child { border-bottom: none; }
.bill-row:active { background: var(--bg-raised); }
.bill-row-title { font-size: 13px; font-weight: 550; color: var(--text-primary); }
.bill-row-meta { font-size: 10.5px; color: var(--text-tertiary); margin-top: 2px; }
.bill-row-right { text-align: right; flex: 0 0 auto; }
.bill-row-amount { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--text-primary); }

.bill-status-badge {
  display: inline-block;
  margin-top: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 650;
  text-transform: capitalize;
}
.bill-status-badge--outstanding { background: rgba(201, 115, 0, 0.12); color: var(--accent-amber); }
.bill-status-badge--overdue { background: rgba(224, 50, 76, 0.12); color: var(--accent-red); }
.bill-status-badge--paid { background: rgba(61, 220, 132, 0.12); color: var(--ok-dim); }

.bill-empty { padding: 20px 14px; text-align: center; font-size: 12.5px; color: var(--text-tertiary); }

/* Access Code (visitor gatepass) */

.access-code-display { font-family: var(--font-mono); font-size: 13px; font-weight: 700; letter-spacing: 0.5px; color: var(--text-primary); }

.access-code-big {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
  padding: 18px 12px;
  margin: 12px 0;
  border: 1px dashed var(--border-hair);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  user-select: all;
}

.estate-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 14px;
}
.estate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-hair-soft);
}
.estate-row:last-child { border-bottom: none; }
.estate-row:active { background: var(--bg-raised); }
.estate-row-name { font-size: 13px; font-weight: 550; color: var(--text-primary); }
.estate-row-address { font-size: 10.5px; color: var(--text-tertiary); margin-top: 2px; }
.estate-row-badge {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 650;
  background: rgba(255, 138, 61, 0.12);
  color: var(--accent-green-dim);
}

/* ==========================================================================
   Meter status (Hub -> My Meters) + Link Meter
   ========================================================================== */

.meter-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.meter-status-badge {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 650;
  white-space: nowrap;
}
.meter-status-badge--active { background: rgba(61, 220, 132, 0.12); color: var(--ok-dim); }
.meter-status-badge--inactive { background: var(--bg-raised); color: var(--text-tertiary); }
.meter-status-badge--pending_verification { background: rgba(201, 115, 0, 0.12); color: var(--accent-amber); }
.meter-status-badge--fault { background: rgba(224, 50, 76, 0.12); color: var(--accent-red); }

.meter-unlink-btn { margin-top: 8px; align-self: flex-start; padding: 8px 12px; font-size: 11.5px; }

.hub-detail-note { font-size: 12px; color: var(--text-tertiary); }

/* ==========================================================================
   Ledger status badge (pending/failed entries)
   ========================================================================== */

.ledger-status {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 650;
  text-transform: capitalize;
  vertical-align: middle;
}
.ledger-status--pending { background: rgba(201, 115, 0, 0.12); color: var(--accent-amber); }
.ledger-status--failed { background: rgba(224, 50, 76, 0.12); color: var(--accent-red); }
.ledger-empty { padding: 18px 14px; text-align: center; font-size: 12.5px; color: var(--text-tertiary); }

/* ==========================================================================
   Dashboard: recent activity + empty meter state
   ========================================================================== */

.recent-tx-section { display: flex; flex-direction: column; gap: 8px; }
.recent-tx-header { display: flex; align-items: center; justify-content: space-between; }
.recent-tx-header .auth-link-btn { padding: 0; font-size: 11.5px; }
.recent-tx-empty { font-size: 12px; color: var(--text-tertiary); text-align: center; padding: 14px 0; }

.dashboard-meter-empty .panel-card-key { color: var(--text-secondary); }
.panel-card-action { width: 100%; }

/* ==========================================================================
   Scanner: manual meter-number confirmation
   ========================================================================== */

.scanner-confirm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 14px;
}

/* ==========================================================================
   Small screens — auth
   ========================================================================== */

@media (max-width: 360px) {
  .quick-action-btn { font-size: 10px; }
  .auth-heading { font-size: 21px; }
}

/* ==========================================================================
   hidden-attribute fix for the two shells

   #app and #auth-shell each set `display: flex` via an ID selector. Since
   normal author CSS always outranks the UA default `[hidden]{display:none}`
   regardless of specificity, that flex rule would otherwise defeat the
   `hidden` attribute entirely. These two rules make `hidden` win back by
   matching on the attribute at equal-or-higher specificity.
   ========================================================================== */

#app[hidden], #auth-shell[hidden] { display: none; }

/* Global safety net: the `hidden` attribute must always win, no matter
   what a class rule elsewhere sets `display` to. A static audit found six
   elements across wallet forms, the Buy Electricity token panel, and the
   scanner fallback/confirm panels that were ALWAYS visible despite being
   marked hidden, because a class-based `display` rule (same author
   origin, equal specificity) was declared after `[hidden]` in the
   cascade and simply overrode it. The per-element overrides above predate
   this and are now redundant but harmless. This one rule covers every
   current case and any future one — nothing should ever need its own
   `.class[hidden]` override again. */
[hidden] { display: none !important; }

/* ==========================================================================
   Loading-state polish
   ========================================================================== */

.ledger-empty--loading, .bill-empty--loading {
  animation: loading-pulse 1.4s ease-in-out infinite;
}
@keyframes loading-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* ==========================================================================
   Responsive: desktop layout

   Below ~880px this file is untouched — that's the exact mobile layout
   it's always been, phone or otherwise. Above that, the app stops being
   a phone-width column stretched into empty space on a wide screen and
   becomes an actual desktop layout:
     - the app frame widens and gets a subtle card treatment on the page
     - the tab bar moves from a bottom mobile tab bar to a top nav, via
       explicit flex `order` on the three #app children — no DOM/JS
       change, so mobile markup and behavior stay identical
     - content settles into a comfortable reading width instead of
       stretching edge to edge across the whole frame
     - sheet overlays (Bill Centre, Link a Meter, Manage Admins) stop
       sliding up as a mobile bottom sheet and become a centered dialog
   ========================================================================== */

@media (min-width: 880px) {
  #app {
    max-width: none;
    min-height: 100dvh;
    height: auto;
    border-left: none;
    border-right: none;
  }

  #auth-shell {
    max-width: 480px;
    box-shadow: 0 1px 40px -12px rgba(16, 22, 31, 0.12);
  }

  .app-header {
    order: 0;
    padding: 0 36px;
  }

  .tab-bar {
    order: 1;
    position: static;
    flex: 0 0 52px;
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    gap: 4px;
    padding: 0 30px;
    border-top: none;
    border-bottom: 1px solid var(--border-hair);
    background: var(--surface);
    backdrop-filter: none;
  }

  .app-main {
    order: 2;
    width: 100%;
    padding: 28px 36px 48px;
  }

  .tab-btn {
    flex-direction: row;
    gap: 7px;
    padding: 0 14px;
    font-size: 12.5px;
    font-weight: 550;
    border-radius: var(--radius-sm);
  }
  .tab-btn.is-active { background: rgba(255, 138, 61, 0.08); }
  .tab-btn.is-active svg { transform: none; }

  /* Sheet overlays: centered dialog, not a mobile bottom sheet. */
  .sheet-overlay { align-items: center; padding: 24px; }
  .sheet-panel {
    max-width: 480px;
    max-height: 84dvh;
    border-radius: 16px;
    border-bottom: 1px solid var(--border-hair);
    box-shadow: 0 24px 60px -20px rgba(16, 22, 31, 0.35);
    transform: translateY(12px);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .sheet-overlay.is-open .sheet-panel { transform: translateY(0); opacity: 1; }
}

/* Show/hide password eye */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { padding-right: 46px; width: 100%; box-sizing: border-box; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; padding: 8px; line-height: 0; color: #8a94a6; }
.pw-eye:hover, .pw-eye:focus-visible { color: #ffffff; }
.pw-eye.is-on { color: #4fd1ff; }

/* Payment confirmation box shown when OPay sends the person back */
.topup-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 9999; }
.topup-panel { background: #1F110A; border: 1px solid #704526; border-radius: 14px; padding: 24px; max-width: 380px; width: 100%; text-align: center; color: #fff; }
.topup-panel h2 { margin: 0 0 10px; font-size: 20px; }
.topup-panel p { margin: 0 0 18px; color: #E3C6AD; line-height: 1.5; font-size: 15px; word-break: break-word; }
.topup-btn { width: 100%; }

/* Overdue-bill lock: only Bills and Fund Wallet stay available */
.bill-lock-banner { border: 1px solid rgba(255, 92, 114, 0.5); background: rgba(255, 92, 114, 0.1); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.bill-lock-title { display: block; font-size: 15px; margin-bottom: 6px; }
.bill-lock-text { margin: 0 0 12px; font-size: 13.5px; color: var(--text-secondary, #aab3c2); line-height: 1.45; }
.bill-lock-actions { display: flex; gap: 10px; flex-wrap: wrap; }
body.bill-locked .tab-bar,
body.bill-locked #quick-action-buy,
body.bill-locked #quick-action-access,
body.bill-locked #dashboard-meter-card,
body.bill-locked #dashboard-meter-empty,
body.bill-locked .recent-tx-section { display: none !important; }
body.bill-locked .app-main { padding-bottom: 24px; }

/* Dashboard welcome */
.dash-welcome { margin: 2px 2px 16px; }
.dash-welcome[hidden] { display: none; }
.dash-welcome-greet { margin: 0; font-size: 21px; font-weight: 700; line-height: 1.25; color: var(--text-primary); }
.dash-welcome-name { color: var(--accent-green); }
.dash-welcome-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--text-secondary); }

/* Install app button (top bar) */
.install-header-btn {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--accent-green);
  color: #140A05;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.install-header-btn[hidden] { display: none; }
.install-header-btn:active { transform: scale(0.97); }
.install-help-steps { text-align: left; }
.conn-status { white-space: nowrap; }
@media (max-width: 380px) {
  .app-header { padding: 0 12px; }
  .header-badges { gap: 8px; }
  .conn-label { display: none; }
  .install-header-btn { padding: 7px 10px; }
}

/* ==========================================================================
   Estate Shopping
   ========================================================================== */
.tab-btn[hidden] { display: none; }
.tab-btn--shop { color: var(--accent-green-dim); }
.shop-banner { display: flex; align-items: center; gap: 12px; padding: 14px; margin-bottom: 14px; border-radius: var(--radius-md); border: 1px solid var(--accent-green); background: linear-gradient(135deg, rgba(255,138,61,.22), rgba(255,138,61,.07)); }
.shop-banner[hidden] { display: none; }
.shop-banner-emoji { font-size: 30px; line-height: 1; }
.shop-banner-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shop-banner-text b { font-size: 15px; color: var(--text-primary); }
.shop-banner-text span { font-size: 12px; color: var(--text-secondary); line-height: 1.35; }
.shop-banner-btn { padding: 9px 14px; font-size: 13px; white-space: nowrap; }
#panel-shop { padding-bottom: 80px; }
.shop-top { display: flex; align-items: center; gap: 8px; }
.shop-title { margin: 0; }
.shop-back { font-size: 28px; line-height: 1; padding: 2px 10px 6px 0; color: var(--accent-green-dim); }
.shop-loading, .shop-empty { color: var(--text-secondary); font-size: 13.5px; padding: 18px 4px; }
.shop-error { color: var(--accent-red); font-size: 13px; margin: 8px 0; }
.shop-toast { background: rgba(61,220,132,.14); border: 1px solid var(--ok); color: var(--ok); padding: 10px 12px; border-radius: var(--radius-md); font-size: 13px; margin: 8px 0; }
.shop-fine { font-size: 12px; color: var(--text-tertiary); margin: 4px 0; line-height: 1.4; }
.shop-search { margin: 12px 0; }
.shop-search input { width: 100%; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border-hair); background: var(--surface); color: var(--text-primary); font-size: 14px; font-family: var(--font-ui); }
.shop-quick { display: flex; gap: 10px; margin-bottom: 14px; }
.shop-quick button { flex: 1; padding: 11px 8px; border-radius: var(--radius-md); border: 1px solid var(--border-hair); background: var(--surface); color: var(--text-primary); font-size: 13px; font-weight: 600; }
.shop-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shop-cat { display: flex; flex-direction: column; text-align: left; border: 1px solid var(--border-hair); background: var(--surface); border-radius: var(--radius-md); overflow: hidden; color: var(--text-primary); }
.shop-cat:active { transform: scale(.98); }
.shop-cat-img, .shop-prod-img, .shop-line-img, .shop-sheet-img { position: relative; display: block; overflow: hidden; background: var(--surface-2); }
.shop-cat-img { width: 100%; aspect-ratio: 2 / 1; }
.shop-cat-img img, .shop-prod-img img, .shop-line-img img, .shop-sheet-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-cat-img i, .shop-prod-img i, .shop-line-img i, .shop-sheet-img i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 34px; z-index: 0; }
.shop-cat-img img, .shop-prod-img img, .shop-line-img img, .shop-sheet-img img { position: relative; z-index: 1; }
.shop-cat-name { padding: 9px 10px 0; font-size: 13.5px; font-weight: 650; line-height: 1.25; }
.shop-cat-tag { padding: 2px 10px 10px; font-size: 11.5px; color: var(--text-tertiary); }
.shop-how { margin-top: 20px; padding: 14px; border: 1px solid var(--border-hair-soft); border-radius: var(--radius-md); background: var(--bg-raised); }
.shop-how h3 { margin: 0 0 8px; font-size: 14px; }
.shop-how ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.shop-how b { color: var(--text-primary); }
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shop-prod { display: flex; flex-direction: column; border: 1px solid var(--border-hair); background: var(--surface); border-radius: var(--radius-md); overflow: hidden; text-align: left; color: var(--text-primary); }
.shop-prod-img { width: 100%; aspect-ratio: 1 / 1; }
.shop-prod-name { padding: 9px 10px 4px; font-size: 13px; font-weight: 600; line-height: 1.3; flex: 1; }
.shop-prod-add { margin: 0 10px 10px; padding: 6px 0; text-align: center; border-radius: 99px; background: rgba(255,138,61,.16); color: var(--accent-green-dim); font-size: 12.5px; font-weight: 650; }
.shop-cartbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom, 0)); width: min(calc(100% - 24px), 436px); z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-radius: 99px; background: var(--accent-green); color: #1b0d03; font-weight: 700; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.shop-sheet-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
.shop-sheet { width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto; background: var(--bg-raised); border: 1px solid var(--border-hair); border-radius: 18px 18px 0 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0)); }
.shop-sheet-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.shop-sheet-head > div { flex: 1; min-width: 0; }
.shop-sheet-head h3 { margin: 0; font-size: 17px; }
.shop-sheet-img { width: 64px; height: 64px; border-radius: 12px; flex: none; }
.shop-x { font-size: 28px; line-height: 1; color: var(--text-secondary); padding: 4px 8px; }
.shop-opts { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.shop-opt { padding: 9px 13px; border-radius: 99px; border: 1px solid var(--border-hair); background: var(--surface); color: var(--text-secondary); font-size: 13px; }
.shop-opt.is-on { border-color: var(--accent-green); background: rgba(255,138,61,.18); color: var(--text-primary); font-weight: 650; }
.shop-qty { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.shop-qty button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border-hair); background: var(--surface); color: var(--text-primary); font-size: 22px; }
.shop-qty input { width: 90px; text-align: center; padding: 11px 6px; border-radius: 12px; border: 1px solid var(--border-hair); background: var(--surface); color: var(--text-primary); font-size: 17px; font-weight: 650; }
.shop-sheet .text-input, .shop-form .text-input { width: 100%; font-family: var(--font-ui); }
.shop-add { width: 100%; margin-top: 14px; }
.shop-lines { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.shop-line { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border-hair-soft); border-radius: var(--radius-md); background: var(--surface); }
.shop-line.is-off { opacity: .55; }
.shop-line-img { width: 48px; height: 48px; border-radius: 10px; flex: none; }
.shop-line-img i { font-size: 22px; }
.shop-line-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.shop-line-main span { color: var(--text-secondary); font-size: 12px; }
.shop-line-main em { color: var(--text-tertiary); font-size: 11.5px; }
.shop-line-qty { display: flex; align-items: center; gap: 6px; }
.shop-line-qty button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border-hair); background: var(--bg-raised); color: var(--text-primary); }
.shop-line-x { font-size: 22px; color: var(--text-tertiary); padding: 0 4px; }
.shop-line-price { font-size: 13px; font-weight: 650; white-space: nowrap; }
.shop-form { margin-top: 18px; padding: 14px; border: 1px solid var(--border-hair); border-radius: var(--radius-md); background: var(--bg-raised); }
.shop-form h3 { margin: 0 0 10px; font-size: 15px; }
.shop-who { display: flex; flex-direction: column; font-size: 13px; padding: 10px 12px; background: var(--surface); border-radius: var(--radius-sm); margin-bottom: 8px; }
.shop-who span { color: var(--text-tertiary); font-size: 12px; }
.shop-form .field-label { margin-top: 12px; display: block; }
.shop-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shop-radios { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; font-size: 13px; color: var(--text-secondary); }
.shop-orders { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.shop-order { text-align: left; padding: 13px; border: 1px solid var(--border-hair); border-radius: var(--radius-md); background: var(--surface); color: var(--text-primary); }
.shop-order-top { display: flex; justify-content: space-between; align-items: center; }
.shop-order-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.shop-order-cta { margin-top: 8px; font-size: 12.5px; font-weight: 650; color: var(--accent-green-dim); }
.shop-chip { font-size: 11.5px; font-weight: 650; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--border-hair); color: var(--text-secondary); }
.shop-chip.st-invoiced { color: var(--accent-blue); border-color: var(--accent-blue); }
.shop-chip.st-paid, .shop-chip.st-shopping, .shop-chip.st-out_for_delivery { color: var(--accent-green-dim); border-color: var(--accent-green); }
.shop-chip.st-delivered { color: var(--ok); border-color: var(--ok); }
.shop-chip.st-cancelled { color: var(--text-tertiary); }
.shop-status { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.shop-steps { list-style: none; display: flex; justify-content: space-between; margin: 12px 0 16px; padding: 0; gap: 2px; }
.shop-steps li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; }
.shop-steps li::before { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--border-hair); z-index: 0; }
.shop-steps li:first-child::before { display: none; }
.shop-steps li.done::before, .shop-steps li.now::before { background: var(--accent-green); }
.shop-steps span { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-hair); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-tertiary); }
.shop-steps li.done span { background: var(--accent-green); border-color: var(--accent-green); color: #1b0d03; font-weight: 800; }
.shop-steps li.now span { border-color: var(--accent-green); color: var(--accent-green-dim); font-weight: 800; }
.shop-steps em { font-style: normal; font-size: 9px; text-align: center; color: var(--text-tertiary); line-height: 1.15; }
.shop-steps li.now em { color: var(--text-primary); font-weight: 650; }
.shop-cancelled { padding: 12px; border-radius: var(--radius-md); border: 1px solid var(--border-hair); background: var(--surface); font-size: 13px; color: var(--text-secondary); margin: 10px 0; }
.shop-h { font-size: 14px; margin: 20px 0 8px; }
.shop-card { padding: 12px; border: 1px solid var(--border-hair-soft); border-radius: var(--radius-md); background: var(--surface); font-size: 13px; }
.shop-card p { margin: 0 0 6px; }
.shop-timeline { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 2px solid var(--border-hair); }
.shop-timeline li { position: relative; padding: 0 0 14px 14px; font-size: 13px; }
.shop-timeline li::before { content: ""; position: absolute; left: -19px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-green); }
.shop-timeline span { margin-left: 8px; color: var(--text-tertiary); font-size: 11.5px; }
.shop-timeline p { margin: 2px 0 0; color: var(--text-secondary); }
.shop-pay { margin: 14px 0; padding: 14px; border: 1px solid var(--accent-green); border-radius: var(--radius-md); background: rgba(255,138,61,.08); }
.shop-pay h3 { margin: 0 0 10px; font-size: 15px; }
.shop-link { display: block; margin: 12px auto 0; color: var(--accent-green-dim); font-size: 13px; text-decoration: underline; }
.shop-danger { color: var(--accent-red); margin-top: 24px; }
.shop-det { margin: 14px 0; } .shop-det summary { cursor: pointer; color: var(--accent-green-dim); font-size: 13px; padding: 6px 0; }
.shop-invoice { background: #fff; color: #161616; border-radius: var(--radius-md); padding: 14px; font-size: 12.5px; }
.shop-invoice small { color: #666; }
.shop-invoice .inv-head, .shop-invoice .inv-grid { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.shop-invoice .inv-r { text-align: right; }
.shop-invoice table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.shop-invoice th, .shop-invoice td { text-align: left; padding: 6px 4px; border-bottom: 1px solid #ddd; vertical-align: top; }
.shop-invoice .inv-totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.shop-invoice .inv-total { font-weight: 800; font-size: 14px; border-top: 2px solid #161616; margin-top: 5px; padding-top: 7px !important; }
.shop-stars { display: flex; gap: 4px; margin: 2px 0 8px; }
.shop-stars button { font-size: 28px; line-height: 1; color: var(--border-hair); padding: 0 2px; }
.shop-stars button.on { color: var(--accent-amber); }
.shop-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.shop-three .shop-stars button { font-size: 20px; }
.shop-stars-ro { color: var(--accent-amber); font-size: 20px; margin: 0 0 6px; } .shop-stars-ro span { color: var(--border-hair); }
.shop-reply { background: var(--bg-raised); padding: 8px 10px; border-radius: var(--radius-sm); }
.shop-prices { display: flex; flex-direction: column; gap: 10px; }
.shop-price { text-align: left; padding: 13px; border: 1px solid var(--border-hair); border-radius: var(--radius-md); background: var(--surface); color: var(--text-primary); }
.shop-price-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; } .shop-price-top span { color: var(--text-tertiary); font-size: 12px; }
.shop-price-main { display: flex; align-items: baseline; gap: 10px; margin: 6px 0; } .shop-price-main strong { font-size: 20px; }
.shop-delta { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--bg-raised); }
.shop-delta.up { color: var(--accent-red); } .shop-delta.down { color: var(--ok); }
.shop-price-date { display: flex; align-items: baseline; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); background: rgba(255,138,61,.12); font-size: 12px; color: var(--text-secondary); }
.shop-price-date b { color: var(--text-primary); font-size: 14px; } .shop-price-date em { font-style: normal; color: var(--text-tertiary); margin-left: auto; }
.shop-spark { display: flex; align-items: flex-end; gap: 4px; height: 90px; margin: 8px 0; }
.shop-spark i { flex: 1; background: var(--accent-green); border-radius: 3px 3px 0 0; min-height: 6px; }
.shop-trend { list-style: none; margin: 8px 0 0; padding: 0; } .shop-trend li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border-hair-soft); font-size: 13px; } .shop-trend span { color: var(--text-tertiary); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 380px) { .shop-banner-text span { display: none; } .tab-btn { font-size: 9px; } }
.shop-top + .panel-subheading { margin-top: 6px; }
.shop-radios input { accent-color: var(--accent-green); width: 18px; height: 18px; vertical-align: middle; margin-right: 8px; }
.shop-radios label { display: flex; align-items: center; }
.shop-three { grid-template-columns: 1fr; gap: 2px; }
.shop-three > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.shop-three .field-label { margin: 0; }
.shop-three .shop-stars { margin: 0; }
.shop-three .shop-stars button { font-size: 24px; }

.tab-btn--shop.has-unread svg { color: var(--accent-red); }
.tab-btn--shop.has-unread::after { content: ""; position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-red); margin: -14px -22px 0 0; }
.tab-btn { position: relative; }
.shop-hold { margin: 10px 0; padding: 12px 14px; border: 1px solid var(--accent-amber); border-radius: var(--radius-md); background: rgba(255,180,84,.1); font-size: 13px; }
.shop-hold b { color: var(--accent-amber); } .shop-hold p { margin: 6px 0 0; color: var(--text-secondary); }
.shop-chat { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--border-hair-soft); border-radius: var(--radius-md); background: var(--bg-raised); }
.shop-msg { max-width: 82%; padding: 8px 12px; border-radius: 14px; font-size: 13.5px; background: var(--surface); }
.shop-msg span { display: block; font-size: 10.5px; font-weight: 700; color: var(--text-tertiary); margin-bottom: 2px; }
.shop-msg p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.shop-msg em { display: block; font-style: normal; font-size: 10.5px; color: var(--text-tertiary); margin-top: 3px; }
.shop-msg.me { align-self: flex-end; background: rgba(255,138,61,.2); border-bottom-right-radius: 4px; }
.shop-msg.them { align-self: flex-start; border-bottom-left-radius: 4px; }
.shop-chat-send { display: flex; gap: 8px; margin-top: 8px; align-items: flex-end; }
.shop-chat-send textarea { flex: 1; padding: 11px 12px; border-radius: var(--radius-md); border: 1px solid var(--border-hair); background: var(--surface); color: var(--text-primary); font: inherit; font-size: 14px; resize: none; max-height: 110px; }
.shop-chat-send .btn-primary { padding: 11px 16px; }

.shop-banner-text .shop-banner-cta { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-green-dim); }
.shop-banner-text .shop-banner-cta + span { font-size: 11.5px; }
.shop-banner-btn { animation: shopPulse 2.4s ease-in-out infinite; }
@keyframes shopPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,138,61,.5); } 50% { box-shadow: 0 0 0 8px rgba(255,138,61,0); } }
@media (prefers-reduced-motion: reduce) { .shop-banner-btn { animation: none; } }
