:root {
  --bg: #0D1626;        /* albastru de celulă PV, noaptea */
  --panel: #142039;
  --panel-2: #1B2A47;
  --line: #273857;
  --text: #E9EFF8;
  --muted: #8C9CB8;
  --sun: #F5B53F;       /* producție */
  --grid: #4FC3E8;      /* injecție în rețea */
  --lei: #7ED69B;       /* bani */
  --price: #B7A2FF;     /* preț PZU */
  --warn: #FF8A65;
  --r-lg: 18px;
  --r-sm: 10px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: 'Barlow', system-ui, sans-serif; font-size: 16px; line-height: 1.45;
  font-variant-numeric: tabular-nums; min-height: 100vh;
  padding: calc(var(--safe-t) + 8px) 0 calc(var(--safe-b) + 24px);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--grid); outline-offset: 2px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.num { font-family: 'Barlow Semi Condensed', 'Barlow', sans-serif; font-weight: 600; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.unit { font-size: .55em; color: var(--muted); font-weight: 500; margin-left: 3px; letter-spacing: 0; }

/* ---------- antet ---------- */
.top { display: flex; align-items: center; gap: 12px; padding: 10px 0 14px; }
.top h1 { font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 600; font-size: 24px; margin: 0; flex: 1; line-height: 1.15; }
.top .sub { display: block; font-family: 'Barlow', sans-serif; font-size: 13px; color: var(--muted); font-weight: 400; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; flex: none; }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- prima pagină ---------- */
.hero { padding: 6px 0 22px; }
.hero .live { font-size: 64px; line-height: 1; }
.hero .live .unit { font-size: 22px; }
.hero .caption { color: var(--muted); margin-top: 6px; font-size: 14px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: var(--r-sm); overflow: hidden; margin-top: 18px; }
.hero-stats div { background: var(--panel); padding: 10px 12px; }
.hero-stats b { display: block; font-size: 21px; }
.hero-stats span { font-size: 12px; color: var(--muted); }

.plant { display: block; text-decoration: none; color: inherit; background: var(--panel); border-radius: var(--r-lg); padding: 16px 16px 14px; margin-bottom: 12px; border: 1px solid transparent; }
.plant:active { border-color: var(--line); }
.plant-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.plant-name { font-weight: 600; font-size: 17px; }
.plant-meta { font-size: 12.5px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--lei); margin-right: 6px; vertical-align: 1px; }
.dot.stale { background: var(--muted); } .dot.bad { background: var(--warn); }
.plant-live { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 10px; gap: 10px; }
.plant-live .big { font-size: 40px; line-height: 1; }
.plant-live .inj { text-align: right; font-size: 13px; color: var(--muted); }
.plant-live .inj b { display: block; font-size: 20px; color: var(--grid); }
.bar { height: 4px; background: var(--panel-2); border-radius: 2px; margin: 12px 0 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--sun); border-radius: 2px; transition: width .6s; }
.spark { width: 100%; height: 46px; display: block; }
.plant-foot { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 8px; font-size: 12px; color: var(--muted); }
.plant-foot b { display: block; font-size: 17px; color: var(--text); }
.plant-foot .money b { color: var(--lei); }
.all-link { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border: 1px dashed var(--line); border-radius: var(--r-lg); color: var(--muted); text-decoration: none; margin-bottom: 18px; }
.links { display: flex; gap: 10px; margin-top: 8px; }
.links a { flex: 1; text-align: center; padding: 12px; border-radius: var(--r-sm); background: var(--panel); color: var(--muted); text-decoration: none; font-size: 14px; }

/* ---------- pagina parcului ---------- */
.seg { display: flex; background: var(--panel); border-radius: 14px; padding: 4px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg button { flex: 1; border: 0; background: none; padding: 9px 10px; border-radius: 10px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); }
.datenav { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 6px; }
.datenav button.arrow { width: 44px; height: 44px; border: 0; background: none; color: var(--text); font-size: 26px; line-height: 1; }
.datenav button.arrow:disabled { opacity: .25; }
.datenav label { position: relative; font-weight: 600; font-size: 18px; padding: 6px 12px; border-radius: 10px; }
.datenav label input { position: absolute; inset: 0; opacity: 0; width: 100%; }
.range-pick { display: flex; gap: 8px; align-items: center; margin: 14px 0 6px; flex-wrap: wrap; }
.range-pick input { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; color-scheme: dark; }
.range-pick .chips { display: flex; gap: 6px; width: 100%; }
.chip { border: 1px solid var(--line); background: none; border-radius: 99px; padding: 5px 12px; font-size: 13px; color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 4px; }
.kpi span { font-size: 12.5px; color: var(--muted); display: block; }
.kpi b { font-size: 26px; line-height: 1.1; }
.kpi.prod b { color: var(--sun); } .kpi.inj b { color: var(--grid); } .kpi.money b { color: var(--lei); }

