/* Výsledky maturity — teal accent (distinct from JPZ blue) */
:root {
  --primary-dark: #115e59;
  --primary: #0f766e;
  --primary-light: #14b8a6;
  --primary-subtle: #f0fdfa;
  --primary-border: #99f6e4;
  /* Peer app (Výběr / JPZ) — blue, used on eco switch */
  --peer: #2563eb;
  --peer-dark: #1e3a8a;
  --peer-subtle: #eff6ff;
  --peer-border: #bfdbfe;
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Plus Jakarta Sans", sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08);
  --sidebar-w: 300px;
  --topbar-h: 60px;
  --transition: 0.15s ease;
}

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

/* Author display:* rules otherwise override the UA [hidden] stylesheet */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--slate-800);
  background: #f5fbfa; /* barely-teal page wash vs JPZ slate-50 */
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.topbar {
  position: relative;
  z-index: 40;
  height: var(--topbar-h);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--slate-200);
  box-shadow: inset 0 3px 0 0 var(--primary);
}

.topbar-inner {
  width: 100%;
  height: 100%;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: flex-start;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  flex-shrink: 0;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
}
.brand-text {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0.4em;
  line-height: 1;
  white-space: nowrap;
}
.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--slate-900);
}
.brand-text strong span { color: var(--primary); }
.brand-text em {
  font-style: normal;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary-dark);
}
.brand-text em::before {
  content: "·";
  margin-right: 0.4em;
  color: var(--primary-border);
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}
.topbar-actions .btn-ghost,
.topbar-actions .btn-topbar-switch,
.topbar-actions .btn-topbar-eco,
.topbar-actions .btn-topbar-feedback,
.topbar-actions .btn-topbar-help {
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1;
  box-sizing: border-box;
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-700);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.topbar-actions .btn-ghost:hover:not(:disabled) {
  border-color: var(--primary-border);
  color: var(--primary-dark);
  background: var(--primary-subtle);
}

/* Zvýrazněná tlačítka ekosystému a přepínání: Grafy/Detail a Analýza JPZ */
.topbar-actions .btn-switch-mode {
  border: 1px solid var(--primary-border);
  color: var(--primary-dark);
  background: var(--primary-subtle);
  font-weight: 700;
}
.topbar-actions .btn-switch-mode:hover:not(:disabled) {
  background: #ccfbf1;
  border-color: var(--primary);
  color: var(--primary-dark);
}
.topbar-actions .btn-topbar-eco,
.btn-topbar-eco {
  border: 1.5px solid #5eead4;
  color: #0f766e;
  background: var(--white);
  font-weight: 700;
}
.topbar-actions .btn-topbar-eco:hover,
.btn-topbar-eco:hover {
  background: var(--primary-subtle);
  border-color: var(--primary);
  color: #115e59;
}

.eco-toast {
  margin: 0;
  padding: 8px 16px;
  background: var(--primary-subtle);
  color: var(--slate-800);
  font-size: 0.85rem;
  font-weight: 600;
}
.eco-toast[hidden] { display: none; }
.btn-topbar-feedback {
  color: var(--slate-700);
}
.btn-topbar-feedback:hover:not(:disabled) {
  color: var(--slate-900);
  border-color: var(--slate-300);
  background: var(--slate-100);
}
.btn-topbar-help {
  color: var(--slate-700);
}
.btn-topbar-help:hover:not(:disabled),
.btn-topbar-help.is-on {
  color: var(--primary-dark);
  border-color: var(--primary-border);
  background: var(--primary-subtle);
}
.btn-topbar-switch {
  white-space: nowrap;
}

/* Dva rozměry dat: Předmět (co) vs Pohled (jak číst) — vizuálně oddělené */
.ctrl-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.ctrl-group + .ctrl-group {
  padding-left: 12px;
  border-left: 1px solid var(--slate-200);
}
.ctrl-label {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--slate-400);
  letter-spacing: 0.01em;
}

.seg {
  display: inline-flex;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.seg-subjects {
  background: var(--primary-subtle);
  border-color: var(--primary-border);
}
.subject-extra {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
}
.subject-extra select {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-700);
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--white);
  max-width: 9.5rem;
}
.subject-extra select:focus {
  outline: 2px solid var(--primary-border);
  outline-offset: 1px;
}
.seg-views {
  border-radius: var(--radius-md);
}
.seg-item { position: relative; cursor: pointer; }
.seg-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seg-item span {
  display: block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-600);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.seg-views .seg-item span {
  border-radius: calc(var(--radius-md) - 2px);
}
.seg-item input:checked + span {
  background: var(--white);
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}
.seg-views .seg-item input:checked + span {
  color: var(--slate-900);
}
.seg-item:hover span { color: var(--slate-900); }

/* Full-bleed app shell */
body {
  display: flex;
  flex-direction: column;
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  width: 100%;
  flex: 1;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--slate-200);
  background: var(--white);
  padding: 12px 12px 16px;
  height: 100%;
  overflow: auto;
}
.sidebar-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--slate-700);
  letter-spacing: 0.01em;
  margin-bottom: 12px;
}
.sidebar-filters-panel {
  border: 0;
  margin: 0;
  padding: 0;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.sidebar-filters-panel > summary.sidebar-title {
  list-style: none;
  cursor: default;
}
.sidebar-filters-panel > summary.sidebar-title::-webkit-details-marker {
  display: none;
}
.sidebar-filters-panel > summary.sidebar-title::marker {
  content: "";
}
.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--slate-200);
  font-size: 0.85rem;
  color: #777;
  line-height: 1.5;
}
.sidebar-footer p {
  margin: 0;
}
.sidebar-footer .footer-link {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-weight: 500;
  display: inline-block;
  margin-top: 2px;
}
.sidebar-footer .footer-link:hover {
  color: var(--primary-dark);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}
.field span {
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--slate-600);
}
.field input,
.field select {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--slate-100);
  color: var(--slate-800);
  width: 100%;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.field input:hover,
.field select:hover:not(:disabled) {
  border-color: var(--slate-300);
  color: var(--slate-900);
}
.field input:focus,
.field select:focus {
  outline: none;
  background: var(--white);
  border-color: var(--primary-border);
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

.okres-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.okres-actions {
  display: inline-flex;
  gap: 4px;
}
.okres-actions .btn-text {
  font-size: 0.72rem;
  padding: 2px 6px;
}
.okres-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow: auto;
  padding: 4px 2px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: var(--slate-50);
}
.okres-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 550;
  color: var(--slate-700);
}
.okres-item:hover {
  background: var(--primary-subtle);
}
.okres-item input {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}
.okres-hint,
.okres-placeholder {
  margin: 4px 0 0;
  font-size: 0.7rem;
}
.field select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.agg-check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 12px;
  padding: 8px 10px;
  min-height: 2.35rem;
  box-sizing: border-box;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: var(--slate-100);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--slate-800);
  user-select: none;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}
