/* ============================================================
   SolarPro – Mobile App Stylesheet
   ============================================================ */

:root {
  --sun: #f5a623;
  --sun-deep: #e8910f;
  --sun-glow: #ffd16a;
  --solar-blue: #1a73e8;
  --solar-teal: #00bcd4;
  --deye-color: #e85c00;
  --solis-color: #0066cc;
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-card2: #1c2333;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 30px rgba(245,166,35,0.25);
  --nav-h: 70px;
  --header-h: 60px;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  user-select: none;
}

/* ─── Splash Screen ─────────────────────────────────────── */
#splash-screen {
  position: fixed; inset: 0;
  background: linear-gradient(145deg, #0d1117 0%, #0a1628 50%, #1a0a00 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
#splash-screen.fade-out { opacity: 0; transform: scale(1.05); pointer-events: none; }
.splash-content { text-align: center; }
.splash-icon {
  width: 90px; height: 90px;
  background: linear-gradient(135deg, var(--sun), var(--sun-deep));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 40px; color: #fff;
  box-shadow: 0 0 40px rgba(245,166,35,0.6), 0 0 80px rgba(245,166,35,0.2);
  animation: pulse-sun 2s infinite;
}
@keyframes pulse-sun {
  0%, 100% { box-shadow: 0 0 40px rgba(245,166,35,0.6), 0 0 80px rgba(245,166,35,0.2); }
  50% { box-shadow: 0 0 60px rgba(245,166,35,0.9), 0 0 120px rgba(245,166,35,0.35); }
}
.splash-content h1 { font-size: 2.2rem; font-weight: 800; color: var(--sun); letter-spacing: -0.5px; }
.splash-content p { color: var(--text-muted); margin-top: 6px; font-size: 0.95rem; }
.splash-loader {
  width: 160px; height: 3px;
  background: var(--bg-card2); border-radius: 3px;
  margin: 28px auto 0; overflow: hidden;
}
.splash-loader div {
  height: 100%; width: 40%;
  background: linear-gradient(90deg, var(--sun), var(--sun-glow));
  border-radius: 3px;
  animation: loader-slide 1.2s ease-in-out infinite;
}
@keyframes loader-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ─── App Shell ─────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; }
#app.hidden { display: none; }

/* ─── Header ─────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.agent-avatar-sm {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--sun), var(--sun-deep));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
  box-shadow: 0 0 12px rgba(245,166,35,0.4);
}
.header-title { display: block; font-weight: 700; font-size: 1rem; color: var(--sun); line-height: 1.1; }
.header-sub { display: block; font-size: 0.7rem; color: var(--text-muted); }
.header-right { display: flex; align-items: center; gap: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); animation: blink 2s infinite; }
@keyframes blink { 0%,100%{ opacity:1; } 50%{ opacity:0.5; } }
.status-text { font-size: 0.75rem; color: var(--success); font-weight: 500; }

/* ─── Screen Container ───────────────────────────────────── */
.screen-container {
  flex: 1; overflow: hidden;
  position: relative;
}
.screen {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + 16px);
  display: none;
  animation: slideIn 0.3s ease;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: block; }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Screen Header ──────────────────────────────────────── */
.screen-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 16px 8px;
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
}
.screen-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.back-btn {
  width: 38px; height: 38px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--text); font-size: 0.9rem; cursor: pointer; flex-shrink: 0;
  transition: background 0.2s;
}
.back-btn:active { background: var(--bg-card2); }

