/* ── „Mélyvíz” UI ─────────────────────────────────────────────────────────── */
:root {
  --bg: #0B1220;
  --panel: #111A2B;
  --panel-2: #16213A;
  --panel-3: #1B2742;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #E8EEF7;
  --text-2: #B7C3D8;
  --muted: #8A9AB5;
  --accent: #3FD2C7;
  --accent-2: #7FE6DE;
  --accent-dim: rgba(63, 210, 199, 0.12);
  --accent-line: rgba(63, 210, 199, 0.4);
  --ok: #46D39A;
  --ok-text: #7FE9B8;
  --ok-dim: rgba(70, 211, 154, 0.12);
  --bad: #FF6B7A;
  --bad-text: #FFA3AC;
  --bad-dim: rgba(255, 107, 122, 0.12);
  --warn: #FFB65C;
  --warn-text: #FFD9A3;
  --warn-dim: rgba(255, 182, 92, 0.10);
  --info-text: #A9C0FF;
  --info-dim: rgba(122, 162, 255, 0.14);
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Bricolage Grotesque", "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 24px;
  --radius-s: 14px;
  --radius-xs: 10px;
  --rail-w: 88px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(63, 210, 199, 0.14), transparent 60%),
    radial-gradient(760px 520px at 100% 105%, rgba(90, 120, 255, 0.10), transparent 60%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--bg); padding: 1px 6px; border-radius: 6px; color: var(--text-2); }
h1 { margin: 0; font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -0.01em; }
h2 { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.mono { font-family: var(--font-mono); }
.ok { color: var(--ok-text); }
.bad { color: var(--bad-text); }
.warn { color: var(--warn-text); }
.error { color: var(--bad-text); font-weight: 600; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Shell: left rail + content ──────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.rail {
  width: var(--rail-w); flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 20px 8px; border-right: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.6); backdrop-filter: blur(8px);
}
.rail .brand {
  width: 48px; height: 48px; border-radius: 16px; background: var(--accent); color: var(--bg);
  display: flex; align-items: center; justify-content: center; margin-bottom: 18px;
}
.rail .brand:hover { background: var(--accent-2); }
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 72px; padding: 10px 0; border-radius: var(--radius-s);
  color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0.02em; text-align: center;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.rail .spacer { flex-grow: 1; }
.rail .logout { margin: 0; }
.rail .logout button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 72px; padding: 10px 0; border: 0; background: transparent; border-radius: var(--radius-s);
  color: var(--muted); font-size: 11px; font-weight: 500;
}
.rail .logout button:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.rail .app-version { font-family: var(--font-mono); font-size: 10px; color: var(--muted); opacity: 0.7; margin-top: 4px; letter-spacing: 0.02em; text-align: center; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .avatar {
  width: 32px; height: 32px; border-radius: 10px; background: var(--panel-3); color: var(--text);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; text-transform: uppercase;
}
.content { flex-grow: 1; min-width: 0; padding: 24px 32px 40px; display: flex; flex-direction: column; gap: 20px; }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.page-head .titles { display: flex; flex-direction: column; gap: 2px; }
.page-head .sub { font-size: 13px; color: var(--muted); }
.page-head .grow { flex-grow: 1; }
.crumb { font-size: 12px; color: var(--muted); }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--text); }
.back {
  width: 44px; height: 44px; border-radius: var(--radius-s); border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); display: flex; align-items: center; justify-content: center;
}
.back:hover { color: var(--text); background: var(--panel-2); }