.agg-check:hover {
  border-color: var(--slate-300);
  background: var(--white);
  color: var(--slate-900);
}
.agg-check:has(input:focus-visible) {
  outline: none;
  border-color: var(--primary-border);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.agg-check:has(input:checked) {
  border-color: var(--primary-border);
  background: var(--primary-subtle);
  color: var(--primary-dark);
}
.agg-check span {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: 0;
  color: inherit;
  flex: 1;
  min-width: 0;
}
.agg-check input {
  appearance: none;
  position: relative;
  width: 2.35rem;
  height: 1.3rem;
  margin: 0;
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  background: var(--slate-300);
  cursor: pointer;
  transition: background 140ms ease;
}
.agg-check input::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.3rem - 4px);
  height: calc(1.3rem - 4px);
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
  transform: none;
  clip-path: none;
  transition: transform 140ms ease;
}
.agg-check input:checked {
  background: var(--primary);
  border-color: transparent;
}
.agg-check input:checked::before {
  transform: translateX(1.05rem);
}
.agg-check input:focus-visible {
  outline: 2px solid var(--primary-border);
  outline-offset: 2px;
}

.geo-block {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--slate-200);
}

.preset-field { margin-top: 4px; }
.preset-grid,
.preset-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}
.preset-actions { margin-top: 8px; }
.preset-btn {
  appearance: none;
  border: 1px solid var(--slate-200);
  background: var(--white);
  border-radius: 8px;
  padding: 5px 4px;
  min-height: 2.85rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--slate-700);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.preset-btn:hover {
  border-color: var(--primary-border);
  color: var(--primary-dark);
}
.preset-btn.is-active {
  background: var(--primary-subtle);
  border-color: var(--primary-border);
  color: var(--primary-dark);
}
.preset-btn:disabled,
.preset-btn.is-unavailable {
  opacity: 0.42;
  cursor: not-allowed;
  color: var(--slate-400);
  background: var(--slate-50);
  border-color: var(--slate-200);
}
.preset-btn:disabled:hover,
.preset-btn.is-unavailable:hover {
  border-color: var(--slate-200);
  color: var(--slate-400);
}
.preset-btn:disabled.is-active,
.preset-btn.is-unavailable.is-active {
  background: var(--slate-50);
  border-color: var(--slate-200);
  color: var(--slate-400);
}
.preset-ico {
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
}
.preset-txt {
  font-size: 0.70rem;
  font-weight: 600;
  line-height: 1.15;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}
.preset-btn-action {
  background: var(--slate-50);
}

.obor-groups,
.snap-settings {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--slate-200);
}
.obor-groups > summary,
.snap-settings > summary,
.ai-settings > summary,
.ai-help > summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--slate-600);
}
.obor-groups-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  max-height: min(180px, 28vh);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}
.obor-group-block {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--slate-100);
  min-width: 0;
  max-width: 100%;
}
.obor-group-block:last-child { border-bottom: none; }
.obor-group-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--slate-700);
  cursor: pointer;
  min-width: 0;
  max-width: 100%;
}
.obor-group-item input { margin-top: 2px; flex-shrink: 0; }
.obor-group-label {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.obor-group-label em {
  font-style: normal;
  font-weight: 700;
  color: var(--slate-500);
  margin-right: 2px;
}
.obor-group-frac {
  margin-left: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--slate-400);
  white-space: nowrap;
}
.obor-groups-empty { margin: 8px 0 0; font-size: 0.75rem; }
.obor-kkov-details {
  margin: 4px 0 2px 1.35rem;
  min-width: 0;
  max-width: calc(100% - 1.35rem);
}
.obor-kkov-details > summary {
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--slate-500);
}
.obor-kkov-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
  padding-left: 2px;
  min-width: 0;
  max-height: min(120px, 18vh);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.obor-kkov-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--slate-700);
  cursor: pointer;
  min-width: 0;
  max-width: 100%;
}
.obor-kkov-item input { margin-top: 2px; flex-shrink: 0; }
.obor-kkov-label {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.obor-kkov-label em {
  font-style: normal;
  color: var(--slate-400);
  font-weight: 500;
}

.snap-lead {
  margin: 8px 0 10px;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--slate-500);
}
.snap-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.snap-btn {
  width: 100%;
  text-align: center;
  justify-content: center;
  cursor: pointer;
}
.snap-upload { display: block; box-sizing: border-box; }
.snap-remember { margin: 0 0 6px; }
.snap-status {
  margin: 0;
  font-size: 0.72rem;
  color: var(--slate-500);
}
.snap-status.is-error { color: #b42318; }
.snap-status.is-ok { color: #027a48; }

.ai-settings {
  margin-top: 14px;
  margin-bottom: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--slate-200);
}
.ai-settings-lead,
.ai-settings-note,
.ai-help {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--slate-500);
}
.ai-settings-lead { margin: 8px 0 10px; }
.ai-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -4px 0 10px;
}
.ai-check {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 0.78rem;
  color: var(--slate-700);
}
.ai-settings-row .ai-check { margin: 0; }
.ai-get-key-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  margin: 6px 0 10px;
  background: var(--slate-100);
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  color: var(--slate-800);
  text-decoration: none;
  font-size: 0.81rem;
  font-weight: 600;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.ai-get-key-btn:hover {
  background: #ede9fe;
  border-color: #818cf8;
  color: #4338ca;
}

.ai-get-key-arrow {
  margin-left: auto;
  font-weight: 700;
  opacity: 0.6;
}

.ai-steps-mini {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.74rem;
  color: var(--slate-600);
  line-height: 1.35;
}

.ai-step-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.ai-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--slate-200);
  color: var(--slate-700);
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.ai-step-item code {
  font-size: 0.72rem;
  background: var(--slate-100);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid var(--slate-200);
}

/* Karta pro zadání klíče přímo na ploše AI rozboru */
.ai-key-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.ai-key-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.ai-key-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  font-size: 1.15rem;
  flex-shrink: 0;
}

.ai-key-card-title {
  margin: 0 0 3px;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--slate-900);
}

.ai-key-card-subtitle {
  margin: 0;
  font-size: 0.83rem;
  color: var(--slate-600);
  line-height: 1.4;
}

.ai-key-card-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--slate-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
}

.ai-key-card-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.79rem;
  color: var(--slate-700);
  line-height: 1.35;
}

.ai-key-card-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.ai-key-card-step code {
  font-size: 0.74rem;
  background: var(--slate-200);
  padding: 1px 4px;
  border-radius: 3px;
}

.ai-key-card-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.ai-key-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.83rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md);
  white-space: nowrap;
  color: #ffffff !important;
}

.ai-key-open-btn:hover,
.ai-key-open-btn:focus,
.ai-key-open-btn:visited,
a.btn-primary:hover,
a.btn-primary:focus {
  color: #ffffff !important;
}

.ai-key-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 270px;
}

