:root { --bg:#f5f6f8; --card:#fff; --text:#111827; --muted:#6b7280; --accent:#2563eb; --line:#e5e7eb; --warn:#b45309; --warnbg:#fef3c7; }
@media (prefers-color-scheme: dark) { :root { --bg:#0f172a; --card:#1e293b; --text:#f1f5f9; --muted:#94a3b8; --accent:#60a5fa; --line:#334155; --warn:#fbbf24; --warnbg:#3b2f0b; } }
* { box-sizing: border-box; }
body { margin:0; font-family: -apple-system, system-ui, sans-serif; background:var(--bg); color:var(--text); font-size:17px; }
header { display:flex; justify-content:space-between; align-items:center; padding: max(12px, env(safe-area-inset-top)) 20px 8px; }
header h1 { margin:0; font-size:24px; } #clock { color:var(--muted); font-variant-numeric: tabular-nums; }
main { padding: 8px 16px 90px; max-width: 1000px; margin: 0 auto; }
.card { background:var(--card); border-radius:16px; padding:16px; margin:10px 0; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card h3 { margin:0 0 8px; font-size:15px; color:var(--muted); text-transform: uppercase; letter-spacing:.04em; }
.card.big { text-align:center; } #energyTotal { font-size:44px; font-weight:700; }
.grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:10px; }
.climate { background:var(--card); border-radius:16px; padding:16px; }
.climate .t { font-size:40px; font-weight:700; } .climate .sp { color:var(--muted); }
.climate .ctl { display:flex; gap:8px; margin-top:8px; align-items:center; }
.climate .ctl button { width:44px; height:44px; border-radius:22px; font-size:22px; }
.muted { color:var(--muted); } .err { color:#dc2626; min-height:1.2em; }
.notice { background:var(--warnbg); color:var(--warn); border-radius:12px; padding:10px 14px; margin:10px 0; }
button, input, select { font: inherit; } 
button { border:0; background:var(--accent); color:#fff; border-radius:10px; padding:10px 14px; cursor:pointer; }
input, select { border:1px solid var(--line); border-radius:10px; padding:10px 12px; background:var(--card); color:var(--text); }
.row { display:flex; gap:8px; align-items:center; margin:8px 0; } .wrap { flex-wrap:wrap; }
.pill, .chip { background:var(--card); color:var(--text); border:1px solid var(--line); border-radius:999px; padding:8px 14px; text-decoration:none; font-size:15px; }
.pill.on { background:var(--accent); color:#fff; border-color:var(--accent); }
nav { position:fixed; bottom:0; left:0; right:0; display:flex; background:var(--card); border-top:1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav button { flex:1; background:none; color:var(--muted); border-radius:0; padding:8px 0 6px; font-size:22px; display:flex; flex-direction:column; align-items:center; gap:2px; }
nav button span { font-size:11px; } nav button.on { color:var(--accent); }
.chat { min-height: 45vh; max-height: 60vh; overflow-y:auto; display:flex; flex-direction:column; gap:8px; padding:8px 0; }
.msg { max-width:85%; padding:10px 14px; border-radius:16px; white-space:pre-wrap; line-height:1.4; }
.msg.user { align-self:flex-end; background:var(--accent); color:#fff; } .msg.bot { align-self:flex-start; background:var(--card); }
.msg small { display:block; opacity:.6; font-size:11px; margin-top:4px; }
.chatbar { display:flex; gap:8px; } .chatbar input { flex:1; }
.item { display:flex; justify-content:space-between; gap:10px; padding:10px 0; border-bottom:1px solid var(--line); }
.item:last-child { border-bottom:0; } .item .k { font-size:12px; color:var(--muted); }
.item button { padding:6px 10px; font-size:14px; background:var(--line); color:var(--text); }
.mono { font-family: ui-monospace, monospace; font-size:13px; word-break: break-all; }
.login { min-height:100vh; display:flex; align-items:center; justify-content:center; }
.login form { background:var(--card); padding:32px; border-radius:20px; display:flex; flex-direction:column; gap:12px; width:min(90vw, 360px); }
.login h1 { text-align:center; margin:0 0 8px; }
.bar { height:8px; background:var(--line); border-radius:4px; overflow:hidden; margin-top:4px; } .bar i { display:block; height:100%; background:var(--accent); }