/* ── Cards / panels ──────────────────────────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.card.glow { position: relative; overflow: hidden; }
.card.glow::before {
  content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(63, 210, 199, 0.18), transparent 70%); pointer-events: none;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.span-2 { grid-column: span 2; }
.inset { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }

/* ── Badges, pills, dots ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.2;
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.on { background: var(--ok-dim); color: var(--ok-text); }
.badge.on .dot { background: var(--ok); }
.badge.off { background: var(--bad-dim); color: var(--bad-text); }
.badge.off .dot { background: transparent; border: 2px solid var(--bad); }
.badge.warn { background: var(--warn-dim); color: var(--warn-text); border: 1px solid rgba(255, 182, 92, 0.3); }
.badge.neutral { background: rgba(255, 255, 255, 0.06); color: var(--text-2); }
.badge.accent { background: var(--accent-dim); color: var(--accent); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 6px;
  font-size: 12px; font-weight: 600; font-family: var(--font-mono); white-space: nowrap;
}
.pill.ok { background: var(--ok-dim); color: var(--ok-text); }
.pill.bad { background: var(--bad-dim); color: var(--bad-text); }
.pill.warn { background: var(--warn-dim); color: var(--warn-text); }
.pill.info { background: var(--info-dim); color: var(--info-text); }
.pill.neutral { background: rgba(255, 255, 255, 0.07); color: var(--text-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.live-chip {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px;
  background: rgba(63, 210, 199, 0.08); color: #9FE9E2; font-size: 13px; font-weight: 500;
}
.live-chip .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.8s ease-out infinite; }
.live-chip.stale .live-dot { animation: none; background: var(--warn); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63, 210, 199, 0.6); } 100% { box-shadow: 0 0 0 10px rgba(63, 210, 199, 0); } }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: var(--radius-s); border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--panel-3); color: var(--text); }
.btn.primary { background: var(--accent); color: var(--bg); border-color: transparent; font-weight: 700; }
.btn.primary:hover { background: var(--accent-2); color: var(--bg); }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--accent-line); }
.btn.ghost:hover { background: var(--accent-dim); color: var(--accent-2); }
.btn.danger { background: transparent; color: #FF8A96; border-color: rgba(255, 107, 122, 0.3); }
.btn.danger:hover { background: var(--bad-dim); color: var(--bad-text); }
.btn.warn { background: var(--warn); color: #1A1200; border-color: transparent; font-weight: 700; }
.btn.small { height: 40px; padding: 0 14px; font-size: 13px; }
.btn.icon { width: 40px; height: 40px; padding: 0; color: var(--muted); background: var(--panel); border-color: var(--line); }
.btn.icon:hover { color: var(--text); background: var(--panel-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: default; }
.btn.block { width: 100%; height: 52px; font-size: 15px; }
form.inline-form { display: inline; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions .grow { flex-grow: 1; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span, .field-label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.field input, .field select, .input {
  height: 48px; width: 100%; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font-size: 15px; outline: 0;
}
.field input:focus, .field select:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63, 210, 199, 0.2); }
.field input[readonly] { color: var(--muted); border-style: dashed; }
.field input[type="file"] { padding: 10px 14px; height: auto; }
.field .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.field.mono input { font-family: var(--font-mono); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1 1 200px; }
.form-foot { display: flex; align-items: center; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.form-foot .hint { flex-grow: 1; }
.sec-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.section { display: flex; flex-direction: column; gap: 14px; }

/* segmented control */
.seg { display: inline-flex; gap: 2px; padding: 4px; border-radius: var(--radius-s); background: var(--bg); border: 1px solid var(--line); }
.seg > button, .seg > label {
  height: 36px; padding: 0 16px; border-radius: 10px; border: 0; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.seg > button:hover, .seg > label:hover { color: var(--text); }
.seg > button.on, .seg > label.on, .seg > button[aria-selected="true"] { background: var(--panel-3); color: var(--text); }
.seg.tall > button, .seg.tall > label { height: 44px; padding: 0 18px; font-size: 14px; }
.seg input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.seg .n { padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 11px; font-family: var(--font-mono); }

/* switch (checkbox) */
.switch-row { display: flex; align-items: flex-start; gap: 16px; }
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px; background: var(--panel-3); transition: background 0.15s;
  cursor: pointer;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--muted); transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(22px); background: var(--bg); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(63, 210, 199, 0.3); }

/* chips (presets, filters) */
.chip {
  height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono);
}
.chip:hover { border-color: rgba(255, 255, 255, 0.2); color: var(--text); }
.chip.on { background: var(--accent-dim); border-color: var(--accent-line); color: var(--accent); }

/* ── Banners ─────────────────────────────────────────────────────────────── */
.banner {
  display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 16px;
  border-radius: var(--radius-s); border: 1px solid var(--line-2); background: var(--panel-2);
}
.banner > .text { flex-grow: 1; font-size: 14px; }
.banner.warn { background: var(--warn-dim); border-color: rgba(255, 182, 92, 0.35); color: var(--warn-text); }
.banner.warn strong { color: #FFE3B8; }
.banner.accent { background: rgba(63, 210, 199, 0.08); border-color: var(--accent-line); }
.banner.accent strong { color: #CFF5F1; }
.banner .close { width: 36px; height: 36px; border: 0; background: transparent; color: inherit; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.banner .close:hover { background: rgba(255, 255, 255, 0.08); }
.banner-dismiss { margin: 0; }
.token {
  font-family: var(--font-mono); font-size: 14px; padding: 10px 14px; border-radius: 10px;
  background: var(--bg); color: var(--text); letter-spacing: 0.04em; user-select: all; word-break: break-all;
}

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; position: relative; overflow: hidden; }
.login-page::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(700px 520px at 50% 50%, rgba(63, 210, 199, 0.14), transparent 65%);
}
.rings { position: fixed; left: 50%; top: 50%; width: 1600px; height: 1600px; margin: -800px 0 0 -800px; z-index: -1; pointer-events: none; animation: ripple 7s ease-in-out infinite alternate; }
@keyframes ripple { from { transform: scale(0.94); opacity: 0.55; } to { transform: scale(1.06); opacity: 1; } }
.login-box {
  position: relative; width: min(420px, 100%); margin: 16px; padding: 40px 40px 32px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 28px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55); display: flex; flex-direction: column; gap: 28px;
}
.login-box .logo { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.login-box .mark {
  width: 64px; height: 64px; border-radius: 20px; background: var(--accent); color: var(--bg);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 12px 30px rgba(63, 210, 199, 0.35);
}
.login-box h1 { font-size: 34px; }
.login-box p { margin: 0; font-size: 14px; color: var(--muted); }
.login-box form { display: flex; flex-direction: column; gap: 18px; }
.login-box .field input { height: 52px; font-size: 16px; }
.login-box .foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); padding-top: 4px; border-top: 1px solid var(--line); }

