/* ================================================================
 * WattView mobile stylesheet
 *
 * Matches the desktop aesthetic:
 *   - GitHub-ish dark palette (#0D1117 bg, #161B22 card, #30363D border)
 *   - WattView orange gradient (#FF7A00 → #FF5100) as the single accent
 *   - Inter typography
 *
 * Mobile-specific decisions:
 *   - Touch targets ≥ 48px
 *   - Bottom-anchored primary actions (thumb-reachable)
 *   - Fixed bottom nav with safe-area-inset padding for iOS
 *   - Single-column card stack, generous vertical spacing
 *   - No tables, no sidebars, no hover-dependent interactions
 * ================================================================ */

:root {
  /* Palette — keep in sync with desktop login.html */
  --bg:            #0D1117;
  --bg-elevated:   #161B22;
  --bg-input:      #0D1117;
  --border:        #30363D;
  --border-hover:  #484F58;

  --text:          #F0F6FC;
  --text-muted:    #C9D1D9;
  --text-dim:      #8B949E;
  --text-faint:    #6E7681;

  --accent:        #FF7A00;
  --accent-hot:    #FF5100;
  --accent-gradient: linear-gradient(135deg, #FF7A00 0%, #FF5100 100%);

  --success:       #2EA043;
  --danger:        #F85149;
  --info:          #4FC0FF;
  --warning:       #FFBF00;

  /* Spacing & radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Bottom nav height (used by content padding) */
  --nav-height: 64px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  /* Prevent iOS Safari from auto-zooming on input focus */
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-muted);
  min-height: 100vh;
  min-height: 100dvh; /* dynamic viewport on iOS 16+ */
  font-size: 15px;
  line-height: 1.5;
  /* Respect iOS safe areas (notch / home indicator) */
  padding-top:    env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ────────────────────────────────────────────────────────────
 * Layout shells
 * ──────────────────────────────────────────────────────────── */

.page {
  max-width: 640px; /* comfortable on tablets too */
  margin: 0 auto;
  padding: 20px 20px calc(var(--nav-height) + 32px) 20px;
}

.page--auth {
  /* Register / standalone pages without bottom nav */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 20px;
  padding-top:    max(env(safe-area-inset-top), 32px);
  padding-bottom: max(env(safe-area-inset-bottom), 32px);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ────────────────────────────────────────────────────────────
 * Brand header (used on auth pages)
 * ──────────────────────────────────────────────────────────── */

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.brand__logo {
  width: 56px;
  height: 56px;
  background: var(--accent-gradient);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(255, 122, 0, 0.25);
}

.brand__logo svg {
  width: 30px;
  height: 30px;
  fill: white;
}

.brand__name {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.brand__tagline {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ────────────────────────────────────────────────────────────
 * Cards
 * ──────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 14px;
}

.card--clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.card--clickable:active {
  transform: scale(0.995);
  border-color: var(--border-hover);
}

.card__label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.card__value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.card__meta {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
}

.card__delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 10px;
}

.card__delta--up    { color: var(--danger); }
.card__delta--down  { color: var(--success); }
.card__delta--flat  { color: var(--text-dim); }

/* Savings card variant — visually distinct for the headline value prop */
.card--savings {
  background: linear-gradient(135deg, rgba(255, 122, 0, 0.08) 0%, rgba(255, 81, 0, 0.04) 100%);
  border-color: rgba(255, 122, 0, 0.3);
}

.card--savings .card__value {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Empty state card — shown when user has no bills yet */
.card--empty {
  text-align: center;
  padding: 40px 20px;
}

.card--empty__icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.card--empty__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.card--empty__body {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ────────────────────────────────────────────────────────────
 * Bill row (used inside the recent-bills list)
 * ──────────────────────────────────────────────────────────── */

.bill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  min-height: 48px; /* touch target */
}

.bill-row:last-child {
  border-bottom: none;
}

.bill-row__period {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.bill-row__period-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.bill-row__amount {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ────────────────────────────────────────────────────────────
 * Forms
 * ──────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="url"] {
  width: 100%;
  padding: 14px 14px;          /* 14px vertical ≈ 48px touch target */
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;             /* 16px prevents iOS auto-zoom on focus */
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.12);
}

input::placeholder {
  color: var(--text-faint);
}

/* ────────────────────────────────────────────────────────────
 * Buttons
 * ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;            /* iOS/Android guideline */
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
  text-decoration: none;
  -webkit-appearance: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--accent-gradient);
  color: white;
}

.btn--primary:active {
  box-shadow: 0 4px 12px rgba(255, 122, 0, 0.3);
}

.btn--secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ────────────────────────────────────────────────────────────
 * Alerts (flash messages)
 * ──────────────────────────────────────────────────────────── */

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.4;
  border-left: 3px solid;
}

