/* Stav a role se nikdy nerozlišují jen barvou: každý štítek nese text a
   návrh má navíc přerušovaný okraj. Barvy se liší hlavně světlostí.

   Značka: modrá z loga (přechod --brand-1 → --brand-2) je vyhrazená pro
   úvodní panel sezóny a hlavní akci; zbytek rozhraní je neutrální. */
:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --text: #121a26;
  --muted: #5a6677;
  --line: #e0e5ec;
  --accent: #1b58a8;
  --accent-text: #ffffff;
  --soft: #e7edf5;
  --danger: #8a1f1f;
  --brand-1: #2f7cd3;
  --brand-2: #142f6b;
  --notice-bg: #fdf1d6;
  --notice-text: #5b3d05;
  --shadow: 0 1px 2px rgba(18, 26, 38, 0.06), 0 2px 8px rgba(18, 26, 38, 0.05);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d131a;
    --card: #17202b;
    --text: #e9eef4;
    --muted: #9aa8b8;
    --line: #273444;
    --accent: #8fc1f7;
    --accent-text: #0d131a;
    --soft: #223043;
    --danger: #f2b5b5;
    --brand-1: #2a6fbe;
    --brand-2: #12264f;
    --notice-bg: #3a2c0c;
    --notice-text: #f6dfa6;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
/* bez toho by display: grid/inline-block u labelů a odznaku přebil atribut hidden */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
header {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  background: var(--bg);
}
h1 { font-size: 19px; margin: 0; display: flex; align-items: center; gap: 9px; letter-spacing: -0.01em; }
h1 img { display: block; }
h1 em { font-weight: 400; font-style: normal; }
h2 { font-size: 14px; margin: 22px 0 8px; color: var(--muted); font-weight: 600; }
#user {
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--soft); color: var(--text); font: inherit; font-size: 13px; font-weight: 700;
}
#clock { font-size: 13px; font-variant-numeric: tabular-nums; margin-top: -6px; }
main { max-width: 720px; margin: 0 auto; padding: 4px 16px 24px; }
.icon { display: inline-flex; }
.icon svg { display: block; }

/* Navigace: ikona + popisek, aktivní záložka má barvu, tučný popisek
   a podbarvenou ikonu. Nový let je uprostřed jako hlavní akce. */
nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
nav button {
  position: relative;
  display: grid; justify-items: center; gap: 2px;
  border: 0; background: none; color: var(--muted);
  font: inherit; font-size: 11px; padding: 4px 2px; cursor: pointer;
}
nav button .icon { padding: 3px 14px; border-radius: 14px; }
nav button[aria-current="true"] { color: var(--accent); font-weight: 700; }
nav button[aria-current="true"] .icon { background: var(--soft); }
nav button.fab {
  width: 54px; height: 54px; margin: -22px auto 2px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: #fff;
  box-shadow: 0 4px 12px rgba(20, 47, 107, 0.35);
}
nav button.fab .icon { padding: 0; background: none; }
nav button.fab[aria-current="true"] { color: #fff; outline: 3px solid var(--soft); }
#badge {
  position: absolute; top: 0; left: calc(50% + 8px);
  min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 700;
}

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 10px 0; box-shadow: var(--shadow);
}
.card.draft { border-style: dashed; border-width: 2px; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-size: 14px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  background: var(--soft); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip.strong { background: var(--accent); color: var(--accent-text); }
.day { margin: 18px 0 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.flight { cursor: pointer; }
.flight .detail { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 5px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; border-top: 0; }

.toolbar { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button {
  border: 0; background: var(--card); color: var(--text); font: inherit;
  padding: 10px 14px; cursor: pointer; min-height: 44px;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); font-weight: 700; }

form { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
label { display: grid; gap: 4px; min-width: 0; font-size: 13px; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px; min-height: 44px; width: 100%;
}
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text); }
.check input { width: 22px; min-height: 22px; height: 22px; }
button.primary, button.secondary, button.danger {
  font: inherit; font-weight: 700; border-radius: 8px; padding: 12px 16px; min-height: 48px; cursor: pointer;
}
a.primary {
  display: block; text-align: center; text-decoration: none;
  font-weight: 700; border-radius: 8px; padding: 12px 16px; min-height: 48px;
  background: var(--accent); color: var(--accent-text);
}
button.primary { border: 0; background: var(--accent); color: var(--accent-text); }
button.secondary { border: 1px solid var(--line); background: var(--card); color: var(--text); }
button.danger { border: 1px solid var(--danger); background: var(--card); color: var(--danger); }
.actions { display: flex; gap: 8px; margin-top: 10px; }
.actions button { flex: 1; }

#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 3;
  max-width: 688px; margin: 0 auto; padding: 12px 14px; border-radius: 8px;
  background: var(--text); color: var(--bg); font-size: 14px;
}

