/* Sekce Analytika (analytika.js). Barvy grafů jsou vlastní proměnné, ať jdou změnit na jednom místě;
   text a rámečky berou proměnné administrace (styles.css). */
.ana {
  --ana-series: #2a78d6;          /* hlavní řada */
  --ana-series-wash: rgba(42, 120, 214, .10);
  --ana-prev: #898781;            /* předchozí období (ustupuje do pozadí) */
  --ana-grid: #e1e0d9;
  --ana-axis: #c3c2b7;
  --ana-good: #006300;
  --ana-bad: #b73a26;
  /* jedna barva od světlé po tmavou = od mála po hodně */
  --ana-s0: #f3f1ee; --ana-s1: #cde2fb; --ana-s2: #9ec5f4; --ana-s3: #6da7ec; --ana-s4: #3987e5; --ana-s5: #256abf; --ana-s6: #104281;
}
.ana-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 0 0 16px; }
.ana-bar__range { font-size: 14px; font-weight: 600; color: var(--ink); }
.ana-bar__prev { font-size: 12.5px; color: var(--muted); }
.ana-bar input[type="date"] { height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; font: inherit; font-size: 13px; color: var(--ink); }
.ana-step { width: 34px; height: 34px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; color: var(--ink); cursor: pointer; font-size: 16px; line-height: 1; }
.ana-step:disabled { opacity: .35; cursor: default; }
.ana-step:hover:not(:disabled) { background: var(--bg-1); }

.ana-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: 16px; }
.ana-kpi { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ana-kpi__label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.ana-kpi__value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); line-height: 1.15; }
.ana-kpi__value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.ana-kpi__sub { font-size: 12px; color: var(--muted); min-height: 16px; }
.ana-delta { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ana-delta--good { color: var(--ana-good); }
.ana-delta--bad { color: var(--ana-bad); }

.ana-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; margin-bottom: 16px; }
.ana-card__head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
.ana-card__head h3 { font-size: 15px; font-weight: 700; margin: 0; color: var(--ink); }
.ana-card__sub { font-size: 12.5px; color: var(--muted); margin: 4px 18px 0; max-width: 780px; line-height: 1.45; }
.ana-card__body { padding: 14px 18px 18px; }
.ana-note { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 10px 0 0; }
.ana-empty { padding: 26px 12px; text-align: center; color: var(--muted); font-size: 13.5px; }
.ana-cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .ana-cols { grid-template-columns: minmax(0, 1fr); } }

/* řádkové pruhy (trychtýř, funkce) */
.ana-rows { display: flex; flex-direction: column; gap: 10px; }
.ana-row { display: grid; grid-template-columns: minmax(120px, 230px) minmax(60px, 1fr) auto; gap: 10px 14px; align-items: center; font-size: 13px; }
.ana-row__label { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.ana-row__track { height: 18px; position: relative; }
.ana-row__fill { position: absolute; left: 0; top: 0; height: 18px; min-width: 2px; background: var(--ana-series); border-radius: 0 4px 4px 0; }
.ana-row__val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink); }
.ana-row__val b { font-weight: 700; }
.ana-row__val span { color: var(--muted); margin-left: 8px; font-size: 12px; }
@media (max-width: 720px) { .ana-row { grid-template-columns: minmax(0, 1fr) auto; } .ana-row__track { grid-column: 1 / -1; order: 3; } }