/* ── Dashboard: meter switcher ───────────────────────────────────────────── */
.switcher { position: relative; }
.switcher summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px;
  padding: 8px 14px 8px 10px; border-radius: var(--radius-s); background: var(--panel); border: 1px solid var(--line-2);
}
.switcher summary::-webkit-details-marker { display: none; }
.switcher summary:hover { background: var(--panel-2); }
.switcher .sw-icon { width: 32px; height: 32px; border-radius: 10px; background: var(--accent-dim); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.switcher .sw-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.switcher .sw-label { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.switcher .sw-name { font-size: 16px; font-weight: 600; }
.switcher .chev { color: var(--muted); }
.switcher[open] .chev { transform: rotate(180deg); }
.switcher ul {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 20; min-width: 300px; margin: 0; padding: 8px; list-style: none;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  display: flex; flex-direction: column; gap: 2px;
}
.switcher li a {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 14px; border-radius: 12px;
  color: var(--text); font-size: 14px; font-weight: 500;
}
.switcher li a:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.switcher li a.active { background: var(--accent-dim); color: var(--accent); }
.switcher li a .reading { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }

/* ── Dashboard: day navigation ───────────────────────────────────────────── */
.day-nav { display: flex; align-items: center; gap: 8px; }
.day-nav .day-input {
  height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel);
  color: var(--text); font-size: 14px; font-weight: 600; outline: 0; font-family: var(--font);
}
.day-nav .day-input:focus { border-color: var(--accent); }
.day-nav .today { height: 40px; }
/* Consumption card head: day picker + range switcher side by side, wrapping on narrow cards */
.cons-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }

/* ── Dashboard: odometer wheels ──────────────────────────────────────────── */
.odometer { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.wheels { display: flex; align-items: flex-end; gap: 6px; }
.wheel {
  --wheel-h: 72px;
  position: relative; overflow: hidden;
  width: 52px; height: var(--wheel-h); border-radius: 10px;
  font-family: var(--font-mono); font-size: 42px; font-weight: 600; line-height: 1;
}
.wheel::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08), inset 0 -12px 18px rgba(0, 0, 0, 0.35);
}
/* Rolling digit strip: 0–9 twice; --idx picks the visible one, the transition rolls it. */
.wheel .strip {
  display: flex; flex-direction: column;
  transform: translateY(calc(var(--wheel-h) * -1 * var(--idx, 0)));
  transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.15, 1);
}
.wheel .strip span { height: var(--wheel-h); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wheel.k { background: linear-gradient(180deg, #1B2742 0%, #0E1628 100%); color: #F3F7FD; border: 1px solid rgba(255, 255, 255, 0.08); }
.wheel.k.lead { color: #3E4D6B; }
.wheel.l { background: linear-gradient(180deg, #C43B4A 0%, #7E1F2B 100%); color: #FFF3F3; border: 1px solid rgba(255, 255, 255, 0.12); }
.wheel.l.first { margin-left: 12px; }
.odometer .unit { align-self: flex-end; padding-bottom: 4px; margin-left: 8px; font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--muted); }
.odo-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.odo-foot .facts { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.odo-foot .facts strong { color: var(--text); font-family: var(--font-mono); }
.spark { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.spark canvas { width: 240px !important; height: 56px !important; }
.spark .hint { letter-spacing: 0.06em; text-transform: uppercase; font-size: 11px; }

/* ── Dashboard: spinning dial ────────────────────────────────────────────── */
.dial { margin-left: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dial svg { width: 88px; height: 88px; }
.dial .flow { font-family: var(--font-mono); font-size: 11px; color: var(--text); white-space: nowrap; }
.dial .flow.idle { color: var(--muted); }
.dial .flow.offline { color: var(--bad-text); }
@keyframes spin { to { transform: rotate(360deg); } }
.rotor { transform-origin: 60px 60px; animation: spin 6s linear infinite; animation-play-state: paused; }
.rotor.spinning { animation-play-state: running; }
@media (prefers-reduced-motion: reduce) { .rotor { animation-play-state: paused; } .live-chip .live-dot { animation: none; } .rings { animation: none; } }

/* ── Dashboard: device card ──────────────────────────────────────────────── */
.device-signal { display: flex; align-items: center; gap: 16px; }
.device-signal .rssi { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1; }
.device-signal .desc { font-size: 13px; color: var(--muted); }
.facts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fact { display: flex; flex-direction: column; gap: 2px; }
.fact .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.fact .v { font-size: 15px; font-weight: 600; }
.fact .pending-note { font-size: 11px; color: var(--warn-text); font-weight: 600; }

/* ── Dashboard: charts ───────────────────────────────────────────────────── */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap.tall { height: 260px; }
.chart-wrap.mid { height: 150px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }
.legend { display: flex; gap: 20px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.legend .sw.accent { background: var(--accent); }
.legend .sw.bad { background: var(--bad); }
.legend .sw.ok { background: var(--ok); }
.legend .sw.unknown { background: rgba(255, 255, 255, 0.14); }
.legend .sw.outline { background: transparent; border: 3px solid var(--bad); border-bottom: 0; border-radius: 3px 3px 0 0; }

/* ── Dashboard: availability strips ──────────────────────────────────────── */
.strip-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 84px; align-items: center; gap: 12px; }
.strip-row + .strip-row { margin-top: 10px; }
.strip-label { font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; }
.strip-label svg { color: var(--muted); }
.strip-pct { font-size: 14px; font-weight: 700; text-align: right; font-family: var(--font-mono); color: var(--ok-text); }
.strip-pct.none { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
.status-strip { position: relative; height: 18px; border-radius: 6px; overflow: hidden; background: var(--bg); }
.status-strip .slice { position: absolute; top: 0; bottom: 0; min-width: 2px; }
.status-strip .slice.ok { background: var(--ok); z-index: 1; }
.status-strip .slice.unknown { background: rgba(255, 255, 255, 0.14); z-index: 2; }
.status-strip .slice.down { background: var(--bad); z-index: 3; }
.status-strip .slice.warn { background: var(--warn); z-index: 2; }
.status-strip .slice.info { background: var(--info-text); z-index: 2; opacity: 0.7; }
.legend .sw.warn { background: var(--warn); }
/* admin-only sensor health on the device card */
.sensor-fact { grid-column: 1 / -1; }
.sensor-fact .v { display: inline-flex; align-items: center; gap: 8px; }
.sensor-fact .dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); }
.sensor-fact[data-state="ok"] .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-dim); }
.sensor-fact[data-state="warn"] .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-dim); }
.sensor-fact[data-state="warn"] .v { color: var(--warn-text); }
.sensor-fact[data-state="bad"] .dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-dim); }
.sensor-fact[data-state="bad"] .v { color: var(--bad-text); }
.sensor-fact .hint { font-size: 12px; }
.status-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-family: var(--font-mono); }

