/* Admin měření návštěvnosti. Žádné inline styly, žádné externí zdroje (CSP style-src 'self'). */

:root {
  color-scheme: light dark;

  /* povrchy a text */
  --pozadi: #f3f3f0;
  --povrch: #fcfcfb;
  --povrch-2: #efeeea;
  --okraj: #d9d8d2;
  --okraj-silny: #7a7973;
  --text: #0b0b0b;
  --text-2: #4a4945;
  --text-3: #5e5d59;

  /* akcent (tlačítka, odkazy, vybrané období) */
  --akcent: #1c5cab;
  --na-akcentu: #ffffff;
  --fokus: #1c5cab;

  /* data */
  --c1: #2a78d6;
  --c1-vyber: #184f95;
  --c2: #eb6834;
  --nula: #8a8983;
  --mrizka: #e3e2dd;

  /* hlášky */
  --varovani-bg: #fff3d1;
  --varovani-text: #4a3400;
  --varovani-okraj: #c99a1d;
  --chyba-bg: #fdecea;
  --chyba-text: #70160f;
  --chyba-okraj: #c8483f;

  --tap: 2.75rem;
  --pismo: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --pozadi: #111110;
    --povrch: #1a1a19;
    --povrch-2: #272725;
    --okraj: #363531;
    --okraj-silny: #8e8d86;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #aaa99f;

    --akcent: #86b6ef;
    --na-akcentu: #0b0b0b;
    --fokus: #86b6ef;

    --c1: #3987e5;
    --c1-vyber: #86b6ef;
    --c2: #e0642f;
    --nula: #6b6a64;
    --mrizka: #2c2b28;

    --varovani-bg: #3a2e0c;
    --varovani-text: #fbe6ae;
    --varovani-okraj: #a98319;
    --chyba-bg: #3b1a17;
    --chyba-text: #fbd3cf;
    --chyba-okraj: #c8605a;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--pozadi);
  color: var(--text);
  font: 1rem/1.5 var(--pismo);
  overflow-wrap: break-word;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--fokus);
  outline-offset: 2px;
}

[tabindex="-1"]:focus {
  outline: none;
}