.alert-error    { background: rgba(248, 81, 73, 0.08); border-color: var(--danger);  color: var(--danger); }
.alert-success  { background: rgba(46, 160, 67, 0.08); border-color: var(--success); color: var(--success); }
.alert-info     { background: rgba(79, 192, 255, 0.08); border-color: var(--info);    color: var(--info); }
.alert-warning  { background: rgba(255, 191, 0, 0.08); border-color: var(--warning); color: var(--warning); }

/* ────────────────────────────────────────────────────────────
 * Bottom navigation
 * ──────────────────────────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--nav-height);
  padding: 8px 4px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.bottom-nav__item--active {
  color: var(--accent);
}

.bottom-nav__icon {
  font-size: 22px;
  line-height: 1;
}

/* ────────────────────────────────────────────────────────────
 * Auth prompt (below register/login forms)
 * ──────────────────────────────────────────────────────────── */

.auth-prompt {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-dim);
}

.auth-prompt a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  margin-left: 6px;
}

/* ────────────────────────────────────────────────────────────
 * Upload
 * ──────────────────────────────────────────────────────────── */

.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  background: var(--bg-elevated);
  margin-bottom: 16px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-dropzone__icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.8;
}

.upload-dropzone__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.upload-dropzone__hint {
  font-size: 12px;
  color: var(--text-dim);
}

/* Visually-hidden file input — the label is the clickable surface */
.upload-input {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.upload-filename {
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  word-break: break-all;
}

/* ────────────────────────────────────────────────────────────
 * Utilities
 * ──────────────────────────────────────────────────────────── */

.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 24px 4px 10px;
}

.muted { color: var(--text-dim); }
.accent { color: var(--accent); }
.center { text-align: center; }

/* ────────────────────────────────────────────────────────────
 * Consent checkboxes (registration form)
 * ──────────────────────────────────────────────────────────── */

.form-group--consent {
  margin-bottom: 14px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}

.checkbox-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 2px 0 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-row__text {
  flex: 1 1 auto;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-muted);
}

.checkbox-row__text a {
  color: var(--accent);
  text-decoration: underline;
}

.checkbox-row__text a:hover,
.checkbox-row__text a:focus {
  text-decoration: none;
}

/* Disabled submit button (used on registration form) */
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ─── Credential card detail (mobile/settings.html) ─────────────────────── */
.cred-card__username {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  word-break: break-all;
}
.cred-card__type {
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 6px;
}
.cred-card__meta {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.cred-card__date {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 6px;
}

/* ─── Password show/hide toggle ─────────────────────────────────────────── */
.password-field {
    position: relative;
}

.password-field input[type="password"],
.password-field input[type="text"] {
    /* Reserve room for the toggle button on the right */
    padding-right: 48px;
}

.password-field__toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    padding: 8px 12px;
    cursor: pointer;
    -webkit-appearance: none;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease;
}

.password-field__toggle:hover {
    color: var(--text);
}

.password-field__toggle:active {
    transform: translateY(-50%) scale(0.92);
    color: var(--accent);
}

.password-field__toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ────────────────────────────────────────────────────────────
 * Supply-point summary card (mobile dashboard)
 * ──────────────────────────────────────────────────────────── */

.sp-summary-card__header {
    margin-bottom: 14px;
}

.sp-summary-card__heading {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    word-break: break-all;
}

.sp-summary-card__subline {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 2px;
    line-height: 1.4;
}

.sp-summary-card__metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 12px;
}