/* ── Admin: meter cards ──────────────────────────────────────────────────── */
.meter-card .name { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--text); }
.meter-card .ids { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.meter-card .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.meter-card .badges { display: flex; gap: 8px; flex-wrap: wrap; }
.odo-mini { font-family: var(--font-mono); font-size: 30px; font-weight: 600; letter-spacing: 0.06em; line-height: 1; }
.odo-mini .lead { color: #3E4D6B; }
.odo-mini .l { color: #FF8A96; }
.odo-mini .u { font-family: var(--font-display); font-size: 16px; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.meter-card.offline .odo-mini { color: var(--muted); }
.meter-card.offline .odo-mini .l { color: #B26A72; }
.meter-card .facts-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.meter-card .actions { border-top: 1px solid var(--line); padding-top: 16px; }
.new-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center;
  border: 2px dashed var(--accent-line); border-radius: var(--radius); color: var(--accent); min-height: 280px; padding: 24px;
}
.new-card:hover { background: rgba(63, 210, 199, 0.06); border-color: rgba(63, 210, 199, 0.6); color: var(--accent-2); }
.new-card .plus { width: 56px; height: 56px; border-radius: 18px; background: var(--accent-dim); display: flex; align-items: center; justify-content: center; }
.new-card .t { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.new-card .hint { max-width: 320px; }

/* ── Lists / tables ──────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; font-size: 13px; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; border-bottom-color: var(--line); }
tr:last-child td { border-bottom: none; }
td.ts, .ts { font-family: var(--font-mono); color: var(--muted); font-size: 12px; white-space: nowrap; }
td .detail, code.detail, code.sha { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); background: transparent; padding: 0; word-break: break-all; }
td.actions-cell { white-space: nowrap; }
td.actions-cell .actions { justify-content: flex-end; flex-wrap: nowrap; }
tr.own td { background: rgba(70, 211, 154, 0.08); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(255, 255, 255, 0.04); }
tr.selected td { background: var(--accent-dim); }
.table-card { padding: 8px 28px 16px; }
.row-list { display: flex; flex-direction: column; }
.row-list > .row { display: grid; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row-list > .row:last-child { border-bottom: 0; }
.row-list > .row.head { padding: 12px 0 8px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.avatar-lg {
  width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 17px; text-transform: uppercase;
}
.avatar-lg.admin { background: var(--bad-dim); color: var(--bad-text); }
.avatar-lg.reader { background: var(--accent-dim); color: var(--accent); }
.role { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; width: fit-content; }
.role.admin { background: var(--bad-dim); color: var(--bad-text); }
.role.reader { background: rgba(255, 255, 255, 0.06); color: var(--text-2); }
.evtype { padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; font-family: var(--font-mono); background: rgba(255, 255, 255, 0.07); color: var(--text-2); }
.evtype.power_loss, .evtype.offline { background: var(--bad-dim); color: var(--bad-text); }
.evtype.online, .evtype.sync { background: var(--ok-dim); color: var(--ok-text); }
.evtype.boot, .evtype.config_applied, .evtype.ota { background: var(--info-dim); color: var(--info-text); }
.tab-panel[hidden] { display: none; }
.filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filterbar .grow { flex-grow: 1; }
.tab-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filterbar .chip { font-family: var(--font); }
.filterbar .chip .dot { width: 8px; height: 8px; }
.filterbar .chip .dot.ok { background: var(--ok); } .filterbar .chip .dot.bad { background: var(--bad); }
.filterbar .chip .dot.info { background: var(--info-text); } .filterbar .chip .dot.neutral { background: var(--muted); }
.vsep { width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; }
.search {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; width: 260px; max-width: 100%;
  border-radius: 12px; background: var(--panel); border: 1px solid var(--line-2); color: var(--muted);
}
.search:focus-within { border-color: var(--accent); }
.search input { flex-grow: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font-size: 13px; }
tr.entry[hidden], tr.day-sep[hidden] { display: none; }

/* ── Sync page ───────────────────────────────────────────────────────────── */
.meter-opt {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 16px;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--text); cursor: pointer; text-align: left; position: relative;
}
.meter-opt:hover { border-color: rgba(255, 255, 255, 0.18); }
.meter-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63, 210, 199, 0.18); }
.meter-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.meter-opt .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #3E4D6B; flex-shrink: 0; }
.meter-opt.on .radio { border-color: var(--accent); border-width: 6px; }
.meter-opt .txt { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.meter-opt .txt .n { font-size: 15px; font-weight: 600; }
.meter-opt .txt .id { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }
.meter-opt .cur { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.meter-opt .cur .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.meter-opt .cur .v { font-family: var(--font-mono); font-size: 16px; font-weight: 600; }
.big-input { height: 60px !important; font-family: var(--font-mono); font-size: 28px !important; font-weight: 600; }
.cmd { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cmd:last-child { border-bottom: 0; }
.cmd .mark { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.cmd .mark.acked { background: var(--ok-dim); color: var(--ok); }
.cmd .mark.pending { background: var(--warn-dim); border: 2px dashed var(--warn); }
.cmd .t { font-size: 15px; font-weight: 600; }
.cmd .s { font-size: 12px; color: var(--muted); }
.cmd .side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.cmd .side .btn.small { height: 30px; padding: 0 10px; font-size: 12px; }

/* ── Firmware ────────────────────────────────────────────────────────────── */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center;
  border: 2px dashed var(--accent-line); border-radius: 18px; padding: 26px 20px; color: var(--text-2); cursor: pointer; position: relative;
}
.drop:hover, .drop.over { background: rgba(63, 210, 199, 0.06); border-color: rgba(63, 210, 199, 0.6); }
.drop .ico { width: 52px; height: 52px; border-radius: 16px; background: var(--accent-dim); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.drop .t { font-size: 15px; font-weight: 600; color: var(--text); }
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.fw-row { grid-template-columns: 64px minmax(0, 1fr) 170px 170px auto; }
.fw-row .ver { font-family: var(--font-mono); font-size: 20px; font-weight: 600; }
.fw-switch button {
  width: 52px; height: 30px; border-radius: 999px; border: 0; padding: 3px; display: flex; align-items: center; background: var(--panel-3);
}
.fw-switch button .knob { width: 24px; height: 24px; border-radius: 50%; background: var(--muted); }
.fw-switch button.on { background: var(--accent); justify-content: flex-end; }
.fw-switch button.on .knob { background: var(--bg); }

/* ── WiFi survey ─────────────────────────────────────────────────────────── */
.channels { display: flex; gap: 8px; align-items: flex-end; }
.ch { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1 1 0; }
.ch .col { width: 100%; display: flex; flex-direction: column-reverse; gap: 3px; height: 64px; }
.ch .col span { display: block; height: 12px; border-radius: 3px; background: #2A3A5C; }
.ch .col span.own { background: var(--ok); }
.ch .lab { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.ch.here .lab { color: var(--ok-text); font-weight: 600; }
.bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; width: 100%; }
.bar > span { display: block; height: 100%; border-radius: 4px; }
.bar > span.ok { background: var(--ok); }
.bar > span.warn { background: var(--warn); }
.bar > span.bad { background: var(--bad); }
.net-strength { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.net-strength .mono { width: 62px; text-align: right; }
.steps { display: flex; flex-direction: column; gap: 8px; }
.steps > div { display: flex; gap: 10px; align-items: flex-start; }
.steps .num { font-family: var(--font-mono); color: var(--accent); font-size: 12px; width: 18px; flex-shrink: 0; }
.steps strong { color: var(--text-2); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .odometer { flex-wrap: wrap; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 .span-2 { grid-column: span 2; }
  .meter-card .facts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fw-row { grid-template-columns: 64px minmax(0, 1fr) auto; }
  .fw-row .hide-md { display: none; }
}
/* ── Diagnostics: device-card row and the admin page ─────────────────────── */
.diag-row { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 10px 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.diag-row.stale { opacity: 0.55; }
.diag-row .di { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.diag-row .di svg { color: var(--muted); flex-shrink: 0; }
.diag-row strong { color: var(--text); }
.diag-row strong.warn { color: var(--warn-text); }
.diag-row strong.ok { color: var(--ok-text); }
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.kpi-tile { padding: 16px 18px; gap: 4px; }
.kpi-tile .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.kpi-tile .v { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1.15; }
.kpi-tile .v.warn { color: var(--warn-text); } .kpi-tile .v.ok { color: var(--ok-text); } .kpi-tile .v.info { color: var(--info-text); }
.diag-chart .chart-wrap { height: 180px; }
.diag-chart h2 { font-size: 17px; }
.cnt-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cnt { display: flex; flex-direction: column; gap: 2px; }
.cnt .n { font-family: var(--font-mono); font-size: 22px; font-weight: 600; }
.row-list > .row.boot-row { grid-template-columns: 120px 120px 150px 70px minmax(0, 1fr); padding: 10px 8px; font-size: 13px; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cnt-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .diag-chart .chart-wrap { height: 160px; }
  :root { --radius: 20px; }
  .shell { flex-direction: column; }
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; height: auto; z-index: 30;
    flex-direction: row; justify-content: space-around; gap: 0; padding: 4px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line); background: rgba(11, 18, 32, 0.92); overflow-x: auto;
  }
  .rail .brand, .rail .spacer, .rail .app-version { display: none; }
  .nav-item, .rail .logout button { width: auto; min-width: 60px; padding: 8px 6px 6px; gap: 4px; }
  .rail .avatar { width: 24px; height: 24px; border-radius: 8px; font-size: 11px; }
  .content { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); gap: 12px; }
  h1 { font-size: 24px; }
  .card { padding: 16px; gap: 12px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-3 .span-2, .grid-2 .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .wheels { gap: 3px; }
  .wheel { --wheel-h: 46px; width: 29px; border-radius: 7px; font-size: 24px; }
  .wheel.l.first { margin-left: 5px; }
  .odometer { flex-wrap: nowrap; }
  .odometer .unit { font-size: 17px; margin-left: 5px; padding-bottom: 3px; }
  .nav-item, .rail .logout button { font-size: 10px; min-width: 50px; padding: 8px 4px 6px; }
  /* Header: meter switcher + live dot on one row, the day picker below */
  .page-head { gap: 8px; }
  .page-head .switcher { flex-grow: 1; min-width: 0; }
  .page-head .switcher summary { width: 100%; }
  .page-head .switcher .sw-text { min-width: 0; }
  .page-head .switcher .sw-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .page-head .live-chip { height: 44px; padding: 0 12px; font-size: 12px; white-space: nowrap; flex-shrink: 0; font-variant-numeric: tabular-nums; }
  .page-head .grow { display: none; }
  /* Cards stack in reading order: reading → consumption → device → availability → wifi */
  .dash-grid { display: contents; }
  .card-odometer { order: 1; } .card-consumption { order: 2; } .card-device { order: 3; }
  .card-availability { order: 4; } .card-wifi { order: 5; }
  /* Small dial in the card's top-right corner, no caption */
  .card-odometer { padding-top: 18px; }
  .card-odometer .card-head { padding-right: 56px; }
  .dial { position: absolute; top: 12px; right: 14px; margin: 0; width: auto; flex-direction: column; }
  .dial svg { width: 48px; height: 48px; }
  .dial .flow { display: none; }
  /* Litres + sparkline side by side */
  .odo-foot { flex-wrap: nowrap; align-items: flex-end; gap: 10px; }
  .odo-foot .facts { font-size: 13px; min-width: 0; flex-shrink: 1; }
  .spark { flex-shrink: 0; }
  .spark .hint { font-size: 9px; letter-spacing: 0.02em; white-space: nowrap; }
  .spark canvas { width: 116px !important; height: 40px !important; }
  .odometer .unit { font-size: 20px; margin-left: 4px; padding-bottom: 4px; }
  .strip-row { grid-template-columns: 1fr auto; }
  .strip-row .strip-label { grid-column: 1 / -1; margin-bottom: -4px; }
  .switcher summary .sw-name { font-size: 15px; }
  .switcher ul { min-width: 0; right: 0; }
  .cons-controls { width: 100%; flex-direction: column; align-items: stretch; gap: 10px; }
  .cons-controls .day-nav .day-input { flex-grow: 1; min-width: 0; }
  .cons-controls .seg { display: flex; }
  .cons-controls .seg button { flex: 1 1 0; }
  .meter-card .facts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-card { padding: 4px 12px 12px; overflow-x: auto; }
  .row-list > .row { grid-template-columns: 1fr !important; gap: 8px; }
  .row-list > .row.head { display: none; }
  .fw-row .hide-md { display: block; }
  .chart-wrap.tall { height: 200px; }
}

/* ── Vendégek (guest nights) ─────────────────────────────────────────────── */
.quick-entry { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; border-radius: var(--radius-s); background: var(--panel); border: 1px solid var(--line-2); }
.quick-entry input[type="number"] { width: 84px; height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font-family: var(--font-mono); font-size: 18px; font-weight: 600; text-align: center; outline: 0; }
.quick-entry input[type="number"]:focus { border-color: var(--accent); }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day {
  position: relative; min-height: 72px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  padding: 8px 10px; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; text-align: left; color: var(--text); font: inherit;
}
.day.editable { cursor: pointer; }
.day.editable:hover { border-color: rgba(255, 255, 255, 0.2); }
.day .n { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.day .g { font-family: var(--font-mono); font-size: 20px; font-weight: 600; line-height: 1; }
.day .g small { font-family: var(--font); font-size: 10px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.day .g .add { font-family: var(--font); font-size: 12px; font-weight: 600; color: var(--accent); }
.day .l { font-size: 11px; color: var(--muted); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day.empty { visibility: hidden; }
.day.future { border-style: dashed; }
.day.future .n { color: #3E4D6B; }
.day.missing { border-style: dashed; border-color: var(--accent-line); }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(63, 210, 199, 0.18); }
.day.lo { background: rgba(70, 211, 154, 0.08); }
.day.hi { background: rgba(255, 182, 92, 0.10); }
.day.out { background: var(--bad-dim); border-color: rgba(255, 107, 122, 0.35); }
.day.skip { background: repeating-linear-gradient(135deg, var(--bg) 0 6px, var(--panel) 6px 12px); }
.day.skip .g, .day.skip .l { color: var(--muted); }
.day.sel { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63, 210, 199, 0.22); background: var(--panel); }
.day.saving { opacity: 0.6; }
.day input { width: 100%; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--accent); background: var(--bg); color: var(--text); font-family: var(--font-mono); font-size: 18px; font-weight: 600; outline: 0; }
.day .flag { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; }
.day .flag.bad { background: var(--bad); }
.day .flag.note { background: var(--warn); }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.kpi .v { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.1; }
.kpi .v small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.kpi .s { font-size: 12px; color: var(--muted); }
.scatter-wrap { height: 280px; }
.scatter-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; }
input[type="range"] { accent-color: var(--accent); height: 32px; }
.guest-line { display: inline-flex; align-items: center; gap: 8px; }
.guest-line svg { color: var(--muted); }
@media (max-width: 820px) {
  .quick-entry { width: 100%; }
  .quick-entry input[type="number"] { flex-grow: 1; }
  .cal, .cal-head { gap: 3px; }
  .day { min-height: 58px; padding: 5px 6px; border-radius: 8px; }
  .day .g { font-size: 15px; }
  .day .g small { display: none; }
  .day .l { font-size: 9px; }
  .day .g .add { font-size: 16px; }
  .day .g .add .t { display: none; }
  .scatter-wrap { height: 220px; }
  .rail { justify-content: space-between; }
  .nav-item, .rail .logout button { min-width: 40px; flex: 1 1 0; font-size: 9px; padding: 8px 2px 6px; }
  .nav-item span:last-child, .rail .logout button span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ── Dashboard top row (v1.0.8): reading card + compact device card ───────── */
.dash-top { display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.odo-body { display: flex; gap: 22px; align-items: flex-end; }
.today-hero { width: 210px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; }
.today-hero .k, .stat .k, .dev-facts .k, .wm-head .k, .conn-today .k, .sensor-line .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.today-hero .hero-v { font-family: var(--font-display); font-size: 40px; font-weight: 800; line-height: 1; color: var(--ok-text); font-variant-numeric: tabular-nums; }
.today-hero .hero-v small, .stat .sv small { font-size: 14px; color: var(--muted); font-weight: 700; margin-left: 4px; }
.hero-bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.hero-bar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #2FB3A9, var(--ok-text)); transition: width 0.6s ease; }
.today-hero .total-line { margin-top: 2px; }
.today-hero .total-line strong { color: var(--text-2); }
.day-curve { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.curve-legend { display: flex; gap: 16px; align-items: center; font-size: 12px; color: var(--muted); }
.curve-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.curve-legend .ln { width: 16px; height: 0; border-top: 2px solid var(--accent); }
.curve-legend .ln.yday { border-top: 2px dashed var(--muted); }
.curve-legend .lbl { margin-left: auto; letter-spacing: 0.06em; text-transform: uppercase; font-size: 11px; }
.chart-wrap.curve { height: 120px; }
.mini-tiles, .dev-boxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dev-boxes { gap: 8px; }
.stat { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); min-width: 0; }
.stat .k { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .k svg { color: var(--muted); flex-shrink: 0; }
.stat .sv { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.dev-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dev-boxes .stat { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 12px; }
.dev-boxes .sv { font-size: 17px; flex-shrink: 0; overflow: visible; }
.dev-boxes .stat .k { white-space: normal; line-height: 1.2; min-width: 0; }
.card-device.reader .chart-wrap.wifi { height: 104px; }
.card-device.reader .dev-boxes .stat { flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; }
.card-device.reader .dev-boxes .stat .k { white-space: nowrap; }
.stat .sv.warn { color: var(--warn-text); } .stat .sv.ok { color: var(--ok-text); }
.stat .hint.up { color: var(--warn-text); font-weight: 600; } .stat .hint.down { color: var(--ok-text); font-weight: 600; }
.dev-boxes.stale { opacity: 0.55; }
.card-device { gap: 14px; }
.dev-head { display: flex; align-items: center; gap: 10px; }
.dev-head .grow { flex-grow: 1; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(63, 210, 199, 0.3); display: inline-flex; align-items: center; justify-content: center; color: var(--accent); }
.icon-btn:hover { background: var(--accent-dim); }
.card-device .device-signal { gap: 12px; align-items: center; flex-wrap: wrap; }
.card-device .device-signal .rssi { font-size: 28px; }
.wifi-mini { display: flex; flex-direction: column; gap: 2px; }
.wm-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.wm-head .hint { font-size: 11px; }
.chart-wrap.wifi { height: 132px; }
.dev-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.dev-facts .fact .v { font-size: 15px; }
.sensor-line { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.sensor-line .k { margin-right: 4px; }
.sensor-line.sensor-fact { grid-column: auto; }
.conn-today { display: flex; flex-direction: column; gap: 8px; }
.mini-strip { display: grid; grid-template-columns: 78px minmax(0, 1fr) 52px; gap: 10px; align-items: center; }
.mini-strip .lab { font-size: 12px; color: var(--text-2); }
.mini-strip .status-strip { height: 14px; }
.mini-strip .strip-pct { font-size: 12px; }
.mini-strip.axis .status-axis { font-size: 9px; }
.grow-v { flex-grow: 1; }
.card-availability { gap: 12px; }
/* Both cards end with their box row at the very bottom, and the two rows are
   exactly as tall (one row of tiles left = two rows of boxes right), so their
   top and bottom edges line up; the leftover height goes to the day curve. */
.card-odometer .odo-body { flex: 1 1 auto; align-items: stretch; min-height: 0; }
.card-odometer .today-hero { justify-content: flex-end; }
.card-odometer .day-curve { min-height: 0; }
.card-odometer .chart-wrap.curve { flex: 1 1 120px; min-height: 120px; height: auto; }
.mini-tiles .stat { height: 112px; box-sizing: border-box; justify-content: space-between; }
.dev-boxes { grid-auto-rows: 52px; }
.dev-boxes .stat { height: 100%; box-sizing: border-box; }
.card-device.reader .dev-boxes .stat { padding: 7px 12px; justify-content: center; }
@media (max-width: 1100px) {
  .dash-top { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .dash-top { display: contents; }
  .odo-body { flex-direction: column; align-items: stretch; gap: 14px; }
  .today-hero { width: auto; padding-bottom: 0; }
  .today-hero .hero-v { font-size: 34px; }
  .mini-tiles, .dev-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-tiles .stat { height: auto; }
  .dev-boxes { grid-auto-rows: auto; }
  .card-odometer .chart-wrap.curve { flex: none; height: 140px; }
  .dev-boxes .stat { flex-direction: column; align-items: flex-start; gap: 2px; }
  .dev-boxes .stat .k { white-space: nowrap; }
  .stat .sv { font-size: 20px; }
  .curve-legend .lbl { display: none; }
}

/* ── Consumption comparison (v1.0.11) ─────────────────────────────────────── */
.cmp-toggle { gap: 8px; }
.cmp-toggle[aria-pressed="true"] { border-color: rgba(255, 203, 138, 0.45); background: rgba(255, 182, 92, 0.12); color: var(--warn-text); }
.cmp-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 14px; background: var(--bg); border: 1px solid rgba(255, 203, 138, 0.2); }
.cmp-row[hidden] { display: none; }
.cmp-row .k { font-size: 11px; color: var(--warn-text); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.cmp-row .grow { flex-grow: 1; }
.cmp-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cmp-chips button { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.cmp-chips button[aria-pressed="true"] { border-color: rgba(255, 203, 138, 0.45); background: rgba(255, 182, 92, 0.12); color: var(--warn-text); }
.cmp-row .cmp-date { height: 32px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font-family: var(--font); font-size: 13px; font-weight: 600; outline: 0; }
.cmp-row .cmp-date[hidden] { display: none; }
.cmp-row .cmp-date.on { border-color: rgba(255, 203, 138, 0.45); }
/* side-by-side comparison: metric | shown period | compared period | difference */
.cmp-table { flex-basis: 100%; display: grid; grid-template-columns: max-content repeat(3, max-content); gap: 6px 36px; align-items: baseline; padding-top: 10px; margin-top: 2px; border-top: 1px solid var(--line); }
.cmp-table .h { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.cmp-table .h.cmp { color: var(--warn-text); }
.cmp-table .lab { font-size: 13px; color: var(--text-2); }
.cmp-table .v { font-family: var(--font-mono); font-size: 17px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.cmp-table .v.cmp { color: #FFD9A8; }
.cmp-table .d { font-family: var(--font-mono); font-size: 17px; white-space: nowrap; }
.cmp-table .d strong { font-weight: 700; }
.cmp-table .d .pct { font-size: 14px; font-weight: 600; margin-left: 4px; }
.cmp-table .d.water.up { color: var(--warn-text); } .cmp-table .d.water.down { color: var(--ok-text); }
.cmp-table .d.guests.up, .cmp-table .d.guests.down { color: var(--info-text); }
.cmp-table .d.none { color: var(--muted); }
.cmp-row .cmp-close { width: 32px; height: 32px; }
.legend .sw.cmp { width: 12px; height: 12px; border-radius: 3px; border: 2.5px dashed #FFB65C; box-sizing: border-box; background: rgba(255, 182, 92, 0.16); box-shadow: 0 0 0 1.5px #0B1220; }
@media (max-width: 820px) {
  .cmp-row .grow { display: none; }
  .cmp-table { grid-template-columns: max-content 1fr 1fr; gap: 4px 14px; }
  .cmp-table .dh { display: none; }
  .cmp-table .d { grid-column: 2 / -1; font-size: 15px; margin-bottom: 4px; }
  .cmp-table .v { font-size: 15px; }
}

/* ── Átfolyás page (v1.0.16) ──────────────────────────────────────────────── */
.flow-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.flow-tile { padding: 16px 18px; gap: 4px; }
.flow-tile .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.flow-tile .v { font-family: var(--font-display); font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.flow-tile .v small { font-size: 14px; color: var(--muted); font-weight: 700; margin-left: 4px; }
.flow-tile .v.bad { color: #FF9AA5; } .flow-tile .v.warn { color: var(--warn-text); } .flow-tile .v.inst { color: #FFB0B8; }
.flow-tile.limited { border-color: rgba(255, 182, 92, 0.45); box-shadow: inset 0 0 0 1px rgba(255, 182, 92, 0.15); }
.flow-note { display: inline-flex; align-items: flex-start; gap: 6px; margin-top: 6px; padding: 6px 9px; border-radius: 9px; background: var(--warn-dim); border: 1px solid rgba(255, 182, 92, 0.4); color: var(--warn-text); font-size: 12px; font-weight: 700; line-height: 1.35; }
.flow-note[hidden] { display: none; }
.flow-note svg { flex: none; margin-top: 1px; color: var(--warn); }
.flow-peak-btn { border-color: rgba(255, 107, 122, 0.35); background: rgba(255, 107, 122, 0.08); color: #FF9AA5; }
.legend .legend-note { margin-left: auto; }
.flow-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; }
.flow-bottom .chart-wrap.mid { height: 220px; }
.flow-days { display: flex; flex-direction: column; }
.frow { display: grid; grid-template-columns: 1.5fr 1fr 1.1fr .7fr .8fr .9fr; gap: 10px; align-items: baseline; padding: 9px 8px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: left; }
button.frow { cursor: pointer; border-radius: 0; }
button.frow:hover { background: rgba(255, 255, 255, 0.04); }
.frow.head { border-top: 0; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.frow.hi { background: rgba(255, 107, 122, 0.08); border-radius: 10px; }
.frow.sel { box-shadow: inset 3px 0 0 var(--accent); }
.frow .strong { font-weight: 700; font-size: 15px; }
.frow .muted { color: var(--muted); }
.frow:not(.head) > span:not(:first-child) { white-space: nowrap; }
.flow-accuracy { font-size: 11px; }
@media (max-width: 1100px) {
  .flow-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .flow-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .flow-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-tile .v { font-size: 24px; }
  .frow { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .frow > span:nth-child(4), .frow > span:nth-child(5) { display: none; }
  .legend .legend-note { margin-left: 0; }
  .card-head .day-nav:has(.flow-peak-btn) { flex-wrap: wrap; width: 100%; }
  .day-nav .flow-peak-btn { flex-basis: 100%; justify-content: center; }
}
.user-seen strong { color: var(--text-2); font-weight: 600; }
