:root {
  --ground: #f4f6f8;
  --surface: #ffffff;
  --ink: #14202b;
  --text2: #4a5a68;
  --line: #d9e0e6;
  --line2: #e6ebef;
  --control: #c5cfd8;
  --chip: #eef1f4;
  --accent: #1f4fd8;
  --accent-dark: #163ba6;
  --accent-ink: #1a3fa8;
  --accent-bg: #e8eefc;
  --warn-bg: #fcefd6;
  --warn-ink: #7a4a00;
  --late-bg: #fbe4e1;
  --late-ink: #8f1d14;
  --ok-ink: #0f5747;
  --side: #14202b;
  --side-ink: #c9d3dc;
  --side-active: #24384a;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 14px/1.45 var(--sans); }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1 { margin: 0; font-size: 26px; font-weight: 600; line-height: 1.2; }
h2, .h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
h3 { margin: 0; font-size: 15px; font-weight: 600; }
p { margin: 0 0 10px; }
strong, .strong { font-weight: 600; }
.muted { color: var(--text2); font-size: 13px; }
.text-late { color: var(--late-ink); font-weight: 600; }
.text-warn { color: var(--warn-ink); font-weight: 600; font-size: 13px; }
.text-ok { color: var(--ok-ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.icon { flex: none; vertical-align: -3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* rozvržení */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 220px; background: var(--side); color: var(--side-ink); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: 1180px; padding: 28px; display: flex; flex-direction: column; gap: 22px; }
.brand { font: 500 17px var(--mono); color: #fff; padding: 4px 10px 18px; }
.brand--dark { color: var(--ink); padding: 0; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 4px 10px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-weight: 500; }
.nav:hover { color: #fff; background: #1c2d3b; }
.nav.is-active { background: var(--side-active); color: #fff; font-weight: 600; }
.side__label { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: #9fb0bf; padding: 18px 10px 6px; }
.badge { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: #2f4558; color: #fff; white-space: nowrap; }
.badge--warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge--late { background: var(--late-bg); color: var(--late-ink); }

/* horní lišta */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top__info { flex: 1 1 240px; min-width: 0; font-size: 13px; color: var(--text2); }
.top__info strong { color: var(--ink); }
.top__box, .top__lock { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.top__lock { font-size: 13px; font-weight: 600; }
.top__user { gap: 10px; }
.banner { display: flex; align-items: flex-start; gap: 10px; margin: 16px 28px 0; padding: 10px 14px; border-radius: 8px; background: var(--accent-bg); color: var(--accent-ink); font-weight: 500; }
.banner--warn { background: var(--warn-bg); color: var(--warn-ink); }
.banner--late { background: var(--late-bg); color: var(--late-ink); }
.card .banner, .head .banner, .login .banner { margin: 0 0 10px; }

/* karty a mřížky */
.head { display: flex; flex-direction: column; gap: 4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; }
.card__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding-bottom: 10px; }
.block { display: flex; flex-direction: column; gap: 12px; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.tile__label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text2); }
.tile__label.text-late { color: var(--late-ink); }
.tile__number { font-size: 34px; font-weight: 600; line-height: 1.15; }
.cols { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 22px; }
.cols--stretch { align-items: stretch; }
.col-wide { flex: 3 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.col-narrow { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.card.col-wide, .card.col-narrow { gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.lanes { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); align-items: start; gap: 20px; }
.lane { display: flex; flex-direction: column; gap: 12px; }
.lane h2 { font-size: 15px; }
.group { margin: 6px 0 0; font-size: 14px; font-weight: 600; color: var(--text2); }
.group--line { padding: 12px 0 4px; border-top: 1px solid var(--line); color: var(--ink); }

/* seznamy */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 0; border-top: 1px solid var(--line2); }
.row__main { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 6px; color: inherit; }
a.row__main { text-decoration: none; display: block; }
a.row__main:hover { text-decoration: underline; }
.row__title { font-size: 15px; font-weight: 500; color: var(--ink); text-decoration: none; }
a.row__title:hover { text-decoration: underline; }
.row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--text2); }
.row__side { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.row--pending { margin: 0 -12px; padding: 12px; border-radius: 8px; background: var(--ground); border-top: 0; }
.row--event { align-items: baseline; }
.event__when { flex: 0 0 150px; display: inline-flex; align-items: center; gap: 6px; }
.event__effect { font-size: 13px; font-weight: 600; color: var(--text2); }
.item { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-top: 1px solid var(--line2); }
.item__title { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); text-decoration: none; }
a.item__title:hover { text-decoration: underline; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--text2); }
.empty { color: var(--text2); padding: 8px 0; margin: 0; }
.crumbs { margin: 0; font-size: 13px; color: var(--text2); }
.lead { font-size: 16px; font-weight: 500; }
.steps { margin: 0 0 14px; padding-left: 20px; }

/* štítky */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; background: var(--chip); color: var(--ink); font-size: 13px; font-weight: 500; white-space: nowrap; align-self: flex-start; }
.chip--late { background: var(--late-bg); color: var(--late-ink); font-weight: 600; }
.chip--today, .chip--soon { background: var(--warn-bg); color: var(--warn-ink); font-weight: 600; }
.chip--accent { background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; }
.chip--fixed { flex: 0 0 160px; justify-content: center; font-size: 12px; font-weight: 600; white-space: normal; text-align: center; }
.code { font: 500 12px var(--mono); padding: 2px 8px; border-radius: 4px; background: var(--chip); color: var(--ink); }
.code--plain { padding: 0; background: none; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--chip); color: var(--ink); white-space: nowrap; }
.pill--accent { background: var(--accent-bg); color: var(--accent-ink); }

/* karta studie */
.study { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; color: var(--ink); text-decoration: none; }
.study:hover { border-color: var(--accent); color: var(--ink); }
.study--alert { border: 2px solid var(--late-ink); }
.study__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.study__head--left { justify-content: flex-start; gap: 12px; }
.study__code { font: 500 17px var(--mono); }
.study__code--big { font-size: 26px; }
.study__counts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.study__counts strong { font-size: 17px; }
.study__protocol { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.study__protocol--missing { padding: 6px 10px; border-radius: 6px; background: var(--late-bg); color: var(--late-ink); }
.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 20px; }
.facts dt { font-size: 12px; font-weight: 600; color: var(--text2); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* úkol */
.task { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; }
.task p { margin: 0; }
.task__title { font-size: 15px; }
.quote { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--ground); font-size: 13px; color: var(--text2); }
.howto { padding: 10px 14px; border-radius: 8px; background: var(--ground); font-size: 13px; }
.howto summary, .panel summary, details.card summary { cursor: pointer; font-weight: 600; min-height: 28px; }
.howto ol { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.draft, .mail { margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 var(--sans); }
.mail { max-height: 70vh; overflow: auto; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions--spread { justify-content: space-between; align-items: center; }

/* ovládací prvky */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--control); border-radius: 8px; background: var(--surface); color: var(--ink); font: 500 14px var(--sans); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn--primary { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 600; }
.btn--primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); color: #fff; }
.btn--outline { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn--quiet { border-color: transparent; color: var(--text2); }
.btn--danger { color: var(--late-ink); font-weight: 600; }
.btn--big { min-height: 48px; padding: 0 22px; font-size: 15px; }
.btn--busy { background: var(--line2); color: var(--text2); font-weight: 600; }
.inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.form h3 { flex: 1 1 100%; }
.form--tight { margin: 0; }
.field { flex: 1 1 170px; min-width: 0; display: flex; flex-direction: column; gap: 4px; border: 0; padding: 0; margin: 0; }
.field--wide { flex: 2 1 280px; }
.field label, .field legend { font-size: 13px; font-weight: 600; padding: 0; }
input, select { min-height: 44px; width: 100%; padding: 0 12px; border: 1px solid var(--control); border-radius: 8px; background: var(--surface); color: var(--ink); font: 14px var(--sans); }
input[type="file"] { padding: 9px 12px; }
input[type="checkbox"] { width: 20px; min-height: 20px; height: 20px; padding: 0; accent-color: var(--accent); }
.inline select { width: auto; max-width: 100%; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 400; font-size: 14px; }
.panel { border-top: 1px solid var(--line2); padding: 12px 0; }
.panel summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-bottom: 3px solid transparent; color: var(--text2); font-weight: 500; text-decoration: none; }
.tab.is-active { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
.progress { height: 8px; max-width: 420px; border-radius: 999px; background: var(--line2); }
.progress__bar { width: 5%; height: 8px; border-radius: 999px; background: var(--accent); transition: width 0.4s; }

/* tabulky */
.scroll { overflow-x: auto; }
table { width: 100%; min-width: 640px; border-collapse: collapse; text-align: left; }
th { padding: 8px 12px 8px 0; font-size: 12px; font-weight: 600; color: var(--text2); border-bottom: 1px solid var(--line); }
td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line2); vertical-align: top; overflow-wrap: anywhere; }

/* přihlášení */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login__card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; padding: 32px; }

@media (max-width: 640px) {
  .content { padding: 16px; }
  .top { padding: 12px 16px; }
  .banner { margin: 12px 16px 0; }
  .event__when, .chip--fixed { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .progress__bar { transition: none; }
}
