:root {
  --ink: #1f2933;
  --muted: #5a6776;
  --line: #dfe3e8;
  --line-strong: #c3cad2;
  --surface: #ffffff;
  --page: #f5f6f8;
  --column: #eef0f3;
  --accent: #0b5cad;
  --accent-surface: #e7f0fa;
  --danger: #b3261e;
  --danger-surface: #fbe9e7;
  --amber: #7a5200;
  --amber-surface: #fdf3dc;
  --ok: #1b6e3c;
  --ok-surface: #e6f4ea;
  --radius: 8px;
  --gap: 8px;
  --col-wide: 176px;
  --col-narrow: 88px;
  --tap: 36px;
}

* { box-sizing: border-box; }

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

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

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

h1 { margin: 8px 0 16px; font-size: 1.5rem; line-height: 1.25; }

h2 { margin: 0 0 8px; font-size: 1.0625rem; line-height: 1.3; }

h3 { margin: 0 0 4px; font-size: 1rem; }

p { margin: 0 0 8px; }

ul, ol { margin: 0; padding: 0; }

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.muted { color: var(--muted); font-size: 0.875rem; }

.hint { margin: 4px 0 8px; color: var(--muted); font-size: 0.875rem; }

/* Header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 700; color: var(--ink); text-decoration: none; }

.main-nav, .user-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }

.user-nav { margin-left: auto; }

.search { display: flex; gap: 6px; flex: 1 1 220px; max-width: 420px; }

.search input { flex: 1; min-width: 0; }

.banner { padding: 10px 16px; background: var(--danger); color: #fff; }

.banner a { color: #fff; font-weight: 600; }

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 8px 16px;
  color: var(--amber);
  background: var(--amber-surface);
  border-bottom: 1px solid var(--line);
}

.bar a { color: inherit; font-weight: 600; }

.content { padding: 16px; max-width: 1200px; margin: 0 auto; }

.content-wide { max-width: none; padding-top: 12px; }

/* Controls */

input[type="text"], input[type="email"], input[type="search"], input[type="file"], input[type="number"], input[type="datetime-local"], select, textarea {
  min-height: var(--tap);
  max-width: 100%;
  padding: 6px 8px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

textarea { width: 100%; resize: vertical; }

button, .button, .button-plain {
  display: inline-block;
  min-height: var(--tap);
  padding: 6px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}

button:hover, .button-plain:hover { background: var(--page); }

.button, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

button.primary:hover, .button:hover { background: #094b8e; }

button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }

button.danger:hover { background: #8f1e18; }

button.link { min-height: 0; padding: 0; background: none; border: 0; color: var(--accent); text-decoration: underline; }

.actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-top: 12px; }

.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }

.inline-form label { display: flex; flex-direction: column; gap: 2px; font-size: 0.875rem; color: var(--muted); }

.form-stack > div { margin-bottom: 12px; }

.form-stack label { display: block; margin-bottom: 2px; font-weight: 600; }

.form-stack input[type="text"], .form-stack input[type="email"], .form-stack select { width: min(420px, 100%); }

.form-stack .helptext { display: block; color: var(--muted); font-size: 0.875rem; }

.errorlist { margin: 0 0 4px; padding: 0; list-style: none; color: var(--danger); font-size: 0.875rem; }

.disclosure { margin-top: 8px; }

.actions .disclosure { margin-top: 0; }

.disclosure > summary {
  display: inline-block;
  min-height: var(--tap);
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  list-style: none;
}

.disclosure > summary::-webkit-details-marker { display: none; }

.disclosure > summary h2 { display: inline; margin: 0; font-size: inherit; }

.disclosure[open] > summary { background: var(--page); }

.disclosure > form { margin-top: 8px; }

/* Shared blocks */

.panel { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.panel + .panel { margin-top: 12px; }

.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; margin-bottom: 8px; }

.empty { padding: 32px 16px; color: var(--muted); text-align: center; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

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

.tag {
  display: inline-block;
  padding: 0 8px;
  font-size: 0.8125rem;
  color: var(--amber);
  background: var(--amber-surface);
  border-radius: 999px;
}

.tag-danger { color: var(--danger); background: var(--danger-surface); }

.tag-accent { color: var(--accent); background: var(--accent-surface); }

.warning { margin: 8px 0; padding: 8px 12px; color: var(--amber); background: var(--amber-surface); border-radius: 6px; font-size: 0.9375rem; }

.warning a { color: inherit; font-weight: 600; }

.facts { display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); gap: 2px 12px; margin: 0; }

