/* PeKe — minimalistický styl. */
:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --ok: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --border: #334155;
  --ok-bg: rgba(34, 197, 94, 0.08);
  --bad-bg: rgba(239, 68, 68, 0.08);
  --warn-bg: rgba(245, 158, 11, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

header {
  padding: 2.5rem 1rem 1rem;
  text-align: center;
}
header h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle { color: var(--muted); margin: 0.35rem 0 0; }

/* ── Layout ──────────────────────────────────────────────────────────────── */

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Liga filter ─────────────────────────────────────────────────────────── */

#league-filter {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  overflow: hidden;
}

.filter-title {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.filter-label-hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.82em;
  white-space: nowrap;
}

.filter-row-spacer { width: 1.25rem; flex-shrink: 0; }

.filter-info-icon {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  cursor: help;
  vertical-align: middle;
  margin-left: 0.2rem;
}
.filter-info-icon:hover { color: var(--accent); }

.filter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-row label {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.filter-row select {
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  cursor: pointer;
}
.filter-row select:focus,
.filter-row select:hover:not(:disabled) { border-color: var(--accent); }
.filter-row select:disabled { opacity: 0.4; cursor: default; }

.filter-row + .filter-row { margin-top: 0.6rem; }

.filter-row input[type="date"],
.filter-row input[type="number"] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.filter-row input[type="date"] { width: 148px; flex: none; color-scheme: dark; }
.filter-row input[type="number"] { width: 130px; }
.filter-row input[type="date"]:focus,
.filter-row input[type="number"]:focus { border-color: var(--accent); }

/* ── Dropzone ────────────────────────────────────────────────────────────── */

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--panel);
  transition: border-color 0.15s, background 0.15s;
  outline: none;
  cursor: default;
}
.dropzone:focus-visible { border-color: var(--accent); }
.dropzone.dragging { border-color: var(--accent); background: #162032; }

.dropzone-icon {
  display: block;
  margin: 0 auto 1rem;
  opacity: 0.35;
}

.dropzone p { margin: 0 0 1.25rem; color: var(--muted); }

.actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  user-select: none;
}
.btn:hover { border-color: var(--accent); background: #263548; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #0f172a;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { background: #7dd3fc; border-color: #7dd3fc; }

kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  background: #334155;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
}

/* ── Ticket tiles ────────────────────────────────────────────────────────── */

.ticket-tile {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
}
.ticket-tile--placed {
  border-color: rgba(34, 197, 94, 0.2);
}
.tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.25rem;
}
.tile-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
}
.ticket-tile--placed .tile-label {
  color: var(--ok);
  opacity: 1;
}

/* ── Preview ─────────────────────────────────────────────────────────────── */

.preview {
  background: var(--panel);
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  transition: background 0.2s, border-color 0.2s;
}
.preview--placed {
  border-color: rgba(34, 197, 94, 0.3);
}
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.preview-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
}
.preview--placed .preview-label {
  color: var(--ok);
  opacity: 1;
}
.preview-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  justify-content: center;
}

.btn-small {
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
}

.already-placed-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.already-placed-label input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

.new-check-section {
  padding: 1.5rem 0 0.5rem;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-danger {
  background: transparent;
  color: var(--bad);
  border: 1px solid var(--bad);
  border-radius: 10px;
  padding: 0.6rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-danger:hover { background: var(--bad-bg); }

.preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
  justify-content: center;
}

.preview-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  flex: 0 0 auto;
}

.preview-item img {
  display: block;
  max-height: 280px;
  max-width: 320px;
  object-fit: contain;
}

.preview-pdf-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1.5rem 1.25rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  max-width: 180px;
  word-break: break-all;
}

.preview-item-num {
  position: absolute;
  top: 6px;
  left: 8px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  line-height: 1.4;
}

.preview-item-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(239,68,68,0.85);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}
.preview-item-remove:hover { background: var(--bad); }