.ai-key-input-group input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  font-size: 0.84rem;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--slate-800);
  outline: none;
  transition: border-color var(--transition);
}

.ai-key-input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-border);
}

.ai-key-input-group button {
  height: 36px;
  padding: 0 14px;
  font-size: 0.83rem;
  white-space: nowrap;
  border-radius: var(--radius-md);
}

.ai-key-card-hint {
  margin: 0;
  font-size: 0.76rem;
  color: var(--slate-500);
  line-height: 1.4;
}


.stage.is-detail .results-body:has(.ai-stage) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.ai-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
}
.ai-stage h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.25rem;
}
.ai-stage-lead {
  margin: 0 0 12px;
  color: var(--slate-500);
  font-size: 0.84rem;
  line-height: 1.45;
}
.ai-stage-model-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--slate-200);
}

.ai-stage-model-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 8px;
}

.ai-stage-model-field {
  flex: 1;
  min-width: 240px;
  margin: 0 !important;
}

.ai-stage-model-field select {
  height: 38px;
  padding: 0 12px;
  font-size: 0.88rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-300);
  background: var(--white);
  color: var(--slate-800);
  width: 100%;
}

.ai-stage-adv-check {
  margin: 0 0 8px 0;
  font-size: 0.82rem;
  white-space: nowrap;
}

.ai-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0 16px;
}

.ai-actions .btn-primary,
.ai-actions .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 42px;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-sizing: border-box;
  transition: all var(--transition);
}

.ai-actions #ai-generate {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border: 1px solid #0284c7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

.ai-actions #ai-generate:hover:not(:disabled) {
  background: linear-gradient(135deg, #0369a1, #075985);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.45);
  transform: translateY(-1px);
}

.ai-actions #ai-generate:disabled {
  background: var(--slate-100) !important;
  color: var(--slate-400) !important;
  border: 1px solid var(--slate-200) !important;
  box-shadow: none !important;
  opacity: 0.65 !important;
  transform: none !important;
  cursor: not-allowed;
}
.ai-status { margin: 0 0 8px; font-size: 0.84rem; color: var(--slate-600); }
.ai-status:empty, .ai-status[hidden] { display: none; margin: 0; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-status.is-loading::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 7px;
  border: 2px solid var(--slate-300, #cbd5e1);
  border-top-color: var(--brand, #2563eb);
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
  vertical-align: -1px;
}
.ai-error {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff1f0;
  border: 1px solid #ffa39e;
  color: #434343;
  font-size: 0.88rem;
  line-height: 1.4;
}
.ai-frame {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  background: #fff;
}
.ai-fallback {
  width: 100%;
  min-height: 180px;
  font: inherit;
  font-size: 0.8rem;
  padding: 8px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 0;
}
.btn-text:hover { color: var(--primary-dark); }

.btn-ghost {
  appearance: none;
  border: 1px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-700);
  font: inherit;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity var(--transition), border-color var(--transition),
    color var(--transition), background var(--transition);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--primary-border);
  color: var(--primary-dark);
  background: var(--primary-subtle);
}
.btn-ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.stage {
  padding: 0;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--slate-50);
  --stage-inline: 12px;
}

.stage > #results-form {
  flex-shrink: 0;
}

.stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 6px var(--stage-inline);
  border-bottom: 1px solid var(--slate-200);
  background: var(--white);
  min-height: 42px;
  position: relative;
  z-index: 6;
}
.stage-toolbar-left,
.stage-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.stage-toolbar-right {
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}
.stage-toolbar-right > .hint {
  margin-right: auto;
}
.toolbar-end-cluster {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 10px;
  flex: 0 1 auto;
  min-width: 0;
}
.chart-curve-extras {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px 10px;
  max-width: min(520px, 55vw);
}
.chart-curve-extras.is-collapsed {
  display: none !important;
}
.sel-pill {
  font-size: 0.8rem;
  color: var(--slate-700);
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  padding: 3px 10px;
}
.sel-pill strong { color: var(--primary-dark); }

.btn-primary {
  appearance: none;
  border: none;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  color: white;
  font: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: filter var(--transition), opacity var(--transition);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  appearance: none;
  border: 1px solid var(--primary-border);
  background: var(--primary-subtle);
  color: var(--primary-dark);
  font: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition), opacity var(--transition);
}
.btn-secondary:hover:not(:disabled) {
  background: #ccfbf1;
  border-color: var(--primary);
}
.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ai {
  appearance: none;
  border: 1px solid var(--primary-border);
  background: linear-gradient(145deg, #f0fdfa, #ccfbf1);
  color: var(--primary-dark);
  font: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition), opacity var(--transition);
}
.btn-ai:hover:not(:disabled) {
  background: #99f6e4;
  border-color: var(--primary);
}
.btn-ai:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.mode-controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  margin-left: auto;
  flex-shrink: 0;
}

.btn-switch-mode {
  border-color: var(--primary-border);
  color: var(--primary-dark);
  background: var(--primary-subtle);
  font-weight: 700;
}
.btn-switch-mode:hover:not(:disabled) {
  background: #ccfbf1;
  border-color: var(--primary);
}
.hint {
  font-size: 0.74rem;
  color: var(--slate-500);
  max-width: 40ch;
}

/* Souhrn filtrů — malý posun doprava vůči levému okraji toolbaru */
.stage-meta {
  flex-shrink: 0;
  padding: 5px var(--stage-inline) 2px;
  padding-left: calc(var(--stage-inline) + 4px);
  background: var(--white);
}
.filter-status {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--slate-500);
}
.filter-status strong {
  color: var(--slate-700);
  font-weight: 650;
}
#filter-status-text {
  color: var(--slate-600);
}

.pick-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 10px 8px;
  animation: fade-in 0.18s ease;
}

/* [hidden] must beat display:flex from .pick-panel / .results-body */
.pick-panel[hidden],
.results-body[hidden],
.stage.is-detail .pick-panel {
  display: none !important;
}

.stage.is-detail .results-body {
  display: block;
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  /* no top padding — sticky header must sit flush under toolbar */
  padding: 0 0 16px;
  background: var(--white);
  --detail-freeze-h: 0px;
}

.stage:not(.is-detail) .results-body {
  display: none !important;
}

.school-list {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.empty-list {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--slate-300);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.7);
}