.facts dt { color: var(--muted); font-size: 0.875rem; }

.facts dd { margin: 0; overflow-wrap: anywhere; }

.plain-list { list-style: none; }

.plain-text { white-space: pre-wrap; overflow-wrap: anywhere; }

.file-list { list-style: none; }

.file-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 4px 0; }

.file-name { overflow-wrap: anywhere; font-weight: 500; }

/* Toasts */

.toasts {
  position: fixed;
  z-index: 20;
  right: 16px;
  bottom: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 520px;
  padding: 10px 12px 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgb(31 41 51 / 0.14);
  pointer-events: auto;
}

.toast a { font-weight: 600; }

.toast-success { border-left-color: var(--ok); }

.toast-error { border-left-color: var(--danger); }

.toast-warning { border-left-color: var(--amber); }

.notice-text { margin-bottom: 0; }

.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.toast-text { flex: 1; }

.toast-close { min-height: 0; padding: 0 4px; background: none; border: 0; color: var(--muted); font-size: 1.125rem; line-height: 1.3; }

/* Board */

.board-scroll { overflow: auto; max-height: calc(100dvh - 104px); min-height: 360px; background: var(--page); }

.board {
  min-width: calc(var(--wide-count) * (var(--col-wide) + var(--gap)) + var(--narrow-count) * (var(--col-narrow) + var(--gap)));
}

.board-head, .row-cells { display: grid; grid-template-columns: var(--board-columns); gap: var(--gap); }

.board-head { position: sticky; z-index: 5; top: 0; padding-bottom: 6px; background: var(--page); border-bottom: 1px solid var(--line-strong); }

.phase-head { min-width: 0; padding: 4px 8px; font-size: 0.875rem; }

.phase-name { font-weight: 600; }

.phase-count {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.phase-email { display: block; color: var(--muted); font-size: 0.8125rem; line-height: 1.3; }

.phase-toggle { width: 100%; min-height: 0; padding: 0; text-align: left; line-height: 1.3; background: none; border: 0; }

.phase-toggle:hover { background: none; color: var(--accent); }

.phase-toggle .phase-count { display: block; width: max-content; margin-top: 2px; }

.phase-head.is-closed:not(.is-expanded) .phase-email { display: none; }

.phase-head.is-closed.is-expanded .phase-toggle .phase-count { display: inline-block; margin-top: 0; }

.board-row { padding: 14px 0 10px; border-bottom: 1px solid var(--line); }

.row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 8px; }

.row-title h2 { margin: 0; }

.cell { display: flex; flex-direction: column; min-width: 0; background: var(--column); border-radius: var(--radius); }

.cell-label { display: none; }

.cell-toggle {
  display: none;
  min-height: 0;
  padding: 6px;
  color: var(--muted);
  text-align: center;
  background: none;
  border: 0;
}

.cell-toggle:hover { background: none; color: var(--accent); }

.cell-toggle .cell-name { display: none; }

.cell.is-closed:not(.is-expanded) .cell-toggle { display: block; }

.cards { flex: 1; display: flex; flex-direction: column; gap: 6px; min-height: 68px; padding: 6px; }

.cell.is-closed:not(.is-expanded) .cards { min-height: 36px; padding-top: 0; }

.cell.is-closed:not(.is-expanded) .card:not(.card-ghost) { display: none; }

.card {
  min-width: 0;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

[data-sortable] .card { cursor: grab; }

.card-ghost { background: var(--accent-surface); border: 1px dashed var(--accent); opacity: 0.8; }

.cell.is-closed:not(.is-expanded) .card-ghost > * { display: none; }

.cell.is-closed:not(.is-expanded) .card-ghost { min-height: 28px; padding: 0; }

.card-name { display: block; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; text-decoration: none; }

.card-name:hover { text-decoration: underline; }

.unread-dot { display: inline-block; width: 8px; height: 8px; vertical-align: 1px; background: var(--accent); border-radius: 50%; }

.card p { margin: 2px 0 0; font-size: 0.8125rem; line-height: 1.35; color: var(--muted); }

.card-also { overflow-wrap: anywhere; }

.card p.card-deletion { color: var(--amber); }

.chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2px 8px;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 0.8125rem;
  line-height: 1.35;
  border-radius: 6px;
}

