/* Mapa povinností — světlý i tmavý režim, respektuje prefers-reduced-motion. */

:root {
  color-scheme: light dark;

  --bg: #fbfaf8;
  --surface: #ffffff;
  --surface-2: #f4f2ee;
  --border: #e2ddd4;
  --border-strong: #cec7ba;
  --text: #1d1b17;
  --text-muted: #6d675d;
  --accent: #8a5a2b;
  --accent-fg: #ffffff;
  --focus: #2f6ba3;

  --prio-low: #9aa38f;
  --prio-mid: #c98a2e;
  --prio-high: #b4472c;
  --prob-fill: #3d6b52;
  --warn-bg: #fdf3e3;
  --warn-border: #e6c48a;
  --warn-text: #7a5312;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 27, 23, .06), 0 4px 12px rgba(29, 27, 23, .04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16151a;
    --surface: #1e1d23;
    --surface-2: #26252c;
    --border: #34323b;
    --border-strong: #4a4854;
    --text: #eae7e1;
    --text-muted: #a39e95;
    --accent: #d8a76a;
    --accent-fg: #1a1712;
    --focus: #7fb3e0;
    --prio-low: #6e7566;
    --prio-mid: #d19b45;
    --prio-high: #d4664a;
    --prob-fill: #6fae8a;
    --warn-bg: #2e2617;
    --warn-border: #6b5426;
    --warn-text: #e8c893;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 12px rgba(0, 0, 0, .2);
  }
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

:root[data-theme="dark"] {
  --bg: #16151a; --surface: #1e1d23; --surface-2: #26252c; --border: #34323b;
  --border-strong: #4a4854; --text: #eae7e1; --text-muted: #a39e95;
  --accent: #d8a76a; --accent-fg: #1a1712; --focus: #7fb3e0;
  --prio-low: #6e7566; --prio-mid: #d19b45; --prio-high: #d4664a; --prob-fill: #6fae8a;
  --warn-bg: #2e2617; --warn-border: #6b5426; --warn-text: #e8c893;
}
:root[data-theme="light"] {
  --bg: #fbfaf8; --surface: #ffffff; --surface-2: #f4f2ee; --border: #e2ddd4;
  --border-strong: #cec7ba; --text: #1d1b17; --text-muted: #6d675d;
  --accent: #8a5a2b; --accent-fg: #ffffff; --focus: #2f6ba3;
  --prio-low: #9aa38f; --prio-mid: #c98a2e; --prio-high: #b4472c; --prob-fill: #3d6b52;
  --warn-bg: #fdf3e3; --warn-border: #e6c48a; --warn-text: #7a5312;
}

* { box-sizing: border-box; }

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

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

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

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

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

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--surface); padding: 10px 16px; border: 1px solid var(--border);
}
.skip:focus { left: 8px; top: 8px; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar h1 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin: 14px 0; }

.disclosure {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.disclosure .wrap { padding-top: 9px; padding-bottom: 9px; }
.disclosure strong { color: var(--text); }

/* ---------------------------------------------------------------- search */

.search { margin: 32px 0 8px; position: relative; }
.search > label { display: block; font-weight: 600; margin-bottom: 8px; }
.search-row { display: flex; gap: 10px; flex-wrap: wrap; }

input[type="text"], input[type="search"] {
  flex: 1 1 260px;
  min-width: 0;
  padding: 11px 13px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 11px 16px;
}
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; }
button.small { padding: 6px 10px; font-size: 13px; }

.hint { margin: 8px 0 0; font-size: 13px; color: var(--text-muted); }

.suggest {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% - 18px);
  margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: 330px; overflow: auto;
}
.suggest li { padding: 0; }
.suggest button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 9px 11px; border-radius: 6px;
}
.suggest button:hover, .suggest button[aria-selected="true"] { background: var(--surface-2); }
.suggest .s-name { font-weight: 600; }
.suggest .s-meta { font-size: 12.5px; color: var(--text-muted); }

.state { min-height: 22px; font-size: 14px; color: var(--text-muted); margin: 10px 0; }
.state.error { color: var(--prio-high); }

/* --------------------------------------------------------------- profile */

.profile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin: 12px 0 18px;
  box-shadow: var(--shadow);
}
.profile-head { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; }
.profile h3 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px 22px; margin: 0; flex: 1 1 420px; }
.facts div { min-width: 0; }
.facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.facts dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }

.badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 12px; border: 1px solid var(--border-strong); background: var(--surface-2);
}
.badge.yes { border-color: var(--prob-fill); color: var(--prob-fill); }

/* ------------------------------------------------------------- questions */

.questions {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px 18px; margin-bottom: 22px;
}
.questions h2 { font-size: 15px; margin: 0 0 2px; }
.q-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.q-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 12px; flex: 1 1 260px;
}
.q-item p { margin: 0 0 7px; font-size: 14px; font-weight: 600; }
.q-item .help { font-weight: 400; color: var(--text-muted); font-size: 12.5px; display: block; margin-top: 2px; }
.q-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.q-opts button { padding: 5px 11px; font-size: 13px; }
.q-opts button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* --------------------------------------------------------------- results */