.school-table-wrap {
  flex: 1;
  min-height: 0;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  overflow: auto;
  box-shadow: var(--shadow-sm);
}
.schools-load-more {
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  pointer-events: none;
}
.schools-load-more.is-loading {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.schools-load-more.is-loading::after {
  content: "Načítám další školy…";
  font-size: 0.75rem;
  color: var(--slate-500);
}
.school-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  table-layout: fixed;
}
.school-table thead th {
  position: sticky;
  z-index: 1;
  background: var(--slate-100);
  color: var(--slate-600);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--slate-200);
}
.school-table thead tr.col-heads th {
  top: 0;
  z-index: 3;
}
.school-table[data-column-filters="1"] thead tr.col-filters th {
  top: 30px;
  z-index: 2;
  background: var(--white);
  padding: 4px 6px 6px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  border-bottom: 1px solid var(--slate-200);
  box-shadow: 0 1px 0 var(--slate-100);
}
.col-filter {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.col-filter-input {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--slate-800);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  background: var(--slate-50);
}
.col-filter-input:focus {
  outline: none;
  border-color: var(--primary-border);
  background: var(--white);
  box-shadow: 0 0 0 2px var(--primary-subtle);
}
.col-filter-clear {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--slate-500);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.col-filter-clear:hover {
  background: var(--slate-100);
  color: var(--slate-800);
}
.school-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}
.school-table .col-check {
  width: 36px;
  text-align: center;
}
.school-table th:nth-child(2),
.school-table td:nth-child(2) { width: 34%; }
.school-table th:nth-child(3),
.school-table td:nth-child(3) { width: 26%; }
.school-table th:nth-child(4),
.school-table td:nth-child(4) { width: 14%; }
.school-table th:nth-child(5),
.school-table td:nth-child(5) { width: 18%; }
.school-table th:nth-child(6),
.school-table td:nth-child(6) { width: 8%; text-align: center; }
.school-web-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  color: var(--primary);
  border-radius: var(--radius-sm, 4px);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
.school-web-link:hover {
  background: var(--primary-subtle, #eff6ff);
  color: var(--primary-dark, #1d4ed8);
}
.school-table .school-cb { accent-color: var(--primary); cursor: pointer; }
.school-item { transition: background var(--transition); }
.school-item:hover { background: var(--primary-subtle); }
.school-item.is-selected { background: var(--primary-subtle); }
.school-item.is-pinned {
  background: #fffbeb;
  box-shadow: inset 3px 0 0 #f59e0b;
}
.school-item.is-pinned td {
  border-bottom-color: #fde68a;
}
.pin-badge {
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: 1px 7px;
}
.school-name {
  font-weight: 650;
  color: var(--slate-900);
  line-height: 1.3;
  cursor: pointer;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.school-field {
  color: var(--slate-600);
  font-size: 0.8rem;
  white-space: nowrap;
}
.school-mesto,
.school-loc,
.list-foot {
  color: var(--slate-500);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.school-grade {
  color: var(--slate-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-foot {
  flex-shrink: 0;
  font-size: 0.72rem;
  padding: 0 2px;
}
.muted { color: var(--slate-500); font-size: 0.82rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.results-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px 12px 16px;
  animation: fade-in 0.22s ease;
}

.compare-wrap {
  /* Keep overflow visible so sticky thead shares .results-body scrollport
     with .detail-header (overflow-x here would offset thead over KPI rows). */
  overflow: visible;
  padding: 0 10px 14px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  table-layout: fixed;
}
.compare-table th,
.compare-table td {
  border-bottom: 1px solid var(--slate-100);
  padding: 5px 6px;
  text-align: left;
  vertical-align: top;
}
.compare-table thead th {
  position: sticky;
  /* sit under sticky .detail-header (height synced via --detail-freeze-h) */
  top: var(--detail-freeze-h, 0px);
  background-color: var(--white);
  background-image: none;
  z-index: 3;
  min-width: 0;
  width: auto;
  box-shadow: 0 1px 0 var(--slate-200);
  text-align: center;
  vertical-align: bottom;
}
.compare-table thead th.cmp-metric-col {
  z-index: 5;
  text-align: left;
  vertical-align: middle;
}
.compare-table .cmp-metric-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--white);
  width: 240px;
  min-width: 240px;
  max-width: 240px;
}
.compare-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--white);
  font-weight: 500;
  color: var(--slate-600);
  white-space: nowrap;
  line-height: 1.25;
}
.compare-table .section-row td {
  background: var(--slate-100);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--slate-800);
  padding-top: 10px;
}
.compare-table .section-row.secondary td {
  background: var(--slate-50);
  color: var(--slate-700);
}

.compare-wrap details.metric-secondary {
  margin-top: 14px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 8px 12px 14px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.compare-wrap details.metric-secondary summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--slate-700);
  padding: 4px 6px;
  user-select: none;
}
.compare-wrap details.metric-secondary summary:hover {
  color: var(--primary-dark);
}
.compare-wrap details.metric-secondary[open] summary {
  margin-bottom: 10px;
  border-bottom: 1px solid var(--slate-100);
  padding-bottom: 8px;
}

/* Hover celé KPI řádky (včetně sticky sloupce metrik) */
.compare-table tbody tr:not(.section-row):hover > th,
.compare-table tbody tr:not(.section-row):hover > td {
  background-color: var(--primary-subtle);
}
.compare-table tbody tr:not(.section-row):hover > th.cmp-metric-col {
  background-color: var(--primary-subtle);
}
.compare-table tbody tr:not(.section-row):hover > td.cmp-val {
  cursor: default;
}
.cmp-school {
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-align: center;
}
.cmp-field {
  font-weight: 500;
  color: var(--slate-500);
  font-size: 0.68rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* 7–10 škol: ještě hustší, ať se vejdou bez H-scrollu na běžném desktopu */
.compare-table.is-dense {
  font-size: 0.72rem;
}
.compare-table.is-dense th,
.compare-table.is-dense td {
  padding: 4px 4px;
}
/* Nejužší šířka 190px se uplatní pro 9–10 škol */
.compare-table.is-dense .cmp-metric-col {
  width: 190px;
  min-width: 190px;
  max-width: 190px;
}
/* Střední srovnání (4–8 škol): 210px pro více prostoru */
.compare-table.is-dense[data-n="4"] .cmp-metric-col,
.compare-table.is-dense[data-n="5"] .cmp-metric-col,
.compare-table.is-dense[data-n="6"] .cmp-metric-col,
.compare-table.is-dense[data-n="7"] .cmp-metric-col,
.compare-table.is-dense[data-n="8"] .cmp-metric-col {
  width: 210px;
  min-width: 210px;
  max-width: 210px;
}
.compare-table.is-dense .cmp-field {
  font-size: 0.62rem;
}
.compare-table.is-dense .cmp-val-inner {
  gap: 0.3rem;
}
.compare-table.is-dense .cmp-val-inner .metric-badge {
  flex-basis: 1em;
  width: 1em;
  height: 1em;
  font-size: 0.85rem;
}
.results-empty {
  border: 1px dashed var(--slate-300);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  color: var(--slate-500);
  background: rgba(255, 255, 255, 0.5);
}

.detail-card,
.compare-card {
  background: var(--white);
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  animation: fade-in 0.22s ease;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.detail-header {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--slate-100);
  /* solid base so KPI never peek through gradient / behind sticky */
  background-color: var(--white);
  background-image: linear-gradient(180deg, var(--primary-subtle) 0%, var(--white) 100%);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}
.detail-header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--slate-900);
  margin-bottom: 4px;
}
.field-label, .addr, .years-note {
  font-size: 0.84rem;
  color: var(--slate-600);
  margin-top: 2px;
}
/* Obor · adresa · web — jeden řádek, zalamuje se jen na úzkém viewportu */
.school-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  row-gap: 2px;
  margin-top: 2px;
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--slate-600);
}
.school-meta > *:not(:last-child)::after {
  content: "·";
  margin: 0 0.5em;
  color: var(--slate-300);
  font-weight: 500;
  pointer-events: none;
  text-decoration: none;
}
.school-meta .meta-field strong {
  color: var(--slate-800);
  font-weight: 650;
}
.school-meta .meta-web {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  white-space: nowrap;
}
.school-meta .meta-web:hover {
  color: var(--primary);
}
.view-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  border-radius: 999px;
  padding: 2px 9px;
}
.detail-body { padding: 8px 14px 16px; }

