:root {
  --c-bg: #f0f2f5;
  --c-card: #fff;
  --c-text: #222;
  --c-muted: #555;
  --c-faint: #888;
  --c-border: #dde;
  --c-cell-border: #eee;
  --c-h1: #0f766e;
  --c-subtitle: #666;
  --c-drop-border: #aac;
  --c-drop-hover: #e8f7f4;
  --c-drop-hover-border: #0D9488;
  --c-drop-icon: #0D9488;
  --c-drop-strong: #333;
  --c-drop-span: #888;
  --c-fileinfo: #444;
  --c-progress-track: #e0e4ee;
  --c-error-bg: #fff3f3;
  --c-error-border: #f5c6c6;
  --c-error-text: #c00;
  --c-summary-bad: #c62828;
  --c-summary-good: #2e7d32;
  --c-summary-warn: #e65100;
  --c-thead-bg: #0f766e;
  --c-row-even: #f7f8fc;
  --c-row-hover: #e8f7f4;
  --c-row-bad-bg: #fff5f5;
  --c-row-neutral-bg: #f9f9f9;
  --c-row-neutral-text: #888;
  --c-row-warn-bg: #fff8f0;
  --c-badge-bad-bg: #fdecea;
  --c-badge-bad-text: #c62828;
  --c-badge-good-bg: #e8f5e9;
  --c-badge-good-text: #2e7d32;
  --c-badge-neutral-bg: #eeeeee;
  --c-badge-neutral-text: #616161;
  --c-badge-warn-bg: #fff3e0;
  --c-badge-warn-text: #e65100;
  --c-legend: #555;
  --c-dot-bad-bg: #fdecea;
  --c-dot-bad-border: #e53935;
  --c-dot-good-bg: #e8f5e9;
  --c-dot-good-border: #43a047;
  --c-dot-neutral-bg: #eeeeee;
  --c-dot-neutral-border: #9e9e9e;
  --c-dot-warn-bg: #fff3e0;
  --c-dot-warn-border: #fb8c00;
  --c-footer: #888;
  --c-footer-link: #0f766e;
}

body.dark {
  --c-bg: #0B1120;
  --c-card: #161F30;
  --c-text: #e2e8f0;
  --c-muted: #94a3b8;
  --c-faint: #64748b;
  --c-border: #243047;
  --c-cell-border: #22304a;
  --c-h1: #2dd4bf;
  --c-subtitle: #94a3b8;
  --c-drop-border: #243047;
  --c-drop-hover: #0f2a26;
  --c-drop-hover-border: #2dd4bf;
  --c-drop-icon: #2dd4bf;
  --c-drop-strong: #e2e8f0;
  --c-drop-span: #64748b;
  --c-fileinfo: #94a3b8;
  --c-progress-track: #334155;
  --c-error-bg: #2d1515;
  --c-error-border: #7f3333;
  --c-error-text: #fc8181;
  --c-summary-bad: #fc8181;
  --c-summary-good: #86efac;
  --c-summary-warn: #fb923c;
  --c-thead-bg: #134e4a;
  --c-row-even: #131C2E;
  --c-row-hover: #12332e;
  --c-row-bad-bg: #2d1515;
  --c-row-neutral-bg: #1a1f2e;
  --c-row-neutral-text: #64748b;
  --c-row-warn-bg: #2d1f0e;
  --c-badge-bad-bg: #4a1515;
  --c-badge-bad-text: #fc8181;
  --c-badge-good-bg: #1a3a1f;
  --c-badge-good-text: #86efac;
  --c-badge-neutral-bg: #334155;
  --c-badge-neutral-text: #94a3b8;
  --c-badge-warn-bg: #3a2000;
  --c-badge-warn-text: #fb923c;
  --c-legend: #94a3b8;
  --c-dot-bad-bg: #4a1515;
  --c-dot-bad-border: #e53935;
  --c-dot-good-bg: #1a3a1f;
  --c-dot-good-border: #43a047;
  --c-dot-neutral-bg: #334155;
  --c-dot-neutral-border: #9e9e9e;
  --c-dot-warn-bg: #3a2000;
  --c-dot-warn-border: #fb8c00;
  --c-footer: #64748b;
  --c-footer-link: #2dd4bf;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  padding: 32px 16px;
  transition: background-color 0.3s, color 0.3s;
}

h1 {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 8px;
  color: var(--c-h1);
}

.subtitle {
  text-align: center;
  color: var(--c-subtitle);
  margin-bottom: 32px;
  font-size: 0.9rem;
}

.card {
  background: var(--c-card);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  padding: 28px;
  max-width: 860px;
  margin: 0 auto 24px;
  transition: background-color 0.3s;
}

/* Upload zona */
#drop-zone {
  border: 2px dashed var(--c-drop-border);
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  color: var(--c-drop-icon);
}

#drop-zone:hover, #drop-zone.drag-over {
  background: var(--c-drop-hover);
  border-color: var(--c-drop-hover-border);
}