.stranka {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

@media (min-width: 640px) {
  .stranka {
    padding: 28px 24px 56px;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin-bottom: 4px;
}

h2 {
  font-size: 1.125rem;
  line-height: 1.3;
  margin-bottom: 12px;
}

/* ---------- tlačítka ---------- */

.tlacitko {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 18px;
  border: 1px solid var(--okraj-silny);
  border-radius: 8px;
  background: var(--povrch);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.tlacitko:hover {
  background: var(--povrch-2);
}

.tlacitko-hlavni {
  background: var(--akcent);
  border-color: var(--akcent);
  color: var(--na-akcentu);
}

.tlacitko-hlavni:hover {
  background: var(--akcent);
  filter: brightness(1.08);
}

/* ---------- záhlaví ---------- */

.zahlavi {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 16px;
}

.zahlavi-web {
  min-width: 0;
}

.domena {
  margin: 0;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.zahlavi-uzivatel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.email {
  color: var(--text-2);
  overflow-wrap: anywhere;
  min-width: 0;
}

/* ---------- přepínač období ---------- */

.obdobi {
  display: flex;
  width: 100%;
  max-width: 420px;
  margin-bottom: 16px;
}

.obdobi button {
  flex: 1 1 0;
  min-height: var(--tap);
  margin: 0 0 0 -1px;
  padding: 0 8px;
  border: 1px solid var(--okraj-silny);
  background: var(--povrch);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.obdobi button:first-child {
  margin-left: 0;
  border-radius: 8px 0 0 8px;
}

.obdobi button:last-child {
  border-radius: 0 8px 8px 0;
}

.obdobi button:hover {
  background: var(--povrch-2);
}

.obdobi button[aria-pressed="true"] {
  background: var(--akcent);
  border-color: var(--akcent);
  color: var(--na-akcentu);
  z-index: 1;
}

.obdobi button:focus-visible {
  z-index: 2;
}

/* ---------- karty a hlášky ---------- */

.karta {
  background: var(--povrch);
  border: 1px solid var(--okraj);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  min-width: 0;
}

@media (min-width: 640px) {
  .karta {
    padding: 20px 24px;
  }
}

.karta > :last-child {
  margin-bottom: 0;
}

.upozorneni,
.chyba-box {
  border: 1px solid var(--varovani-okraj);
  background: var(--varovani-bg);
  color: var(--varovani-text);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 16px;
}

.chyba-box {
  border-color: var(--chyba-okraj);
  background: var(--chyba-bg);
  color: var(--chyba-text);
}

.chyba-box p {
  margin-bottom: 12px;
}

.chyba-box p:last-child {
  margin-bottom: 0;
}

.stav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 4px;
  color: var(--text-2);
}

.tocik {
  flex: none;
  width: 20px;
  height: 20px;
  border: 3px solid var(--okraj);
  border-top-color: var(--akcent);
  border-radius: 50%;
  animation: otaceni 0.9s linear infinite;
}

@keyframes otaceni {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tocik {
    animation: none;
    border-top-color: var(--akcent);
    border-right-color: var(--akcent);
  }
}

.zastarale {
  opacity: 0.5;
  pointer-events: none;
}

/* ---------- přihlášení / bez přístupu ---------- */

.stred {
  max-width: 480px;
  margin: 6vh auto 0;
}

.stred .karta {
  padding: 24px 20px;
}

.stred h1 {
  margin-bottom: 8px;
}

.stred .domena {
  margin-bottom: 16px;
}

.stred .tlacitko {
  margin-top: 4px;
}

.google-obal {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 56px;
  margin: 16px 0;
  padding: 8px;
  border-radius: 8px;
  background: #ffffff;
  color: #3c3b37;
  border: 1px solid var(--okraj);
}

.google-obal.google-obal-vlastni {
  background: none;
  border: 0;
  padding: 0;
}

.google-obal .stav {
  padding: 0;
}

.google-obal .tocik {
  border-color: #d9d8d2;
  border-top-color: #1c5cab;
}

/* ---------- ukazatele ---------- */

.kpi-mrizka {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
  padding: 0;
}

@media (min-width: 720px) {
  .kpi-mrizka {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.kpi {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--povrch);
  border: 1px solid var(--okraj);
  border-radius: 12px;
  padding: 14px;
}

.kpi dt {
  min-height: 2.6em;
  color: var(--text-2);
  font-weight: 600;
  line-height: 1.3;
}

.kpi dd {
  margin: 0;
}

.kpi-cislo {
  padding-top: 4px;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

@media (min-width: 720px) {
  .kpi-cislo {
    font-size: 2.25rem;
  }
}

.kpi-pozn {
  color: var(--text-2);
  line-height: 1.35;
}

.zmena {
  white-space: nowrap;
  font-weight: 600;
  color: var(--text);
}

/* ---------- graf ---------- */

.legenda {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  color: var(--text-2);
}

.legenda li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zn {
  flex: none;
  display: inline-block;
}

.zn-sloupec {
  width: 12px;
  height: 12px;
  border-radius: 3px 3px 0 0;
  background: var(--c1);
}

.zn-znacka {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c2);
}

.graf-odecet {
  min-height: 1.5em;
  margin: 0 0 4px;
  color: var(--text);
}

.graf-obal {
  min-width: 0;
  width: 100%;
}

svg.graf {
  display: block;
  max-width: 100%;
  height: auto;
  touch-action: pan-y;
}

svg.graf text {
  font-family: var(--pismo);
  font-size: 13px;
  fill: var(--text-2);
}

.mrizka {
  stroke: var(--mrizka);
  stroke-width: 1;
}

.zakladna {
  stroke: var(--okraj-silny);
  stroke-width: 1;
}

.pas {
  fill: var(--povrch-2);
  opacity: 0;
}

.pas.viditelny {
  opacity: 1;
}

.sloupec {
  fill: var(--c1);
}

.sloupec.vybrany {
  fill: var(--c1-vyber);
}

.sloupec-nula {
  fill: var(--nula);
}

.znacka {
  fill: var(--c2);
  stroke: var(--povrch);
  stroke-width: 1.5;
}

.tabulka-detail {
  margin-top: 8px;
}

.tabulka-detail summary {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--akcent);
  font-weight: 600;
  cursor: pointer;
}

.tabulka-obal {
  max-height: 22rem;
  overflow: auto;
  border: 1px solid var(--okraj);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--okraj);
}

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

thead th {
  position: sticky;
  top: 0;
  background: var(--povrch-2);
  font-weight: 600;
}

tbody th {
  font-weight: 400;
}

th.cislo,
td.cislo {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- pruhy ---------- */

.pruhy {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.pruh-radek {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}

.pruh-popisek {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pruh-cislo {
  flex: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pruh-cislo strong {
  font-weight: 700;
}

.pruh-pct {
  display: inline-block;
  min-width: 3.6em;
  margin-left: 6px;
  text-align: right;
  color: var(--text-2);
}

svg.pruh-graf {
  display: block;
  width: 100%;
  height: 8px;
}

.pruh-draha {
  fill: var(--povrch-2);
}

.pruh-vypln {
  fill: var(--c1);
}

.vice {
  margin-top: 12px;
}

.prazdna-karta {
  margin: 0;
  color: var(--text-2);
}

/* ---------- patička ---------- */

.paticka {
  margin-top: 8px;
  color: var(--text-2);
}

.paticka p {
  margin-bottom: 4px;
}

@media (min-width: 640px) {
  .stred {
    margin-top: 10vh;
  }
}
