/* Mis Placas Solares — v5 Ultra Premium */
:root{
  --g:#34C759;--g2:#248A3D;--gg:rgba(48,209,88,.12);
  --sun:#F09000;--sun2:#E8A317;
  --b:#007AFF;--b2:#5AC8FA;
  --p:#AF52DE;--p2:#D89CF6;
  --r:#FF3B30;
  --gr:#8E8E93;--gr2:#AEAEB2;--gr3:#C7C7CC;--gr4:#D1D1D6;--gr5:#E5E5EA;--gr6:#F2F2F7;
  --bg:#F2F2F7;
  --card:rgba(255,255,255,.92);
  --cb:rgba(0,0,0,.06);
  --t1:#1C1C1E;--t2:rgba(0,0,0,.5);--t3:rgba(0,0,0,.3);
  --rad:20px;--sh:0 1px 12px rgba(0,0,0,.08), 0 0 1px rgba(0,0,0,.1);
}
*{margin:0;padding:0;box-sizing:border-box}
html{font-size:16px;-webkit-text-size-adjust:100%}
body{
  font-family:-apple-system,'SF Pro Display','SF Pro Text',system-ui,sans-serif;
  background:var(--bg);color:var(--t1);
  min-height:100dvh;max-width:500px;margin:0 auto;
  padding:env(safe-area-inset-top) 14px calc(env(safe-area-inset-bottom)+16px);
  -webkit-font-smoothing:antialiased;overflow-x:hidden;
}

/* ─ HEADER ─ */
.app-header{
  display:flex;align-items:center;justify-content:space-between;
  padding:14px 2px 6px;position:sticky;top:0;z-index:100;
  background:linear-gradient(to bottom,var(--bg) 70%,transparent);
  -webkit-backdrop-filter:blur(24px);backdrop-filter:blur(24px);
}
.header-left{display:flex;align-items:center;gap:10px}
.header-icon{font-size:1.6rem}
.app-title{font-size:.98rem;font-weight:700;letter-spacing:-.3px}
.app-subtitle{font-size:.68rem;color:var(--t3);font-weight:500}
.live-badge{
  display:flex;align-items:center;gap:5px;
  background:rgba(52,199,89,.1);color:var(--g2);
  font-size:.58rem;font-weight:800;letter-spacing:.8px;
  padding:5px 10px;border-radius:20px;border:1px solid rgba(52,199,89,.2);
}
.live-dot{
  width:5px;height:5px;background:var(--g);border-radius:50%;
  box-shadow:0 0 6px var(--g);animation:pulse 2s ease-in-out infinite;
}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.25}}

/* ─ HERO ─ */
.hero{text-align:center;padding:4px 0 26px;position:relative}
.hero-ring-container{width:200px;height:200px;margin:0 auto 14px;position:relative}
.hero-ring-svg{width:100%;height:100%;transform:rotate(-90deg)}
.ring-bg{fill:none;stroke:var(--gr4);stroke-width:5}
.ring-fill{fill:none;stroke:var(--g);stroke-width:5;stroke-linecap:round;transition:stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1),stroke 0.6s}
.hero-inner{
  position:absolute;inset:0;display:flex;flex-direction:column;
  align-items:center;justify-content:center;
}
.hero-value{
  font-size:3.8rem;font-weight:900;letter-spacing:-3px;line-height:1;
  font-variant-numeric:tabular-nums;transition:color .6s;
}
.hero-unit{font-size:.9rem;font-weight:600;color:var(--t2);margin-top:-1px;letter-spacing:.5px}
.hero-label{font-size:1.1rem;color:var(--t2);font-weight:600;letter-spacing:-.2px}
.hero-sub{font-size:.76rem;color:var(--t3);margin-top:3px;font-weight:500}

.hero.generating .hero-value{color:var(--g2)}
.hero.generating .ring-fill{stroke:var(--g)}
.hero.low .hero-value{color:var(--sun)}
.hero.low .ring-fill{stroke:var(--sun)}
.hero.night .hero-value{color:var(--gr)}
.hero.night .ring-fill{stroke:var(--gr4)}

/* ─ CARDS ─ */
.card{
  background:var(--card);border:1px solid var(--cb);
  border-radius:var(--rad);padding:20px 18px;margin-bottom:14px;
  box-shadow:var(--sh);position:relative;overflow:hidden;
  -webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);
}
.card::after{
  content:'';position:absolute;top:0;left:0;right:0;height:1px;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.06),transparent);
}
.card-title{font-size:.92rem;font-weight:700;margin-bottom:16px;letter-spacing:-.2px}
.card-title-outer{font-size:.92rem;font-weight:700;padding:0 4px;margin-bottom:10px}