#drop-zone svg {
  display: block;
  margin: 0 auto 12px;
  color: var(--c-drop-icon);
}

#drop-zone strong { display: block; font-size: 1.05rem; color: var(--c-drop-strong); margin-bottom: 4px; }
#drop-zone span { font-size: 0.85rem; color: var(--c-drop-span); }

#file-input { display: none; }

#file-info {
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--c-fileinfo);
  min-height: 20px;
}

/* Tlačítka */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.2s, opacity 0.2s;
}

.btn-primary { background: #1a3c6e; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #254f94; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-success { background: #1e7e34; color: #fff; }
.btn-success:hover:not(:disabled) { background: #26a044; }
.btn-success:disabled { opacity: 0.5; cursor: not-allowed; }

.actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* Progress */
#progress-section {
  display: none;
  margin-top: 20px;
}

#progress-label {
  font-size: 0.9rem;
  color: var(--c-muted);
  margin-bottom: 6px;
}

#progress-bar-wrap {
  background: var(--c-progress-track);
  border-radius: 99px;
  height: 14px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1a3c6e, #4477cc);
  border-radius: 99px;
  width: 0%;
  transition: width 0.3s;
}

/* Chyby */
#error-box {
  display: none;
  background: var(--c-error-bg);
  border: 1px solid var(--c-error-border);
  border-radius: 6px;
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--c-error-text);
}

/* Výsledky */
#results-section { display: none; }

#results-summary {
  font-size: 0.9rem;
  color: var(--c-muted);
  margin-bottom: 12px;
}

.summary-nespolehlivy { color: var(--c-summary-bad); }
.summary-spolehlivy   { color: var(--c-summary-good); }
.summary-chyba        { color: var(--c-summary-warn); }

.table-wrap {
  overflow-x: auto;
  border-radius: 6px;
  border: 1px solid var(--c-border);
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 900px;
}

thead tr { background: var(--c-thead-bg); color: #fff; }
thead th {
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
  font-weight: 600;
}

tbody tr:nth-child(even) { background: var(--c-row-even); }
tbody tr:hover { background: var(--c-row-hover); }

tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--c-cell-border);
  vertical-align: top;
}

/* Barevné označení */
tr.row-nespolehlivy td:first-child { border-left: 4px solid #e53935; }
tr.row-nespolehlivy { background: var(--c-row-bad-bg) !important; }

tr.row-spolehlivy td:first-child { border-left: 4px solid #43a047; }

tr.row-nenalezen td:first-child { border-left: 4px solid #9e9e9e; }
tr.row-nenalezen { background: var(--c-row-neutral-bg) !important; color: var(--c-row-neutral-text); }

tr.row-chyba td:first-child { border-left: 4px solid #fb8c00; }
tr.row-chyba { background: var(--c-row-warn-bg) !important; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-ano      { background: var(--c-badge-bad-bg);     color: var(--c-badge-bad-text); }
.badge-ne       { background: var(--c-badge-good-bg);    color: var(--c-badge-good-text); }
.badge-nenalezen { background: var(--c-badge-neutral-bg); color: var(--c-badge-neutral-text); }
.badge-chyba    { background: var(--c-badge-warn-bg);    color: var(--c-badge-warn-text); }

.ucet-list { line-height: 1.7; }

/* Legenda */
.legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  margin-top: 12px;
  color: var(--c-legend);
}

.legend-item { display: flex; align-items: center; gap: 5px; }

.legend-dot {
  width: 12px; height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-dot-nespolehlivy { background: var(--c-dot-bad-bg);     border: 1px solid var(--c-dot-bad-border); }
.legend-dot-spolehlivy   { background: var(--c-dot-good-bg);    border: 1px solid var(--c-dot-good-border); }
.legend-dot-nenalezen    { background: var(--c-dot-neutral-bg); border: 1px solid var(--c-dot-neutral-border); }
.legend-dot-chyba        { background: var(--c-dot-warn-bg);    border: 1px solid var(--c-dot-warn-border); }

/* Patička */
.footer {
  text-align: center;
  margin-top: 8px;
  padding-bottom: 32px;
  font-size: 0.82rem;
  color: var(--c-footer);
}

.footer-link {
  color: var(--c-footer-link);
  text-decoration: none;
}

/* Přepínač tématu */
.home-link {
  position: fixed;
  top: 26px;
  left: 16px;
  font-family: Consolas, Menlo, monospace;
  font-size: 0.8rem;
  color: var(--c-h1);
  text-decoration: none;
  opacity: 0.75;
  transition: opacity 0.2s;
  z-index: 100;
}

.home-link:hover,
.home-link:focus-visible {
  opacity: 1;
}

#theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-h1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: background-color 0.2s, border-color 0.2s;
  z-index: 100;
}

#theme-toggle:hover { background: var(--c-drop-hover); }

#theme-toggle .icon-sun  { display: none; }
#theme-toggle .icon-moon { display: block; }

body.dark #theme-toggle .icon-sun  { display: block; }
body.dark #theme-toggle .icon-moon { display: none; }
