:root {
  color-scheme: light;
  --bg: #f4f5f4;
  --bg-accent: #eceeed;
  --panel: #ffffff;
  --text: #14231c;
  --muted: #67766e;
  --line: #e2e9e4;
  --line-strong: #d0dbd3;
  --brand: #0b5137;
  --brand-light: #0e5f41;
  --brand-dark: #083d2a;
  --brand-soft: #eaf4ef;
  --header: #fafbfa;
  --header-dark: #f0f2f1;
  --header-text: #123527;
  --header-muted: #6b7570;
  --accent: #e9a23b;
  --accent-soft: rgba(233, 162, 59, 0.16);
  --warn: #b45309;
  --bad: #b91c1c;
  --good: #1e7a46;
  --soft-warn: #fdf4e5;
  --soft-good: #effaf4;
  --soft-bad: #fdf0ef;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 35, 28, 0.04), 0 10px 30px -24px rgba(20, 35, 28, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 380px at 15% -140px, var(--bg-accent), transparent 70%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app-shell {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.toolbar,
.actions-row,
.all-countries-panel,
.control-row,
.table-wrap,
.kpis article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* --- Hlavička (tmavě zelená jako Retail Radar) ---------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  background: linear-gradient(160deg, var(--header), var(--header-dark));
  border-color: #e1e5e2;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.logo {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  box-shadow: 0 4px 12px -4px rgba(10, 47, 35, 0.4);
}

h1 {
  margin: 0 0 3px;
  color: var(--header-text);
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
  color: var(--muted);
}

#tagline {
  color: var(--header-muted);
  font-size: 13.5px;
}

/* --- Přepínač zemí --------------------------------------------------------- */

.country-switch {
  display: inline-flex;
  flex: none;
  gap: 4px;
  padding: 4px;
  background: rgba(20, 35, 28, 0.045);
  border: 1px solid #e1e5e2;
  border-radius: 12px;
}

.country-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--header-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.country-btn:hover {
  background: rgba(255, 255, 255, 0.75);
  color: var(--header-text);
  box-shadow: none;
}

.country-btn.active {
  background: #ffffff;
  border-color: var(--accent);
  color: var(--brand);
  box-shadow: 0 1px 3px rgba(20, 35, 28, 0.1);
}

.country-btn:active {
  transform: none;
}

.country-btn .flag {
  display: inline-flex;
  width: 22px;
  height: 15.5px;
  border-radius: 3.5px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(20, 35, 28, 0.16);
}

.country-btn .flag svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* --- Akce a ovládání ------------------------------------------------------- */

.actions-row {
  margin-top: 14px;
  padding: 12px 14px;
}

.actions,
.control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.active-country-badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px 0 5px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.active-country-flag {
  display: inline-flex;
  width: 27px;
  height: 19px;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(20, 35, 28, 0.16);
}

.active-country-flag svg {
  display: block;
  width: 100%;
  height: 100%;
}

.all-countries-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 12px 20px;
  margin-top: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f7fbf8, var(--brand-soft));
  border-color: #d6e6dc;
}

.all-countries-copy {
  display: grid;
  gap: 3px;
}

.all-countries-copy > span {
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.all-countries-copy > strong {
  font-size: 16px;
}

.all-countries-copy p,
#allCountriesStatus {
  color: var(--muted);
  font-size: 13px;
}

.all-countries-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

#allCountriesStatus {
  grid-column: 1 / -1;
  min-height: 18px;
  line-height: 1.45;
  white-space: pre-line;
}

button {
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--brand-light), var(--brand));
  color: #fff;
  min-height: 38px;
  padding: 0 15px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(8, 61, 42, 0.3);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

button:hover {
  background: var(--brand-dark);
  box-shadow: 0 2px 8px -2px rgba(8, 61, 42, 0.5);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px #d3e5db;
}

button.publish {
  background: #b45309;
  box-shadow: 0 7px 16px rgba(180, 83, 9, 0.2);
}

button.publish:hover:not(:disabled) {
  background: #92400e;
}

button.secondary:hover {
  background: #ddefe5;
  box-shadow: inset 0 0 0 1px #bfd9cc;
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

/* --- KPI -------------------------------------------------------------------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.kpis article {
  padding: 16px 18px;
}

.kpis article.good {
  background: var(--soft-good);
  border-color: #d3e8db;
}

.kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kpis strong {
  display: block;
  margin-top: 6px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpis .good strong {
  color: var(--good);
}

.kpis .warn strong {
  color: var(--warn);
}

/* --- Řádky s ovládáním ------------------------------------------------------ */

.control-row {
  min-height: 64px;
  padding: 13px 16px;
  margin-bottom: 14px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input[type="number"] {
  display: block;
  width: 96px;
  margin-top: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font: inherit;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
  display: block;
  width: min(680px, calc(100vw - 64px));
  margin-top: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 81, 55, 0.14);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

input[type="checkbox"] {
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
}

#status {
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
}

#batchStatus {
  flex-basis: 100%;
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
}

.report-row {
  margin-top: -4px;
}

#reportStatus {
  flex-basis: 100%;
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
}

/* --- Tabulka ----------------------------------------------------------------- */

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: #fafcfb;
}

tbody tr:last-child td {
  border-bottom: 0;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f9f6;
  color: #3f5449;
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
}