/* ── Status ──────────────────────────────────────────────────────────────── */

.status {
  background: var(--panel);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.status::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: pulse 1.2s ease-in-out infinite;
}

.status.status-error { color: var(--bad); border-color: rgba(239,68,68,0.3); }
.status.status-error::before { background: var(--bad); animation: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.35; transform: scale(0.75); }
}

/* ── Results ─────────────────────────────────────────────────────────────── */

.results {
  background: var(--panel);
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; margin-top: 0.75rem; table-layout: auto; }
/* # sloupec fixní, zdroje (4–12) na minimum, HOME/AWAY/NOTE auto */
:is(#verification-table, #placed-verification-table, #manual-verification-table) th:nth-child(1),
:is(#verification-table, #placed-verification-table, #manual-verification-table) td:nth-child(1) { width: 2rem; }
:is(#verification-table, #placed-verification-table, #manual-verification-table) th:nth-child(n+4):nth-child(-n+12),
:is(#verification-table, #placed-verification-table, #manual-verification-table) td:nth-child(n+4):nth-child(-n+12) { width: 1px; white-space: nowrap; }
th, td {
  padding: 0.65rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}
th { color: var(--muted); font-weight: 500; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }

tr.row-ok   td { background: var(--ok-bg); }
tr.row-swapped td { background: var(--bad-bg); }
tr.row-unknown td { background: var(--warn-bg); }

.match-score { font-size: 0.78em; color: var(--muted); white-space: nowrap; }

/* ── Zdrojové buňky v tabulce výsledků ───────────────────────────────────── */

.src-cell { font-size: 0.85rem; white-space: normal; }
.src-name { display: block; color: var(--muted); font-size: 0.80em; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; word-break: normal; overflow-wrap: normal; }
.src-na   { color: var(--border); }

.note-cell { font-size: 0.82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: help; max-width: 0; word-break: normal; overflow-wrap: normal; }

.src-ok      { color: var(--ok);   font-weight: 700; }
.src-swapped { color: var(--bad);  font-weight: 700; }
.src-unknown { color: var(--warn); font-weight: 700; }

.status-ok      { color: var(--ok);   font-weight: 600; }
.status-swapped { color: var(--bad);  font-weight: 600; }
.status-unknown { color: var(--warn); font-weight: 600; }

/* ── Verify grid — nový styl výsledků verifikace tiketu ─────────────────── */

.verify-grid-wrap { width: 100%; margin-top: 0.75rem; }

.vg-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.5rem 0.45rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
  border-radius: 4px;
  transition: background 0.1s;
}
.vg-row:hover { background: rgba(255,255,255,0.025); }

.vg-bar {
  width: 6px;
  min-height: 2em;
  align-self: stretch;
  border-radius: 3px;
  flex-shrink: 0;
}
.vg-bar--ok      { background: #22c55e; }
.vg-bar--swapped { background: #ef4444; }
.vg-bar--unknown { background: #f59e0b; }

.vg-num {
  font-size: 0.72rem;
  color: var(--muted, #94a3b8);
  width: 1.1rem;
  flex-shrink: 0;
  text-align: center;
}

.vg-teams {
  flex: 1;
  min-width: 180px;
  max-width: 300px;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.vg-home, .vg-away { color: var(--text, #e2e8f0); }
.vg-sep { color: var(--muted, #94a3b8); }

.vg-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  align-items: center;
}

.vg-src {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 0.15rem 0.3rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--border, #334155);
  background: var(--panel, #1e293b);
  color: var(--muted, #94a3b8);
  cursor: default;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.vg-src--ok      { border-color: rgba(34,197,94,0.45);  color: #4ade80; }
.vg-src--swapped { border-color: rgba(239,68,68,0.5);   color: #f87171; }
.vg-src--unknown { border-color: rgba(251,191,36,0.45); color: #fbbf24; }
.vg-src--na      { color: #3d5068; border-color: #243044; }

.vg-status {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  margin-left: auto;
}
.vg-status--ok      { color: #22c55e; }
.vg-status--swapped { color: #ef4444; }
.vg-status--unknown { color: #f59e0b; }

.vg-note {
  font-size: 0.75rem;
  color: var(--muted, #94a3b8);
  flex-basis: 100%;
  padding-left: 2.4rem;
  margin-top: -0.1rem;
}
.vg-note:empty { display: none; }

/* ── Ticket diff banner ──────────────────────────────────────────────────── */

.ticket-diff {
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
}
.ticket-diff--ok {
  background: var(--ok-bg);
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.ticket-diff--warn {
  background: var(--bad-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.ticket-diff-title {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.ticket-diff--ok  .ticket-diff-title { color: var(--ok); }
.ticket-diff--warn .ticket-diff-title { color: var(--bad); }
.ticket-diff-row {
  color: var(--muted);
  padding-left: 1.4rem;
  font-size: 0.85rem;
  line-height: 1.5;
}
.ticket-diff-row strong { color: var(--text); }

/* ── Placed ticket section ───────────────────────────────────────────────── */

.placed-header {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  align-self: stretch;
  color: var(--ok);
}

.placed-header p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.placed-header strong {
  color: var(--text);
}

/* ── History section ─────────────────────────────────────────────────────── */

.history-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.history-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s;
}
.history-header:hover { color: var(--text); }

.history-count {
  margin-left: 0.25rem;
  background: var(--border);
  color: var(--muted);
  border-radius: 99px;
  padding: 0.05rem 0.55rem;
  font-size: 0.78rem;
}

#history-chevron {
  margin-left: auto;
  transition: transform 0.2s;
}
#history-chevron.open { transform: rotate(180deg); }

.history-body {
  padding: 0 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0 0.25rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: calc(5 * 2.6rem);
  overflow-y: auto;
  scrollbar-width: thin;
}

.history-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem 0.45rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.history-list-item:hover { border-color: var(--accent); }
.history-list-item.active { border-color: var(--accent); background: var(--panel); }

.history-list-label {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-save,
.history-item-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.history-item-delete { font-size: 1.1rem; }
.history-item-save:hover  { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.history-item-delete:hover { color: var(--bad); background: var(--bad-bg); }
.history-item-delete--confirm { color: var(--bad); }

.history-delete-confirm {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  margin-left: 0.4rem;
}
.history-delete-yes {
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--bad);
  background: var(--bad-bg);
  color: var(--bad);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.history-delete-yes:hover { background: var(--bad); color: #fff; }
.history-delete-no {
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.history-delete-no:hover { background: var(--border); }

.history-detail {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.history-cols {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 3fr;
  gap: 1rem;
}

.history-col { display: flex; flex-direction: column; gap: 0.4rem; }

.history-col-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.history-col-content {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.6;
}

.history-match { color: var(--muted); font-size: 0.82rem; display: flex; align-items: baseline; gap: 0.35rem; flex-wrap: wrap; }
.history-match.status-ok      { color: var(--ok); }
.history-match.status-swapped { color: var(--bad); }
.history-match.status-unknown { color: var(--warn); }
.hd-icon { font-size: 0.78rem; flex-shrink: 0; }
.hd-match-label { flex: 1; min-width: 0; }
.hd-sources { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.3rem; width: 100%; }
.hd-src-box {
  flex: 1; min-width: 110px;
  border-radius: 5px;
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1.4;
}
.hd-src-af        { background: rgba(56,  139, 255, 0.08); border: 1px solid rgba(56,  139, 255, 0.25); }
.hd-src-odds      { background: rgba(168,  85, 247, 0.08); border: 1px solid rgba(168,  85, 247, 0.25); }
.hd-src-fd        { background: rgba(20,  184, 166, 0.08); border: 1px solid rgba(20,  184, 166, 0.25); }
.hd-src-tsdb      { background: rgba(251, 146,  60, 0.08); border: 1px solid rgba(251, 146,  60, 0.25); }
.hd-src-ifortuna  { background: rgba(239,  68,  68, 0.08); border: 1px solid rgba(239,  68,  68, 0.25); }
.hd-src-tipsport  { background: rgba(234, 179,   8, 0.08); border: 1px solid rgba(234, 179,   8, 0.25); }
.hd-src-livesport { background: rgba(34,  197,  94, 0.08); border: 1px solid rgba(34,  197,  94, 0.25); }
.hd-src-be        { background: rgba(100, 116, 139, 0.08); border: 1px solid rgba(100, 116, 139, 0.25); }
.hd-src-label { display: block; font-size: 0.70rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.1rem; }
.hd-src-af        .hd-src-label { color: #388bff; }
.hd-src-odds      .hd-src-label { color: #a855f7; }
.hd-src-fd        .hd-src-label { color: #14b8a6; }
.hd-src-tsdb      .hd-src-label { color: #fb923c; }
.hd-src-ifortuna  .hd-src-label { color: #ef4444; }
.hd-src-tipsport  .hd-src-label { color: #ca8a04; }
.hd-src-livesport .hd-src-label { color: #22c55e; }
.hd-src-be        .hd-src-label { color: #64748b; }
.hd-src-icon { font-weight: 700; margin-right: 0.25rem; }
.hd-src-team { color: var(--muted); word-break: break-word; }

/* ── Příběh zachycení ──────────────────────────────────────────────────── */
.capture-story {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-left: 4px solid var(--bad);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}
.story-header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--bad);
  margin-bottom: 0.25rem;
}
.story-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.story-match {
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.5rem;
}
.story-match-title { font-weight: 600; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.35rem; }
.story-row { display: flex; gap: 0.5rem; font-size: 0.88rem; margin-bottom: 0.2rem; align-items: baseline; }
.story-label { color: var(--muted); min-width: 10rem; flex-shrink: 0; }
.story-wrong   { color: var(--bad);  font-weight: 600; }
.story-correct { color: var(--ok);   font-weight: 600; }
.story-muted .story-label, .story-muted .story-val { color: var(--muted); font-size: 0.82rem; }

.history-thumbnail {
  width: 100%;
  max-width: 240px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
  cursor: zoom-in;
  transition: opacity 0.15s;
}
.history-thumbnail:hover { opacity: 0.85; }

/* ── Lightbox ───────────────────────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}
.lightbox.hidden { display: none; }

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.lightbox-close:hover { opacity: 1; }
.history-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-ok      { background: var(--ok-bg);   color: var(--ok);   }
.badge-swapped { background: var(--bad-bg);  color: var(--bad);  }
.badge-unknown { background: var(--warn-bg); color: var(--warn); }
.badge-none    { background: var(--border);  color: var(--muted);}

@media (max-width: 700px) {
  .history-cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .history-cols { grid-template-columns: 1fr; }
}

/* ── Event log ───────────────────────────────────────────────────────────── */

#event-log-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

.event-log-toggle {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.15s;
}
.event-log-toggle::before {
  content: "▸";
  font-size: 0.75rem;
  transition: transform 0.15s;
}
.event-log-toggle.open::before { transform: rotate(90deg); }
.event-log-toggle:hover { color: var(--text); }

.event-log-panel {
  margin-top: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: visible;
}

.event-log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.event-log-count {
  font-size: 0.75rem;
  color: var(--muted);
}

.event-log-clear {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.event-log-clear:hover { color: var(--bad); background: var(--bad-bg); }

.event-log-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  font-size: 0.78rem;
}

.event-log-list li {
  display: flex;
  gap: 0.75rem;
  padding: 0.18rem 0.85rem;
  line-height: 1.5;
  border-left: 2px solid transparent;
}
.event-log-list li:hover { background: rgba(255,255,255,0.03); }

.event-log-list li.log-info   { border-left-color: var(--accent); }
.event-log-list li.log-ok     { border-left-color: var(--ok); }
.event-log-list li.log-error  { border-left-color: var(--bad); color: var(--bad); }
.event-log-list li.log-warn   { border-left-color: var(--warn); color: var(--warn); }

.event-log-ts {
  color: var(--muted);
  flex-shrink: 0;
  user-select: none;
}

/* ── Mapa systému ────────────────────────────────────────────────────────── */

#sysmap-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

.sysmap {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 1.25rem 1rem 0.75rem;
  flex-wrap: wrap;
}

.sysmap-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  min-width: 90px;
  max-width: 130px;
  gap: 0.3rem;
}

.sysmap-step--wide { max-width: 180px; }

.sysmap-icon { font-size: 1.6rem; line-height: 1; }

.sysmap-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.sysmap-desc {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.35;
}

.sysmap-arrow {
  font-size: 1.2rem;
  color: var(--border);
  padding-top: 1.4rem;
  flex-shrink: 0;
}

.sysmap-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: center;
  margin: 0.2rem 0;
}

.sysmap-src {
  background: rgba(56,189,248,0.1);
  color: var(--accent);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  white-space: nowrap;
}

.sysmap-rule {
  margin: 0.5rem 1rem 1rem;
  padding: 0.65rem 1rem;
  background: rgba(239,68,68,0.07);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 8px;
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.5;
}

.sysmap-rule strong { color: var(--bad); }

/* ── Zdroje dat panel ────────────────────────────────────────────────────── */

.sources-count {
  display: inline-block;
  background: var(--border);
  color: var(--muted);
  border-radius: 99px;
  padding: 0.05rem 0.5rem;
  font-size: 0.75rem;
  margin-left: 0.3rem;
  vertical-align: middle;
}

.sources-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  min-width: unset;
  table-layout: auto;
  font-size: 0.85rem;
}

.sources-table th {
  padding: 0.5rem 1rem;
  text-align: left;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.sources-table td {
  padding: 0.55rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
  word-break: normal;
  overflow-wrap: normal;
  white-space: normal;
}

.sources-table tr:last-child td { border-bottom: none; }
.sources-table tr:hover td { background: rgba(255,255,255,0.02); }

.sbadge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.3rem;
}
.sbadge--free    { background: rgba(34,197,94,0.12);  color: var(--ok); }
.sbadge--paid    { background: rgba(56,189,248,0.12); color: var(--accent); }
.sbadge--patreon { background: rgba(245,158,11,0.12); color: var(--warn); }

.sources-stat-note {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.4rem 1rem 0.75rem;
  margin: 0;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}
footer a { color: var(--accent); }

/* ── Utilities ───────────────────────────────────────────────────────────── */

.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  header h1 { font-size: 1.5rem; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-row label { margin-top: 0.25rem; }
  .filter-row select { min-width: unset; width: 100%; }
  .filter-row input[type="date"] { min-width: unset; }
  .filter-row input[type="number"] { width: 100%; }
  .dropzone { padding: 2rem 1rem; }
}

/* ── Refresh button ─────────────────────────────────────────────────────── */

.refresh-btn {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s;
  z-index: 900;
}

.refresh-btn:hover {
  opacity: 1;
  color: var(--accent);
}

/* ── Automatické kontroly ────────────────────────────────────────────────── */

.ac-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.ac-run-status {
  font-size: 0.82rem;
  color: var(--muted);
}

.ac-lead-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}

.ac-lead-input {
  width: 3.5rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.82rem;
  text-align: center;
  font-family: inherit;
}
.ac-lead-input:focus {
  outline: none;
  border-color: var(--accent);
}

.ac-next-trigger {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.ac-next-trigger strong { color: var(--text); }

.ac-results {
  padding: 0.5rem 0;
  max-height: 520px;
  overflow-y: auto;
}

.ac-match-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle, #1e293b);
  flex-wrap: nowrap;
}
.ac-match-icon { flex-shrink: 0; font-size: 0.9rem; padding-top: 0.1rem; }
.ac-match-teams {
  flex: 0 0 auto;
  min-width: 200px;
  max-width: 280px;
  font-size: 0.82rem;
  color: var(--text, #e2e8f0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-match-srcs {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  min-width: 0;
}

.ac-empty {
  padding: 1rem;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Řádek ligy */
.ac-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 0.5rem 1rem;
  align-items: center;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  font-size: 0.875rem;
}
.ac-row:hover { background: rgba(255,255,255,0.03); }
.ac-row:last-child { border-bottom: none; }

/* BET Radar styl — grid s source sloupci */
.ac-grid-header,
.ac-grid-row {
  display: grid;
  grid-template-columns: 1fr 2rem repeat(7, 3rem);
  gap: 0.25rem 0.5rem;
  align-items: center;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.ac-grid-header { font-size: 0.72rem; font-weight: 700; color: var(--muted); padding-bottom: 0.3rem; border-bottom: 2px solid var(--border); position: sticky; top: 0; background: var(--panel, #1e293b); z-index: 10; }
.ac-grid-row { cursor: pointer; transition: background 0.1s; }
.ac-grid-row:hover { background: rgba(255,255,255,0.03); }
.ac-gh-liga { }
.ac-gh-fix, .ac-gh-src { text-align: center; }
.ac-src-cell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; padding: 0.2rem 0;
  border-radius: 999px; font-size: 0.78rem; font-weight: 700;
  border: 1px solid var(--border, #334155);
  background: var(--panel, #1e293b);
}
.ac-src-ok      { border-color: rgba(34,197,94,0.5);  color: #4ade80; }
.ac-src-conflict { border-color: rgba(239,68,68,0.4); color: #f87171; }
.ac-src-nodata  { color: var(--muted, #94a3b8); }

.ac-league-name { font-weight: 500; }

.ac-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.ac-badge--ok      { background: rgba(34,197,94,0.15);  color: #22c55e; }
.ac-badge--warning { background: rgba(245,158,11,0.15); color: #f59e0b; }
.ac-badge--no_data { background: rgba(148,163,184,0.15); color: #94a3b8; }
.ac-badge--error   { background: rgba(239,68,68,0.15);  color: #ef4444; }

.ac-sources {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.ac-sources--ok      { color: #22c55e; }
.ac-sources--warning { color: #f59e0b; }

.ac-fixtures {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.ac-time {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Detail zápasů (expandovaný řádek) */
.ac-detail {
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem 0.75rem;
  font-size: 0.82rem;
}

.ac-detail-title {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.ac-match-row {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  gap: 0.3rem 0.75rem;
  align-items: start;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.ac-match-row:last-child { border-bottom: none; }

.ac-match-icon { font-size: 0.9rem; text-align: center; }
.ac-match-teams { }
.ac-match-teams .home { font-weight: 500; }
.ac-match-teams .away { color: var(--muted); }
.ac-match-srcs {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
}
.ac-match-srcs .ok-src   { color: #22c55e; }
.ac-match-srcs .warn-src { color: #f59e0b; }

/* Dot indikátor stavu v tlačítku sekce */
.ac-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 0.4rem;
  vertical-align: middle;
}
.ac-dot--ok      { background: #22c55e; }
.ac-dot--warning { background: #f59e0b; }
.ac-dot--idle    { background: var(--muted); }

/* Selektor lig */
.ac-selector-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.ac-selector-label { font-size: 0.82rem; color: var(--muted); }
.ac-selector-count { color: var(--text); font-weight: 500; }
.ac-sel-btn {
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
}

.ac-league-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  max-height: none;
}

.ac-chip {
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
  font-size: 0.775rem;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.12s;
  user-select: none;
  white-space: nowrap;
}
.ac-chip--on  { background: rgba(56,189,248,0.12); border-color: var(--accent); color: var(--accent); }
.ac-chip--off { background: transparent; color: var(--muted); opacity: 0.45; }
.ac-chip--inactive { border-style: dashed; }

/* ── Audit pokrytí lig ────────────────────────────────────────────────────── */
.ac-cov-wrap {
  overflow-x: auto;
  margin-bottom: 1.25rem;
}
.ac-cov-table {
  border-collapse: collapse;
  font-size: 0.8rem;
  white-space: nowrap;
}
.ac-cov-league-hdr, .ac-cov-n-hdr, .ac-cov-src-hdr {
  padding: 0.3rem 0.5rem;
  border-bottom: 2px solid var(--border, #e5e5e5);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}
.ac-cov-league-hdr { text-align: left; min-width: 140px; }
.ac-cov-n-hdr { min-width: 2rem; }
.ac-cov-league { padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--border-subtle, #f0f0f0); font-size: 0.82rem; }
.ac-cov-n { padding: 0.25rem 0.5rem; text-align: center; color: var(--muted); font-size: 0.78rem; border-bottom: 1px solid var(--border-subtle, #f0f0f0); }
.ac-cov-cell {
  padding: 0.25rem 0.4rem;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle, #f0f0f0);
  border-left: 1px solid var(--border-subtle, #f0f0f0);
  min-width: 3rem;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: default;
}
.ac-cov--absent  { color: var(--border, #ccc); font-weight: 400; }
.ac-cov--zero    { color: #dc2626; background: rgba(220,38,38,0.06); }
.ac-cov--partial { color: #d97706; background: rgba(217,119,6,0.08); }
.ac-cov--good    { color: #16a34a; background: rgba(22,163,74,0.08); }

.ac-cov-unchecked-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}
.ac-cov-unchecked {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

/* ── Korelace zdrojů ──────────────────────────────────────────────────────── */
.ac-corr-section {
  border-top: 1px solid var(--border, #e5e5e5);
  margin-top: 0.25rem;
}
.ac-corr-toggle {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted, #888);
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.01em;
}
.ac-corr-toggle:hover { color: var(--text, #1a1a1a); }
.ac-corr-panel { padding: 0 1rem 1rem; }
.ac-corr-empty { color: var(--muted); font-size: 0.85rem; padding: 0.5rem 0; }
.ac-corr-summary {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

/* Tabulka spolehlivosti */
.ac-corr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
}
.ac-corr-table th {
  text-align: left;
  padding: 0.3rem 0.6rem;
  border-bottom: 2px solid var(--border, #e5e5e5);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.ac-corr-table th:not(:first-child) { text-align: center; }
.ac-corr-table td {
  padding: 0.3rem 0.6rem;
  border-bottom: 1px solid var(--border-subtle, #f0f0f0);
  text-align: center;
}
.ac-corr-table td:first-child { text-align: left; }
.ac-corr-n { color: var(--muted); font-size: 0.78rem; }

/* Barevné třídy procent */
.ac-pct--good { color: #16a34a; font-weight: 600; }
.ac-pct--warn { color: #d97706; font-weight: 600; }
.ac-pct--bad  { color: #dc2626; font-weight: 600; }

/* Párová matice */
.ac-corr-pair-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}
.ac-corr-matrix {
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}
.ac-matrix-hdr {
  padding: 0.25rem 0.5rem;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}
.ac-corr-matrix td {
  padding: 0.25rem 0.5rem;
  text-align: center;
  border: 1px solid var(--border-subtle, #f0f0f0);
  min-width: 3rem;
}
.ac-matrix-diag { background: var(--surface-alt, #f8f8f8); color: var(--muted); }
.ac-matrix-empty { color: var(--border, #ccc); }
.ac-matrix-cell { font-weight: 600; cursor: default; }

@keyframes be-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(1.35); }
}
.be-dot-active { animation: be-pulse 1.4s ease-in-out infinite; }