/* Agregace: přehled zahrnutých oborů (parity maturity _obory_table) */
.obory-breakdown {
  padding: 4px 14px 18px;
  border-top: 1px solid var(--slate-100);
}
.obory-breakdown h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--slate-800);
  margin: 10px 0 8px;
  font-weight: 650;
}
.obory-breakdown .obory-count {
  color: var(--slate-500);
  font-weight: 500;
  font-size: 0.85em;
}
.obory-wrap {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 0 4px;
}
.obory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}
.obory-table th,
.obory-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--slate-100);
  text-align: left;
  vertical-align: top;
}
.obory-table thead th {
  color: var(--slate-500);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom-color: var(--slate-200);
}
.obory-table th.num,
.obory-table td.num {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}
.obory-table tbody th.obor-name {
  font-weight: 550;
  color: var(--slate-800);
  max-width: 28rem;
}
.obory-table tbody tr:nth-child(odd):not(.section-row) {
  background: var(--slate-50);
}
.obory-table tbody tr:not(.section-row):hover {
  background: var(--primary-subtle);
}
.obory-table .section-row.obor-section td {
  padding-top: 12px;
  font-weight: 650;
  color: var(--slate-800);
}

/* Detail: multiyear columns (reuse compare-table + badge layout) */
.detail-year-wrap {
  /* Same as .compare-wrap: overflow must stay visible so sticky thead
     shares .results-body with .detail-header (overflow-x offsets thead over rows). */
  overflow: visible;
  margin: 0 -4px;
  padding: 0 4px 4px;
}
.detail-year-table.detail-year-table {
  margin-top: 4px;
}
.detail-year-table thead th.th-year {
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
  font-weight: 600;
  color: var(--slate-600);
  min-width: 4.5rem;
  background-color: var(--white);
}
.detail-year-table thead th.th-year-active {
  color: var(--slate-800);
  font-weight: 700;
}
.detail-year-table .badge-active {
  display: inline-block;
  color: var(--primary-dark);
  font-size: 0.62rem;
  margin-left: 4px;
  font-weight: 600;
  vertical-align: middle;
  letter-spacing: 0.02em;
}
.detail-year-table td.val-active .cmp-num {
  font-weight: 700;
}

.metric-block { margin: 10px 0; padding-bottom: 4px; }
.metric-block h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--slate-800);
  margin-bottom: 6px;
}
.metric-grid { display: grid; gap: 2px; }
.metric-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(88px, 0.55fr);
  gap: 8px 12px;
  align-items: baseline;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
}
.metric-row-3 {
  grid-template-columns: minmax(150px, 1.15fr) minmax(72px, 0.45fr) minmax(140px, 1.2fr);
}
.metric-row:nth-child(odd) { background: var(--slate-50); }
.metric-row:hover {
  background-color: var(--primary-subtle);
}
.metric-name {
  color: var(--slate-600);
  font-size: 0.82rem;
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}
.metric-label-text { min-width: 0; }
.metric-val {
  font-weight: 700;
  color: var(--slate-900);
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.metric-note { min-width: 0; }
.metric-comment {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--slate-600);
  line-height: 1.35;
  cursor: help;
}
.metric-comment-empty {
  color: var(--slate-300);
  cursor: default;
}
.metric-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  line-height: 1;
  cursor: help;
  flex-shrink: 0;
}
.metric-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--slate-300);
  background: var(--white);
  color: var(--slate-500);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  user-select: none;
}
.metric-help:hover {
  border-color: var(--primary-border);
  color: var(--primary-dark);
  background: var(--primary-subtle);
}

# App tooltip bubble (replaces native title= for badges / help / comments)
.has-tip {
  cursor: help;
}
#app-tip {
  position: fixed;
  z-index: 10000;
  width: max-content;
  min-width: 12rem;
  max-width: min(28rem, calc(100vw - 24px));
  max-height: min(70vh, 32rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--slate-900);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--slate-200);
  pointer-events: none;
  white-space: pre-line;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.12s var(--transition), transform 0.12s var(--transition), visibility 0.12s;
}
#app-tip.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  /* Jinak overflow scrollbar nejde použít (dřív pointer-events: none). */
  pointer-events: auto;
}
#app-tip::after {
  content: "";
  position: absolute;
  left: var(--tip-arrow-x, 16px);
  bottom: 100%;
  border: 6px solid transparent;
  border-bottom-color: var(--white);
  filter: drop-shadow(0 -1px 0 var(--slate-200));
}
#app-tip.is-above::after {
  bottom: auto;
  top: 100%;
  border-bottom-color: transparent;
  border-top-color: var(--white);
  filter: drop-shadow(0 1px 0 var(--slate-200));
}
.metric-primary { border-left: 3px solid var(--primary); padding-left: 8px; }
.metric-secondary {
  margin-top: 8px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 6px 10px;
}
.metric-secondary summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--slate-700);
  padding: 4px 0;
}