/* ─── Agent Hero ─────────────────────────────────────────── */
.agent-hero {
  margin: 0;
  background: linear-gradient(160deg, #0d1117 0%, #1a0d00 60%, #0d1117 100%);
  border-bottom: 1px solid var(--border);
  padding: 22px 16px 20px;
  position: relative; overflow: hidden;
}
.sun-bg-anim {
  position: absolute; top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(245,166,35,0.18) 0%, transparent 70%);
  border-radius: 50%;
  animation: sun-pulse 4s ease-in-out infinite;
}
@keyframes sun-pulse {
  0%,100%{ transform: scale(1); opacity:1; }
  50%{ transform: scale(1.2); opacity:0.7; }
}
.agent-hero-content { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.agent-avatar-lg {
  width: 64px; height: 64px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--sun-deep), var(--sun));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff;
  box-shadow: 0 0 24px rgba(245,166,35,0.4);
  position: relative;
}
.agent-badge {
  position: absolute; bottom: -2px; right: -2px;
  width: 22px; height: 22px;
  background: var(--bg-card); border: 2px solid var(--bg);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--sun);
}
.agent-intro h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 6px; }
.wave { display: inline-block; animation: wave-anim 1.5s ease-in-out infinite; }
@keyframes wave-anim { 0%,100%{ transform: rotate(0deg); } 50%{ transform: rotate(20deg); } }
.agent-intro p { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }
.agent-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(245,166,35,0.12); border: 1px solid rgba(245,166,35,0.25);
  color: var(--sun); border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; padding: 3px 10px;
}
.btn-voice-hero {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--sun-deep), var(--sun));
  border: none; border-radius: var(--radius);
  color: #fff; font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 20px rgba(245,166,35,0.4);
}
.btn-voice-hero:active { transform: scale(0.98); }

/* ─── Section Title ──────────────────────────────────────── */
.section-title {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
  padding: 18px 16px 8px;
}