.chip-wait { color: var(--muted); background: var(--column); }

.chip-amber { color: var(--amber); background: var(--amber-surface); }

.chip-red { color: var(--danger); background: var(--danger-surface); }

.chip-button { min-height: 0; padding: 0 6px; font-size: 0.8125rem; line-height: 1.5; }

.card-move { margin-top: 4px; }

.card-move select { width: 100%; min-height: 28px; padding: 2px 4px; font-size: 0.8125rem; color: var(--muted); border-color: var(--line); }

/* Triage, attention, search */

.triage-card .mail-text { margin: 12px 0; padding: 10px 12px; background: var(--page); border-radius: 6px; }

.suggestion { margin-top: 12px; }

mark { padding: 0 3px; color: inherit; background: var(--amber-surface); border-radius: 3px; }

.mail-text mark { padding: 0; }

.attention-list, .result-list { list-style: none; }

.attention-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }

.attention-text { display: flex; flex-direction: column; min-width: 0; }

.attention-line .actions { margin-top: 0; }

.result { display: flex; flex-direction: column; gap: 0; }

.result span { overflow-wrap: anywhere; }

.evidence-search { margin-bottom: 12px; }

.evidence-search input { width: min(420px, 100%); }

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }

.evidence-counts { margin: 8px 0 0; }

.evidence-card h3 { margin-top: 12px; }

.evidence-text + .evidence-text { margin-top: 8px; }

.evidence-text .plain-text { padding: 6px 10px; background: var(--page); border-radius: 6px; }

.guide-list { margin: 4px 0 8px; padding-left: 20px; }

.guide-part { margin-top: 12px; }

/* Card detail */

.card-title { margin-bottom: 12px; }

.card-title h1 { margin-bottom: 2px; overflow-wrap: anywhere; }

.card-page { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); align-items: start; gap: 12px; }

.card-side .inline-form { margin-top: 12px; }

.card-side .facts { display: block; }

.card-side .facts dt { margin-top: 6px; }

.card-side .facts dt:first-child { margin-top: 0; }

.mail-list { list-style: none; }

.mail-item { padding: 8px 0; border-top: 1px solid var(--line); }

.mail-item:first-child { padding-top: 0; border-top: 0; }

.mail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-bottom: 2px; }

.mail-head .chip { display: inline-block; margin-top: 0; }

.mail-preview { margin-top: 8px; padding: 8px 10px; background: var(--page); border-radius: 6px; }

.timeline { list-style: none; }

.timeline-entry { padding: 10px 0; border-top: 1px solid var(--line); }

.timeline-entry:first-child { padding-top: 0; border-top: 0; }

.timeline-head { margin-bottom: 0; }

.timeline-note .plain-text { margin-top: 4px; padding: 6px 10px; background: var(--amber-surface); border-radius: 6px; }

.timeline-mail .plain-text { margin-top: 4px; padding: 6px 10px; background: var(--page); border-radius: 6px; }

.timeline-entry button { margin-top: 6px; }

/* Vymazať natrvalo */

.checklist { padding-left: 20px; }

.checklist li { margin-bottom: 6px; }

/* Applicant pages */

.public-page { max-width: 760px; }

.public-page section { margin-top: 24px; }

.public-page h2 { margin-bottom: 8px; }

.public-page .facts { margin-bottom: 8px; }

.public-page mark { background: #fff3a3; }

.slot-day { margin: 16px 0 8px; }

.slot-day::first-letter { text-transform: uppercase; }

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }

.slot-button { width: 100%; min-height: 52px; font-size: 1.125rem; font-weight: 600; }

.call-button { display: flex; align-items: center; justify-content: center; min-height: 52px; font-size: 1.125rem; font-weight: 600; }

.notice-list { margin: 8px 0; padding-left: 20px; }

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

/* Interview dialog and panel */

.interview-dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); }

.interview-dialog::backdrop { background: rgb(0 0 0 / 40%); }

.interview-form fieldset { margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }

.interview-form input[type="number"], .interview-form input[type="datetime-local"] { width: min(240px, 100%); }