.chart-card { background: var(--panel); border-radius: var(--r-lg); padding: 12px 10px 10px; margin-top: 12px; position: relative; }
.readout { min-height: 46px; padding: 0 6px 8px; display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.readout .t { font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 600; font-size: 20px; color: var(--text); min-width: 52px; }
.readout b { font-family: 'Barlow Semi Condensed', sans-serif; font-size: 20px; font-weight: 600; }
.readout .p b { color: var(--sun); } .readout .g b { color: var(--grid); } .readout .z b { color: var(--price); } .readout .l b { color: var(--lei); }
.canvas-box { position: relative; height: 280px; touch-action: pan-y; }
.chart-tools { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px 0; gap: 8px; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; }
.legend button { border: 1px solid var(--line); background: none; border-radius: 99px; padding: 4px 10px 4px 8px; font-size: 13px; color: var(--muted); }
.legend button i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.legend button[aria-pressed="false"] { opacity: .45; }
.tool { border: 0; background: var(--panel-2); border-radius: 10px; padding: 6px 10px; font-size: 13px; color: var(--muted); }
.pending { font-size: 13px; color: var(--sun); padding: 6px 6px 0; }

.chart-card.full { position: fixed; inset: 0; z-index: 50; border-radius: 0; padding: calc(var(--safe-t) + 10px) 14px calc(var(--safe-b) + 10px); display: flex; flex-direction: column; }
.chart-card.full .canvas-box { flex: 1; height: auto; }

.rev { background: var(--panel); border-radius: var(--r-lg); padding: 16px; margin-top: 12px; }
.rev h2 { font-size: 16px; margin: 0 0 4px; font-weight: 600; }
.rev .total { font-size: 34px; color: var(--lei); }
.rev .how { font-size: 13px; color: var(--muted); margin-top: 2px; }
.rev .alt { font-size: 14px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }

table.t { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
table.t th { text-align: right; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.t th:first-child, table.t td:first-child { text-align: left; }
table.t td { text-align: right; padding: 9px 4px; border-bottom: 1px solid var(--line); }
table.t td.lei { color: var(--lei); font-weight: 600; }
table.t tr.link { cursor: pointer; }
table.t tr.link:active td { background: var(--panel-2); }
table.t tfoot td { font-weight: 600; border-bottom: 0; }
.flag { font-size: 11px; color: var(--sun); margin-left: 4px; }

/* PZU / stare */
.pzu-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pzu-row .m { flex: 1; }
.pzu-row input { width: 110px; text-align: right; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; }
.note { font-size: 13px; color: var(--muted); }
.card { background: var(--panel); border-radius: var(--r-lg); padding: 16px; margin-top: 12px; }
.card h3 { margin: 0 0 8px; font-size: 15px; }

/* login */
.login { max-width: 360px; margin: 18vh auto 0; padding: 0 20px; }
.login h1 { font-family: 'Barlow Semi Condensed', sans-serif; font-size: 34px; margin: 0 0 18px; }
.login input { width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); margin-bottom: 10px; }
.login button { width: 100%; padding: 14px; border-radius: 12px; border: 0; background: var(--sun); color: #1B1300; font-weight: 600; }
.err { color: var(--warn); font-size: 14px; min-height: 20px; }
.empty { padding: 40px 10px; text-align: center; color: var(--muted); }

@media (min-width: 640px) {
  .canvas-box { height: 340px; }
  .hero .live { font-size: 80px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ajustări după testul vizual */
.icon-btn { color: var(--text); }
.kpi b, .hero-stats b, .rev .alt b, .plant-foot b { white-space: nowrap; }
.kpi b { font-size: 24px; }
.hero-stats b { font-size: 19px; }
.rev .alt b { flex: none; }
.readout { row-gap: 2px; }
