/* ==========================================================================
   LuzReal - Sistema de Estilos Material Design 3 para Android Mobile
   ========================================================================== */

:root {
  --primary: #0d9488;
  --primary-light: #14b8a6;
  --primary-dark: #0f766e;
  --primary-container: #134e4a;
  --on-primary-container: #ccfbf1;
  
  --bg-dark: #090d16;
  --surface-1: #111827;
  --surface-2: #1f2937;
  --surface-3: #374151;
  --surface-card: #151e2e;
  --border-subtle: #1e293b;
  --border-focus: #2dd4bf;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --valle-green: #10b981;
  --valle-bg: rgba(16, 185, 129, 0.15);
  --llano-yellow: #f59e0b;
  --llano-bg: rgba(245, 158, 11, 0.15);
  --punta-red: #ef4444;
  --punta-bg: rgba(239, 68, 68, 0.15);

  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}

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

input, select, textarea, button {
  font-family: inherit;
  user-select: auto;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-family);
  line-height: 1.4;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Contenedor principal de estilo móvil Android */
.app-container {
  width: 100%;
  max-width: 500px;
  min-height: 100vh;
  background-color: var(--bg-dark);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 50px rgba(0,0,0,0.7);
  padding-bottom: 85px; /* Espacio para la barra de navegación inferior */
}

/* ==========================================================================
   Cabecera Superior
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9, 13, 22, 0.92);
  backdrop-filter: blur(12px);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  filter: drop-shadow(0 2px 6px rgba(13, 148, 136, 0.4));
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #2dd4bf 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.contract-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(13, 148, 136, 0.2);
  color: #2dd4bf;
  border: 1px solid rgba(45, 212, 191, 0.3);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contract-badge.has-bono {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

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

.btn-header-change-bill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-header-change-bill:active {
  transform: scale(0.96);
  background: var(--primary);
  color: #fff;
}

.btn-header-install {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(13, 148, 136, 0.15);
  color: var(--primary);
  border: 1px solid rgba(13, 148, 136, 0.4);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-header-install:active, .btn-header-install:hover {
  transform: scale(0.96);
  background: var(--primary);
  color: #fff;
}

/* ==========================================================================
   Contenido Principal & Vistas (Tabs)
   ========================================================================== */
.view-section {
  display: none;
  padding: 16px;
  flex: 1;
  animation: fadeIn 0.25s ease-out forwards;
}

.view-section.active {
  display: block;
}

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

/* ==========================================================================
   Hero Card: Hora Actual & Precio en Vivo
   ========================================================================== */
.hero-current-hour-card {
  background: linear-gradient(145deg, #131c2e, #182236);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}

.hero-glow {
  position: absolute;
  top: -50px;
  right: -50px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.hero-current-hour-card.period-valle .hero-glow {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.35) 0%, transparent 70%);
}
.hero-current-hour-card.period-llano .hero-glow {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.35) 0%, transparent 70%);
}
.hero-current-hour-card.period-punta .hero-glow {
  background: radial-gradient(circle, rgba(239, 68, 68, 0.35) 0%, transparent 70%);
}

