:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c2330;
  --muted: #5d6675;
  --border: #dde1e7;
  --accent: #1f4e79;
  --accent-text: #ffffff;
  --accent-soft: #e6eef6;
  --error: #b42318;
  --focus: #2f7fd1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2029;
    --text: #e5e9ef;
    --muted: #9aa4b2;
    --border: #2c3542;
    --accent: #6ea8dc;
    --accent-text: #0e1620;
    --accent-soft: #1e2d3d;
    --error: #f97066;
    --focus: #8cc0f0;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[hidden] { display: none !important; }

a { color: var(--accent); }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
}

.account { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); font-size: 0.9rem; }

main { max-width: 80rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.narrow { max-width: 26rem; margin: 3rem auto; }

h1 { font-size: 1.4rem; line-height: 1.3; margin: 0 0 0.5rem; }

label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0 0 0.3rem; }

input[type="text"], input[type="search"], input[type="password"], input[type="date"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; margin: 0.9rem 0; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.primary { background: var(--accent); color: var(--accent-text); }
.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.link { background: none; border: none; padding: 0; color: var(--accent); font-weight: 500; }
button:disabled { opacity: 0.6; cursor: progress; }

.muted, .hint, .status { color: var(--muted); }
.hint { font-size: 0.85rem; margin: 0.75rem 0 0; }
.status { margin: 1rem 0.25rem; }
.error { color: var(--error); }

.search .row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.9rem; }
.search .row > div { flex: 1 1 10rem; }
.search .row > .grow { flex: 3 1 18rem; }
.search .actions { display: flex; align-items: flex-end; flex: 0 0 auto !important; }

.sources { display: flex; flex-wrap: wrap; gap: 0.4rem; border: none; margin: 0; padding: 0; }
.sources legend { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; padding: 0; }
.sources label {
  margin: 0;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 500;
  cursor: pointer;
}
.sources input { position: absolute; opacity: 0; pointer-events: none; }
.sources label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.sources label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.results a {
  display: block;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.results a:hover { border-color: var(--accent); }
.results .title { font-weight: 650; }
.results .meta, .decision .meta, .court { color: var(--muted); font-size: 0.9rem; margin: 0.15rem 0; }
.results .excerpt { margin: 0.4rem 0 0; font-size: 0.95rem; overflow-wrap: anywhere; }
.more { display: block; margin: 1rem auto 0; }

.back { display: inline-block; margin: 0 0 0.75rem; text-decoration: none; }
.decision header { border-bottom: 1px solid var(--border); padding-bottom: 1rem; margin-bottom: 1rem; }
.court { margin: 0 0 0.25rem; }
.tools { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

details { margin-bottom: 1rem; }
summary { cursor: pointer; font-weight: 600; }
dl { display: grid; grid-template-columns: minmax(8rem, 14rem) 1fr; gap: 0.35rem 1rem; margin: 0.75rem 0 0; font-size: 0.92rem; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }

.text p { margin: 0 0 0.85rem; overflow-wrap: anywhere; hyphens: auto; }

@media (max-width: 40rem) {
  main { padding: 1rem 0.75rem 2rem; }
  .card { padding: 1rem; }
  dl { grid-template-columns: 1fr; }
  dt { margin-top: 0.4rem; }
}

.tabs { display: flex; gap: 0.25rem; margin-right: auto; margin-left: 1.5rem; }
.tabs a {
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }

.provision { margin-top: 1rem; }
.provision .row { margin-top: 0; }
.version { font-weight: 600; margin: 0 0 0.5rem; }
.notes { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--muted); font-size: 0.92rem; }
.notes li { margin-bottom: 0.25rem; }
.notes li.warn { color: var(--error); }
.versions { list-style: none; margin: 0.75rem 0 0; padding: 0; font-size: 0.92rem; max-height: 22rem; overflow-y: auto; }
.versions li { margin-bottom: 0.2rem; }
.versions a[aria-current="true"] { font-weight: 700; }
.law-text p { white-space: pre-wrap; }
.status-badge { font-size: 0.8rem; font-weight: 600; padding: 0.1rem 0.45rem; border-radius: 999px; margin-left: 0.4rem; }
.status-badge.on { background: var(--accent-soft); color: var(--accent); }
.status-badge.off { background: color-mix(in srgb, var(--error) 15%, transparent); color: var(--error); }

@media (max-width: 40rem) {
  .topbar { flex-wrap: wrap; }
  .tabs { order: 3; margin: 0.5rem 0 0; width: 100%; }
}

/* Široké obrazovky: detail rozhodnutí a předpisu přes celou šířku, údaje v postranním panelu. */
@media (min-width: 75rem) {
  main.wide { max-width: 110rem; padding-left: 2rem; padding-right: 2rem; }
  .decision {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(20rem, 28rem);
    column-gap: 2.5rem;
    align-items: start;
  }
  .decision > header { grid-column: 1 / -1; }
  .decision > :not(header):not(details) { grid-column: 1; }
  .decision > details {
    grid-column: 2;
    grid-row: 2 / span 20;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    margin: 0;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
  }
  .decision > details dl { grid-template-columns: 1fr; gap: 0.1rem; }
  .decision > details dt { margin-top: 0.5rem; }
  .decision > details .versions { max-height: none; }
  .decision .text { font-size: 1.02rem; line-height: 1.6; }
}