.interview-item + .interview-item { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Login and status pages */

.login { max-width: 420px; margin: 48px auto; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.error { padding: 8px 12px; color: var(--danger); background: var(--danger-surface); border-radius: 6px; }

.ok { color: var(--ok); font-weight: 600; }

.problems { padding-left: 20px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }

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

th { color: var(--muted); font-weight: 600; white-space: nowrap; }

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

tr.stale td { background: var(--danger-surface); }

td.action { min-width: 260px; }

section > h2 { margin-top: 0; }

.content > section { margin-bottom: 24px; }

/* Phone: the board becomes a list, the dropdown replaces dragging, and targets get bigger. */

@media (hover: hover) and (min-width: 761px) {
  [data-sortable] .card-move { display: none; }
  [data-sortable] .card:hover .card-move, [data-sortable] .card:focus-within .card-move { display: block; }
}

@media (max-width: 760px) {
  :root { --tap: 44px; }

  input[type="text"], input[type="email"], input[type="search"], select, textarea { font-size: 16px; }

  .site-header { padding: 8px 16px; }

  .search { flex-basis: 100%; max-width: none; order: 3; }

  .user-nav { margin-left: 0; }

  .content { padding: 12px 16px; }

  .board-scroll { overflow: visible; max-height: none; min-height: 0; }

  .board { min-width: 0; }

  .board-head { display: none; }

  .board-row { padding: 12px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

  .row-cells { display: block; }

  .cell { display: block; margin-top: 8px; padding: 0; background: none; }

  .cell.is-empty { display: none; }

  .cell-label, .cell-toggle, .cell.is-closed:not(.is-expanded) .cell-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: var(--tap);
    margin: 0;
    padding: 4px 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink);
    text-align: left;
  }

  .cell-toggle .cell-name { display: inline; }

  .cell-toggle::after { content: "▸"; order: 3; color: var(--muted); }

  .cell-toggle[aria-expanded="true"]::after { content: "▾"; }

  .cell-toggle .phase-count { margin-left: auto; }

  .cell.is-closed.is-expanded .cell-toggle { display: flex; }

  .cards, .cell.is-closed:not(.is-expanded) .cards { min-height: 0; padding: 0; }

  .card { padding: 10px 12px; cursor: default; }

  .card-move select { min-height: var(--tap); font-size: 16px; color: var(--ink); }

  .chip-button { min-height: var(--tap); padding: 0 12px; }

  .card-page { grid-template-columns: minmax(0, 1fr); }

  .facts { display: block; }

  .facts dt { margin-top: 6px; }

  .facts dt:first-child { margin-top: 0; }

  .inline-form, .inline-form label, .inline-form select { width: 100%; }

  .toasts { align-items: stretch; }

  .toast { max-width: none; }
}

/* Print: the card detail as the applicant's copy of their data. Controls and navigation stay on screen. */

.print-only { display: none; }

@media print {
  @page { margin: 16mm 14mm; }

  html, body { background: #fff; color: #000; font-size: 11pt; line-height: 1.4; }

  .site-header, .banner, .bar, .toasts, .no-print, .actions, .disclosure, form, button { display: none !important; }

  .print-only { display: block; }

  .content { max-width: none; margin: 0; padding: 0; }

  a { color: inherit; text-decoration: none; }

  .file-list a { display: none; }

  .card-page { display: block; }

  .panel, .panel + .panel { margin: 0 0 12pt; padding: 0; background: none; border: 0; border-radius: 0; }

  h1 { margin-top: 0; }

  h2 { margin-bottom: 4pt; padding-bottom: 2pt; border-bottom: 1px solid #000; break-after: avoid; }

  .muted { color: #333; font-size: 10pt; }

  .facts, .card-side .facts { display: grid; grid-template-columns: 40mm minmax(0, 1fr); gap: 1pt 8pt; }

  .facts dt, .card-side .facts dt { margin-top: 0; color: #333; font-size: 10pt; }

  .tag, .chip, .mail-head .chip { display: inline-block; margin: 0; padding: 0 4pt; color: #000; background: none; border: 1px solid #666; border-radius: 3pt; }

  .warning { padding: 2pt 0; color: #000; background: none; border-radius: 0; }

  .file-list li { break-inside: avoid; }

  .timeline-head, .timeline-entry > .muted { break-after: avoid; }

  .plain-text { orphans: 3; widows: 3; }

  .timeline-note .plain-text, .timeline-mail .plain-text { margin-top: 2pt; padding: 0 0 0 8pt; background: none; border-left: 2px solid #666; border-radius: 0; }
}