/* grafy */
.ana-chart { width: 100%; height: auto; display: block; overflow: visible; }
.ana-chart text { font-size: 11px; fill: var(--muted); font-family: inherit; }
.ana-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-3); margin-top: 8px; flex-wrap: wrap; }
.ana-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.ana-tip { position: fixed; z-index: 9999; pointer-events: none; background: #1f1a17; color: #fff; font-size: 12.5px; line-height: 1.45; padding: 8px 10px; border-radius: 8px; max-width: 280px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); display: none; }
.ana-tip b { font-weight: 700; }

/* tabulky */
.ana-table-wrap { overflow-x: auto; }
.ana-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ana-table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ana-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink); }
.ana-table tr:last-child td { border-bottom: 0; }
.ana-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ana-table .sub { display: block; font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.ana-table a { color: var(--link); text-decoration: none; }
.ana-table a:hover { text-decoration: underline; }
.ana-mini { display: inline-block; height: 8px; border-radius: 0 4px 4px 0; background: var(--ana-series); vertical-align: middle; min-width: 2px; }
.ana-flag { display: inline-block; font-size: 11px; color: var(--ink-3); background: var(--bg-2); border-radius: 999px; padding: 2px 8px; margin: 2px 4px 0 0; white-space: nowrap; }

/* den × hodina */
.ana-hours { display: grid; grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 2px; align-items: center; min-width: 560px; }
.ana-hours__d, .ana-hours__h { font-size: 11px; color: var(--muted); text-align: center; }
.ana-hours__d { text-align: left; }
.ana-cell { height: 22px; border-radius: 3px; }
.ana-scale { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); margin-top: 10px; }
.ana-scale i { width: 22px; height: 10px; border-radius: 2px; display: inline-block; }

/* mapa okna chatu */
.ana-map { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); align-items: start; }
.ana-phone { border: 1px solid var(--line-2); border-radius: 18px; padding: 10px; background: var(--bg-1); display: flex; flex-direction: column; gap: 6px; }
.ana-phone__t { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 0 4px 2px; }
.ana-zrow { display: flex; gap: 6px; }
.ana-zone { flex: 1 1 0; min-width: 0; border-radius: 8px; padding: 7px 8px; font-size: 11.5px; line-height: 1.25; min-height: 44px; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; cursor: default; }
.ana-zone b { font-size: 13px; font-weight: 700; }
.ana-zone--tall { min-height: 76px; }
.ana-zone--slim { flex: 0 0 62px; }

/* sloupce (hloubka scrollu) */
.ana-reach { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 6px; align-items: end; height: 170px; border-bottom: 1px solid var(--ana-axis); }
.ana-reach__col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.ana-reach__bar { width: 100%; max-width: 24px; background: var(--ana-series); border-radius: 4px 4px 0 0; min-height: 2px; }
.ana-reach__x { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 6px; font-size: 11px; color: var(--muted); text-align: center; margin-top: 6px; }