.result-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; }
.result-head h2 { font-size: 19px; margin: 0; }
.sortbar { display: flex; align-items: center; gap: 8px; }
.segmented { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.segmented button { border: 0; border-radius: 0; padding: 6px 11px; font-size: 13px; background: var(--surface); }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button[aria-checked="true"] { background: var(--accent); color: var(--accent-fg); font-weight: 600; }

.coverage {
  margin: 10px 0 18px; padding: 9px 12px; font-size: 13.5px;
  background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text);
  border-radius: var(--radius);
}

.layout { display: grid; grid-template-columns: 230px 1fr; gap: 26px; align-items: start; }
@media (max-width: 800px) { .layout { grid-template-columns: 1fr; } }

.filters { position: sticky; top: 14px; }
.filters h3 { font-size: 14px; margin: 0 0 12px; }
.filter-group { border: 0; padding: 0; margin: 0 0 18px; }
.filter-group legend { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding: 0; margin-bottom: 7px; }
.filter-group input[type="search"] { width: 100%; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13.5px; padding: 3px 0; cursor: pointer; }
.check .count { margin-left: auto; color: var(--text-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 12px; align-items: center; }
.swatch-priority, .swatch-prob { display: inline-block; vertical-align: -1px; margin-right: 5px; }
.swatch-priority { width: 22px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--prio-low), var(--prio-high)); }
.swatch-prob { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--prob-fill); background: conic-gradient(var(--prob-fill) 70%, transparent 0); }

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

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 17px; box-shadow: var(--shadow);
}
.card-top { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; }
.card h3 { margin: 0 0 4px; font-size: 16px; line-height: 1.35; letter-spacing: -.005em; }
.card .ref { font-size: 13px; color: var(--text-muted); }
.card .ref a { color: inherit; }

.axes { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }

.prio { width: 92px; }
.prio-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.prio-bar > i { display: block; height: 100%; border-radius: 3px; }
.prio-label { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; font-variant-numeric: tabular-nums; }

.ring {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: conic-gradient(var(--prob-fill) calc(var(--p) * 1%), var(--surface-2) 0);
}
.ring > span {
  width: 28px; height: 28px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center;
}

.meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 11px 0 0; }
.chip {
  font-size: 12.5px; padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.chip.deadline { border-color: var(--prio-mid); color: var(--prio-mid); }
.chip.sanction { border-color: var(--prio-high); color: var(--prio-high); }

.why { margin: 11px 0 0; padding: 9px 11px; background: var(--surface-2); border-radius: 8px; font-size: 13px; }
.why summary { cursor: pointer; font-weight: 600; }
.why ul { margin: 8px 0 0; padding-left: 18px; }
.why li { margin: 3px 0; }
.why .missing { color: var(--warn-text); }

.empty {
  padding: 26px 20px; text-align: center; color: var(--text-muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}

.warn { color: var(--warn-text); }
.foot { margin: 40px 0 48px; border-top: 1px solid var(--border); padding-top: 16px; }

.unverified {
  display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 999px;
  background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text);
}

/* Animace jsou dekorace, ne informace — kdo je nechce, nedostane je. */
@media (prefers-reduced-motion: no-preference) {
  .card { transition: box-shadow .15s ease; }
  .prio-bar > i { transition: width .25s ease; }
  .ring { transition: background .25s ease; }
}

/* ------------------------------------------------------------- kalendář */

.viewbar { display: flex; justify-content: flex-end; margin: 18px 0 6px; }

.kal-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kal-tools select {
  padding: 6px 9px; font: inherit; font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
button.primary.small { padding: 6px 12px; font-size: 13px; }

#kal-url {
  width: 100%; padding: 7px 9px; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text-muted);
}

.kal-months { display: flex; flex-direction: column; gap: 22px; margin-top: 16px; }

.kal-month-head {
  display: flex; align-items: baseline; gap: 8px;
  margin: 0 0 8px; padding-bottom: 6px;
  font-size: 15px; letter-spacing: .01em;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 1;
}

.kal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.kal-item {
  display: grid; grid-template-columns: 62px 1fr; gap: 14px;
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* Barevný proužek nese prioritu — stejná škála jako v žebříčku. */
.kal-day {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding-right: 12px;
  border-right: 3px solid var(--prio, var(--border-strong));
}
.kal-day strong { font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }

.kal-body h4 { margin: 0 0 3px; font-size: 15px; font-weight: 600; }
.kal-body .ref { margin: 0 0 7px; }

.undated { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--border); }
.undated h3 { font-size: 16px; margin: 0 0 4px; }
.undated-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.undated-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 13px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.undated-item p { margin: 2px 0 0; }
.undated-item button {
  flex: none; padding: 5px 11px; font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.undated-item button:hover { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* Zvýraznění bloku otázek po kliknutí na „Odpovědět". */
.flash { animation: flash 1.6s ease-out; }
@keyframes flash {
  0%, 100% { box-shadow: none; }
  15%      { box-shadow: 0 0 0 3px var(--focus); }
}
@media (prefers-reduced-motion: reduce) {
  .flash { animation: none; outline: 2px solid var(--focus); }
}

@media (max-width: 620px) {
  .kal-item { grid-template-columns: 48px 1fr; gap: 10px; padding: 10px; }
  .kal-day { padding-right: 8px; }
  .kal-day strong { font-size: 20px; }
  .undated-item { flex-direction: column; align-items: flex-start; }
}