/* ─ FLOW ─ */
.flow{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px;gap:0}
.flow-node{text-align:center;flex:0 0 auto}
.flow-bubble{
  width:76px;height:76px;border-radius:50%;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  transition:all .5s;
}
.solar-bubble{background:rgba(240,144,0,.08);border:1.5px solid rgba(240,144,0,.25)}
.home-bubble{background:rgba(0,122,255,.06);border:1.5px solid rgba(0,122,255,.2);width:82px;height:82px}
.grid-bubble{background:rgba(142,142,147,.06);border:1.5px solid rgba(142,142,147,.18)}
.flow-emoji{font-size:1.15rem;line-height:1}
.flow-val{font-size:1.1rem;font-weight:800;line-height:1.15;margin-top:1px;font-variant-numeric:tabular-nums}
.flow-u{font-size:.5rem;color:var(--t3);font-weight:700;text-transform:uppercase;letter-spacing:.6px}
.flow-name{display:block;font-size:.6rem;color:var(--t3);margin-top:5px;font-weight:600}

.flow-arrows{flex:1;display:flex;flex-direction:column;align-items:center;gap:7px;min-width:32px}
.flow-arrow{
  height:16px;width:100%;position:relative;
  display:flex;align-items:center;justify-content:center;
}
.flow-arrow::before{
  content:'';position:absolute;top:50%;left:0;right:0;height:1px;transform:translateY(-50%);
}
.solar-arrow::before{background:linear-gradient(90deg,rgba(255,159,10,.45),rgba(255,159,10,.05))}
.grid-import-arrow::before{background:linear-gradient(270deg,rgba(142,142,147,.05),rgba(142,142,147,.4))}
.grid-import-arrow .arrow-particle{background:var(--gr);animation:particle-reverse 2.2s linear infinite}
.export-arrow::before{background:linear-gradient(90deg,rgba(191,90,242,.05),rgba(191,90,242,.45))}
.arrow-particle{
  width:4px;height:4px;border-radius:50%;position:absolute;left:0;
  animation:particle 2.2s linear infinite;
}
.solar-arrow .arrow-particle{background:var(--sun);box-shadow:0 0 5px rgba(255,159,10,.4)}
.grid-arrow .arrow-particle{background:var(--gr)}
.export-arrow .arrow-particle{background:var(--p);box-shadow:0 0 5px rgba(191,90,242,.4)}
.arrow-label{
  font-size:.56rem;font-weight:700;color:var(--t3);z-index:1;
  background:var(--bg);padding:1px 5px;border-radius:4px;font-variant-numeric:tabular-nums;
}
.flow-arrow.inactive .arrow-particle{animation:none;opacity:0}
.flow-arrow.inactive::before{opacity:.06}
.flow-arrow.inactive .arrow-label{opacity:.25}
@keyframes particle{0%{left:0;opacity:0}8%{opacity:1}92%{opacity:1}100%{left:calc(100% - 4px);opacity:0}}
@keyframes particle-reverse{0%{left:calc(100% - 4px);opacity:0}8%{opacity:1}92%{opacity:1}100%{left:0;opacity:0}}