/* ─── Stats Grid ─────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; padding: 0 16px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  display: flex; align-items: center; gap: 12px;
  transition: transform 0.2s;
}
.stat-card:active { transform: scale(0.97); }
.stat-card i { font-size: 1.6rem; }
.stat-card.solar i { color: var(--sun); }
.stat-card.battery i { color: var(--success); }
.stat-card.grid i { color: var(--solar-teal); }
.stat-card.saving i { color: #56d364; }
.stat-val { display: block; font-size: 1.3rem; font-weight: 800; line-height: 1; }
.stat-label { display: block; font-size: 0.7rem; color: var(--text-muted); margin-top: 3px; }

/* ─── Quick Actions ──────────────────────────────────────── */
.quick-actions {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 7px; padding: 0 12px;
}
.qa-btn { font-size: 0.65rem !important; }
.qa-btn {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: transform 0.15s;
  color: var(--text); font-size: 0.68rem; font-weight: 600;
}
.qa-btn:active { transform: scale(0.95); }
.qa-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.qa-icon.learn { background: rgba(26,115,232,0.18); color: var(--solar-blue); }
.qa-icon.fix { background: rgba(245,166,35,0.18); color: var(--sun); }
.qa-icon.error { background: rgba(248,81,73,0.18); color: var(--danger); }
.qa-icon.voice { background: rgba(63,185,80,0.18); color: var(--success); }
.qa-icon.battery-qa { background: rgba(45,122,0,0.18); color: #7fff00; }

/* ─── Daily Tip ──────────────────────────────────────────── */
.tip-card {
  margin: 16px; background: linear-gradient(135deg, rgba(245,166,35,0.08), rgba(245,166,35,0.03));
  border: 1px solid rgba(245,166,35,0.25); border-radius: var(--radius);
  padding: 14px 16px;
}
.tip-header {
  font-size: 0.8rem; font-weight: 700; color: var(--sun);
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.tip-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

/* ─── Inverter Selector ──────────────────────────────────── */
.inverter-select-row {
  display: flex; gap: 10px; padding: 0 16px 16px;
}
.inverter-btn {
  flex: 1; padding: 12px;
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 0.85rem; font-weight: 700; cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.inverter-btn.active {
  border-color: var(--sun); color: var(--sun);
  background: rgba(245,166,35,0.1);
}

/* ─── Learn Tabs ─────────────────────────────────────────── */
.learn-tabs {
  display: flex; gap: 6px; padding: 8px 16px 0;
  overflow-x: auto; scrollbar-width: none;
}
.learn-tabs::-webkit-scrollbar { display: none; }
.ltab {
  flex-shrink: 0; padding: 8px 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text-muted);
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
}
.ltab.active { background: var(--sun); border-color: var(--sun); color: #fff; }
.learn-tab-content { display: none; padding: 4px 0; }
.learn-tab-content.active { display: block; }

/* ─── Info Cards ─────────────────────────────────────────── */
.info-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin: 12px 16px; padding: 16px;
}
.info-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 12px; }
.info-card p:last-child { margin-bottom: 0; }
.info-card-header {
  font-size: 0.95rem; font-weight: 700; color: var(--text);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.info-card-header i { color: var(--sun); }
.info-card-header.deye i, .info-card-header.deye { color: var(--deye-color); }
.info-card-header.solis i, .info-card-header.solis { color: var(--solis-color); }
.deye-card { border-color: rgba(232,92,0,0.3); }
.solis-card { border-color: rgba(0,102,204,0.3); }

.info-steps { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; align-items: flex-start; gap: 12px; font-size: 0.84rem; color: var(--text-muted); }
.step-num {
  flex-shrink: 0; width: 24px; height: 24px;
  background: linear-gradient(135deg, var(--sun-deep), var(--sun));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff;
}

.type-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.type-item {
  background: var(--bg-card2); border-radius: var(--radius-sm);
  padding: 12px 10px; text-align: center;
}
.type-item i { font-size: 1.4rem; color: var(--sun); display: block; margin-bottom: 6px; }
.type-item strong { font-size: 0.78rem; color: var(--text); display: block; margin-bottom: 4px; }
.type-item p { font-size: 0.72rem; color: var(--text-muted); margin: 0; line-height: 1.4; }

.metric-list { display: flex; flex-direction: column; gap: 8px; }
.metric-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; background: var(--bg-card2); border-radius: var(--radius-sm);
}
.metric-name { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.metric-desc { font-size: 0.75rem; color: var(--text-muted); text-align: right; max-width: 55%; }

.spec-table { border-radius: var(--radius-sm); overflow: hidden; }
.spec-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  padding: 8px 10px; font-size: 0.8rem;
}
.spec-row.head { background: var(--bg-card2); font-weight: 700; color: var(--text); }
.spec-row:not(.head) { background: rgba(255,255,255,0.02); color: var(--text-muted); }
.spec-row:not(.head):nth-child(even) { background: rgba(255,255,255,0.04); }

.feature-list { display: flex; flex-direction: column; gap: 8px; }
.feat {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.83rem; color: var(--text-muted);
}
.feat i { font-size: 0.9rem; flex-shrink: 0; }
.feat i.fa-check { color: var(--success); }
.feat.danger i { color: var(--danger); }
.feat.danger { color: #f89898; }

.formula-box { margin: 10px 0; }
.formula {
  background: var(--bg-card2); border-left: 3px solid var(--sun);
  padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.82rem; color: var(--sun-glow); font-family: monospace;
  margin-bottom: 8px;
}
.tip-text { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }

.schedule-list { display: flex; flex-direction: column; gap: 12px; }
.schedule-item { border-radius: var(--radius-sm); padding: 12px 14px; }
.schedule-item.monthly { background: rgba(26,115,232,0.1); border: 1px solid rgba(26,115,232,0.2); }
.schedule-item.quarterly { background: rgba(245,166,35,0.08); border: 1px solid rgba(245,166,35,0.2); }
.schedule-item.annual { background: rgba(63,185,80,0.08); border: 1px solid rgba(63,185,80,0.2); }
.freq {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px; padding: 3px 8px; border-radius: 20px;
}
.monthly .freq { background: rgba(26,115,232,0.3); color: #6ab4ff; }
.quarterly .freq { background: rgba(245,166,35,0.3); color: var(--sun); }
.annual .freq { background: rgba(63,185,80,0.3); color: var(--success); }
.schedule-item ul { padding-left: 18px; }
.schedule-item ul li { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 5px; line-height: 1.4; }

/* ─── Filter Bar ─────────────────────────────────────────── */
.inverter-filter-bar {
  display: flex; gap: 8px; padding: 10px 16px;
  overflow-x: auto; scrollbar-width: none;
}
.inverter-filter-bar::-webkit-scrollbar { display: none; }
.filter-btn {
  flex-shrink: 0; padding: 7px 18px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text-muted);
  font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.filter-btn.active { background: var(--sun); border-color: var(--sun); color: #1a0d00; }

/* ─── Trouble List ───────────────────────────────────────── */
.trouble-list { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.trouble-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: border-color 0.2s;
}
.trouble-card:active { transform: scale(0.99); }
.trouble-card-header {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
}
.trouble-icon {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.trouble-icon.deye { background: rgba(232,92,0,0.15); color: var(--deye-color); }
.trouble-icon.solis { background: rgba(0,102,204,0.15); color: var(--solis-color); }
.trouble-icon.general { background: rgba(245,166,35,0.15); color: var(--sun); }
.trouble-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.trouble-brand {
  font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 10px;
  margin-left: auto; flex-shrink: 0;
}
.trouble-brand.deye { background: rgba(232,92,0,0.15); color: var(--deye-color); }
.trouble-brand.solis { background: rgba(0,102,204,0.15); color: var(--solis-color); }
.trouble-brand.general { background: rgba(245,166,35,0.15); color: var(--sun); }
.trouble-body {
  max-height: 0; overflow: hidden; transition: max-height 0.35s ease;
  padding: 0 16px;
}
.trouble-body.open { max-height: 1000px; padding: 0 16px 16px; }
.trouble-body p { font-size: 0.83rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 10px; }
.trouble-steps { display: flex; flex-direction: column; gap: 8px; }
.trouble-step {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 0.82rem; color: var(--text-muted);
}
.t-num {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-card2); display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: var(--sun);
}
.chevron {
  margin-left: auto; color: var(--text-dim); font-size: 0.8rem;
  transition: transform 0.3s;
}
.trouble-card.open .chevron { transform: rotate(180deg); }

/* ─── Error List ─────────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 16px; padding: 10px 14px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.search-bar i { color: var(--text-muted); }
.search-bar input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 0.9rem; font-family: inherit;
}
.search-bar input::placeholder { color: var(--text-dim); }

.error-list { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.error-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex; align-items: flex-start; gap: 12px;
}
.error-card:active { background: var(--bg-card2); }
.error-code-badge {
  flex-shrink: 0; min-width: 58px;
  padding: 5px 8px; border-radius: var(--radius-sm);
  text-align: center; font-size: 0.78rem; font-weight: 800; font-family: monospace;
}
.error-code-badge.deye { background: rgba(232,92,0,0.15); color: var(--deye-color); border: 1px solid rgba(232,92,0,0.3); }
.error-code-badge.solis { background: rgba(0,102,204,0.15); color: #6ab4ff; border: 1px solid rgba(0,102,204,0.3); }
.error-info { flex: 1; }
.error-name { font-size: 0.88rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.error-summary { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }
.error-sev {
  flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px;
}
.sev-high { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.sev-med { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.sev-low { background: var(--success); box-shadow: 0 0 6px var(--success); }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 500; display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal-card {
  width: 100%; max-width: 500px; max-height: 82vh;
  background: var(--bg-card); border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px; overflow-y: auto;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-close {
  position: absolute; right: 20px; top: 20px;
  width: 32px; height: 32px; background: var(--bg-card2);
  border: none; border-radius: 50%; color: var(--text);
  font-size: 0.85rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.modal-content-inner h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.modal-content-inner .fix-step {
  display: flex; gap: 10px; margin-bottom: 10px;
  font-size: 0.85rem; color: var(--text-muted); line-height: 1.5;
}
.modal-content-inner .warning-box {
  background: rgba(248,81,73,0.1); border: 1px solid rgba(248,81,73,0.3);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 0.82rem; color: #f89898; margin-top: 12px;
}
.modal-content-inner .info-box {
  background: rgba(245,166,35,0.08); border: 1px solid rgba(245,166,35,0.25);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 0.82rem; color: var(--sun-glow); margin-top: 12px;
}

/* ─── Bottom Nav ─────────────────────────────────────────── */
.bottom-nav {
  height: var(--nav-h);
  background: var(--bg-card); border-top: 1px solid var(--border);
  display: flex; align-items: center;
  flex-shrink: 0; z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  background: none; border: none; color: var(--text-dim);
  font-size: 0.62rem; font-weight: 600; cursor: pointer;
  padding: 8px 4px; transition: color 0.2s;
}
.nav-btn i { font-size: 1.1rem; }
.nav-btn.active { color: var(--sun); }
.nav-btn.voice-nav { color: var(--success); }
.nav-btn.voice-nav i {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #1a4a1a, #2d7a2d);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; color: var(--success);
  box-shadow: 0 0 14px rgba(63,185,80,0.35);
}

/* ─── Voice Agent Screen ─────────────────────────────────── */
#screen-voice { padding-bottom: 0 !important; }
.voice-screen {
  display: flex; flex-direction: column; height: 100%;
}
.voice-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0; position: relative;
}
.agent-avatar-md {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sun-deep), var(--sun));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
}
.voice-agent-info { flex: 1; }
.voice-agent-info strong { display: block; font-size: 0.95rem; font-weight: 700; }
.voice-agent-info span { font-size: 0.72rem; color: var(--text-muted); }
.voice-status-indicator {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: blink 1.5s infinite;
}
.voice-status-indicator.listening {
  background: var(--danger); box-shadow: 0 0 12px var(--danger);
  animation: blink 0.6s infinite;
}
.voice-status-indicator.thinking {
  background: var(--sun); box-shadow: 0 0 12px var(--sun);
  animation: blink 0.8s infinite;
}
.voice-status-indicator.speaking {
  background: var(--solar-teal); box-shadow: 0 0 12px var(--solar-teal);
}

/* Chat messages */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  -webkit-overflow-scrolling: touch;
}
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.user { flex-direction: row-reverse; }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--sun-deep), var(--sun));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #fff;
}
.msg.user .msg-avatar { background: linear-gradient(135deg, #1a4a80, #2a6aaa); }
.msg-bubble {
  max-width: 78%;
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 10px 14px; font-size: 0.85rem; color: var(--text); line-height: 1.6;
}
.msg.user .msg-bubble {
  background: linear-gradient(135deg, #1a3a6a, #0f2545);
  border-color: rgba(26,115,232,0.3);
  border-radius: var(--radius) 0 var(--radius) var(--radius);
}
.msg-bubble strong { color: var(--sun); }
.msg-bubble p { margin: 0; }
.msg-time { font-size: 0.65rem; color: var(--text-dim); margin-top: 4px; }

/* Typing indicator */
.typing-indicator {
  display: flex; gap: 5px; align-items: center; padding: 4px 0;
}
.typing-indicator span {
  width: 7px; height: 7px; background: var(--text-muted); border-radius: 50%;
  animation: typing-bounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

/* Voice visualiser */
.voice-visualiser {
  background: var(--bg-card); border-top: 1px solid var(--border);
  padding: 14px; text-align: center;
  flex-shrink: 0;
}
.voice-visualiser.hidden { display: none; }
.voice-wave {
  display: flex; align-items: center; justify-content: center; gap: 4px; height: 36px;
}
.voice-wave span {
  width: 4px; border-radius: 4px;
  background: linear-gradient(to top, var(--sun-deep), var(--sun-glow));
  animation: wave-bar 1s ease-in-out infinite;
  height: 8px;
}
.voice-wave span:nth-child(1) { animation-delay: 0.0s; }
.voice-wave span:nth-child(2) { animation-delay: 0.1s; }
.voice-wave span:nth-child(3) { animation-delay: 0.2s; }
.voice-wave span:nth-child(4) { animation-delay: 0.3s; }
.voice-wave span:nth-child(5) { animation-delay: 0.4s; }
.voice-wave span:nth-child(6) { animation-delay: 0.3s; }
.voice-wave span:nth-child(7) { animation-delay: 0.2s; }
.voice-wave span:nth-child(8) { animation-delay: 0.1s; }
.voice-wave span:nth-child(9) { animation-delay: 0.05s; }
.voice-wave span:nth-child(10) { animation-delay: 0.0s; }
@keyframes wave-bar {
  0%, 100% { height: 6px; }
  50% { height: 30px; }
}
.interim-text { font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; font-style: italic; }

/* Input area */
.voice-input-area {
  padding: 12px 16px; border-top: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.text-input-row {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.text-input-row input {
  flex: 1; background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--text); font-size: 0.9rem; font-family: inherit; outline: none;
}
.text-input-row input:focus { border-color: var(--sun); }
.send-btn {
  width: 42px; height: 42px; background: var(--sun); border: none;
  border-radius: var(--radius-sm); color: #fff; font-size: 0.9rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.send-btn:active { transform: scale(0.95); }

.voice-controls {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.voice-mode-label { font-size: 0.75rem; color: var(--text-dim); min-width: 80px; }
.mic-btn {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--sun-deep), var(--sun));
  border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff; cursor: pointer;
  box-shadow: 0 4px 20px rgba(245,166,35,0.4);
  position: relative; transition: transform 0.15s;
}
.mic-btn:active { transform: scale(0.93); }
.mic-btn.listening {
  background: linear-gradient(135deg, #a00, var(--danger));
  box-shadow: 0 4px 24px rgba(248,81,73,0.5);
  animation: mic-pulse 1s infinite;
}
@keyframes mic-pulse {
  0%,100%{ box-shadow: 0 4px 24px rgba(248,81,73,0.5); }
  50%{ box-shadow: 0 4px 40px rgba(248,81,73,0.8), 0 0 60px rgba(248,81,73,0.3); }
}
.mic-ripple {
  position: absolute; inset: -8px; border-radius: 50%;
  border: 2px solid rgba(245,166,35,0.4);
  animation: ripple 2s infinite;
}
@keyframes ripple {
  0%{ transform: scale(1); opacity: 1; }
  100%{ transform: scale(1.5); opacity: 0; }
}

.tts-toggle label {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: var(--text-muted); cursor: pointer;
}
.tts-toggle input { accent-color: var(--sun); }

/* ─── Utility ────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ─── Desktop centering (optional) ──────────────────────── */
@media (min-width: 500px) {
  body { display: flex; justify-content: center; background: #070c12; }
  #splash-screen { max-width: 480px; left: 50%; transform: translateX(-50%); }
  #splash-screen.fade-out { transform: translateX(-50%) scale(1.05); }
  #app { max-width: 480px; width: 100%; box-shadow: 0 0 60px rgba(0,0,0,0.8); }
  .modal-card { max-width: 480px; }
}

/* ============================================================
   BATTERY SETTINGS SCREEN
   ============================================================ */

/* ─── Battery Sub-Tabs ───────────────────────────────────── */
.batt-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 10px 12px 4px;
  flex-shrink: 0;
}
.batt-ltab {
  font-size: 0.72rem !important;
  padding: 7px 4px !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
}
.batt-ltab.active {
  background: linear-gradient(135deg, #1a4a00, #2d7a00) !important;
  color: #7fff00 !important;
  border-color: #2d7a00 !important;
}

/* ─── Battery Tab Content ────────────────────────────────── */
.batt-tab-content {
  display: none;
  padding: 8px 14px 100px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.batt-tab-content.active { display: block; }

/* ─── Battery Cards ──────────────────────────────────────── */
.batt-card { margin-bottom: 14px; border-left: 3px solid #2d7a00; }
.batt-header {
  color: #7fff00 !important;
  border-bottom: 1px solid rgba(45,122,0,0.3) !important;
}
.batt-desc {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

/* ─── SOC Visual Bar ─────────────────────────────────────── */
.soc-visual-bar {
  display: flex;
  border-radius: 10px;
  overflow: hidden;
  height: 36px;
  margin: 12px 0 8px;
  border: 1px solid var(--border);
}
.soc-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  transition: all 0.3s;
}
.soc-zone span { text-shadow: 0 1px 3px rgba(0,0,0,0.7); white-space: nowrap; }
.soc-zone.danger  { background: linear-gradient(135deg, #8b0000, #c0392b); }
.soc-zone.warning { background: linear-gradient(135deg, #7d4e00, #d4830a); }
.soc-zone.caution { background: linear-gradient(135deg, #5a5a00, #b8a800); }
.soc-zone.good    { background: linear-gradient(135deg, #1a4a00, #2d7a00); }

.soc-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.soc-legend .leg {
  font-size: 0.7rem;
  font-weight: 600;
}
.soc-legend .leg.danger  { color: #f85149; }
.soc-legend .leg.warning { color: var(--warning); }
.soc-legend .leg.caution { color: #c9b000; }
.soc-legend .leg.good    { color: var(--success); }

/* ─── Battery Parameter List ─────────────────────────────── */
.batt-param-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.batt-param {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 12px;
  gap: 10px;
}
.batt-param-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.batt-param-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.batt-param-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.batt-param-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.batt-param-value {
  font-size: 0.9rem;
  font-weight: 800;
  font-family: 'Inter', monospace;
  flex-shrink: 0;
  text-align: right;
}

/* Parameter colour variants */
.danger-param  { background: rgba(248,81,73,0.08);  border: 1px solid rgba(248,81,73,0.2); }
.warning-param { background: rgba(210,153,34,0.08); border: 1px solid rgba(210,153,34,0.2); }
.good-param    { background: rgba(63,185,80,0.08);  border: 1px solid rgba(63,185,80,0.2); }
.neutral-param { background: rgba(245,166,35,0.06); border: 1px solid rgba(245,166,35,0.15); }

.batt-param-icon               { background: rgba(245,166,35,0.12); color: var(--sun); }
.danger-param  .batt-param-icon { background: rgba(248,81,73,0.15);  color: #f85149; }
.warning-param .batt-param-icon,
.warn-icon                      { background: rgba(210,153,34,0.15); color: var(--warning); }
.good-param    .batt-param-icon,
.good-icon                      { background: rgba(63,185,80,0.15);  color: var(--success); }
.neutral-param .batt-param-icon,
.neutral-icon                   { background: rgba(245,166,35,0.12); color: var(--sun); }

.danger-val  { color: #f85149; }
.warn-val    { color: var(--warning); }
.good-val    { color: var(--success); }
.neutral-val { color: var(--sun); }
.green-val   { color: var(--success); }
.red-val     { color: #f85149; }

/* ─── Battery Example Box ────────────────────────────────── */
.batt-example-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(245,166,35,0.07);
  border: 1px solid rgba(245,166,35,0.2);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.batt-example-box i { color: var(--sun); margin-top: 2px; flex-shrink: 0; font-size: 1rem; }
.batt-example-box strong { color: var(--sun); }

/* ─── Critical Warning Box ───────────────────────────────── */
.batt-warning {
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.critical-warning {
  background: rgba(248,81,73,0.08);
  border: 1.5px solid rgba(248,81,73,0.35);
}
.warn-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f85149;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.warn-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.warn-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.warn-list li i { color: #f85149; margin-top: 2px; flex-shrink: 0; }
.warn-list li strong { color: var(--text); }

/* ─── Preset Cards ───────────────────────────────────────── */
.preset-card {
  border-radius: 16px;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
}
.recommended-preset { border-color: var(--sun); box-shadow: 0 0 20px rgba(245,166,35,0.15); }

.preset-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.preset-name { font-size: 0.92rem; font-weight: 700; color: var(--text); }
.preset-sub  { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

.preset-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.ls-icon     { background: rgba(248,81,73,0.15);  color: #f85149; }
.save-icon   { background: rgba(63,185,80,0.15);  color: var(--success); }
.hybrid-icon { background: rgba(245,166,35,0.15); color: var(--sun); }

.preset-badge {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}
.critical-badge { background: rgba(248,81,73,0.15);  color: #f85149;       border: 1px solid rgba(248,81,73,0.3); }
.savings-badge  { background: rgba(63,185,80,0.15);  color: var(--success); border: 1px solid rgba(63,185,80,0.3); }
.hybrid-badge   { background: rgba(245,166,35,0.12); color: var(--sun);     border: 1px solid rgba(245,166,35,0.3); }

.preset-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }

.preset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.preset-row:last-child { border-bottom: none; }
.preset-key { color: var(--text-muted); }
.preset-val { font-weight: 600; color: var(--text); }
.ls-val     { color: #f85149; font-weight: 700; }

.preset-ray-btn {
  width: calc(100% - 32px);
  margin: 0 16px 16px;
  padding: 10px;
  background: rgba(245,166,35,0.1);
  border: 1px solid rgba(245,166,35,0.3);
  border-radius: 10px;
  color: var(--sun);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}
.preset-ray-btn:active { background: rgba(245,166,35,0.2); }

/* ─── Strategy Scenarios ─────────────────────────────────── */
.strategy-scenario {
  background: var(--bg-card);
  border-radius: 14px;
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.scenario-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.daily-sc    { background: rgba(245,166,35,0.1);  color: var(--sun); }
.loadshed-sc { background: rgba(248,81,73,0.1);   color: #f85149; }
.away-sc     { background: rgba(0,188,212,0.1);   color: var(--solar-teal); }
.winter-sc   { background: rgba(63,185,80,0.1);   color: var(--success); }

.scenario-body { padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }

.scenario-tip {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.scenario-tip i { color: var(--success); margin-top: 2px; flex-shrink: 0; }
.scenario-tip strong { color: var(--text); }

/* ─── Priority Flow ──────────────────────────────────────── */
.priority-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.priority-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  position: relative;
  flex: 1;
  min-width: 0;
}
.priority-step i:first-child {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.solar-step i:first-child { background: rgba(245,166,35,0.15); color: var(--sun); }
.load-step  i:first-child { background: rgba(26,115,232,0.15);  color: var(--solar-blue); }
.batt-step  i:first-child { background: rgba(63,185,80,0.15);   color: var(--success); }
.grid-step  i:first-child { background: rgba(0,188,212,0.15);   color: var(--solar-teal); }
.pf-arrow { font-size: 0.7rem !important; width: auto !important; height: auto !important; background: none !important; color: var(--border) !important; margin-top: 8px; }

/* ─── Health Check List ──────────────────────────────────── */
.health-check-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

.hc-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-card2);
  border-radius: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.hc-icon { color: var(--sun); font-size: 1rem; margin-top: 1px; flex-shrink: 0; }
.hc-item strong { color: var(--text); }

/* ─── Tech Shortcut Box ──────────────────────────────────── */
.tech-shortcut-box {
  background: rgba(63,185,80,0.07);
  border: 1.5px solid rgba(63,185,80,0.25);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 4px;
}
.ts-title {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}
.ts-steps { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.ts-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.79rem;
  color: var(--text-muted);
}
.ts-step.ok i { color: var(--success); }
.ts-result {
  font-size: 0.77rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(63,185,80,0.2);
  padding-top: 8px;
  font-weight: 600;
}

/* ─── Bottom nav 6-button layout ────────────────────────── */
.bottom-nav {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
}
.bottom-nav .nav-btn span {
  font-size: 0.58rem;
}