/* nastavení */
.ana-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ana-opt:last-child { border-bottom: 0; padding-bottom: 0; }
.ana-opt:first-child { padding-top: 0; }
.ana-opt input[type="checkbox"], .ana-opt input[type="radio"] { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--ink); flex: 0 0 auto; }
.ana-opt__t { font-size: 14px; font-weight: 600; color: var(--ink); }
.ana-opt__d { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 2px; max-width: 760px; }
.ana-fields { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 10px; font-size: 13px; color: var(--ink-3); }
.ana-fields input[type="date"], .ana-fields select, .ana-url { height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; font: inherit; font-size: 13px; color: var(--ink); }
.ana-url { flex: 1 1 320px; min-width: 0; }
.ana-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: 13px; color: var(--ink); }
.ana-checks label { display: inline-flex; gap: 6px; align-items: center; }
.ana-pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; background: var(--bg-2); color: var(--ink-3); }
.ana-pill--on { background: #dcf3e6; color: #0f6b47; }
.ana-pill--wait { background: #fef3c7; color: #92400e; }

/* ===== Návod: měření a UTM odkazy (openGuide v analytika.js) ===== */
.ana-guide { font-size: 13.5px; line-height: 1.55; }
.ana-guide section + section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.ana-guide h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 15px; }
.ana-guide h4 span { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-grid; place-items: center; font-size: 12px; flex: none; }
.ana-guide p { margin: 0 0 8px; }
.ana-guide ol { margin: 0; padding-left: 20px; }
.ana-guide ol li { margin: 3px 0; }
.ana-guide code { font-family: 'JetBrains Mono', monospace; font-size: 12px; background: var(--canvas); padding: 1px 5px; border-radius: 5px; }
.ana-guide__note { font-size: 12.5px; color: var(--muted); margin-top: 10px !important; }
.ana-guide__note--warn { color: #92400e; background: #fef3c7; padding: 8px 10px; border-radius: 10px; }
.ana-guide__tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 8px 0; }
.ana-guide__tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.ana-guide__tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ana-guide__rules { margin: 6px 0 10px; padding-left: 18px; font-size: 12.5px; color: var(--ink-3); }
.ana-guide__build { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; border-radius: 12px; background: var(--canvas); }
.ana-guide__build label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); min-width: 0; }
.ana-guide__wide { grid-column: 1 / -1; }
.ana-guide__out { display: flex; gap: 8px; }
.ana-guide__out input { flex: 1; min-width: 0; font-size: 12px; background: #fff; }
@media (max-width: 560px) { .ana-guide__build { grid-template-columns: 1fr; } }

/* Konverze a Měření UTM (analytika.js drawKonverze / drawUtm, pokyn vlastníka 16. 11. 2026). */
.ana-pill--off { background: #fde7e3; color: #9b2c1a; }
.konv-st { --konv-c: var(--danger); background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--konv-c); border-radius: 16px; padding: 14px 18px; margin-bottom: 16px; }
.konv-st--on { --konv-c: var(--ok); }
.konv-st__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.konv-st__pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap;
  color: var(--konv-c); background: color-mix(in srgb, var(--konv-c) 12%, #fff); }
.konv-st__pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.konv-st__text { flex: 1 1 320px; min-width: 0; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.konv-st__facts { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); }
.konv-st__facts b { color: var(--ink-2); }
.konv-st__facts .konv-st__bad { color: var(--danger); }

.utm-why { background: var(--lime-50, #fdf1cc); border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.utm-why b { color: var(--ink); }
.utm-why a { color: var(--ink); font-weight: 600; }
.utm-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; }
.utm-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
.utm-form label i { font-style: normal; font-weight: 400; color: var(--muted-2); }
.utm-form__wide { grid-column: 1 / -1; }
.utm-form__where { font-size: 12.5px; color: var(--ink-2); background: var(--canvas); border-radius: 10px; padding: 8px 12px; }
.utm-form__out { display: flex; gap: 8px; }
.utm-form__out input { flex: 1; min-width: 0; font-size: 12px; background: var(--bg-1); }
@media (max-width: 640px) { .utm-form { grid-template-columns: minmax(0, 1fr); } .utm-form__out { flex-wrap: wrap; } }
.utm-links { display: flex; flex-direction: column; }
.utm-link { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 8px 20px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.utm-link:first-child { border-top: 0; padding-top: 0; }
.utm-link__name { font-size: 14px; font-weight: 700; color: var(--ink); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.utm-link__desc { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.utm-link__where { font-size: 12px; color: var(--muted); margin-top: 3px; }
.utm-link__copy { display: flex; gap: 6px; min-width: 0; }
.utm-link__copy input { flex: 1; min-width: 0; height: 30px; font-size: 11.5px; background: var(--bg-1); }
@media (max-width: 900px) { .utm-link { grid-template-columns: minmax(0, 1fr); } }
.ana-card__body > .ana-bar { margin-bottom: 12px; }
.ana-table tr.utm-row--none td { color: var(--muted); }
.utm-stats tr.utm-sec td { background: var(--bg-1); padding: 7px 10px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.utm-stats tr.utm-sec td span { margin-left: 8px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.utm-stats tr.utm-grp { cursor: pointer; }
.utm-stats tr.utm-grp:hover td, .utm-stats tr.utm-grp:focus-visible td { background: var(--bg-1); }
.utm-stats tr.utm-grp:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.utm-grp__arrow { display: inline-block; width: 16px; color: var(--muted); transition: transform .15s; }
.utm-stats tr.utm-grp.is-open .utm-grp__arrow { transform: rotate(90deg); }
.utm-stats tr.utm-grp .sub { padding-left: 16px; }
.utm-stats tr.utm-camp td { font-size: 12.5px; color: var(--ink-2); background: var(--bg-1); }
.utm-stats tr.utm-camp td:first-child { padding-left: 36px; }

/* Zpětné ověření měření z e-shopu (api/_lib/mereni.php, pokyn vlastníka 16. 11. 2026). */
.ana-pill--warn { background: #fef3c7; color: #92400e; }
.ana-pill--bad { background: #fee2e2; color: #b91c1c; }
.konv-st--bad { --konv-c: var(--danger); }
.mer-checks { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; line-height: 1.45; }
.mer-checks li { display: flex; gap: 8px; align-items: baseline; }
.mer-checks .tag { flex: 0 0 auto; }
.mer-box { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--bg-2); border-left: 4px solid var(--line); }
.mer-box--ok { border-left-color: var(--ok); }
.mer-box--warn { border-left-color: #f59e0b; }
.mer-box--bad { border-left-color: var(--danger); background: #fef2f2; }
.mer-box__t { font-weight: 700; font-size: 13.5px; }
.mer-more { margin-top: 10px; font-size: 13px; }
.mer-more summary { cursor: pointer; color: var(--muted); }

/* Verze Lucy (18. 11. 2026): srovnání verzí ostré – tabulka verzí ve sloupcích, souhrn lepší / horší */
.ver-table { min-width: 720px; }
.ver-table th.ver-col { min-width: 128px; text-align: right; cursor: pointer; white-space: normal; vertical-align: bottom; color: var(--ink); font-size: 12.5px; }
.ver-table th.ver-col .sub { font-weight: 500; }
.ver-table th.ver-col .tag { margin-top: 4px; }
.ver-table th.ver-col.is-sel, .ver-table td.is-sel { background: var(--bg-1); }
.ver-table th.ver-col:hover { background: var(--bg-1); }
.ver-sticky { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 210px; max-width: 260px; }
.ver-table thead .ver-sticky { vertical-align: bottom; }
.ver-table tr.ver-group td { background: var(--bg-1); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding-top: 12px; }
.ver-table tr.ver-subrow td:first-child { padding-left: 24px; color: var(--ink-3); }
.ver-table tr.ver-subtoggle td { border-bottom: 1px solid var(--line); padding: 4px 10px 8px; }
.ver-table td.ver-na { color: var(--muted); }
.ver-d { font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ver-d--good { color: var(--ana-good); }
.ver-d--bad { color: var(--ana-bad); }
.ver-d--weak { color: var(--muted); opacity: .8; }
.ver-link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; text-align: left; }
.ver-link:hover { text-decoration: underline; }
.ver-sum { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.ver-sum__good { color: var(--ana-good); font-weight: 700; }
.ver-sum__bad { color: var(--ana-bad); font-weight: 700; }
.ver-sum--sm { font-size: 12px; margin: 0; gap: 8px; }
.ver-warn { margin: 0 0 14px; padding-left: 18px; font-size: 12.5px; color: #92400e; line-height: 1.5; }
.ver-notes { margin: 6px 0; font-size: 13px; color: var(--ink-3); }
.ver-changes { margin: 6px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.5; color: var(--ink); }
.ver-changes li + li { margin-top: 4px; }
.ver-list { display: flex; flex-direction: column; }
.ver-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ver-item:last-child { border-bottom: 0; }
.ver-item.is-sel { background: var(--bg-1); margin: 0 -18px; padding: 12px 18px; }
.ver-item__head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: 13px; color: var(--muted); }
.ver-item__head b { color: var(--ink); font-size: 14px; }
@media (max-width: 720px) { .ver-sticky { min-width: 150px; } }
@media (max-width: 720px) { .ver-hero .ana-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .ver-hero .ana-kpi { padding: 12px; } .ver-hero .ana-kpi__value { font-size: 21px; } }