/* ─ FLOW BARS ─ */
.flow-bars{display:flex;flex-direction:column;gap:14px}
.flow-bar-row{}
.bar-info{display:flex;justify-content:space-between;align-items:center;font-size:.75rem;font-weight:600;margin-bottom:6px}
.bar-info b{color:var(--t2);font-variant-numeric:tabular-nums}
.bar-track{height:7px;border-radius:4px;background:var(--gr5);display:flex;overflow:hidden;box-shadow:inset 0 1px 2px rgba(0,0,0,.06)}
.bar-seg{height:100%;transition:width 1s cubic-bezier(.25,1,.5,1)}
.solar-seg{background:linear-gradient(90deg,#D88508,var(--sun2));border-radius:4px 0 0 4px}
.grid-seg{background:linear-gradient(90deg,var(--gr3),var(--gr2));border-radius:0 4px 4px 0}
.blue-seg{background:linear-gradient(90deg,var(--b),var(--b2));border-radius:4px 0 0 4px}
.purple-seg{background:linear-gradient(90deg,#9040D0,var(--p2));border-radius:0 4px 4px 0}
.bar-legend{display:flex;gap:14px;margin-top:6px;flex-wrap:wrap}
.bar-legend span{font-size:.65rem;color:var(--t3);display:flex;align-items:center;gap:4px}
.bar-legend b{color:var(--t1);font-weight:700;font-variant-numeric:tabular-nums}
.dot{width:7px;height:7px;border-radius:50%;flex-shrink:0;display:inline-block}
.sun-bg{background:var(--sun)}.gray-bg{background:var(--gr)}.blue-bg{background:var(--b)}.purple-bg{background:var(--p)}

/* ─ STATS ─ */
.stats{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px;margin-bottom:14px}
.stat{
  background:var(--card);border:1px solid var(--cb);
  border-radius:16px;padding:12px 10px;text-align:center;
  box-shadow:var(--sh);position:relative;overflow:hidden;
  -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
}
.stat::after{content:'';position:absolute;bottom:0;left:0;right:0;height:2px;border-radius:0 0 16px 16px}
.stat.generated::after{background:var(--sun)}
.stat.consumed::after{background:var(--b)}
.stat.selfcons::after{background:var(--g)}
.stat.export::after{background:var(--p)}
.stat.import::after{background:var(--gr)}
.stat.saving::after{background:var(--g)}
.stat-top{display:flex;align-items:center;justify-content:center;gap:4px;margin-bottom:6px}
.stat-emoji{font-size:1rem}
.stat-lbl{font-size:.58rem;color:var(--t3);font-weight:700;text-transform:uppercase;letter-spacing:.4px}
.stat-num{font-size:1.55rem;font-weight:900;letter-spacing:-1px;font-variant-numeric:tabular-nums;line-height:1}
.stat-num small{font-size:.65rem;font-weight:600;color:var(--t3);margin-left:2px}
.stat-num.green{color:var(--g)}

/* ─ MONEY ─ */
.money-card{
  background:linear-gradient(145deg,#E8F5E9,#F1F8E9,#E8F5E9)!important;
  border-color:rgba(52,199,89,.15)!important;
}
.money-rows{display:flex;flex-direction:column;gap:12px;margin-bottom:16px}
.money-line{display:flex;align-items:center;justify-content:space-between;gap:10px}
.money-line-left{display:flex;align-items:center;gap:10px}
.money-line-icon{font-size:1.2rem}
.money-line-label{font-size:.78rem;font-weight:600}
.money-line-detail{font-size:.62rem;color:var(--t3);margin-top:1px;font-variant-numeric:tabular-nums}
.money-line-val{font-size:1.4rem;font-weight:900;font-variant-numeric:tabular-nums;flex-shrink:0}
.money-line-val.red{color:var(--r)}
.money-line-val.green{color:var(--g)}

.money-net{
  text-align:center;padding:16px 0;margin-bottom:14px;
  border-top:1px solid rgba(0,0,0,.06);border-bottom:1px solid rgba(0,0,0,.06);
  background:rgba(0,0,0,.03);border-radius:14px;
}
.money-net-lbl{font-size:.7rem;color:var(--t2);font-weight:600;display:block;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px}
.money-net-val{
  font-size:2.4rem;font-weight:900;letter-spacing:-2px;
  font-variant-numeric:tabular-nums;
}

.money-compare{
  display:flex;flex-direction:column;gap:8px;margin-bottom:14px;
  padding:14px;background:rgba(0,0,0,.12);border-radius:14px;
}
.money-compare-row{display:flex;justify-content:space-between;align-items:center;font-size:.75rem;font-weight:600}
.money-compare-row .red{color:var(--r);font-variant-numeric:tabular-nums}
.money-compare-row .green{color:var(--g);font-variant-numeric:tabular-nums}
.money-compare-row .big{font-size:1.1rem;font-weight:900}
.money-compare-row.highlight{
  padding-top:8px;margin-top:4px;
  border-top:1px solid rgba(255,255,255,.06);
}

.money-tariffs{display:flex;flex-direction:column;gap:4px}
.tariff-row{display:flex;justify-content:space-between;font-size:.65rem;color:var(--t3);padding:2px 0}
.tariff-row span:last-child{font-weight:700;color:var(--t3);font-variant-numeric:tabular-nums}

/* ─ CHART ─ */
.chart-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}
.chart-badge{font-size:.65rem;color:var(--sun);font-weight:700;background:rgba(255,159,10,.07);padding:3px 10px;border-radius:10px}
.chart{display:flex;align-items:flex-end;gap:2px;height:100px;padding-bottom:20px}
.bar-w{flex:1;display:flex;flex-direction:column;align-items:center;height:100%;justify-content:flex-end}
.bar-col{
  width:100%;max-width:22px;border-radius:5px 5px 2px 2px;min-height:1px;
  background:linear-gradient(to top,#C07A08,var(--sun2));
  transition:height .8s cubic-bezier(.34,1.56,.64,1);
}
.bar-col.now{background:linear-gradient(to top,#1FA04A,#6EE79A);box-shadow:0 2px 8px rgba(48,209,88,.25);position:relative}
.bar-col.now::after{content:'';position:absolute;top:-3px;left:50%;transform:translateX(-50%);width:5px;height:5px;border-radius:50%;background:var(--g);box-shadow:0 0 6px var(--g)}
.bar-col.later{background:var(--gr4);opacity:.35}
.bar-h{font-size:.46rem;color:var(--t3);margin-top:5px;font-weight:700}

/* ─ MONTH ─ */
.month-card{background:linear-gradient(145deg,#E3F2FD,#E8EAF6,#E3F2FD)!important;border-color:rgba(0,122,255,.1)!important}
.month-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}
.month-badge{font-size:.62rem;font-weight:700;background:rgba(255,255,255,.06);padding:4px 11px;border-radius:10px;border:1px solid rgba(255,255,255,.04)}
.month-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.month-item{text-align:center}
.month-val{font-size:1.6rem;font-weight:900;letter-spacing:-.5px;font-variant-numeric:tabular-nums}
.month-val.green{color:var(--g)}
.month-sub{font-size:.62rem;color:rgba(255,255,255,.32);font-weight:500;margin-top:2px}

/* ─ MONTHLY BILL ─ */
.month-bill{display:flex;flex-direction:column;gap:10px;margin-bottom:16px}
.bill-row{display:flex;justify-content:space-between;align-items:center;font-size:.82rem;font-weight:600;padding:6px 0}
.bill-row .red{color:var(--r);font-variant-numeric:tabular-nums;font-size:.95rem}
.bill-row .green{color:var(--g);font-variant-numeric:tabular-nums;font-size:.95rem}
.bill-row.total{border-top:1px solid rgba(0,0,0,.08);padding-top:10px;margin-top:4px}
.bill-row.total span:last-child{font-size:1.2rem;font-weight:900;font-variant-numeric:tabular-nums}
.bill-compare{
  background:rgba(0,0,0,.03);border-radius:14px;padding:14px;
  display:flex;flex-direction:column;gap:8px;margin-bottom:16px;
}
.bill-compare-row{display:flex;justify-content:space-between;align-items:center;font-size:.78rem;font-weight:600}
.bill-compare-row .red{color:var(--r);font-variant-numeric:tabular-nums}
.bill-compare-row .green{color:var(--g);font-variant-numeric:tabular-nums}
.bill-compare-row .big{font-size:1.15rem;font-weight:900}
.bill-compare-row.highlight{border-top:1px solid rgba(0,0,0,.08);padding-top:8px;margin-top:2px}
.bill-estimate{
  background:rgba(0,0,0,.03);border-radius:14px;padding:16px;text-align:center;
}
.bill-est-title{font-size:.75rem;font-weight:700;color:var(--t2);margin-bottom:12px;text-transform:uppercase;letter-spacing:.5px}
.bill-est-grid{display:flex;justify-content:space-around;margin-bottom:8px}
.bill-est-item{text-align:center}
.bill-est-val{font-size:1.6rem;font-weight:900;font-variant-numeric:tabular-nums}
.bill-est-val.green{color:var(--g)}
.bill-est-sub{font-size:.6rem;color:var(--t3);margin-top:2px;font-weight:500}
.bill-est-note{font-size:.62rem;color:var(--t3);font-style:italic}

/* ─ LIFETIME ─ */
.lifetime{display:flex;justify-content:space-around;text-align:center}
.life-val{font-size:1.5rem;font-weight:800;font-variant-numeric:tabular-nums}
.life-sub{font-size:.6rem;color:var(--t3);margin-top:2px;font-weight:500}

/* ─ INVERTER ─ */
.inverter-head{font-size:.88rem;font-weight:700;display:flex;align-items:center;gap:8px;margin-bottom:12px}
.inv-grid{display:grid;grid-template-columns:1fr 1fr;gap:3px 12px}
.inv-row{display:flex;justify-content:space-between;font-size:.7rem;padding:5px 0;border-bottom:1px solid rgba(255,255,255,.025)}
.inv-row span:first-child{color:var(--t3)}
.inv-row span:last-child{font-weight:600;font-variant-numeric:tabular-nums}

/* ─ WEATHER ─ */
.weather-row{display:flex;align-items:center;justify-content:space-between;padding:14px 18px!important}
.weather-left{display:flex;align-items:center;gap:10px}
.weather-icon{font-size:1.4rem}
.weather-temp{font-size:1.2rem;font-weight:800;font-variant-numeric:tabular-nums}
.weather-loc{font-size:.68rem;color:var(--t3);font-weight:500}

/* ─ FOOTER ─ */
.footer{text-align:center;padding:12px 0 20px}
.footer div:first-child{font-size:.72rem;color:var(--t3);font-variant-numeric:tabular-nums}
.footer-small{font-size:.58rem;color:var(--t3);opacity:.4;margin-top:4px}

/* ─ OFFLINE ─ */
.offline-banner{
  display:none;background:rgba(255,159,10,.08);color:var(--sun);
  text-align:center;padding:10px;font-weight:700;font-size:.76rem;
  border-radius:14px;margin-bottom:8px;border:1px solid rgba(255,159,10,.12);
}
body.offline .offline-banner{display:block}
body.offline .live-badge{background:rgba(142,142,147,.08);color:var(--gr2);border-color:rgba(142,142,147,.1)}
body.offline .live-dot{background:var(--gr2);box-shadow:none;animation:none}

/* ─ LOGIN ─ */
.login-screen{
  position:fixed;inset:0;z-index:9999;
  background:#F2F2F7;
  display:flex;align-items:center;justify-content:center;
  padding:20px;
  transition:opacity .4s,transform .4s;
}
.login-screen.hidden{opacity:0;transform:scale(.96);pointer-events:none}
.login-card{
  width:100%;max-width:340px;text-align:center;
}
.login-icon{font-size:3.5rem;margin-bottom:12px;filter:drop-shadow(0 0 20px rgba(255,159,10,.3))}
.login-title{font-size:1.4rem;font-weight:800;letter-spacing:-.5px;margin-bottom:4px}
.login-sub{font-size:.78rem;color:var(--t3);margin-bottom:28px}
.login-form{display:flex;flex-direction:column;gap:14px}
.login-field{text-align:left}
.login-field label{display:block;font-size:.7rem;font-weight:700;color:var(--t3);text-transform:uppercase;letter-spacing:.5px;margin-bottom:6px}
.login-field input{
  width:100%;padding:14px 16px;
  background:#fff;border:1.5px solid #D1D1D6;border-radius:14px;
  color:#1C1C1E;font-size:1.05rem;font-weight:600;
  outline:none;transition:border-color .3s;
  -webkit-appearance:none;
}
.login-field input:focus{border-color:var(--g)}
.login-field input::placeholder{color:#AEAEB2;font-weight:500}
.login-error{
  font-size:.78rem;color:var(--r);font-weight:600;
  min-height:1.2em;transition:all .3s;
}
.login-btn{
  width:100%;padding:16px;margin-top:4px;
  background:var(--g);color:#000;
  font-size:1rem;font-weight:800;letter-spacing:-.2px;
  border:none;border-radius:14px;cursor:pointer;
  transition:all .2s;
  -webkit-appearance:none;
}
.login-btn:active{transform:scale(.97);opacity:.85}
.login-btn:disabled{opacity:.4}

/* ─ ANIMATIONS ─ */
@keyframes up{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:translateY(0)}}
.card,.stats,.card-title-outer{animation:up .55s cubic-bezier(.25,1,.5,1) backwards}
.flow-card{animation-delay:.03s}
.stats{animation-delay:.06s}
.money-card{animation-delay:.09s}

@media(max-width:374px){
  .hero-value{font-size:3rem}
  .flow-bubble{width:64px;height:64px}.home-bubble{width:70px;height:70px}
  .stat-num{font-size:1.3rem}
  .stats{grid-template-columns:1fr 1fr}
}