.sp-summary-card__metric-label {
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.sp-summary-card__metric-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.sp-summary-footer {
    margin-top: 4px;
    margin-bottom: 18px;
    font-size: 12px;
}

/* ─── Supply-point detail page ─────────────────────────────────────────── */

/* When a card becomes an <a>, strip default link styles. The existing
   .card--clickable rule (cursor + transform + border-color on active)
   continues to apply. */
a.card--clickable {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Sticky page-top header with back button */
.page--no-pad-top {
    padding-top: 0;
}

.sp-detail-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    margin: 0 -20px 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sp-detail-header__back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    transition: background 120ms ease;
}

.sp-detail-header__back:hover,
.sp-detail-header__back:active {
    background: var(--bg-elevated);
}

.sp-detail-header__title {
    flex: 1;
    min-width: 0;
}

.sp-detail-header__contract {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.sp-detail-header__address {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-detail-content {
    padding-top: 8px;
}

/* Chart container sized for mobile viewport */
.sp-detail-chart {
    position: relative;
    height: 220px;
    margin-top: 4px;
}

.sp-detail-chart canvas {
    max-width: 100%;
    height: 100% !important;
}

/* Bill history rows */
.sp-detail-bill__period {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 10px;
    font-variant-numeric: tabular-nums;
}

.sp-detail-bill__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 12px;
}

.sp-detail-bill__metric-label {
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.sp-detail-bill__metric-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.sp-detail-bill__metric-subtitle {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 400;
    color: var(--text-dim);
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
}

/* ─── Energy balance block (net-metering bills, in expanded charges) ───── */
.sp-detail-bill__energy-balance {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.sp-detail-bill__energy-balance-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.sp-detail-bill__energy-balance-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.sp-detail-bill__energy-balance-label {
    color: var(--text-dim);
    flex: 0 0 auto;
}

.sp-detail-bill__energy-balance-value {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.sp-detail-bill__energy-balance-pct {
    color: var(--text-dim);
    font-weight: 400;
    font-size: 12px;
    margin-left: 4px;
}

.sp-detail-bill__energy-balance-delta {
    margin-left: 8px;
    font-size: 11px;
    font-weight: 500;
}

.sp-detail-bill__energy-balance-delta--up   { color: var(--success); }
.sp-detail-bill__energy-balance-delta--down { color: var(--warning); }

.sp-detail-bill__energy-balance-note {
    font-size: 11px;
    color: var(--text-faint);
    font-style: italic;
    margin-top: 4px;
    text-align: right;
}

/* ─── Net-metering narrative (tap-to-reveal "Τι σημαίνει...") ─────────── */
.sp-detail-bill__narrative-wrapper {
    margin: 12px 0 16px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.sp-detail-bill__narrative-toggle {
    display: none;
}

.sp-detail-bill__narrative-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--text);
}

.sp-detail-bill__narrative-button:hover {
    border-color: var(--border-hover);
}

.sp-detail-bill__narrative-button-text {
    font-weight: 500;
}

.sp-detail-bill__narrative-button-icon {
    font-size: 12px;
    color: var(--text-dim);
    transition: transform 0.2s ease;
}

.sp-detail-bill__narrative-toggle:checked + .sp-detail-bill__narrative-button .sp-detail-bill__narrative-button-icon {
    transform: rotate(180deg);
}

.sp-detail-bill__narrative-content {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text);
}

.sp-detail-bill__narrative-toggle:checked ~ .sp-detail-bill__narrative-content {
    display: block;
}

.sp-detail-bill__narrative-title {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.sp-detail-bill__narrative-intro {
    margin: 0 0 16px;
    color: var(--text);
}

.sp-detail-bill__narrative-section {
    margin-bottom: 14px;
}

.sp-detail-bill__narrative-section:last-child {
    margin-bottom: 0;
}

.sp-detail-bill__narrative-section-header {
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.sp-detail-bill__narrative-section p {
    margin: 6px 0;
    color: var(--text-dim);
}

.sp-detail-bill__narrative-list {
    margin: 6px 0;
    padding-left: 18px;
    color: var(--text-dim);
}

.sp-detail-bill__narrative-list li {
    margin-bottom: 4px;
    line-height: 1.45;
}

.sp-detail-bill__narrative-aside {
    color: var(--text-faint);
    font-size: 12px;
    font-style: italic;
}

.sp-detail-bill__narrative-note {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-style: italic;
    font-size: 12px;
}

.sp-detail-bill__narrative-content strong {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ─── Energy autonomy block (NM bills) ─────────────────────────────── */
.sp-detail-bill__autonomy {
    margin: 16px 0;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: 8px;
    border-left: 3px solid var(--accent-secondary, var(--accent));
}

.sp-detail-bill__autonomy-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.sp-detail-bill__autonomy-content {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-dim);
}

.sp-detail-bill__autonomy-content p {
    margin: 0 0 10px;
}

.sp-detail-bill__autonomy-content p:last-child {
    margin-bottom: 0;
}

.sp-detail-bill__autonomy-content strong {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.sp-detail-bill__autonomy-pitch {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    color: var(--text);
}

.sp-detail-bill__autonomy-cta {
    display: block;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.sp-detail-bill__autonomy-cta:hover,
.sp-detail-bill__autonomy-cta:active {
    border-color: var(--accent);
    background: var(--bg-elevated);
}

/* ─── Battery info page ────────────────────────────────────────────── */
.battery-info {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
}

.battery-info__header {
    margin-bottom: 24px;
}

.battery-info__back {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--text-dim);
    font-size: 14px;
    text-decoration: none;
}

.battery-info__back:hover {
    color: var(--accent);
}

.battery-info__title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.battery-info__article {
    color: var(--text-dim);
    line-height: 1.6;
    font-size: 15px;
}

.battery-info__section {
    margin-bottom: 28px;
}

.battery-info__section h2 {
    margin: 0 0 12px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.battery-info__section p {
    margin: 0 0 12px;
}

.battery-info__section ul {
    margin: 0 0 12px;
    padding-left: 22px;
}

.battery-info__section li {
    margin-bottom: 8px;
}

.battery-info__section strong {
    color: var(--text);
    font-weight: 600;
}

.battery-info__section em {
    font-style: italic;
    color: var(--text);
}

.battery-info__section--note {
    margin-top: 32px;
    padding: 14px;
    background: var(--bg-elevated);
    border-left: 3px solid var(--warning);
    border-radius: 6px;
    font-size: 13px;
}

.battery-info__section--note p {
    margin: 0;
    color: var(--text-dim);
}

/* ─── View toggle (segmented control on supply-point detail) ───────────── */
/* Two-option segmented control. The sliding indicator is a separate absolute-
   positioned element behind the buttons; its position is driven by the parent's
   data-view attribute so we can animate via translateX (GPU-accelerated) and
   keep the markup minimal. */
.view-toggle {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px;
    margin: 0 0 16px;
    overflow: hidden;
    user-select: none;
}

.view-toggle__indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    background: var(--accent);
    border-radius: 999px;
    transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

/* Indicator slides right when 'estimated' is the active view. */
.view-toggle[data-view="estimated"] .view-toggle__indicator {
    transform: translateX(100%);
}

.view-toggle__option {
    position: relative;
    z-index: 1;             /* sit above the indicator */
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color 180ms ease;
    -webkit-tap-highlight-color: transparent;
}

/* Active option: text flips to bg color so it contrasts against the
   accent-colored indicator behind it. */
.view-toggle__option--active {
    color: var(--bg);
    font-weight: 600;
}

.view-toggle__option:focus {
    outline: none;
}

.view-toggle__option:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 999px;
}

/* ─── Net-metering meter detail (bill history) ─────────────────────────── */
/* Net-metering bills (those with type 'Ε' export or 'Π' production rows in
   dei_bill_meters) get an accent left-border, sun icon in the period header,
   and an expanded per-meter breakdown beneath the main metrics row. Regular
   single-meter bills are unaffected. */

.sp-detail-bill--net-metering {
    border-left: 3px solid var(--accent);
}

/* Dual-tariff (Γ1Ν) bills carry a quieter gray accent — they're more
   common than net-metering and the breakdown is a routine day/night
   split, not a remarkable solar bill. */
.sp-detail-bill--dual-tariff {
    border-left: 3px solid var(--text-dim);
}

.sp-detail-bill__icon {
    margin-right: 6px;
    font-size: 14px;
    line-height: 1;
}

/* Tariff-code text badge — mirrors what DEI prints on the bill so a Γ1Ν
   customer recognises it at a glance. */
.sp-detail-bill__icon--dual {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: inherit;
    letter-spacing: 0.02em;
}

.sp-detail-bill__meters {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sp-detail-bill__meter-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.sp-detail-bill__meter-label {
    color: var(--text);
    font-weight: 500;
}

/* Raw type code in subdued style — human label leads, code is reference. */
.sp-detail-bill__meter-code {
    color: var(--text-faint);
    font-weight: 400;
    font-size: 11px;
    margin-left: 4px;
}

.sp-detail-bill__meter-value {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ─── Bill card header (period + chevron) ──────────────────────────────── */
.sp-detail-bill__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.sp-detail-bill__chevron {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1;
    user-select: none;
}

/* Whole-card tap target. The chevron rotation is handled in JS via text swap
   ▾ ↔ ▴ rather than a CSS transform, so no transition rule needed. */
.sp-detail-bill {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sp-detail-bill--expanded {
    background: var(--bg-elevated);
}

/* ─── Charge breakdown content (revealed on expand) ────────────────────── */
.sp-detail-bill__charges {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.sp-detail-bill__charges[hidden] {
    display: none;
}

.sp-detail-bill__charges-empty {
    font-size: 13px;
    color: var(--text-dim);
    font-style: italic;
    text-align: center;
    padding: 8px 0;
}

.sp-detail-bill__charge-section {
    margin-bottom: 12px;
}

.sp-detail-bill__charge-section:last-child {
    margin-bottom: 0;
}

.sp-detail-bill__charge-section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.sp-detail-bill__charge-section-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
}

.sp-detail-bill__charge-section-total {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.sp-detail-bill__charge-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 3px 0;
    font-size: 12px;
}

.sp-detail-bill__charge-line-label {
    color: var(--text-dim);
    flex: 1;
    margin-right: 12px;
}

.sp-detail-bill__charge-line-amount {
    color: var(--text);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ─── PDF download button (inside expanded charge breakdown) ───────────── */
.sp-detail-bill__pdf-action {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.sp-detail-bill__pdf-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-elevated);
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
    -webkit-tap-highlight-color: transparent;
}

.sp-detail-bill__pdf-button:hover,
.sp-detail-bill__pdf-button:active {
    background: var(--bg);
    border-color: var(--accent);
    color: var(--accent);
}

.sp-detail-bill__pdf-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

