/* Apple HIG look: SF system font, system colors, grouped cards, translucent bars, 44pt touch targets */
:root {
  --bg: #f2f2f7; --panel: #fff; --text: #1c1c1e; --muted: #8a8a8e; --line: rgba(60,60,67,.14);
  --pv: #ff9500; --load: #007aff; --batt: #34c759; --grid: #ff3b30; --export: #af52de; --accent: #007aff;
  --blur: rgba(242,242,247,.72); --fill: rgba(118,118,128,.12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #000; --panel: #1c1c1e; --text: #fff; --muted: #98989f; --line: rgba(84,84,88,.55);
    --pv: #ff9f0a; --load: #0a84ff; --batt: #30d158; --grid: #ff453a; --export: #bf5af2; --accent: #0a84ff; --blur: rgba(0,0,0,.72); --fill: rgba(118,118,128,.24); }
}
:root[data-theme="dark"] { --bg: #000; --panel: #1c1c1e; --text: #fff; --muted: #98989f; --line: rgba(84,84,88,.55);
  --pv: #ff9f0a; --load: #0a84ff; --batt: #30d158; --grid: #ff453a; --export: #bf5af2; --accent: #0a84ff; --blur: rgba(0,0,0,.72); --fill: rgba(118,118,128,.24); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", system-ui, sans-serif; -webkit-font-smoothing: antialiased; letter-spacing: -.01em; }
header { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; padding: 14px 20px; background: var(--blur); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid var(--line); }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 0; } h1 small, h2 small { font-weight: 400; color: var(--muted); font-size: 15px; margin-left: 8px; }
h2 { font-size: 13px; margin: 0 0 8px; color: var(--muted); font-weight: 400; text-transform: uppercase; letter-spacing: -.01em; }
.head-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill { padding: 4px 12px; border-radius: 99px; background: var(--fill); font-size: 13px; color: var(--muted); }
.pill.ok::before { content: "● "; color: var(--batt); } .pill.err::before { content: "● "; color: var(--grid); }
.btn, .tabs button, .nav button { background: var(--fill); border: 0; color: var(--accent); border-radius: 99px; padding: 7px 16px; font: inherit; font-size: 15px; cursor: pointer; text-decoration: none; transition: opacity .15s; }
.btn:hover, .tabs button:hover, .nav button:hover { opacity: .75; }
.btn:active, .tabs button:active, .nav button:active { opacity: .5; }
main { padding: 8px 20px 40px; display: grid; gap: 20px; max-width: 1200px; margin: 0 auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.card, .panel { background: var(--panel); border: 0; border-radius: 16px; padding: 18px; }
.big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sub { color: var(--muted); font-size: 15px; min-height: 20px; }
#pv { color: var(--pv); } #load { color: var(--load); } #soc { color: var(--batt); }
.bar { height: 6px; background: var(--fill); border-radius: 99px; overflow: hidden; margin: 8px 0; }
#socBar { height: 100%; width: 0; background: var(--batt); border-radius: 99px; transition: width .6s; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 11px 8px; border-bottom: .5px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { text-align: left; } th { color: var(--muted); font-weight: 400; font-size: 13px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 8px; }
.toolbar h2 { margin: 0; }
.tabs { display: flex; gap: 2px; padding: 2px; background: var(--fill); border-radius: 9px; }  /* segmented control */
.tabs button { background: transparent; color: var(--text); border-radius: 7px; padding: 5px 14px; font-size: 14px; }
.tabs button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.nav { display: flex; gap: 6px; align-items: center; margin-left: auto; }
#period { min-width: 120px; text-align: center; font-weight: 600; }
.summary { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 6px 0 12px; }
.summary div { font-size: 13px; color: var(--muted); } .summary b { display: block; color: var(--text); font-size: 20px; font-weight: 600; }
.chart { position: relative; height: 340px; } .chart.short { height: 240px; margin-bottom: 12px; }
.empty { color: var(--muted); text-align: center; margin: 8px 0 0; }
.scroll { overflow-x: auto; }
@media (max-width: 700px) {
  header { padding: 10px 16px; } h1 { font-size: 22px; } h1 small { display: block; margin: 2px 0 0; }
  main { padding: 4px 16px 20px; gap: 16px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card, .panel { padding: 14px; border-radius: 14px; }
  .big { font-size: 28px; } .chart { height: 270px; } .chart.short { height: 210px; }
  .head-right { width: 100%; }
  .toolbar { gap: 8px; } .tabs { order: 3; width: 100%; } .tabs button { flex: 1; min-height: 36px; }
  .nav { margin-left: 0; width: 100%; justify-content: space-between; } .nav button { min-height: 44px; min-width: 44px; }
  th, td { padding: 10px 5px; font-size: 15px; }
  .scroll { overflow: visible; } #stringTable { table-layout: fixed; } #stringTable th, #stringTable td { padding: 6px 2px; font-size: 13px; } #stringTable th:first-child { width: 17%; }
}


/* live strings: tighter rows */
#stringTable { font-size: 14px; } #stringTable th, #stringTable td { padding: 5px 8px; } #stringTable th { font-size: 12px; }

/* production by string */
.str { display: grid; grid-template-columns: 4.5em 1fr 5.5em 3em; gap: 10px; align-items: center; padding: 7px 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.str .bar { margin: 0; height: 10px; } .str .bar div { height: 100%; border-radius: 99px; transition: width .4s; }
.str b { text-align: right; } .str small { text-align: right; color: var(--muted); } .str.total { border-top: .5px solid var(--line); margin-top: 4px; }

/* weather strip */
.weather { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; }
.wx-now { display: flex; align-items: center; gap: 12px; } .wx-ico { font-size: 40px; line-height: 1; }
.wx-now .big { font-size: 30px; }
.wx-facts, .wx-sun { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.wx-facts div, .wx-sun div { font-size: 13px; color: var(--muted); } .wx-facts b, .wx-sun b { display: block; color: var(--text); font-size: 17px; font-weight: 600; }
.wx-sun { margin-left: auto; } .wx-where { flex-basis: 100%; min-height: 0; margin-top: -4px; }
.wx-where { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; } .wx-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.wx-pick input { padding: 6px 10px; font: inherit; border: 0; border-radius: 8px; background: var(--fill); color: var(--text); }
@media (max-width: 700px) { .wx-sun { margin-left: 0; } .wx-facts, .wx-sun { gap: 6px 16px; } }

.sv-total { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 6px; } .sv-total .big { font-size: 40px; color: var(--batt); }
