:root { --bg:#f4f5f7; --card:#fff; --text:#1c2430; --muted:#6b7684; --line:#e3e6ea; --accent:#d9480f; --ok:#2b8a3e; }
@media (prefers-color-scheme: dark) {
  :root { --bg:#14181d; --card:#1e242b; --text:#e8ecf0; --muted:#97a1ad; --line:#2d353e; --accent:#ff922b; --ok:#69db7c; }
}
* { box-sizing: border-box; }
body { margin:0; font:16px/1.45 system-ui, sans-serif; background:var(--bg); color:var(--text); }
header { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; background:var(--card); border-bottom:1px solid var(--line); }
nav a { margin-left:16px; color:var(--text); text-decoration:none; }
nav a:hover { text-decoration:underline; }
main { max-width:900px; margin:0 auto; padding:16px; }
h1 { font-size:1.3rem; margin:8px 0 16px; }
h2 { font-size:1.05rem; margin:24px 0 8px; }
.grid { display:grid; gap:16px; grid-template-columns:repeat(auto-fit, minmax(260px, 1fr)); }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:16px; }
.card h2 { margin:0 0 8px; }
.big { font-size:2.4rem; font-weight:600; line-height:1.1; }
.muted { color:var(--muted); font-size:.9rem; }
.badge { display:inline-block; padding:2px 10px; border-radius:999px; font-size:.85rem; border:1px solid var(--line); }
.badge.on { background:var(--accent); border-color:var(--accent); color:#fff; }
.stats { display:flex; gap:24px; margin:12px 0; flex-wrap:wrap; }
.stats div span { display:block; font-size:1.25rem; font-weight:600; }
form.inline { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:12px; }
input, select, button { font:inherit; padding:8px 10px; border-radius:8px; border:1px solid var(--line); background:var(--card); color:var(--text); }
input[type=number] { width:90px; }
button { background:var(--accent); border-color:var(--accent); color:#fff; cursor:pointer; }
a.button { display:inline-block; padding:8px 10px; border-radius:8px; border:1px solid var(--line); color:var(--text); text-decoration:none; }
.msg { padding:10px 12px; border-radius:8px; border:1px solid var(--line); background:var(--card); margin-bottom:16px; }
.msg.err { border-color:var(--accent); }
.scroll { overflow-x:auto; }
table { width:100%; border-collapse:collapse; background:var(--card); border:1px solid var(--line); border-radius:12px; }
th, td { padding:8px 10px; text-align:left; border-bottom:1px solid var(--line); white-space:nowrap; }
th { font-size:.85rem; color:var(--muted); font-weight:600; }
tr:last-child td { border-bottom:0; }
td.num, th.num { text-align:right; }
.bar { height:10px; background:var(--accent); border-radius:5px; min-width:2px; }
td.barcell { width:40%; }

/* Grafice */
:root { --heat:#d9480f; --series-1:#257de0; }
@media (prefers-color-scheme: dark) { :root { --heat:#e76624; --series-1:#338ced; } }
.filters .seg { display:inline-flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.filters .seg a { padding:8px 12px; color:var(--text); text-decoration:none; background:var(--card); }
.filters .seg a + a { border-left:1px solid var(--line); }
.filters .seg a.on { background:var(--accent); color:#fff; }
.chartcard { margin-top:16px; }
.chartcard h3 { font-size:.95rem; margin:16px 0 4px; }
.chartwrap { width:100%; }
svg.chart { width:100%; height:auto; display:block; overflow:visible; }
svg.chart .grid { stroke:var(--line); stroke-width:1; }
svg.chart .base { stroke:var(--muted); stroke-width:1; }
svg.chart .axis { fill:var(--muted); font-size:11px; }
svg.chart .hit, svg.chart .hitarea { fill:transparent; }
svg.chart .hit:hover { fill:var(--text); fill-opacity:.06; }
svg.chart .roomline { fill:none; stroke:var(--series-1); stroke-width:2; stroke-linejoin:round; }
svg.chart .setline { fill:none; stroke:var(--muted); stroke-width:1.5; stroke-dasharray:4 3; }
svg.chart .heatband { fill:var(--heat); fill-opacity:.16; }
svg.chart .cross { stroke:var(--muted); stroke-width:1; }
.legend { display:flex; gap:16px; flex-wrap:wrap; font-size:.85rem; color:var(--muted); }
.legend .sw { display:inline-block; width:18px; height:10px; margin-right:6px; vertical-align:middle; }
.legend .sw.roomline { height:0; border-top:2px solid var(--series-1); }
.legend .sw.setline { height:0; border-top:2px dashed var(--muted); }
.legend .sw.heatband { background:var(--heat); opacity:.35; border-radius:2px; }
details { margin-top:12px; }
summary { cursor:pointer; color:var(--muted); font-size:.9rem; }
.tip { position:fixed; z-index:10; pointer-events:none; background:var(--card); color:var(--text); border:1px solid var(--line);
       border-radius:8px; padding:6px 10px; font-size:.85rem; box-shadow:0 4px 14px rgba(0,0,0,.15); white-space:nowrap; }
.card .devid { margin:-6px 0 8px; font-size:.8rem; }
.rename { margin-top:12px; }
.rename input[type=text] { flex:1; min-width:0; }

/* Autentificare și jurnal */
.authbox { max-width:380px; margin:40px auto; }
.authbox h1 { margin-top:0; }
form.stack { display:flex; flex-direction:column; gap:6px; }
form.stack label { margin-top:8px; font-size:.9rem; }
form.stack button { margin-top:16px; }
nav { display:flex; align-items:center; flex-wrap:wrap; }
nav .user { margin-left:24px; display:inline-flex; align-items:center; gap:8px; color:var(--muted); }
nav .user a { margin-left:0; color:var(--muted); }
form.logout { display:inline; margin:0 0 0 8px; }
button.link { background:none; border:0; padding:0; color:var(--muted); text-decoration:underline; cursor:pointer; font-size:inherit; }
table.log td .dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:8px; background:var(--line); vertical-align:middle; }
table.log tr.good .dot { background:var(--ok); }
table.log tr.warn .dot { background:#e8a400; }
table.log tr.bad .dot { background:var(--accent); }
table.log tr.bad td:nth-child(2) { font-weight:600; }