.compare-table .cmp-val {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.compare-table .cmp-val-inner {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  width: 100%;
}
.compare-table .cmp-num {
  font-weight: 700;
  color: var(--slate-900);
  text-align: right;
}
.compare-table .cmp-sub {
  display: block;
  font-size: 0.70rem;
  color: var(--slate-500);
  font-weight: 400;
  line-height: 1.1;
}
.compare-table .cmp-val-inner .metric-badge {
  flex: 0 0 1.25em;
  width: 1.25em;
  height: 1.25em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
}
.compare-table .cmp-val-inner .metric-badge-empty {
  visibility: hidden;
  pointer-events: none;
  cursor: default;
}
.compare-table .cmp-metric-col .cmp-metric-cell-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  min-width: 0;
}
.compare-table .cmp-metric-col .metric-help {
  flex: 0 0 auto;
  margin-left: 2px;
  vertical-align: middle;
}
/* One line, no spill into value cols (no min-width:max-content). */
.compare-table tbody th.cmp-metric-col {
  white-space: nowrap;
  overflow: hidden;
}
.compare-table tbody th.cmp-metric-col .metric-label-text {
  flex: 1 1 auto;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Sub-metric rows (↳ hierarchical child metrics) */
.compare-table tr.sub-metric-row th.cmp-metric-col,
.compare-table tr.sub-metric-row td.cmp-val {
  padding-top: 3px;
  padding-bottom: 3px;
  font-size: 0.77rem;
  background: var(--slate-50);
}
.compare-table tr.sub-metric-row th.cmp-metric-col .metric-label-text {
  padding-left: 12px;
  color: var(--slate-600);
}
.compare-table tr.sub-metric-row:hover th.cmp-metric-col,
.compare-table tr.sub-metric-row:hover td.cmp-val {
  background: var(--slate-100);
}
.compare-table.is-dense tr.sub-metric-row th.cmp-metric-col,
.compare-table.is-dense tr.sub-metric-row td.cmp-val {
  padding-top: 2px;
  padding-bottom: 2px;
  font-size: 0.73rem;
}
.cmp-sortable-row,
.cmp-sortable-metric-head {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}
.cmp-sortable-row:hover,
.cmp-sortable-metric-head:hover {
  background-color: var(--slate-100, #f1f5f9);
}
.cmp-sort-icon {
  margin-left: auto;
  opacity: 0.35;
  font-size: 0.75rem;
  padding-left: 4px;
}
.cmp-sortable-row:hover .cmp-sort-icon,
.cmp-sortable-metric-head:hover .cmp-sort-icon {
  opacity: 0.8;
}
.cmp-sortable-row[data-sort-dir="desc"] .cmp-sort-icon,
.cmp-sortable-metric-head[data-sort-dir="desc"] .cmp-sort-icon,
.cmp-sortable-row[data-sort-dir="asc"] .cmp-sort-icon,
.cmp-sortable-metric-head[data-sort-dir="asc"] .cmp-sort-icon {
  opacity: 1;
  color: var(--primary, #0f766e);
}
.school-table thead tr.col-heads th.sortable-col {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}
.school-table thead tr.col-heads th.sortable-col:hover {
  background: var(--slate-100);
  color: var(--slate-900);
}
.col-sort-icon {
  display: inline-block;
  font-size: 0.7rem;
  opacity: 0.35;
  margin-left: 2px;
  vertical-align: middle;
}
.sortable-col:hover .col-sort-icon {
  opacity: 0.8;
}
.sortable-col[data-sort-dir="asc"] .col-sort-icon,
.sortable-col[data-sort-dir="desc"] .col-sort-icon {
  opacity: 1;
  color: var(--primary, #0f766e);
}

@media (max-width: 960px) {
  html, body { overflow: auto; height: auto; }
  body { display: block; }
  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .stage {
    order: -1;
    height: auto;
    min-height: 70vh;
  }
  .sidebar {
    order: 2;
    height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--slate-200);
  }
  .sidebar-filters-panel {
    flex: none;
    overflow: visible;
  }
  .sidebar-filters-panel > summary.sidebar-title {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
    padding: 10px 12px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    background: var(--slate-50);
  }
  .sidebar-filters-panel > summary.sidebar-title::after {
    content: "▾";
    color: var(--slate-500);
    font-size: 0.85rem;
  }
  .sidebar-filters-panel[open] > summary.sidebar-title {
    margin-bottom: 12px;
  }
  .sidebar-filters-panel[open] > summary.sidebar-title::after {
    content: "▴";
  }
  .pick-panel { min-height: 50vh; }
  .school-table-wrap { max-height: 60vh; flex: none; height: 60vh; }
  .topbar { height: auto; }
  .topbar-inner {
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
  }
  .brand { order: 1; }
  .topbar-actions {
    order: 2;
    margin-left: auto;
  }
  .ctrl-group {
    flex-wrap: wrap;
  }
  .ctrl-group + .ctrl-group {
    padding-left: 0;
    border-left: none;
    width: 100%;
    padding-top: 6px;
    border-top: 1px solid var(--slate-200);
  }
  .seg { flex-wrap: wrap; border-radius: 12px; }
  .seg-views { border-radius: 12px; }
  .school-table { table-layout: auto; }
  .school-name,
  .school-field { white-space: normal; }
  .metric-row-3 {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name val"
      "note note";
  }
  .metric-row-3 .metric-name { grid-area: name; }
  .metric-row-3 .metric-val { grid-area: val; }
  .metric-row-3 .metric-note { grid-area: note; }
}

/* Chart stage toolbar */
.chart-stage-toolbar {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.chart-stage-toolbar[hidden] {
  display: none !important;
}
.chart-toolbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  width: 100%;
  box-sizing: border-box;
}
.chart-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chart-stage-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--slate-900);
}
.chart-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-left: auto;
}
.chart-curve-extras {
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-ref-all {
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--primary-border);
  background: var(--primary-subtle);
  color: var(--primary-dark);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-right: 2px;
}
.btn-ref-all:hover {
  background: var(--primary);
  color: #fff;
}