td:first-child,
th:first-child {
  width: 48px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.store-title {
  max-width: 300px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.store-address {
  max-width: 300px;
  margin-top: 6px;
  color: #374151;
  font-size: 13px;
  font-weight: 650;
}

.store-title a {
  display: inline-block;
  margin-top: 6px;
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

td a {
  color: var(--brand);
  text-decoration-color: rgba(11, 81, 55, 0.3);
  text-underline-offset: 2px;
}

.mini {
  color: var(--muted);
  font-size: 12px;
}

.download-summary {
  margin: 6px 0 2px;
  font-weight: 650;
  color: var(--text);
}

.site-opening-date {
  display: grid;
  gap: 4px;
}

.site-opening-date span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.site-opening-date strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

.site-opening-detail {
  margin-top: 8px;
}

.site-note {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--soft-warn);
  color: var(--text);
}

.site-note span {
  color: var(--warn);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.site-note p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.query-line {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.extracted-fact {
  display: grid;
  gap: 4px;
  margin: 8px 0;
}

.extracted-fact > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.fact-value-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.open-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--soft-good);
  color: var(--good);
  font-size: 11px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px #cfe8d8;
}

.source-link {
  width: fit-content;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.source-detail {
  width: fit-content;
  color: #66736d;
  font-size: 12px;
}

.source-detail summary {
  width: fit-content;
  cursor: pointer;
  color: var(--brand);
  font-weight: 750;
}

.source-detail p {
  max-width: 360px;
  margin: 6px 0;
  color: #4b5563;
  line-height: 1.45;
}

.source-detail a {
  color: var(--brand);
  font-weight: 700;
}

.detail-toggle {
  margin-top: 8px;
  color: #66736d;
  font-size: 12px;
}

.detail-toggle summary {
  width: fit-content;
  cursor: pointer;
  color: var(--brand);
  font-weight: 750;
}

.detail-toggle[open] {
  padding-top: 4px;
}

.hours {
  display: grid;
  grid-template-columns: 86px minmax(110px, 1fr);
  gap: 3px 8px;
  width: 220px;
}

.hours span:nth-child(odd) {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.pill.ok {
  background: var(--soft-good);
  color: var(--good);
}

.pill.needs_review {
  background: var(--soft-bad);
  color: var(--bad);
}

.pill.insufficient_news {
  background: var(--soft-warn);
  color: var(--warn);
}

.pill.pending_llm {
  background: #eef6ff;
  color: #1d4ed8;
}

.status-badges {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.work-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.work-badge.update-date,
.work-badge.update-hours,
.work-badge.update-note,
.work-badge.review {
  background: var(--soft-bad);
  color: var(--bad);
  box-shadow: inset 0 0 0 1px #f6dbd9;
}

.work-badge.ok {
  background: var(--soft-good);
  color: var(--good);
  box-shadow: inset 0 0 0 1px #cfe8d8;
}

.issues {
  margin: 8px 0 0;
  padding-left: 16px;
  color: #4b5563;
}

.article-list {
  margin: 8px 0 0;
  padding-left: 16px;
}

.article-list li {
  margin-bottom: 4px;
}

.article-list a {
  color: var(--brand);
}

.admin-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--brand-light), var(--brand));
  color: #fff;
  padding: 0 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(8, 61, 42, 0.3);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.admin-link:hover {
  background: var(--brand-dark);
  box-shadow: 0 2px 8px -2px rgba(8, 61, 42, 0.5);
}

.admin-error {
  color: var(--bad);
}

.update-cell {
  min-width: 170px;
}

.empty {
  height: 180px;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}

@media (max-width: 1000px) {
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .country-switch {
    align-self: flex-start;
  }

  .actions {
    width: 100%;
  }

  .active-country-badge {
    width: 100%;
    min-height: 28px;
    padding: 0 0 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .actions button {
    flex: 1;
  }

  .all-countries-panel {
    grid-template-columns: 1fr;
  }

  .all-countries-actions {
    justify-content: flex-start;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


.public-report-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin: 14px 0; padding: 14px 18px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.public-report-summary > div:first-child { display: grid; gap: 3px; }
.public-report-summary > div:first-child > span,
.public-metrics span { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.public-report-summary > div:first-child > strong { font-size: 16px; }
.public-report-summary > div:first-child > p { font-size: 12px; }
.public-metrics { display: flex; gap: 10px; }
.public-metrics p { min-width: 105px; padding: 8px 12px; border-radius: var(--radius-sm); background: #f5f7f6; }
.public-metrics p.good { background: var(--soft-good); }
.public-metrics p.warn { background: var(--soft-warn); }
.public-metrics strong { display: block; margin-top: 2px; color: var(--text); font-size: 19px; }
.country-btn { text-decoration: none; }
.country-btn .flag { align-items: center; justify-content: center; overflow: visible; box-shadow: none; font-size: 19px; line-height: 1; }
.public-export .table-wrap { margin-top: 0; }
@media (max-width: 900px) {
  .public-report-summary { align-items: flex-start; flex-direction: column; }
  .public-metrics { width: 100%; flex-wrap: wrap; }
  .public-metrics p { flex: 1; }
  .public-export .country-switch { width: 100%; max-width: 100%; overflow-x: auto; }
  .public-export .country-btn { flex: 0 0 auto; }
}