/* Kompaktní seznam: jeden let na řádek. */
.clist { margin-top: 8px; border-top: 1px solid var(--line); }
.crow {
  display: grid; grid-template-columns: 3.2em minmax(0, 1fr) auto 2.4em 3em auto;
  gap: 8px; align-items: baseline; padding: 7px 2px; font-size: 14px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.crow > :nth-child(4), .crow > :nth-child(5) { text-align: right; }
.creg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clist .card { margin: 4px 0 8px; }

/* Přepis: buňky v pořadí sloupců papírového zápisníku. */
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px 10px; }
.cell { display: grid; gap: 1px; min-width: 0; }
.cell span { font-size: 11px; color: var(--muted); }
.cell b { font-size: 15px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cell.wide { grid-column: 1 / -1; }
.cell.wide b { font-weight: 500; }
.sumbtn {
  padding: 6px 10px; min-height: 36px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--soft); color: var(--text); font: inherit; font-size: 13px;
}
table.sums td:first-child, table.sums th:first-child { color: var(--muted); }
table.sums td { font-weight: 600; }
table.sums td:first-child { font-weight: 400; }
details.card summary { cursor: pointer; font-weight: 600; }
details.card[open] summary { margin-bottom: 8px; }

.paperbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.paperbar > :last-child { margin-left: auto; }
/* Zapsaný let: tlumený a s textovým štítkem, ať se nepozná jen podle odstínu. */
.paper.done .cells { opacity: 0.55; }

/* Rozpracovaný let: silný okraj, pruh vlevo a textový štítek — ne jen barva. */
.paper { cursor: pointer; }
.paper.active { border: 3px solid var(--accent); box-shadow: inset 7px 0 0 var(--accent); padding-left: 20px; }
.paper.active .cells { opacity: 1; }
.activebar { margin-bottom: 10px; }
.releasebtn {
  border: 0; border-radius: 16px; padding: 6px 12px; min-height: 36px; cursor: pointer;
  background: var(--accent); color: var(--accent-text); font: inherit; font-size: 13px; font-weight: 700;
}
#jump {
  position: fixed; top: 58px; right: 16px; z-index: 3;
  border: 0; border-radius: 18px; padding: 8px 14px; min-height: 36px; cursor: pointer;
  background: var(--accent); color: var(--accent-text); font: inherit; font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.gliderOnly { display: grid; gap: 12px; }
details > summary.muted { cursor: pointer; padding: 10px 0; }

/* ---------- Přehled ---------- */
.hero {
  display: grid; gap: 2px; margin: 4px 0 12px; padding: 20px 20px 22px;
  border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 6px 18px rgba(20, 47, 107, 0.25);
}
.hero-label { font-size: 14px; font-weight: 600; opacity: 0.9; }
.hero-value { font-size: 44px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.hero-value small { font-size: 22px; font-weight: 600; }
.hero-sub { font-size: 14px; opacity: 0.92; }

.action {
  display: flex; align-items: center; gap: 12px; width: 100%; margin: 10px 0; padding: 12px 14px;
  border: 0; border-radius: var(--radius); cursor: pointer; text-align: left;
  background: var(--notice-bg); color: var(--notice-text); font: inherit; font-size: 14px; font-weight: 600;
}
.action > span:nth-child(2) { flex: 1; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.tile {
  display: grid; gap: 1px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.tile-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile-value { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tile-sub { font-size: 12px; color: var(--muted); }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 132px; margin-top: 12px; }
.bar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 3px; }
/* výška sloupce se počítá z dráhy, ne z celé buňky s popisky — jinak by
   popisky poměr výšek zkreslily */
.bar-track { flex: 1; width: 100%; min-height: 0; display: flex; align-items: flex-end; }
.bar-fill { width: 100%; border-radius: 5px 5px 2px 2px; background: #a9c8ec; }
.bar-value, .bar-year { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar.now .bar-fill { background: var(--brand-2); }
.bar.now .bar-value, .bar.now .bar-year { color: var(--text); font-weight: 700; }
@media (prefers-color-scheme: dark) {
  .bar-fill { background: #35527a; }
  .bar.now .bar-fill { background: #8fc1f7; }
}
details.card table + table { margin-top: 10px; }
