/* Energie — vizuál „štítek elektroměru“ (docs/DESIGN.md).
   Jediný výrazný prvek je válečkové počítadlo; vše ostatní je klidné a čitelné. */

@font-face { font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(../fonts/archivo-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; font-display: swap; }
@font-face { font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(../fonts/archivo-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; font-display: swap; }

:root {
  --plate: #EEF1F2;      /* štítek elektroměru */
  --panel: #FFFFFF;
  --plate-2: #E1E7EA;
  --ink: #1B2A3A;
  --ink-2: #4A5968;
  --rule: #BFC9D1;
  --red: #B80E29;        /* jen termíny a naléhavost */
  --red-bg: #FBE9EC;
  --el: #F5C400;         /* výstražná žlutá — vždy na černém štítku */
  --gas: #2F6FDB;
  --fve: #2E7D4F;
  --ok: #2E7D4F;
  --ok-text: #1B5E37;     /* text na zeleně podbarveném řádku (kontrast ≥ 4,5 : 1) */
  --wheel: #12171D;
  --wheel-ink: #F4F6F7;
  --focus: #2F6FDB;
  --radius-s: 4px;
  --radius-m: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --plate: #151D25; --panel: #1C2630; --plate-2: #24303B; --ink: #E7ECF0; --ink-2: #A8B5C0; --rule: #3A4957;
    --red: #FF6B7E; --red-bg: #3A1D24; --gas: #7FA8F0; --fve: #6CC495; --ok: #6CC495; --ok-text: #8FE0B4; --focus: #7FA8F0; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { font-size: 106.25%; }  /* 17 px základ — čitelnost i pro starší */
body {
  margin: 0; background: var(--plate); color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif; font-stretch: 100%; line-height: 1.55;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-stretch: 112%; font-weight: 700; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.005em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; margin-top: 1.6em; }
h3 { font-size: 1.12rem; }
p, li { max-width: 72ch; }
small, .muted { color: var(--ink-2); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--panel); padding: 8px 12px; z-index: 10; }

/* ---------- hlavička ---------- */
.top { border-bottom: 1px solid var(--rule); background: var(--panel); }
.top-in { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-stretch: 118%; font-size: 1.2rem; }
.brand svg { width: 34px; height: 34px; }
.nav { display: flex; gap: 4px 16px; flex-wrap: wrap; flex: 1; }
.nav a { text-decoration: none; padding: 6px 0; border-bottom: 3px solid transparent; }
.nav .nav-logout { display: none; }
.nav a[aria-current="page"] { border-bottom-color: var(--ink); font-weight: 650; }
.top .nav-toggle { display: none; }
.who { display: flex; gap: 12px; align-items: center; font-size: .9rem; }
.who .muted { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1180px) { .who .muted { display: none; } }

main { max-width: 1120px; margin: 0 auto; padding: 28px 20px 64px; }
footer { border-top: 1px solid var(--rule); color: var(--ink-2); font-size: .88rem; }
footer .in { max-width: 1120px; margin: 0 auto; padding: 18px 20px; display: flex; gap: 20px; flex-wrap: wrap; }

@media (max-width: 760px) {
  .js .top .nav-toggle { display: inline-flex; margin-left: auto; }
  .js .nav { display: none; flex-basis: 100%; flex-direction: column; }
  .js .nav.open { display: flex; }
  .js .who { display: none; }
  .js .nav .nav-logout { display: block; padding: 8px 0; }
  h1 { font-size: 1.6rem; }
}

/* ---------- tlačítka a formuláře ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 18px; border-radius: var(--radius-s);
  border: 2px solid var(--ink); background: var(--ink); color: var(--plate); font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.15); }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.btn.google { background: var(--panel); color: var(--ink); border-color: var(--rule); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }
label { display: block; font-weight: 600; margin: 14px 0 4px; }
.hint { display: block; font-weight: 400; color: var(--ink-2); font-size: .9rem; }
input[type=text], input[type=email], input[type=number], input[type=date], select, textarea {
  width: 100%; max-width: 32rem; min-height: 44px; padding: 8px 10px; font: inherit; color: var(--ink);
  background: var(--panel); border: 1.5px solid var(--rule); border-radius: var(--radius-s); }
textarea { min-height: 7rem; max-width: 48rem; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 10px 0; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
fieldset { border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 8px 20px 20px; margin: 0 0 20px; background: var(--panel); }
legend { font-weight: 700; font-stretch: 112%; padding: 0 6px; font-size: 1.1rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 24px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; align-items: center; }

.alert { border-left: 5px solid var(--ink); background: var(--panel); padding: 12px 16px; margin: 0 0 20px; border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.alert.err { border-color: var(--red); background: var(--red-bg); }
.alert.ok { border-color: var(--ok); }
.alert ul { margin: 4px 0 0; padding-left: 20px; }

/* ---------- komodity: ikona + text, žlutá jen na černém štítku ---------- */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 6px; border-radius: 999px; font-size: .85rem; font-weight: 650; white-space: nowrap; }
.tag svg { width: 16px; height: 16px; }
.tag.el { background: #111; color: var(--el); }
.tag.gas { background: var(--gas); color: #fff; }
.tag.fve { background: var(--fve); color: #fff; }
.tag.plain { background: var(--plate-2); color: var(--ink); }
.tag.warn { background: var(--red-bg); color: var(--red); }

/* ---------- štítek s počítadlem ---------- */
.plate { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 24px 28px;
  display: grid; grid-template-columns: auto 1fr; gap: 12px 32px; align-items: center; position: relative; }
.plate.urgent { border: 3px solid var(--red); }
.plate .screws { position: absolute; inset: 0; pointer-events: none; }
.plate .screws::before, .plate .screws::after { content: ""; position: absolute; top: 10px; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0 18%, var(--rule) 20% 100%); }
.plate .screws::before { left: 10px; } .plate .screws::after { right: 10px; }
.plate .unit { font-size: .95rem; color: var(--ink-2); margin-top: 8px; }
.plate h1, .plate h2 { margin: 0 0 6px; }
@media (max-width: 640px) { .plate { grid-template-columns: 1fr; padding: 20px; } }

.counter { display: inline-flex; gap: 3px; padding: 7px; background: #2A333C; border-radius: 6px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.55); font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1; }
.wheel { width: .72em; height: 1.18em; overflow: hidden; background: linear-gradient(#050709, var(--wheel) 22%, var(--wheel) 78%, #050709);
  color: var(--wheel-ink); border-radius: 2px; position: relative; font-weight: 600; font-stretch: 90%; }
.wheel .strip { display: flex; flex-direction: column; transform: translateY(calc(var(--d) * -1.18em));
  animation: roll 1.6s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i) * 90ms); }
.wheel .strip span { height: 1.18em; display: flex; align-items: center; justify-content: center; }
.counter .sep { width: .25em; }
@keyframes roll { from { transform: translateY(0); } }
.strip.d0 { --d: 0; }
.strip.d1 { --d: 1; }
.strip.d2 { --d: 2; }
.strip.d3 { --d: 3; }
.strip.d4 { --d: 4; }
.strip.d5 { --d: 5; }
.strip.d6 { --d: 6; }
.strip.d7 { --d: 7; }
.strip.d8 { --d: 8; }
.strip.d9 { --d: 9; }
.strip.i0 { --i: 0; }
.strip.i1 { --i: 1; }
.strip.i2 { --i: 2; }
.strip.i3 { --i: 3; }
.strip.i4 { --i: 4; }
.strip.i5 { --i: 5; }
.strip.i6 { --i: 6; }
.strip.i7 { --i: 7; }
.strip.i8 { --i: 8; }
.strip.i9 { --i: 9; }
@media (prefers-reduced-motion: reduce) { .wheel .strip { animation: none; } }

/* ---------- přehled ---------- */
.cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; margin-top: 28px; }
.cols > * { min-width: 0; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { position: relative; padding: 12px 0 12px 64px; border-bottom: 1px solid var(--rule); max-width: none; }
.steps li::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 12px; width: 44px; text-align: center;
  font-weight: 700; font-stretch: 112%; font-size: 1.1rem; border: 2px solid var(--ink); border-radius: var(--radius-s); line-height: 36px; }
.steps li.kind-deadline::before { border-color: var(--red); color: var(--red); }
.steps .when { font-size: .9rem; color: var(--ink-2); }
.steps .when.soon { color: var(--red); font-weight: 650; }

.wires { list-style: none; margin: 0; padding: 0; }
.wires li { border: 1px solid var(--rule); border-left-width: 8px; border-radius: var(--radius-s); background: var(--panel); padding: 12px 16px; margin-bottom: 10px; max-width: none; }
.wires li.el { border-left-color: #111; }
.wires li.gas { border-left-color: var(--gas); }
.wires li.fve { border-left-color: var(--fve); }
.wires .row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- tabulky ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 650; background: var(--plate-2); }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.best td { background: color-mix(in srgb, var(--ok) 10%, var(--panel)); }
.pos { color: var(--ok-text); font-weight: 650; }
.neg { color: var(--red); }

.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 20px 24px; margin-bottom: 20px; }
.panel > :first-child { margin-top: 0; }
.md-body { max-width: 80ch; }
.md-body table { margin: 10px 0; table-layout: fixed; width: 100%; overflow-wrap: anywhere; }
pre.letter { white-space: pre-wrap; background: var(--plate-2); padding: 16px; border-radius: var(--radius-s); font-family: inherit; max-width: 80ch; }
pre.md-raw { white-space: pre-wrap; font-size: .85rem; max-height: 60vh; overflow: auto; background: var(--plate-2); padding: 14px; border-radius: var(--radius-s); }
details summary { cursor: pointer; font-weight: 600; min-height: 32px; }

.chat { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.msg { max-width: 72ch; padding: 12px 16px; border-radius: var(--radius-m); border: 1px solid var(--rule); background: var(--panel); }
.msg.user { align-self: flex-end; background: var(--plate-2); }
.msg .who { font-size: .8rem; color: var(--ink-2); margin-bottom: 4px; }

/* ---------- úvodní stránka ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; padding: 20px 0 36px; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); font-stretch: 116%; }
.hero .lead { font-size: 1.15rem; max-width: 46ch; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 24px; margin-top: 12px; }
.how div { border-top: 3px solid var(--ink); padding-top: 12px; }

.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-2); margin-right: 6px; }
.status-dot.done { background: var(--ok); } .status-dot.error { background: var(--red); }
.status-dot.running, .status-dot.pending { background: var(--gas); }

.mt { margin-top: 20px; }
.h3 { font-size: 1.15rem; margin: 0 0 4px; }
.js-only { display: none; }
.js .js-only { display: inline-flex; }
.checklist { list-style: none; padding: 0; }
.checklist li { padding: 8px 0; border-bottom: 1px solid var(--rule); }

form.actions + .panel, .actions + section.panel { margin-top: 20px; }