/* Chart menu (toolbar) + full-stage Plotly panel */
.chart-menu {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.chart-menu-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate-500, #64748b);
}
.chart-menu select {
  min-width: 11.5rem;
  max-width: min(18rem, 42vw);
  padding: 7px 28px 7px 10px;
  border: 1px solid var(--slate-300, #cbd5e1);
  border-radius: 8px;
  background: var(--white, #fff)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23475569' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  appearance: none;
  font: inherit;
  font-size: 0.9rem;
  color: var(--slate-800, #1e293b);
  cursor: pointer;
}
.chart-menu select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.chart-menu select:focus-visible {
  outline: 2px solid var(--brand, #0d9488);
  outline-offset: 2px;
}

.chart-axis-mode,
.chart-xaxis {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chart-axis-mode.is-collapsed,
.chart-xaxis.is-collapsed {
  display: none !important;
}
.chart-axis-mode .seg-axis,
.chart-xaxis .seg-xaxis {
  display: inline-flex;
  background: var(--slate-100);
  border-color: var(--slate-200);
}
.seg-axis .seg-item span,
.seg-xaxis .seg-item span {
  font-size: 0.78rem;
  padding: 5px 10px;
}
.seg-axis .seg-item input:checked + span,
.seg-xaxis .seg-item input:checked + span {
  background: var(--white);
  color: var(--slate-900);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.chart-refs {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  position: relative;
}
.chart-refs.is-collapsed {
  display: none !important;
}
.chart-refs .seg-refs {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
}
.seg-refs .seg-item.has-peer-pick input:checked + span::after {
  content: " ▾";
  font-size: 0.75em;
  opacity: 0.8;
}

/* Secondary reference bar (Sub-toolbar) */
.chart-peer-subbar {
  display: flex;
  align-items: center;
  padding: 7px 16px;
  background: var(--slate-50, #f8fafc);
  border-top: 1px solid var(--slate-200, #e2e8f0);
  width: 100%;
  box-sizing: border-box;
}
.chart-peer-subbar[hidden] {
  display: none !important;
}
.chart-peer-subbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.chart-peer-subbar-title {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate-500, #64748b);
  white-space: nowrap;
}
.chart-peer-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--slate-700, #334155);
  background: #ffffff;
  border: 1px solid var(--slate-300, #cbd5e1);
  border-radius: 6px;
  padding: 3px 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.chart-peer-field[hidden] {
  display: none !important;
}
.chart-peer-label {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--slate-600, #475569);
  white-space: nowrap;
}
.chart-peer-select {
  font: inherit;
  font-size: 0.82rem;
  padding: 3px 8px;
  border: 1px solid var(--slate-300, #cbd5e1);
  border-radius: 4px;
  background: #fff;
  color: var(--slate-800, #1e293b);
  max-width: 24rem;
  cursor: pointer;
}
.chart-peer-select:focus {
  outline: none;
  border-color: var(--primary-border, #0284c7);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.is-chart-loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}

/* Graf / AI / …: JS nastaví hidden — drž display:none i proti flex rodičům. */
#chart-menu[hidden],
#view-controls[hidden] {
  display: none !important;
}

/* Pohled u neaktivních grafů: na místě, jen znepřístupněný (bez posunu předmětů). */
#view-controls.is-idle {
  opacity: 0.45;
}
#view-controls.is-idle .seg-item,
.seg-views .seg-item.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
#view-controls.is-idle .seg-item span,
.seg-views .seg-item.is-disabled span {
  pointer-events: none;
}

.chart-stage {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 12px 16px 20px;
  background: var(--white, #fff);
}
.chart-stage-header {
  flex: 0 0 auto;
  margin-bottom: 8px;
}
.chart-stage-header h2 {
  margin: 0 0 6px;
  font-family: "Space Grotesk", "Plus Jakarta Sans", sans-serif;
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--slate-900, #0f172a);
}
.chart-stage-body {
  flex: 1 1 auto;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  padding-top: 4px;
}
.plotly-host {
  flex: 1 1 auto;
  min-height: 380px;
  width: 100%;
  touch-action: pan-y;
  /* Room above plot for Plotly modebar so it doesn't collide with legend/header */
  padding-top: 8px;
}
.plotly-host .js-plotly-plot,
.plotly-host .plot-container {
  width: 100% !important;
}
.chart-note {
  margin: 0 0 6px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--slate-600, #475569);
}
.chart-note-warn {
  color: var(--slate-700, #334155);
  background: #fff7ed;
  border-radius: 8px;
  padding: 6px 10px;
}
.chart-explanation-box {
  flex: 0 0 auto;
  height: auto;
  margin-top: 8px;
  background: #f8fafc;
  border: 1px solid var(--slate-200, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  padding: 8px 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.chart-explain-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-family: var(--font-display, inherit);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--slate-700, #334155);
}
.chart-explain-icon {
  font-size: 0.85rem;
  line-height: 1;
}
.chart-explain-title {
  letter-spacing: 0.01em;
}
.chart-explain-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.chart-explain-row {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}
.chart-explain-badge {
  flex-shrink: 0;
  width: 128px;
  box-sizing: border-box;
  text-align: right;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--slate-500, #64748b);
  background: var(--slate-100, #f1f5f9);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.chart-explain-text {
  flex: 1 1 auto;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.42;
  color: var(--slate-700, #334155);
}
.chart-explanation-box .chart-note-warn {
  margin: 4px 0 0;
  padding: 4px 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 4px;
  color: #9a3412;
  font-size: 0.78rem;
  line-height: 1.4;
}
.chart-empty {
  margin: 24px 4px;
  color: var(--slate-500, #64748b);
  font-size: 0.95rem;
}
.chart-unavailable {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 220px;
  padding: 28px 20px;
}
.chart-unavailable-msg {
  margin: 0 0 8px;
  color: var(--slate-700, #334155);
  font-size: 1.05rem;
  font-weight: 600;
  max-width: 36rem;
}
.chart-unavailable-hint {
  margin: 0;
  color: var(--slate-500, #64748b);
  font-size: 0.95rem;
}

/* —— Návod v hlavním okně —— */
.results-body:has(.manual) {
  scroll-behavior: smooth;
}
.manual {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  padding: 16px 20px 48px;
  color: var(--slate-800);
}
.manual-head { margin-bottom: 10px; }
.manual h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 650;
  color: var(--slate-900);
  margin-bottom: 8px;
}
.manual h3 {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 650;
  color: var(--slate-900);
  margin: 0 0 8px;
  scroll-margin-top: 12px;
}
.manual h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--slate-800);
  margin: 16px 0 6px;
}
.manual p,
.manual li,
.manual dd {
  font-size: 0.92rem;
  line-height: 1.55;
}
.manual-lead {
  color: var(--slate-600);
}
.manual-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 12px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
}
.manual section {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--slate-200);
  scroll-margin-top: 8px;
}
.manual section:last-child,
.manual #nav-podminky {
  min-height: calc(100vh - 160px);
  padding-bottom: 40px;
}
.manual ul,
.manual ol {
  padding-left: 1.2rem;
  margin: 6px 0;
}
.manual li + li { margin-top: 6px; }
.manual .disclaimer-list li {
  margin-top: 10px;
  line-height: 1.55;
}
.manual .disclaimer-list li strong {
  color: var(--slate-900);
}
.manual code {
  font-size: 0.84em;
  background: var(--slate-100);
  padding: 0 4px;
  border-radius: 4px;
}
.flow { margin: 14px 0 8px; }
.flow-spine {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.flow-step {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.flow-step strong { display: block; font-size: 0.92rem; }
.flow-step span {
  display: block;
  margin-top: 2px;
  color: var(--slate-600);
  font-size: 0.8rem;
}
.flow-step + .flow-step {
  margin-top: 22px;
  position: relative;
}
.flow-step + .flow-step::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -18px;
  width: 2px;
  height: 10px;
  background: var(--slate-300);
}
.flow-step + .flow-step::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--slate-400);
}
.flow-fork {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate-500);
  margin: 16px 0 8px;
}
.flow-outs {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
@media (min-width: 1100px) {
  .flow-outs {
    grid-template-columns: repeat(5, 1fr);
  }
  .path-list {
    columns: 2;
    column-gap: 2.2rem;
  }
  .path-list li {
    break-inside: avoid;
  }
  #nav-slovnik .gloss {
    columns: 2;
    column-gap: 2.2rem;
  }
  #nav-slovnik .gloss dt,
  #nav-slovnik .gloss dd {
    break-inside: avoid-column;
  }
}
.flow-out {
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.flow-out strong {
  display: block;
  font-size: 0.88rem;
  color: var(--primary-dark);
}
.flow-out span {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--slate-700);
}
.gloss dt {
  font-weight: 700;
  margin-top: 12px;
  color: var(--slate-900);
}
.gloss dd { margin: 2px 0 0; }
.formula {
  margin-top: 6px;
  padding: 6px 10px;
  background: var(--slate-50);
  border-left: 3px solid var(--primary);
  border-radius: 0 6px 6px 0;
  font-size: 0.84rem;
  color: var(--slate-800);
}

/* —— Veřejná nástěnka podnětů —— */
.feedback-board {
  padding: 8px 4px 32px;
  max-width: 720px;
}
.feedback-board-head {
  margin-bottom: 18px;
}
.feedback-board-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 650;
  color: var(--slate-900);
  margin-bottom: 6px;
}
.feedback-board-lead {
  font-size: 0.92rem;
  color: var(--slate-600);
  line-height: 1.45;
}
.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  margin-bottom: 28px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.feedback-form .field span {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate-500);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.feedback-form select,
.feedback-form textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 8px 10px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--slate-800);
}
.feedback-form textarea {
  resize: vertical;
  min-height: 96px;
}
.feedback-disclaimer {
  font-size: 0.82rem;
  color: var(--slate-500);
  line-height: 1.4;
}
.feedback-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.feedback-form-status {
  font-size: 0.88rem;
  color: var(--slate-600);
}
.feedback-form-status.is-ok { color: #15803d; }
.feedback-form-status.is-error { color: #b91c1c; }
.feedback-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.feedback-empty {
  color: var(--slate-500);
  font-size: 0.95rem;
  padding: 8px 2px;
}
.feedback-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.feedback-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--slate-500);
}
.feedback-badge {
  display: inline-block;
  font-weight: 650;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--slate-100);
  color: var(--slate-700);
}
.feedback-card.status-new .feedback-badge {
  background: var(--primary-subtle);
  color: var(--primary-dark);
}
.feedback-card.status-in_progress .feedback-badge {
  background: #fff7ed;
  color: #c2410c;
}
.feedback-card.status-resolved .feedback-badge {
  background: #f0fdf4;
  color: #15803d;
}
.feedback-card.status-archived .feedback-badge {
  background: var(--slate-100);
  color: var(--slate-600);
}
.feedback-type {
  font-weight: 550;
  color: var(--slate-700);
}
.feedback-message {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--slate-800);
  white-space: pre-wrap;
}
.feedback-context {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--slate-500);
}
.feedback-reply {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--slate-50);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.feedback-reply strong {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-500);
  margin-bottom: 4px;
}
.feedback-reply p {
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--slate-800);
  white-space: pre-wrap;
}

@media (max-width: 720px) {
  .stage-toolbar-right {
    flex-wrap: wrap;
  }
  .chart-menu {
    width: auto;
  }
  .chart-menu select {
    flex: 1;
    max-width: none;
  }
  .chart-curve-extras {
    max-width: 100%;
    width: 100%;
    order: -1;
  }
  .chart-xaxis,
  .chart-refs {
    width: auto;
    margin-left: 0;
  }
  .chart-peer-select {
    max-width: 100%;
    flex: 1;
  }
  .stage-meta {
    padding: 5px var(--stage-inline) 2px;
    padding-left: calc(var(--stage-inline) + 4px);
  }
  .filter-status {
    font-size: 0.68rem;
  }
}

/* Screen sticky must never have been applied in the print document — button
   Tisk uses a clean iframe (vyber.js). Ctrl+P on the live page may still
   show Chromium sticky ghosts; prefer the Tisk button. */
@media print {
  html, body {
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
    display: block !important;
  }
  body {
    background: #fff !important;
  }
  .topbar,
  .sidebar,
  .stage-toolbar,
  .stage-meta,
  .pick-panel,
  #btn-feedback,
  .chart-menu,
  .chart-curve-extras,
  .chart-xaxis,
  .chart-refs,
  .ai-stage .ai-actions {
    display: none !important;
  }
  .layout,
  .stage,
  .results-body,
  .detail-body,
  .compare-wrap,
  .detail-year-wrap,
  .obory-breakdown,
  .obory-wrap,
  .detail-card,
  .compare-card {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    background: #fff !important;
    flex: none !important;
    animation: none !important;
    transform: none !important;
    box-shadow: none !important;
  }
  .detail-header {
    position: static !important;
    break-inside: avoid;
    break-after: avoid;
    background: #fff !important;
    background-image: none !important;
    box-shadow: none !important;
  }
  .compare-table,
  .detail-year-table,
  .obory-table {
    border-collapse: collapse !important;
  }
  .compare-table thead {
    display: table-header-group !important;
  }
  .compare-table th,
  .compare-table td,
  .compare-table .cmp-metric-col,
  .compare-table tbody th,
  .compare-table thead th {
    position: static !important;
    left: auto !important;
    top: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
    background-image: none !important;
    transform: none !important;
    filter: none !important;
  }
  .cmp-school {
    display: block !important;
    -webkit-box-orient: unset !important;
    -webkit-line-clamp: unset !important;
    max-height: 2.5em;
    overflow: hidden !important;
  }
  #app-tip,
  .metric-help {
    display: none !important;
  }
  details.metric-secondary:not([open]) {
    display: none !important;
  }
  details.metric-secondary[open] {
    border: none !important;
    padding: 0 !important;
    background: none !important;
  }
  details.metric-secondary[open] > summary {
    display: none !important;
  }
}


/* --- vysledky: maturity detail --- */
.ethics-disclaimer {
  margin: 0.75rem 0 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--primary-subtle);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
  color: var(--slate-700);
  line-height: 1.45;
}
.detail-card > .ethics-disclaimer,
.compare-card > .ethics-disclaimer {
  margin: 0 14px 10px;
  font-size: 0.82rem;
}
.gdpr-banner {
  margin: 0 14px 10px;
  padding: 0.65rem 0.9rem;
  background: #fff7ed;
  border-left: 3px solid #f97316;
  border-radius: 0 8px 8px 0;
  font-size: 0.85rem;
  color: #9a3412;
  line-height: 1.4;
}
.detail-head { margin-bottom: 0.5rem; }
.detail-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.45rem;
  margin: 0 0 0.35rem;
  color: #0f172a;
}
.detail-meta {
  margin: 0.15rem 0;
  color: #64748b;
  font-size: 0.9rem;
}
.metric-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}
.metric-card h3 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  color: #0f172a;
}
.metric-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.92rem;
}
.metric-row:last-child { border-bottom: 0; }
.metric-label { color: #475569; }
.metric-value { font-weight: 600; color: #0f172a; font-variant-numeric: tabular-nums; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.cmp-table th, .cmp-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.4rem 0.5rem;
  text-align: left;
  vertical-align: top;
}
.cmp-table th { background: #f8fafc; font-weight: 600; }
.cmp-school { font-weight: 600; }
.cmp-field { font-size: 0.8rem; color: #64748b; font-weight: 400; }
.cmp-label { color: #475569; white-space: nowrap; }
.results-detail .metric-grid,
.results-compare { display: flex; flex-direction: column; gap: 0.25rem; }