.hero-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary-light);
  box-shadow: 0 0 8px var(--primary-light);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.period-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.period-badge.valle {
  background: var(--valle-bg);
  color: var(--valle-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.period-badge.llano {
  background: var(--llano-bg);
  color: var(--llano-yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.period-badge.punta {
  background: var(--punta-bg);
  color: var(--punta-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.hero-price-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 6px 0;
}

.hero-price-amount {
  font-size: 2.75rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
}

.hero-price-unit {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.hero-bono-comparison {
  margin-top: 4px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fbbf24;
}

.hero-bono-comparison .strike-price {
  text-decoration: line-through;
  color: var(--text-muted);
}

.hero-breakdown-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.breakdown-chip {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.72rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.breakdown-chip .chip-label {
  color: var(--text-muted);
  font-size: 0.65rem;
}

.breakdown-chip .chip-val {
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================================
   Selector de Fecha (Hoy / Mañana)
   ========================================================================== */
.date-toggle-bar {
  display: flex;
  background: var(--surface-1);
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.date-toggle-btn {
  flex: 1;
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.date-toggle-btn.active {
  background: var(--surface-2);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.date-toggle-btn .tomorrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
}

/* ==========================================================================
   Métricas Resumen del Día
   ========================================================================== */
.daily-highlights-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.highlight-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.highlight-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}

.highlight-card.min .highlight-label { color: var(--valle-green); }
.highlight-card.max .highlight-label { color: var(--punta-red); }
.highlight-card.avg .highlight-label { color: #38bdf8; }

.highlight-price {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.highlight-hour {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   Gráfico de Barras de 24 Horas
   ========================================================================== */
.chart-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

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

.chart-title {
  font-size: 0.88rem;
  font-weight: 700;
}

.chart-legend {
  display: flex;
  gap: 10px;
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-color {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.bars-container {
  display: flex;
  align-items: flex-end;
  height: 140px;
  gap: 3px;
  padding-bottom: 22px;
  position: relative;
  overflow-x: auto;
}

.hour-bar-col {
  flex: 1;
  min-width: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  cursor: pointer;
  position: relative;
}

.hour-bar-fill {
  width: 100%;
  border-radius: 3px 3px 0 0;
  transition: height 0.3s ease, transform 0.15s ease;
}

.hour-bar-col:hover .hour-bar-fill,
.hour-bar-col.active .hour-bar-fill {
  transform: scaleY(1.05);
  filter: brightness(1.25);
}

.hour-bar-col.current::after {
  content: '';
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 6px #ffffff;
}

.hour-bar-label {
  font-size: 0.58rem;
  color: var(--text-muted);
  position: absolute;
  bottom: 0;
  text-align: center;
  width: 100%;
}

.hour-tooltip-box {
  background: var(--surface-2);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

/* ==========================================================================
   Lista Detallada de las 24 Horas
   ========================================================================== */
.schedule-list-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

.schedule-header {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.filter-chips {
  display: flex;
  gap: 6px;
}

.filter-chip {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
}

.filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.hours-table {
  max-height: 380px;
  overflow-y: auto;
}

.hour-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
}

.hour-row:hover, .hour-row.current-row {
  background: rgba(13, 148, 136, 0.08);
}

.hour-row.current-row {
  border-left: 3px solid var(--primary-light);
}

.hour-row-time {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hour-pill {
  width: 6px;
  height: 24px;
  border-radius: 3px;
}

.time-range {
  font-size: 0.82rem;
  font-weight: 700;
}

.time-period-tag {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.hour-row-prices {
  text-align: right;
}

.main-price {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.sub-price {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Pestaña: Recomendador de Electrodomésticos
   ========================================================================== */
.recommender-header {
  margin-bottom: 16px;
}

.recommender-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.recommender-header p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.appliances-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.appliance-btn {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  position: relative;
}

.appliance-btn-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.btn-edit-appliance {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-edit-appliance:hover, .btn-edit-appliance:active {
  background: var(--primary);
  color: white;
}

.appliances-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 16px;
}

/* ==========================================================================
   Branding Gran Pico
   ========================================================================== */
.header-granpico-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  padding: 3px 8px;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.header-granpico-badge:hover,
.header-granpico-badge:active {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 3px 10px rgba(255, 255, 255, 0.4);
}

.header-granpico-logo {
  height: 20px;
  width: auto;
  max-width: 125px;
  display: block;
  object-fit: contain;
}

.granpico-sponsor-card {
  background: linear-gradient(135deg, #0b1c2d 0%, #132a42 100%);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin: 18px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.granpico-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.granpico-tagline {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #f59e0b;
}

.granpico-logo-wrap {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  padding: 6px 12px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  width: fit-content;
}

.granpico-logo-img {
  height: 28px;
  width: auto;
  max-width: 170px;
  display: block;
  object-fit: contain;
}

.btn-granpico-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #002d62 0%, #004b93 100%);
  color: #ffffff;
  padding: 9px 15px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  text-decoration: none;
  border: 1px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 2px 8px rgba(0, 45, 98, 0.4);
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-granpico-link:hover,
.btn-granpico-link:active {
  transform: scale(0.97);
  background: linear-gradient(135deg, #00387b 0%, #005bb3 100%);
  border-color: #f59e0b;
}

@media (max-width: 400px) {
  .header-granpico-logo {
    max-width: 100px;
    height: 18px;
  }
  .granpico-sponsor-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .btn-granpico-link {
    align-self: flex-end;
  }
}

.recommendation-result-card {
  background: linear-gradient(145deg, #13242b, #193539);
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.best-window-time {
  font-size: 1.6rem;
  font-weight: 900;
  color: #f8fafc;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.window-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 12px 0;
}

.cost-item {
  display: flex;
  flex-direction: column;
}

.cost-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.cost-val {
  font-size: 1.15rem;
  font-weight: 800;
}

.cost-val.best { color: #34d399; }
.cost-val.worst { color: #f87171; }

.savings-banner {
  background: rgba(16, 185, 129, 0.15);
  border: 1px dashed #34d399;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: #34d399;
  font-weight: 700;
}

/* ==========================================================================
   Pestaña: Bono Social & Consumo
   ========================================================================== */
.bono-tracker-card {
  background: linear-gradient(145deg, #1f1d15, #2b2515);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.bono-tracker-card.not-active {
  background: var(--surface-card);
  border-color: var(--border-subtle);
}

.bono-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.bono-title h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fbbf24;
}

.bono-title p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.bono-discount-pill {
  background: #f59e0b;
  color: #000;
  font-size: 0.75rem;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 20px;
}

.progress-track-wrapper {
  margin: 16px 0 10px 0;
}

.progress-track-bg {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, #10b981 0%, #f59e0b 80%, #ef4444 100%);
  transition: width 0.5s ease;
}

.progress-limits-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.bono-alert-box {
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  margin-top: 12px;
  line-height: 1.4;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.bono-alert-box.good {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.bono-alert-box.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.bono-alert-box.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Panel de sincronización de Endesa / Consumo */
.sync-section-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 16px;
}

.sync-tabs-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.sync-tab-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.sync-tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.sync-tab-panel {
  display: none;
}

.sync-tab-panel.active {
  display: block;
}

.endesa-instructions {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
}

.endesa-instructions ol {
  padding-left: 18px;
  margin: 8px 0;
}

.btn-open-endesa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: #005bb5;
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.file-dropzone {
  border: 2px dashed var(--border-focus);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  background: rgba(13, 148, 136, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-dropzone:hover {
  background: rgba(13, 148, 136, 0.12);
}

.dropzone-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.dropzone-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Pestaña: Mi Factura / Perfil de Contrato
   ========================================================================== */
.bill-summary-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 16px;
}

.bill-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.contract-rows-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contract-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.contract-row-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.contract-row-value {
  font-size: 0.85rem;
  font-weight: 700;
}

.btn-primary-action {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

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

/* ==========================================================================
   Barra de Navegación Inferior (Material 3 Bottom Navigation)
   ========================================================================== */
.bottom-nav-bar {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 500px;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0));
  z-index: 50;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 0;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 700;
}

.nav-item.active {
  color: var(--primary-light);
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
}

/* ==========================================================================
   Modal / Bottom Sheet para Cambiar o Configurar Factura
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 100;
  justify-content: center;
  align-items: flex-end;
  animation: fadeInOverlay 0.2s ease-out forwards;
}

.modal-overlay.active {
  display: flex;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-sheet {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  background: var(--surface-1);
  border-top: 1px solid var(--border-focus);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0));
  overflow-y: auto;
  animation: slideUpSheet 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpSheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  margin: -12px auto 16px;
}

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

.sheet-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.btn-close-sheet {
  background: var(--surface-2);
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
}

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

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px;
  font-size: 0.85rem;
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.2);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Interruptor Switch Android */
.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-2);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.switch-label h4 {
  font-size: 0.85rem;
  font-weight: 700;
}

.switch-label p {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.switch-input {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch-input input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--surface-3);
  transition: 0.3s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* ==========================================================================
   Aviso Legal, Privacidad y Fuentes Oficiales Modal
   ========================================================================== */
.btn-legal-link {
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-legal-link:hover,
.btn-legal-link:active {
  color: var(--text-primary);
  border-color: var(--primary);
  background: rgba(13, 148, 136, 0.15);
  transform: translateY(-1px);
}

.legal-section {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.legal-section h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.legal-section p {
  font-size: 0.73rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.legal-section li {
  font-size: 0.73rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.legal-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

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

