:root { --fg:#1a1a1a; --bg:#2a2a2a; --accent:#2b6cb0; --border:#ddd; }
* { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--fg); background: var(--bg); margin: 0; }
header { padding: 0.65rem 1.5rem; border-bottom: 1px solid var(--border); background: white; display: flex; align-items: center; gap: 1.5rem; position: sticky; top: 0; z-index: 100; }
header h1 { margin: 0; font-size: 1.1rem; }
header nav a { margin-right: 0.8rem; color: var(--accent); text-decoration: none; font-weight: 500; }
header nav a:hover { text-decoration: underline; }
.header-btn { background: var(--accent); color: white; border: 0; padding: 0.4rem 0.9rem; border-radius: 4px; cursor: pointer; font-size: 0.85rem; font-weight: 500; }
.header-btn:hover { background: #2c5282; }
.header-btn:disabled { background: #999; cursor: wait; }
#header-run-status { color: #666; font-size: 0.82rem; }
.export-btn { background: #4a5568; color: white; border: 0; padding: 0.25rem 0.6rem; border-radius: 4px; cursor: pointer; font-size: 0.75rem; font-weight: 500; margin-left: 0.6rem; vertical-align: middle; }
.export-btn:hover { background: #2d3748; }

/* KPI badges v hlavičce: Return + Max DD vždy viditelné */
/* KPI row directly below <header>: shows 8 universal metrics from last backtest. */
.kpi-row {
  display: flex; gap: 0.6rem;
  padding: 0.45rem 1rem;
  background: #f7fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}
.kpi-row .kpi {
  flex: 1 1 9rem;
  min-width: 7rem;
  background: #fff;
  border: 1px solid #edf2f7;
  border-radius: 4px;
  padding: 0.25rem 0.55rem;
  display: flex; flex-direction: column; gap: 0.05rem;
}
.kpi-row .kpi-label { font-size: 0.65rem; color: #718096; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-row .kpi-value { font-size: 1.0rem; font-weight: 700; color: var(--fg, #1a202c); }
.kpi-row .kpi-value.pos { color: #38a169; }
.kpi-row .kpi-value.neg { color: #e53e3e; }
/* Legacy: stará třída uvnitř <header> už není použitá, ale necháváme rule pro
   zpětnou kompatibilitu kdyby někde někdo .header-kpi referenoval. */
.header-kpi { display: flex; gap: 0.5rem; margin-left: auto; padding-left: 0.5rem; }
.header-kpi .kpi {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 0.18rem 0.55rem; border: 1px solid var(--border); border-radius: 5px;
  background: #f7fafc; min-width: 78px; line-height: 1.1;
}
.header-kpi .kpi-label { font-size: 0.65rem; color: #666; text-transform: uppercase; letter-spacing: 0.04em; }
.header-kpi .kpi-value { font-size: 1.0rem; font-weight: 700; color: var(--fg); }
.header-kpi .kpi-value.pos { color: #38a169; }
.header-kpi .kpi-value.neg { color: #e53e3e; }
@media (max-width: 1200px) {
  .header-kpi { order: 9; margin-left: 0; }
}

/* Strategy controls in header */
.strategy-controls { display: flex; align-items: center; gap: 0.4rem; padding: 0 0.6rem; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.strategy-controls label { font-size: 0.8rem; color: #555; display: inline-flex; align-items: center; gap: 0.3rem; margin: 0; }
.strategy-controls select { padding: 0.25rem 0.4rem; font-size: 0.85rem; min-width: 160px; max-width: 220px; border-radius: 4px; border: 1px solid var(--border); }
.strategy-controls button { background: #edf2f7; color: #2b6cb0; border: 1px solid var(--border); padding: 0.22rem 0.55rem; border-radius: 4px; cursor: pointer; font-size: 0.78rem; font-weight: 500; }
.strategy-controls button:hover { background: #e2e8f0; }
.strategy-controls button:active { background: #cbd5e0; }
.strategy-controls.empty { opacity: 0.5; }
@media (max-width: 1200px) {
  header { flex-wrap: wrap; }
  .strategy-controls { order: 10; flex-basis: 100%; padding: 0.3rem 0; border-left: 0; border-right: 0; border-top: 1px dashed var(--border); }
}
main { padding: 2rem; max-width: 1100px; margin: 0 auto; }
fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 1rem; margin-bottom: 1rem; background: white; }
legend { font-weight: 600; padding: 0 0.5rem; }
label { display: inline-block; margin: 0.25rem 1rem 0.25rem 0; font-size: 0.9rem; }
input, select { padding: 0.3rem; border: 1px solid var(--border); border-radius: 4px; margin-left: 0.25rem; }
button { background: var(--accent); color: white; border: 0; padding: 0.6rem 1.2rem; border-radius: 4px; cursor: pointer; font-size: 1rem; }
button:hover { background: #2c5282; }
#result { margin-top: 1.5rem; padding: 1rem; background: white; border: 1px solid var(--border); border-radius: 6px; min-height: 4rem; }

/* Data explorer */
.controls { display: flex; gap: 1rem; align-items: center; padding: 1rem; background: white; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 1rem; }
.controls label { margin: 0; font-size: 0.9rem; }
.controls #status { color: #666; font-size: 0.85rem; margin-left: auto; }
.chart-wrap { background: white; border: 1px solid var(--border); border-radius: 6px; padding: 1rem; margin-bottom: 1rem; }
.chart-wrap h2 { margin: 0 0 0.75rem 0; font-size: 1rem; color: #444; }
.chart-toggles { display: flex; gap: 1rem; margin: 0 0 0.5rem 0; font-size: 0.9rem; color: #444; }
.chart-toggles label { cursor: pointer; }
.chart-box { position: relative; height: 200px; }
.chart-box.tall { height: 340px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.table-wrap { overflow-x: auto; max-height: 400px; overflow-y: auto; }
#chain-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
#chain-table th, #chain-table td { padding: 0.3rem 0.5rem; border-bottom: 1px solid #eee; text-align: right; white-space: nowrap; }
#chain-table th { background: #f7f7f7; position: sticky; top: 0; text-align: right; font-weight: 600; }
#chain-table th:first-child, #chain-table td:first-child { text-align: left; }
#chain-meta { color: #666; font-size: 0.85rem; margin: 0 0 0.5rem 0; }

/* Backtest form + results */
.bt-form fieldset { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.period-presets { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; font-size: 0.85rem; color: #666; }
.period-presets .preset { background: #edf2f7; border: 1px solid var(--border); color: #2b6cb0; padding: 0.25rem 0.65rem; border-radius: 4px; cursor: pointer; font-size: 0.85rem; font-weight: 500; }
.period-presets .preset:hover { background: #e2e8f0; }
.period-presets .preset:active { background: #cbd5e0; }
/* Exchange-coded "Max" preset buttons — sjednocené napříč moduly */
/* Opce period (2019-04-01 → 2026-12-31) — fialová, nepatří k žádné burze. */
.period-presets .preset.preset-opce { background: #e9d8fd; color: #44337a; border-color: #d6bcfa; }
.period-presets .preset.preset-opce:hover { background: #d6bcfa; }
.period-presets .preset.preset-opce:active { background: #b794f4; }
.period-presets .preset.preset-bitfinex { background: #c6f6d5; color: #22543d; border-color: #9ae6b4; }
.period-presets .preset.preset-bitfinex:hover { background: #9ae6b4; }
.period-presets .preset.preset-bitfinex:active { background: #68d391; }
.period-presets .preset.preset-binance { background: #fefcbf; color: #744210; border-color: #faf089; }
.period-presets .preset.preset-binance:hover { background: #faf089; }
.period-presets .preset.preset-binance:active { background: #f6e05e; }
.period-presets .preset.preset-deribit { background: #4a5568; color: #f7fafc; border-color: #2d3748; }
.period-presets .preset.preset-deribit:hover { background: #2d3748; }
.period-presets .preset.preset-deribit:active { background: #1a202c; }
.bt-form label.toggle { background: #f0f4f8; padding: 0.25rem 0.6rem; border-radius: 4px; font-weight: 500; }
.bt-form input:disabled { background: #f0f0f0; color: #aaa; }
.bt-form small.hint { color: #888; font-size: 0.7rem; flex-basis: 100%; margin-top: -0.1rem; line-height: 1.25; }
.bt-form label.toggle { background: #f0f4f8; padding: 0.18rem 0.45rem; border-radius: 3px; font-weight: 500; font-size: 0.78rem; }
.advanced { background: white; border: 1px solid var(--border); border-radius: 6px; padding: 0.3rem 0.9rem; margin-bottom: 0.6rem; }
.advanced > summary { cursor: pointer; font-weight: 600; padding: 0.3rem 0; color: #444; font-size: 0.85rem; }
.advanced fieldset { margin-top: 0.3rem; }
/* Period presets — kompaktnější */
.period-presets { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; font-size: 0.78rem; color: #666; }
.period-presets .preset { padding: 0.15rem 0.5rem; font-size: 0.78rem; }
/* Wider main column so grafy mají víc šířky */
main { max-width: 1400px; }
.bt-form #run-btn { margin-top: 0.5rem; }
.bt-form #run-status { margin-left: 1rem; color: #666; font-size: 0.9rem; }
#result.hidden { display: none; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.5rem; margin: 1rem 0; }
.stat { background: white; border: 1px solid var(--border); border-radius: 5px; padding: 0.5rem; text-align: center; }
.stat .label { color: #666; font-size: 0.72rem; margin-bottom: 0.2rem; }
.stat .value { font-size: 1.15rem; font-weight: 600; }
.stat .value.pos { color: #38a169; }
.stat .value.neg { color: #e53e3e; }
#trades-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
#trades-table th, #trades-table td { padding: 0.3rem 0.5rem; border-bottom: 1px solid #eee; text-align: right; white-space: nowrap; }
#trades-table th { background: #f7f7f7; position: sticky; top: 0; font-weight: 600; text-align: right; }
#trades-table th:nth-child(-n+3), #trades-table td:nth-child(-n+3) { text-align: left; }
.pos { color: #38a169; }
.neg { color: #e53e3e; }

/* === Compact form layout (overrides) — minimalizace vertikálního místa === */
.bt-form fieldset {
  padding: 0.25rem 0.55rem 0.35rem;
  margin-bottom: 0;
  gap: 0.15rem 0.55rem;
}
.bt-form fieldset legend { font-size: 0.78rem; padding: 0 0.3rem; font-weight: 600; }
.bt-form label { margin: 0.03rem 0.4rem 0.03rem 0; font-size: 0.76rem; color: #333; line-height: 1.3; }
.bt-form input[type="number"] { width: 84px; padding: 0.1rem 0.3rem; font-size: 0.82rem; margin-left: 0.2rem; }
.bt-form input[type="date"]   { width: 124px; padding: 0.1rem 0.3rem; font-size: 0.8rem; margin-left: 0.15rem; }
.bt-form select               { padding: 0.1rem 0.3rem; font-size: 0.8rem; margin-left: 0.15rem; }
.bt-form #run-btn { margin-top: 0.3rem; padding: 0.4rem 0.9rem; font-size: 0.9rem; }
.bt-form label.toggle { padding: 0.12rem 0.4rem; font-size: 0.74rem; }
.bt-form small.hint { margin-top: 0; line-height: 1.15; font-size: 0.68rem; }
.chart-wrap { padding: 0.55rem 0.75rem; margin-bottom: 0.55rem; }
.chart-wrap h2 { font-size: 0.9rem; margin: 0 0 0.4rem 0; }
.advanced { padding: 0.25rem 0.7rem; }

/* === Two-column layout: form vlevo (resizovatelná šířka), výsledky vpravo === */
main { max-width: none; padding: 1rem 1.5rem; }
.bt-layout {
  display: grid;
  /* tři sloupce: form | resizer | výsledky. --bt-left-width řídí JS přetažením.
     Default 380px = jeden sloupec panelů (tall list, žádný horizontální scroll).
     Uživatel může dragnout doprava pro 2 nebo 3 sloupce (cap 3 v column-count). */
  grid-template-columns: var(--bt-left-width, 380px) 8px minmax(0, 1fr);
  gap: 0 0.4rem;
  align-items: start;
  width: 100%;
}
.bt-resizer {
  align-self: stretch;
  min-height: 80vh;
  background: linear-gradient(to right, transparent 40%, #cbd5e0 40%, #cbd5e0 60%, transparent 60%);
  cursor: col-resize;
  border-radius: 2px;
  position: sticky; top: 4rem;
  transition: background 0.15s;
  user-select: none;
}
.bt-resizer:hover, .bt-resizer.dragging {
  background: linear-gradient(to right, transparent 30%, #3182ce 30%, #3182ce 70%, transparent 70%);
}
/* Generic: každý <form> v bt-layout je sticky levý panel + multi-column "masonry".
   Místo CSS Grid (které vyrovnává řádky a způsobuje prázdné mezery pod
   krátkými fieldsety) používáme CSS Multi-column. Každý fieldset má přesně
   výšku svých řádků — žádný empty space. Šířka sloupce je fixní (280px),
   browser fitne tolik sloupců, kolik se vejde do dostupné šířky formu. */
.bt-layout > form {
  position: sticky; top: 4rem;
  /* BEZ max-height + overflow-y: form se rozroste podle obsahu, žádný interní
     scroll, který by skryl panely. Sticky se chová "scroll s page" pro vysoké
     formy a "drž se nahoře" pro krátké. */
  padding-right: 0.4rem;
  align-self: start;
  /* CSS Multi-column "masonry": každý panel = vlastní výška podle obsahu.
     Krátké panely se NEPROTAHUJÍ na výšku nejvyššího v řádku — nezabírají
     prázdné místo dole. Browser sám balancuje sloupce (column-fill: balance)
     tak, aby všechny sloupce měly přibližně stejnou výšku, a panely tečou
     SHORA DOLŮ ve sloupci. !important přebíjí per-modul display: grid. */
  display: block !important;
  column-width: 280px;
  column-count: 3;
  column-gap: 0.4rem;
  column-fill: balance;
  /* Repaint-glitch izolace (sticky + multi-column kombinace na WebKitu). */
  isolation: isolate;
  contain: layout style;
  transform: translateZ(0);
}
.bt-layout > form > fieldset {
  /* Multi-column item — výška = přesně podle obsahu (žádné prázdné místo dole).
     break-inside: avoid drží celý panel v jednom sloupci (nerozdělí ho mezi 2). */
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  /* Margin-top dá legendě vzduch, aby border-line nepřekrývala legendu sousedů. */
  margin: 0.5rem 0 0 0;
  display: block;
  background: white;
  min-width: 0;
  contain: layout paint;
  /* Šetrné kompaktování: padding shora/zdola místo defaultního 1rem. Šetří
     ~13px na panel × N panelů → znatelně víc obsahu v zobrazené výšce. */
  padding: 0.55rem 0.7rem 0.6rem;
}
/* Vnitřek fieldsetů — šetrné zhuštění labelů a hintů, aby panel měl výšku
   přesně podle obsahu bez zbytečných vertikálních mezer. */
.bt-layout > form > fieldset label {
  margin: 0.1rem 0.5rem 0.1rem 0;
}
.bt-layout > .adx-form > fieldset label {
  /* .adx-form má display:block na labelech (line 286). Komprimujeme vertikální margin. */
  margin: 0.18rem 0;
}
.bt-layout > form > fieldset label.toggle {
  padding: 0.15rem 0.45rem;
  margin: 0.1rem 0.4rem 0.1rem 0;
}
.bt-layout > form > fieldset small.hint {
  margin-top: 0.05rem;
  line-height: 1.25;
}
.bt-layout > .bt-form > fieldset {
  /* Opce (flex layout uvnitř fieldsetu): zmenšit gap mezi řádky labelů. */
  gap: 0.25rem 0.7rem;
}
.bt-layout > form > fieldset:first-child {
  margin-top: 0;
}
.bt-layout > form > fieldset > legend {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0 0.35rem;
  line-height: 1.2;
  /* Browser default kreslí border-top SKRZ legend, takže text je oříznutý.
     Bíle pozadí na legendu border překryje. Plus drobné padding nahoru/dolu
     ať legend "sedí" vizuálně na border line. */
  background: white;
  margin-left: 0.3rem;
}
/* Full-width elementy (span all columns) — typicky control row, advanced details.
   V multi-column layoutu používáme column-span: all (přepne na full-width block). */
.bt-layout > form > .advanced,
.bt-layout > form > details.advanced,
.bt-layout > form > .run-row,
.bt-layout > form > .export-setup-row {
  column-span: all;
  -webkit-column-span: all;
  break-inside: avoid;
  margin: 0 0 0.4rem 0;
}
/* Right-side results: může být plné šířky, scrolluje s page (form je sticky). */
.bt-layout > section { min-width: 0; }   /* prevent overflow z canvasů uvnitř */

/* Opce module: run-row je full-width radek (grid-column: 1/-1 už platí z obecného
   rule výše), tady jen zachováváme flex layout uvnitř té buňky. */
.bt-layout > .bt-form > .run-row { display: flex; align-items: center; gap: 1rem; margin-top: 0.3rem; }
.bt-layout > .bt-form > .export-setup-row {
  display: flex; align-items: center; gap: 0.7rem;
  margin: 0.15rem 0 0.3rem;
  padding: 0.35rem 0.6rem;
  background: #f0fff4;
  border: 1px dashed #9ae6b4;
  border-radius: 5px;
}
.export-setup-btn,
.import-setup-btn {
  border: 0; color: white; padding: 0.42rem 1rem; border-radius: 4px;
  cursor: pointer; font-size: 0.88rem; font-weight: 600;
}
.export-setup-btn { background: #38a169; }
.export-setup-btn:hover { background: #2f855a; }
.export-setup-btn:active { background: #276749; }
.import-setup-btn { background: #2b6cb0; }
.import-setup-btn:hover { background: #2c5282; }
.import-setup-btn:active { background: #2a4365; }
.export-setup-note { color: #4a5568; font-size: 0.72rem; line-height: 1.3; }
.bt-layout > #result { min-width: 0; }
.bt-layout > #result.hidden { display: none; }
/* Středně široká okna: form se sbalí na 2 sloupce, výsledky zůstanou vpravo */
/* Stará 1500px media query přepisovala bt-layout na 620px form — odstraněno,
   --bt-left-width (default 920px, drag-resizable) teď řídí šířku napříč okny.
   CSS Multi-column ve formu sama sníží počet sloupů (3→2→1) když je form užší. */
@media (max-width: 1000px) {
  /* Mobilní: zruším sticky + scroll, form expanduje pod chart. */
  .bt-layout { grid-template-columns: 1fr; }
  .bt-layout > form { position: static; max-height: none; overflow: visible; columns: auto; }
  .bt-resizer { display: none; }
}

/* =========================================================================
   ADX strategy page
   ========================================================================= */
.adx-page { max-width: none; margin: 0; }
.adx-page > h2 { margin-top: 0; }
.adx-page .hint { color: #555; font-size: 0.88rem; background: #f7fafc; padding: 0.7rem 0.9rem; border-left: 3px solid var(--accent); border-radius: 4px; }
.adx-page .hint code { background: rgba(0,0,0,0.06); padding: 0 0.3em; border-radius: 3px; }

.adx-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; margin: 1rem 0; }
.adx-form fieldset { margin: 0; }
.adx-form input[type="number"], .adx-form input[type="date"], .adx-form select { width: 100%; margin-left: 0; margin-top: 0.2rem; }
.adx-form label { display: block; margin: 0.45rem 0; font-size: 0.85rem; color: #444; }
.period-presets { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; margin-top: 0.5rem; font-size: 0.82rem; color: #666; }
.period-presets .preset { background: #edf2f7; color: #2b6cb0; border: 1px solid var(--border); padding: 0.2rem 0.55rem; border-radius: 4px; cursor: pointer; font-size: 0.78rem; }
.period-presets .preset:hover { background: #e2e8f0; }
.adx-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; }
#adx-run { padding: 0.55rem 1.3rem; }
#adx-run:disabled { background: #999; cursor: wait; }
#adx-status { font-size: 0.85rem; color: #666; }
#adx-status.ok  { color: #2f855a; }
#adx-status.err { color: #c53030; }
#adx-status.running { color: var(--accent); }

@media (max-width: 1000px) {
  .adx-form { grid-template-columns: 1fr; }
}

.adx-results.hidden { display: none; }
.adx-results { margin-top: 1.2rem; }
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem; margin-bottom: 1rem;
}
.kpi-grid .kpi {
  background: white; border: 1px solid var(--border); border-radius: 6px;
  padding: 0.55rem 0.8rem; display: flex; flex-direction: column;
}
.kpi-grid .kpi-label { font-size: 0.7rem; color: #777; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-grid .kpi-value { font-size: 1.15rem; font-weight: 700; color: var(--fg); }
.kpi-grid .kpi-value.pos { color: #38a169; }
.kpi-grid .kpi-value.neg { color: #e53e3e; }

.adx-page .chart-box.tall { height: 380px; }
.adx-page .chart-box { height: 220px; }

.trades-details { background: white; border: 1px solid var(--border); border-radius: 6px; padding: 0.7rem 1rem; margin-bottom: 1rem; }
.trades-details summary { cursor: pointer; font-weight: 600; font-size: 0.95rem; }
.trades-details .table-wrap { max-height: 420px; overflow: auto; margin-top: 0.6rem; }
#trades-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
#trades-table th, #trades-table td { padding: 0.3rem 0.55rem; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
#trades-table th { background: #f7fafc; position: sticky; top: 0; text-align: center; }
#trades-table td:first-child, #trades-table td.reason { text-align: left; }
#trades-table td.side-long  { color: #2f855a; font-weight: 600; text-align: center; }
#trades-table td.side-short { color: #c53030; font-weight: 600; text-align: center; }
#trades-table tr.trade-win  td:nth-last-child(2) { color: #2f855a; }
#trades-table tr.trade-loss td:nth-last-child(2) { color: #c53030; }
#trades-table td.reason { color: #666; font-size: 0.78rem; }

/* Regime backtest config */
.adx-regime-config { grid-column: 1 / -1; background: #fffaf0; border: 1px dashed #d69e2e; }
.adx-regime-config legend { color: #975a16; font-weight: 600; }
.regime-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0.4rem 0.8rem; }
.regime-grid label { font-size: 0.82rem; margin: 0.2rem 0; }
.regime-grid label.toggle { background: #fef3c7; padding: 0.2rem 0.4rem; border-radius: 3px; }
#adx-regime-run { background: #d69e2e; margin-left: 0.5rem; }
#adx-regime-run:hover { background: #b7791f; }
#adx-regime-run:disabled { background: #999; cursor: wait; }

/* Optimized config presets */
.adx-presets { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.7rem 0.9rem; border: 1px dashed var(--border); border-radius: 6px; background: #f9fafb; }
.adx-presets legend { font-size: 0.85rem; padding: 0 0.4rem; color: #555; }
.adx-presets .adx-preset {
  background: #edf2f7; color: #1a365d; border: 1px solid var(--border);
  padding: 0.35rem 0.7rem; border-radius: 4px; cursor: pointer;
  font-size: 0.8rem; font-weight: 500;
}
.adx-presets .adx-preset:hover { background: #cbd5e0; }
.adx-presets .adx-preset:active { background: #a0aec0; }

/* ─── Landing rozcestník ─────────────────────────────────────────────── */
.landing { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.landing > h2 { margin-top: 0; }
.landing > .hint { color: #4a5568; margin-bottom: 1.5rem; }
.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.landing-card {
  display: block;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.landing-card:hover {
  border-color: #2b6cb0;
  box-shadow: 0 4px 12px rgba(43,108,176,0.10);
  transform: translateY(-2px);
}
.landing-card h3 {
  margin: 0 0 0.5rem 0;
  color: #2b6cb0;
  font-size: 1.05rem;
}
.landing-card p {
  margin: 0;
  color: #4a5568;
  font-size: 0.85rem;
  line-height: 1.4;
}

/* =====================================================================
   Compare page (/compare)
   ===================================================================== */
.compare-page { padding: 0 1rem 2rem; }
.cmp-form { display: flex; flex-direction: column; gap: 0.8rem; max-width: 1100px; }
.cmp-form fieldset { border: 1px solid #e2e8f0; border-radius: 6px; padding: 0.6rem 0.8rem; }
.cmp-form legend { padding: 0 0.4rem; font-weight: 600; color: #2d3748; }
.cmp-selections { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.6rem; }
.cmp-module-group { border: 1px solid #edf2f7; border-radius: 4px; padding: 0.4rem 0.6rem; background: #fafbfc; }
.cmp-module-group h4 { margin: 0 0 0.4rem; font-size: 0.85rem; color: #2d3748; }
.cmp-pick { display: block; padding: 0.15rem 0; font-size: 0.8rem; cursor: pointer; }
.cmp-pick:hover { background: #f1f5f9; }
.cmp-pick input[type=checkbox] { vertical-align: middle; margin-right: 0.3rem; }
.cmp-actions { display: flex; align-items: center; gap: 0.8rem; padding: 0.4rem 0; }
/* Compare: sjednocený sizing fieldset (kapitál + radio + qty input) */
.cmp-form fieldset { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.cmp-form label { font-size: 0.85rem; color: #2d3748; }
.cmp-form input[type=number] { width: 8.5rem; padding: 0.28rem 0.4rem; border: 1px solid var(--border); border-radius: 4px; margin-left: 0.35rem; }
.cmp-form input[type=date]   { padding: 0.28rem 0.4rem; border: 1px solid var(--border); border-radius: 4px; margin-left: 0.35rem; }
.cmp-sizing { display: inline-flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; color: #4a5568; }
.cmp-sizing > span { font-weight: 500; }
.cmp-radio { display: inline-flex; align-items: center; gap: 0.25rem; background: #f0f4f8; padding: 0.2rem 0.6rem; border-radius: 4px; cursor: pointer; font-weight: 500; }
.cmp-radio input[type=radio] { margin: 0 0.2rem 0 0; vertical-align: middle; }
#cmp-fixed-warn { color: #b7791f; font-size: 0.78rem; flex-basis: 100%; }
#cmp-status.ok      { color: #2f855a; }
#cmp-status.err     { color: #c53030; }
#cmp-status.running { color: var(--accent, #3182ce); }

.cmp-results h3 { margin: 1rem 0 0.4rem; }
.cmp-table-wrap { overflow-x: auto; }
.cmp-table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
.cmp-table th, .cmp-table td { padding: 0.3rem 0.5rem; border-bottom: 1px solid #edf2f7; text-align: right; white-space: nowrap; }
.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; max-width: 360px; white-space: normal; }
.cmp-table th { background: #f7fafc; color: #2d3748; font-weight: 600; }
.cmp-table td.best { background: #f0fff4; color: #22543d; font-weight: 700; }
.cmp-table tr.err td { color: #c53030; }
.cmp-table tr:hover td { background: #fafbfc; }
.cmp-chart-wrap { background: #fff; padding: 0.6rem; border: 1px solid #e2e8f0; border-radius: 6px; }
.cmp-chart-controls { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; font-size: 0.8rem; }
.cmp-ctl-label { color: #4a5568; font-weight: 600; margin-right: 0.2rem; }
.cmp-ctl-sep { display: inline-block; width: 1px; height: 18px; background: #e2e8f0; margin: 0 0.4rem; }
.cmp-ctl { padding: 0.25rem 0.7rem; border: 1px solid #cbd5e0; background: #f7fafc; color: #2d3748; border-radius: 4px; cursor: pointer; font-size: 0.78rem; font-weight: 500; }
.cmp-ctl:hover { background: #edf2f7; }
.cmp-ctl.active { background: #3182ce; border-color: #2c5282; color: #fff; }
.cmp-chart-canvas { position: relative; height: 480px; width: 100%; }
@media (max-width: 720px) { .cmp-chart-canvas { height: 360px; } }
.nav-compare { font-weight: 700; }
