/* ==========================================================================
   Spisovka – design systém
   Jeden zdroj pravdy pro barvy, typografii, rozestupy a komponenty.
   Používejte pouze tokeny (var(--…)), nikdy „natvrdo“ zapsané hodnoty.
   Přehled komponent: /styleguide.html   Dokumentace: docs/DESIGN_SYSTEM.md
   ========================================================================== */

/* ---------- 1. Tokeny ---------- */
:root {
  /* Značka */
  --c-primary: #1f5bd8;
  --c-primary-hover: #1a4cb6;
  --c-primary-active: #163f97;
  --c-primary-soft: #ebf1fd;
  --c-primary-soft-2: #d6e3fb;
  --c-on-primary: #ffffff;

  /* Neutrály */
  --c-bg: #f5f6f8;
  --c-surface: #ffffff;
  --c-surface-2: #f8f9fb;
  --c-surface-3: #eff1f4;
  --c-border: #e4e7ec;
  --c-border-strong: #cfd4dc;
  --c-text: #141b26;
  --c-text-2: #475264;
  --c-text-3: #6b7587;
  --c-text-inverse: #ffffff;

  /* Stavy */
  --c-info: #1f5bd8;       --c-info-soft: #ebf1fd;
  --c-success: #16804f;    --c-success-soft: #e6f4ec;
  --c-warning: #a35f00;    --c-warning-soft: #fdf1dc;
  --c-danger: #c42b2b;     --c-danger-soft: #fcebea;
  --c-neutral: #5b6576;    --c-neutral-soft: #eef0f3;

  /* Boční panel */
  --c-sidebar: #ffffff;
  --c-sidebar-active: var(--c-primary-soft);

  /* Typografie */
  --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-mono: "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;

  --fs-xs: 0.75rem;    /* 12 */
  --fs-sm: 0.875rem;   /* 14 */
  --fs-md: 1rem;       /* 16 – základ, čitelnost pro všechny věkové skupiny */
  --fs-lg: 1.125rem;   /* 18 */
  --fs-xl: 1.375rem;   /* 22 */
  --fs-2xl: 1.75rem;   /* 28 */
  --fs-3xl: 2.125rem;  /* 34 */
  --lh-tight: 1.25;
  --lh-normal: 1.5;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Rozestupy – mřížka 4 px */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 56px;

  /* Zaoblení */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* Stíny */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 6px 16px -4px rgba(16, 24, 40, .10), 0 2px 6px -2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .22);
  --focus-ring: 0 0 0 3px rgba(31, 91, 216, .32);

  /* Rozměry a pohyb */
  --sidebar-w: 256px;
  --content-max: 1180px;
  --control-h: 40px;
  --control-h-sm: 32px;
  --control-h-lg: 48px;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --t-fast: 120ms;
  --t-med: 200ms;

  color-scheme: light;
}

/* Tmavý režim – řídí systém, lze vynutit atributem data-theme na <html> */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-primary: #5b8cf0; --c-primary-hover: #7aa3f4; --c-primary-active: #97b8f7;
    --c-primary-soft: #1a2640; --c-primary-soft-2: #22335a; --c-on-primary: #0b1220;
    --c-bg: #0e131b; --c-surface: #151b25; --c-surface-2: #19202b; --c-surface-3: #212a37;
    --c-border: #283241; --c-border-strong: #364254;
    --c-text: #e8ecf2; --c-text-2: #b3bccb; --c-text-3: #8691a3; --c-text-inverse: #0e131b;
    --c-info: #7aa3f4; --c-info-soft: #1a2640;
    --c-success: #4cc38a; --c-success-soft: #13291f;
    --c-warning: #f0b35a; --c-warning-soft: #2e2413;
    --c-danger: #f07a7a; --c-danger-soft: #331a1c;
    --c-neutral: #a2acbc; --c-neutral-soft: #212a37;
    --c-sidebar: #121821;
    --shadow-xs: none; --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 8px 20px -6px rgba(0,0,0,.5); --shadow-lg: 0 24px 48px -12px rgba(0,0,0,.6);
    --focus-ring: 0 0 0 3px rgba(91, 140, 240, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --c-primary: #5b8cf0; --c-primary-hover: #7aa3f4; --c-primary-active: #97b8f7;
  --c-primary-soft: #1a2640; --c-primary-soft-2: #22335a; --c-on-primary: #0b1220;
  --c-bg: #0e131b; --c-surface: #151b25; --c-surface-2: #19202b; --c-surface-3: #212a37;
  --c-border: #283241; --c-border-strong: #364254;
  --c-text: #e8ecf2; --c-text-2: #b3bccb; --c-text-3: #8691a3; --c-text-inverse: #0e131b;
  --c-info: #7aa3f4; --c-info-soft: #1a2640;
  --c-success: #4cc38a; --c-success-soft: #13291f;
  --c-warning: #f0b35a; --c-warning-soft: #2e2413;
  --c-danger: #f07a7a; --c-danger-soft: #331a1c;
  --c-neutral: #a2acbc; --c-neutral-soft: #212a37;
  --c-sidebar: #121821;
  --shadow-xs: none; --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 8px 20px -6px rgba(0,0,0,.5); --shadow-lg: 0 24px 48px -12px rgba(0,0,0,.6);
  --focus-ring: 0 0 0 3px rgba(91, 140, 240, .45);
  color-scheme: dark;
}

/* ---------- 2. Základ ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: var(--lh-tight); margin: 0; color: var(--c-text); }
h1 { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); letter-spacing: -0.015em; }
h2 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: -0.01em; }
h3 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
h4 { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
p { margin: 0 0 var(--s-3); }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }
::selection { background: var(--c-primary-soft-2); }
img, svg { display: block; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* Utility */
.muted { color: var(--c-text-3); }
.text-2 { color: var(--c-text-2); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.mono { font-family: var(--font-mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-2); }
.row { display: flex; align-items: center; gap: var(--s-3); }
.row-sm { display: flex; align-items: center; gap: var(--s-2); }
.spacer { flex: 1; }
.wrap { flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.eyebrow { font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: .06em; text-transform: uppercase; color: var(--c-text-3); }

/* ---------- 3. Rozvržení aplikace ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 20;   /* nad obsahem, ať nabídka uživatele a její pozadí překryjí stránku */
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-5) var(--s-4);
  background: var(--c-sidebar);
  border-right: 1px solid var(--c-border);
}
.brand { flex-shrink: 0; } 
.brand { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-1) var(--s-2) var(--s-5); color: var(--c-text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--c-primary) 0%, #3f7df0 100%); color: #fff;
  box-shadow: 0 4px 10px -4px rgba(31, 91, 216, .55);
}
/* Logo obce místo ikony Spisovky: znaky obcí počítají se světlým podkladem, proto bílá i v tmavém režimu. */
.brand-mark.has-logo { background: #fff; box-shadow: none; border: 1px solid var(--c-border); padding: 2px; overflow: hidden; }
.brand-mark.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-name { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: var(--fw-bold); letter-spacing: -0.02em; line-height: 1.1; }
.brand-org { font-size: var(--fs-xs); color: var(--c-text-3); line-height: 1.3; }
/* Položky menu se rolují samostatně – značka nahoře a uživatel dole zůstávají vidět (dlouhé menu správce). */
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 calc(-1 * var(--s-2)); padding: 0 var(--s-2); }
.nav-label { padding: var(--s-4) var(--s-3) var(--s-2); }
.nav-item {
  display: flex; align-items: center; gap: var(--s-3);
  height: 42px; padding: 0 var(--s-3); border-radius: var(--r-md);
  color: var(--c-text-2); font-weight: var(--fw-medium);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-item:hover { background: var(--c-surface-3); color: var(--c-text); text-decoration: none; }
.nav-item.is-active { background: var(--c-sidebar-active); color: var(--c-primary); }
.nav-item .count { margin-left: auto; }
.sidebar-footer { flex-shrink: 0; margin-top: auto; border-top: 1px solid var(--c-border); padding-top: var(--s-4); position: relative; }
.user-chip { display: flex; align-items: center; gap: var(--s-1); }
/* Jméno je tlačítko – otevře nabídku uživatele (vzhled, Moje nastavení); odhlášení zůstává vedle. */
.user-chip-main { display: flex; align-items: center; gap: var(--s-3); flex: 1; min-width: 0; padding: var(--s-2); border: 0; border-radius: var(--r-md); background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.user-chip-main:hover, .user-chip-main[aria-expanded="true"] { background: var(--c-surface-3); }
.user-chip-main:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.user-chip .who { min-width: 0; flex: 1; }
.menu-backdrop { position: fixed; inset: 0; z-index: 55; }
.user-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + var(--s-2)); z-index: 60; padding: var(--s-2); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.user-menu-section { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-1) 0 var(--s-2); border-bottom: 1px solid var(--c-border); margin-bottom: var(--s-1); }
.user-menu-section > .eyebrow { padding: var(--s-1) var(--s-3) 0; }
.user-menu-item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--r-md); color: var(--c-text); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.user-menu-item:hover { background: var(--c-surface-3); text-decoration: none; }
.user-menu-item .icon { width: 18px; height: 18px; color: var(--c-text-3); }
/* Volba vzhledu (nabídka uživatele, Moje nastavení) */
.theme-picker button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.theme-picker button.is-active { background: var(--c-primary-soft); color: var(--c-primary); }
.theme-list { display: flex; flex-direction: column; }
.theme-list .user-menu-item { width: 100%; border: 0; background: transparent; font: inherit; font-size: var(--fs-sm); cursor: pointer; text-align: left; }
.theme-list .user-menu-item:hover { background: var(--c-surface-3); }
.theme-list .user-menu-item.is-active { color: var(--c-primary); font-weight: var(--fw-semibold); }
.theme-list .user-menu-item.is-active .icon { color: var(--c-primary); }
.user-chip .name { font-weight: var(--fw-semibold); font-size: var(--fs-sm); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar-mobile { display: none; }
.page { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--s-8) var(--s-7) var(--s-9); }
.page-header { display: flex; align-items: flex-end; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-6); }
.page-header .titles { flex: 1; min-width: 240px; }
.page-header .subtitle { color: var(--c-text-3); margin-top: var(--s-1); }
/* Hlavička, která při posouvání zůstává nahoře (např. probíhající zasedání). Pozadí stránky, aby obsah pod ní nebyl vidět. */
.page-header.is-sticky { position: sticky; top: 0; z-index: 15; background: var(--c-bg); padding: var(--s-3) 0; border-bottom: 1px solid var(--c-border); align-items: center; }
.page-header.is-sticky h1 { font-size: var(--fs-xl); }
.back-link { display: inline-flex; align-items: center; gap: var(--s-1); color: var(--c-text-3); font-size: var(--fs-sm); font-weight: var(--fw-medium); margin-bottom: var(--s-3); }
.back-link:hover { color: var(--c-text); text-decoration: none; }

.grid { display: grid; gap: var(--s-5); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.layout-detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-5); align-items: start; }

/* ---------- 4. Karty ---------- */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.card-body { padding: var(--s-6); }
.card-header { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-5) var(--s-6) 0; }
.card-header h2, .card-header h3 { font-size: var(--fs-lg); }
.card-header + .card-body { padding-top: var(--s-4); }
.card-flush { overflow: hidden; }
.card-link { transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); color: inherit; }
.card-link:hover { border-color: var(--c-border-strong); box-shadow: var(--shadow-md); text-decoration: none; transform: translateY(-1px); }

/* Statistická dlaždice */
.stat { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-5) var(--s-6); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon { width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--c-primary-soft); color: var(--c-primary); }
.stat-icon.warning { background: var(--c-warning-soft); color: var(--c-warning); }
.stat-icon.success { background: var(--c-success-soft); color: var(--c-success); }
.stat-value { font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: var(--fw-semibold); line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--c-text-2); font-weight: var(--fw-medium); }

/* ---------- 5. Tlačítka ---------- */
.btn {
  --btn-bg: var(--c-surface); --btn-fg: var(--c-text); --btn-border: var(--c-border-strong); --btn-hover: var(--c-surface-3);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--control-h); padding: 0 var(--s-4);
  font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semibold); line-height: 1; white-space: nowrap;
  color: var(--btn-fg); background: var(--btn-bg); border: 1px solid var(--btn-border); border-radius: var(--r-md);
  cursor: pointer; user-select: none; text-decoration: none;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--r-md); }
.btn[disabled], .btn.is-loading { opacity: .55; cursor: not-allowed; transform: none; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { --btn-bg: var(--c-primary); --btn-fg: var(--c-on-primary); --btn-border: var(--c-primary); --btn-hover: var(--c-primary-hover); box-shadow: 0 1px 2px rgba(31, 91, 216, .25); }
.btn-soft { --btn-bg: var(--c-primary-soft); --btn-fg: var(--c-primary); --btn-border: transparent; --btn-hover: var(--c-primary-soft-2); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-fg: var(--c-text-2); --btn-hover: var(--c-surface-3); }
.btn-danger { --btn-bg: var(--c-danger); --btn-fg: #fff; --btn-border: var(--c-danger); --btn-hover: #a92424; }
.btn-success { --btn-bg: var(--c-success); --btn-fg: #fff; --btn-border: var(--c-success); --btn-hover: #116a41; }
.btn-warning { --btn-bg: var(--c-warning-soft); --btn-fg: var(--c-warning); --btn-border: var(--c-warning); --btn-hover: var(--c-warning-soft); }
.btn-warning:hover { box-shadow: inset 0 0 0 1px var(--c-warning); }
.btn-sm { height: var(--control-h-sm); padding: 0 var(--s-3); border-radius: var(--r-sm); }
.btn-lg { height: var(--control-h-lg); padding: 0 var(--s-5); font-size: var(--fs-md); border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn-icon { width: var(--control-h); padding: 0; }
.btn-icon.btn-sm { width: var(--control-h-sm); }
.is-loading::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }

/* Velká akční dlaždice (rychlé akce na přehledu) */
.action-tile {
  display: flex; align-items: center; gap: var(--s-4); padding: var(--s-5);
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg);
  color: var(--c-text); font: inherit; text-align: left; cursor: pointer; width: 100%;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.action-tile:hover { border-color: var(--c-primary-soft-2); box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
.action-tile .tile-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--c-primary-soft); color: var(--c-primary); flex: none; }
.action-tile .tile-title { font-weight: var(--fw-semibold); }
.action-tile .tile-desc { font-size: var(--fs-sm); color: var(--c-text-3); }

/* ---------- 6. Formuláře ---------- */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-text); }
.label .req { color: var(--c-danger); margin-left: 2px; }
.hint { font-size: var(--fs-xs); color: var(--c-text-3); }
.input, .select, .textarea {
  width: 100%; height: var(--control-h); padding: 0 var(--s-3);
  font: inherit; font-size: var(--fs-md); color: var(--c-text);
  background: var(--c-surface); border: 1px solid var(--c-border-strong); border-radius: var(--r-md);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.textarea { height: auto; min-height: 96px; padding: var(--s-3); resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--c-text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--c-text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: var(--focus-ring); }
.input.is-invalid { border-color: var(--c-danger); }
.select {
  appearance: none; padding-right: var(--s-8); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7587' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-group { position: relative; }
.input-group .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--c-text-3); pointer-events: none; }
.input-group .input { padding-left: 40px; }
.form-grid { display: grid; gap: var(--s-5); }
.form-actions { display: flex; gap: var(--s-3); justify-content: flex-end; padding-top: var(--s-2); }

.check { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r-md); cursor: pointer; }
.check:hover { border-color: var(--c-border-strong); background: var(--c-surface-2); }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--c-primary); flex: none; }
.check:has(input:checked) { border-color: var(--c-primary); background: var(--c-primary-soft); }
.withdrawn { opacity: .6; }
.withdrawn .agenda-title { text-decoration: line-through; }
.toggle { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--c-text-2); user-select: none; }
.toggle input { appearance: none; width: 36px; height: 20px; border-radius: var(--r-pill); background: var(--c-border-strong); position: relative; cursor: pointer; transition: background var(--t-fast) var(--ease); margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--t-med) var(--ease); }
.toggle input:checked { background: var(--c-primary); }
.toggle input:checked::after { transform: translateX(16px); }

/* Nahrávání souboru */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2);
  padding: var(--s-7) var(--s-5); text-align: center; cursor: pointer;
  border: 2px dashed var(--c-border-strong); border-radius: var(--r-lg); background: var(--c-surface-2);
  color: var(--c-text-2); transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--c-primary); background: var(--c-primary-soft); }
.dropzone .dz-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--c-surface); color: var(--c-primary); box-shadow: var(--shadow-sm); margin-bottom: var(--s-2); }
.dropzone strong { color: var(--c-text); }
.dropzone.has-file { border-style: solid; border-color: var(--c-primary-soft-2); background: var(--c-surface); }
.dropzone { position: relative; }
/* Skutečný <input type=file> přes celou plochu – klik i přetažení souboru jdou přímo do něj. */
.dropzone-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone:focus-within { box-shadow: var(--focus-ring); }

/* ---------- 7. Odznaky a stavy ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: 1; white-space: nowrap;
  border-radius: var(--r-pill); background: var(--c-neutral-soft); color: var(--c-neutral);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge-info { background: var(--c-info-soft); color: var(--c-info); }
.badge-success { background: var(--c-success-soft); color: var(--c-success); }
.badge-warning { background: var(--c-warning-soft); color: var(--c-warning); }
.badge-danger { background: var(--c-danger-soft); color: var(--c-danger); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: var(--fw-bold); background: var(--c-primary); color: var(--c-on-primary); font-variant-numeric: tabular-nums; }
.count.subtle { background: var(--c-surface-3); color: var(--c-text-2); }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--r-sm); background: var(--c-surface-3); color: var(--c-text-2); font-size: var(--fs-xs); font-weight: var(--fw-semibold); }
.retention { display: inline-flex; align-items: center; height: 24px; border-radius: var(--r-sm); overflow: hidden; font-size: var(--fs-xs); font-weight: var(--fw-bold); border: 1px solid var(--c-border); }
.retention span { padding: 0 8px; line-height: 22px; }
.retention .mark { background: var(--c-surface-3); color: var(--c-text); }
.retention.A .mark { background: var(--c-primary-soft); color: var(--c-primary); }
.retention.V .mark { background: var(--c-warning-soft); color: var(--c-warning); }

/* Avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-primary); background: var(--c-primary-soft); }
.avatar-sm { width: 28px; height: 28px; font-size: var(--fs-xs); }
.avatar-lg { width: 44px; height: 44px; font-size: var(--fs-md); }

/* ---------- 8. Tabulky ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th {
  text-align: left; font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: .04em; text-transform: uppercase;
  color: var(--c-text-3); padding: var(--s-3) var(--s-4); background: var(--c-surface-2); border-bottom: 1px solid var(--c-border); white-space: nowrap;
}
.table td { padding: var(--s-4); border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-clickable { cursor: pointer; transition: background var(--t-fast) var(--ease); }
.table tr.is-clickable:hover td { background: var(--c-surface-2); }
.table .cell-title { font-weight: var(--fw-semibold); color: var(--c-text); font-size: var(--fs-md); }
.table .cell-sub { color: var(--c-text-3); font-size: var(--fs-sm); margin-top: 2px; }
.table .col-shrink { width: 1%; white-space: nowrap; }

/* ---------- 9. Záložky / filtry ---------- */
.tabs { display: inline-flex; gap: 2px; padding: 4px; background: var(--c-surface-3); border-radius: var(--r-md); flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: var(--s-2); height: 34px; padding: 0 var(--s-3);
  border: 0; border-radius: 8px; background: transparent; color: var(--c-text-2);
  font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semibold); cursor: pointer;
}
.tab:hover { color: var(--c-text); }
.tab.is-active { background: var(--c-surface); color: var(--c-text); box-shadow: var(--shadow-sm); }
.tab .count { background: var(--c-surface-3); color: var(--c-text-2); height: 20px; min-width: 20px; }
.tab.is-active .count { background: var(--c-primary-soft); color: var(--c-primary); }
.toolbar { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-4); }

/* ---------- 10. Průběh stavu (stepper) ---------- */
.stepper { display: flex; align-items: flex-start; gap: 0; list-style: none; margin: 0; padding: 0; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--s-2); position: relative; text-align: center; font-size: var(--fs-sm); color: var(--c-text-3); font-weight: var(--fw-medium); }
.step::before { content: ""; position: absolute; top: 13px; left: calc(-50% + 18px); right: calc(50% + 18px); height: 2px; background: var(--c-border); border-radius: 2px; }
.step:first-child::before { display: none; }
.step .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--c-surface); border: 2px solid var(--c-border-strong); color: var(--c-text-3); position: relative; z-index: 1; font-size: var(--fs-xs); font-weight: var(--fw-bold); }
.step.is-done { color: var(--c-text-2); }
.step.is-done::before, .step.is-current::before { background: var(--c-primary); }
.step.is-done .dot { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.step.is-current { color: var(--c-text); font-weight: var(--fw-semibold); }
.step.is-current .dot { border-color: var(--c-primary); color: var(--c-primary); box-shadow: 0 0 0 4px var(--c-primary-soft); }

/* ---------- 11. Seznamy, soubory, časová osa ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--c-border); }
.list-item.list-link { padding: var(--s-3) var(--s-6); color: inherit; text-decoration: none; }
.list-item.list-link:hover { background: var(--c-surface-2); }
li:last-child > .list-item.list-link { border-bottom: 0; }
.comment.is-new { background: var(--c-primary-soft); border-radius: var(--r-md); padding: var(--s-2); margin: 0 calc(-1 * var(--s-2)); }
.list-item:last-child { border-bottom: 0; }
.file { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4); border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface-2); }
.file + .file { margin-top: var(--s-3); }
.file-link { display: flex; align-items: center; gap: var(--s-4); flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.file-link:hover { text-decoration: none; }
.file-link:hover .file-name { color: var(--c-primary); }
.file-icon { width: 40px; height: 48px; border-radius: 6px; display: grid; place-items: center; background: var(--c-surface); border: 1px solid var(--c-border); color: var(--c-primary); font-size: 10px; font-weight: var(--fw-bold); flex: none; position: relative; }
.file-icon > .icon { width: 18px; height: 18px; margin-top: -12px; }
.file-icon span { position: absolute; bottom: 5px; left: 0; right: 0; text-align: center; letter-spacing: .03em; }
.file-meta { min-width: 0; flex: 1; }
.file-name { font-weight: var(--fw-semibold); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: var(--s-3) var(--s-4); margin: 0; font-size: var(--fs-sm); }
.dl dt { color: var(--c-text-3); }
.dl dd { margin: 0; color: var(--c-text); font-weight: var(--fw-medium); min-width: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 2px; background: var(--c-border); }
.tl-item { position: relative; display: flex; gap: var(--s-4); padding: 0 0 var(--s-5); }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--c-surface); border: 2px solid var(--c-border); color: var(--c-text-3); position: relative; z-index: 1; flex: none; }
.tl-dot .icon { width: 14px; height: 14px; }
.tl-item.is-primary .tl-dot { border-color: var(--c-primary-soft-2); background: var(--c-primary-soft); color: var(--c-primary); }
.tl-item.is-success .tl-dot { border-color: var(--c-success-soft); background: var(--c-success-soft); color: var(--c-success); }
.tl-body { padding-top: 3px; min-width: 0; }
.tl-title { font-weight: var(--fw-semibold); font-size: var(--fs-sm); }
.tl-meta { font-size: var(--fs-xs); color: var(--c-text-3); margin-top: 2px; }

/* Zastupitelstvo – program, návrh usnesení, hlasování, diskuse */
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.agenda { padding: 0 var(--s-6) var(--s-2); }
.agenda-item { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) 0; border-bottom: 1px solid var(--c-border); }
.agenda-item:last-child { border-bottom: 0; }
/* Přetahování za číslo bodu: číslo je úchyt, čára ukazuje, kam bod dopadne. */
.agenda-no.is-draggable { cursor: grab; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.agenda-no.is-draggable:hover { background: var(--c-primary); color: var(--c-on-primary); }
.agenda-no.is-draggable:active { cursor: grabbing; }
.agenda-item.is-dragging { opacity: .45; }
.agenda-item.drop-before { box-shadow: inset 0 3px 0 var(--c-primary); }
.agenda-item.drop-after { box-shadow: inset 0 -3px 0 var(--c-primary); }
.agenda-no { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--c-primary-soft); color: var(--c-primary); font-weight: var(--fw-bold); font-size: var(--fs-sm); }
.agenda-body { flex: 1; min-width: 0; }
.agenda-title { font-weight: var(--fw-semibold); color: var(--c-text); }
/* Sekce programu (nadřazený bod bez hlasování) a body v ní – odsazené pod sekcí. */
.agenda-item.is-section .agenda-no { border-radius: var(--r-md); background: var(--c-primary); color: var(--c-on-primary); }
.agenda-item.is-section .agenda-title { font-weight: var(--fw-bold); font-size: var(--fs-md); }
.agenda-item.is-sub { padding-left: var(--s-7); border-left: 2px solid var(--c-primary-soft); }
.agenda-item.is-sub .agenda-no { width: auto; min-width: 32px; padding: 0 6px; border-radius: 16px; }
.agenda-add:last-child { border-bottom: 0; }
/* Sbalení sekce: šipka v levém okraji seznamu (čísla bodů zůstávají zarovnaná); otočená dolů = rozbaleno. */
.agenda-item { position: relative; }
.agenda-toggle { position: absolute; left: calc(-1 * var(--s-6)); top: 50%; transform: translateY(-50%); width: var(--s-6); height: 32px;
    display: grid; place-items: center; border: 0; background: transparent; color: var(--c-text-3); cursor: pointer; border-radius: var(--r-md); padding: 0; }
.agenda-toggle:hover { color: var(--c-primary); }
.agenda-toggle svg { transform: rotate(90deg); transition: transform var(--t-fast) var(--ease); }
.agenda-item.is-collapsed .agenda-toggle svg { transform: none; }
/* Zásobník připravovaných bodů: šipka rozbalení podrobností přímo v řádku, název bodu jako tlačítko. */
.agenda-toggle.is-inline { position: static; transform: none; flex: none; width: 32px; }
.agenda-toggle.is-inline[aria-expanded="false"] svg { transform: none; }
.agenda-title.is-button { background: none; border: 0; padding: 0; font-family: inherit; font-size: inherit; text-align: left; cursor: pointer; }
.agenda-title.is-button:hover { color: var(--c-primary); }
/* Přílohy k příspěvkům v diskusi */
.comment-files { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.comment-file { display: inline-flex; align-items: center; gap: var(--s-1); max-width: 100%; padding: 2px var(--s-2); border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface-2); font-size: var(--fs-sm); color: var(--c-text); }
a.comment-file:hover { border-color: var(--c-primary); color: var(--c-primary); }
/* Našeptávač návrhu usnesení – doplnění podle dřívějších usnesení. */
.phrase-chips { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-top: var(--s-2); }
.phrase-chip { border: 1px dashed var(--c-border-strong); background: var(--c-surface-2); color: var(--c-text-2); border-radius: 999px; padding: 2px var(--s-3); font: inherit; font-size: var(--fs-xs); cursor: pointer; }
.phrase-chip:hover { border-style: solid; border-color: var(--c-primary); color: var(--c-primary); background: var(--c-primary-soft); }
.agenda-add {padding: var(--s-1) 0 var(--s-2) var(--s-7); border-left: 2px solid var(--c-primary-soft); border-bottom: 1px solid var(--c-border); }
.agenda-add .btn { color: var(--c-text-3); }
.agenda-add .btn:hover { color: var(--c-primary); }
/* Akce zobrazená až při najetí na řádek (na dotykových displejích je vždy vidět). */
@media (hover: hover) {
    .agenda-item .on-hover { visibility: hidden; }
    .agenda-item:hover .on-hover, .agenda-item:focus-within .on-hover { visibility: visible; }
}
.agenda-item.drop-into { box-shadow: inset 0 0 0 2px var(--c-primary); border-radius: var(--r-md); }
.projection-program li.is-sub { margin-left: 2em; }
.projection-program li.is-section { font-weight: var(--fw-bold); }
.proposal { padding: var(--s-4); border-left: 3px solid var(--c-primary); background: var(--c-primary-soft); border-radius: 0 var(--r-md) var(--r-md) 0; }
.vote-panel { padding: var(--s-5); border: 2px solid var(--c-warning); border-radius: var(--r-lg); background: var(--c-warning-soft); }
.vote-panel .list-item { border-color: color-mix(in srgb, var(--c-warning) 25%, transparent); }
.vote-counts { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-3); }
.vote-result { padding: var(--s-4); border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface-2); }
.segmented { display: inline-flex; border: 1px solid var(--c-border-strong); border-radius: var(--r-md); overflow: hidden; background: var(--c-surface); }
.segmented button { border: 0; background: transparent; padding: 0 var(--s-3); height: 34px; font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-text-2); cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--c-border); }
.segmented button:hover { background: var(--c-surface-3); }
.segmented button.is-active { border-radius: 0; height: 34px; }
.segmented button.is-active::before { display: none; }
/* Zvolená volba při hlasování – plná barva, aby byla vidět na první pohled (i ve tmavém režimu). */
.segmented button.choice-For.is-active { background: var(--c-success); color: var(--c-surface); }
.segmented button.choice-Against.is-active { background: var(--c-danger); color: var(--c-surface); }
.segmented button.choice-Abstain.is-active { background: var(--c-warning); color: var(--c-surface); }
.segmented button.choice-kind.is-active { background: var(--c-primary); color: var(--c-on-primary); }
/* Předchozí / další bod programu */
.item-nav { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-3); }
.item-nav .back-link { margin-bottom: 0; }
.item-pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); margin-top: var(--s-6); }
.item-pager a { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4); border: 1px solid var(--c-border); border-radius: var(--r-lg); background: var(--c-surface); color: var(--c-text); min-width: 0; }
.item-pager a:hover { border-color: var(--c-primary); text-decoration: none; }
.item-pager a.next { grid-column: 2; justify-content: flex-end; text-align: right; }
.item-pager .pager-text { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 640px) { .item-pager { grid-template-columns: 1fr; } .item-pager a.next { grid-column: 1; } }
/* Našeptávač (dřívější body programu) */
.suggest { margin-top: var(--s-1); border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); box-shadow: var(--shadow-sm, none); overflow: hidden; }
.suggest-head { padding: var(--s-2) var(--s-3); background: var(--c-surface-2); border-bottom: 1px solid var(--c-border); }
.suggest-list { max-height: 232px; overflow-y: auto; overscroll-behavior: contain; }   /* ~6 řádků, dál se roluje */
.suggest-item { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); width: 100%; min-width: 0; padding: var(--s-2) var(--s-3); border: 0; background: transparent; font: inherit; font-size: var(--fs-sm); color: var(--c-text); text-align: left; cursor: pointer; }
.suggest-item + .suggest-item { border-top: 1px solid var(--c-border); }
.suggest-item:hover, .suggest-item:focus-visible { background: var(--c-primary-soft); outline: none; }
/* Nastavení */
.settings { max-width: 760px; }
.input.is-readonly { display: flex; align-items: center; background: var(--c-surface-2); color: var(--c-text-2); cursor: default; }
.input.is-readonly:hover { border-color: var(--c-border-strong); }
.logo-preview { display: grid; place-items: center; padding: var(--s-4); border: 1px solid var(--c-border); border-radius: var(--r-md); background: #fff; }
.logo-preview img { max-height: 96px; max-width: 100%; }
/* Náhled záhlaví dokumentu – napodobuje Word výstup (vždy na bílém papíře). */
.letterhead-preview { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4); background: #fff; color: #1b2230; border: 1px solid var(--c-border); border-radius: var(--r-md); border-bottom: 2px solid #cfd4dc; }
.letterhead-preview img { height: 48px; width: auto; max-width: 120px; flex: none; }
.letterhead-preview .lh-name { color: #1f5bd8; font-weight: 700; font-size: 15px; }
.letterhead-preview .lh-line { color: #6b7587; font-size: 12px; overflow-wrap: anywhere; }
.comment { display: flex; gap: var(--s-3); align-items: flex-start; }
.comment-body { flex: 1; min-width: 0; padding: var(--s-3) var(--s-4); background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: 0 var(--r-lg) var(--r-lg) var(--r-lg); }
/* Zápis ze zasedání */
.minutes-editor { min-height: 60vh; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.6; }
.minutes-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.6; }

/* Projekce zasedání na plátno – velké písmo, vysoký kontrast */
.projection { min-height: 100vh; padding: 3vw 4vw; background: var(--c-bg); display: flex; flex-direction: column; gap: 3vw; font-size: clamp(18px, 1.6vw, 28px); }
.projection h1 { font-size: 2.2em; margin-top: .2em; }
.projection h2 { font-size: 2em; }
.projection-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 2vw; flex-wrap: wrap; }
.projection-quorum { padding: .6em 1em; border-radius: var(--r-lg); background: var(--c-surface); border: 2px solid var(--c-border); text-align: right; }
.projection-quorum span { display: block; font-size: .7em; font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: .05em; }
.projection-quorum.ok span { color: var(--c-success); }
.projection-quorum.no span { color: var(--c-danger); }
.projection-vote { padding: 2vw; background: var(--c-surface); border-radius: var(--r-xl); box-shadow: var(--shadow-md); display: flex; flex-direction: column; gap: 1vw; }
.projection-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5vw; }
.projection-counts div { padding: 1vw; border-radius: var(--r-lg); text-align: center; font-weight: var(--fw-semibold); }
.projection-counts strong { display: block; font-size: 3.5em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.projection-counts .for { background: var(--c-success-soft); color: var(--c-success); }
.projection-counts .against { background: var(--c-danger-soft); color: var(--c-danger); }
.projection-counts .abstain { background: var(--c-warning-soft); color: var(--c-warning); }
.projection-result { font-size: 1.6em; font-weight: var(--fw-bold); }
.projection-result.ok { color: var(--c-success); }
.projection-result.no { color: var(--c-danger); }
.projection-program ol { list-style: none; margin: .5em 0 0; padding: 0; display: grid; gap: .4em; }
.projection-program li { padding: .4em .8em; border-radius: var(--r-md); }
.projection-program li span { font-weight: var(--fw-bold); color: var(--c-primary); margin-right: .3em; }
.projection-program li em { font-style: normal; font-size: .75em; color: var(--c-text-3); margin-left: .5em; }
.projection-program li.current { background: var(--c-primary-soft); font-weight: var(--fw-semibold); }

details summary { cursor: pointer; color: var(--c-primary); font-weight: var(--fw-medium); }

/* ---------- 12. Upozornění, prázdné stavy, načítání ---------- */
.alert { display: flex; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-md); background: var(--c-info-soft); color: var(--c-text); font-size: var(--fs-sm); border: 1px solid transparent; }
.alert .icon { color: var(--c-info); margin-top: 1px; }
.alert-warning { background: var(--c-warning-soft); } .alert-warning .icon { color: var(--c-warning); }
.alert-danger { background: var(--c-danger-soft); } .alert-danger .icon { color: var(--c-danger); }
.alert-success { background: var(--c-success-soft); } .alert-success .icon { color: var(--c-success); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-2); padding: var(--s-9) var(--s-5); color: var(--c-text-3); }
.empty .empty-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--c-surface-3); color: var(--c-text-3); margin-bottom: var(--s-2); }
.empty h3 { color: var(--c-text); }
.skeleton { background: linear-gradient(90deg, var(--c-surface-3) 0%, var(--c-surface-2) 50%, var(--c-surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: var(--r-sm); height: 14px; }
.loader { display: grid; place-items: center; padding: var(--s-9); color: var(--c-text-3); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--c-border); border-top-color: var(--c-primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- 13. Dialog a oznámení ---------- */
.dialog { border: 0; padding: 0; border-radius: var(--r-xl); background: var(--c-surface); color: var(--c-text); box-shadow: var(--shadow-lg); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.dialog.dialog-wide { width: min(920px, calc(100vw - 32px)); display: flex; flex-direction: column; }
.dialog.dialog-wide .dialog-body { overflow-y: auto; }
.doc-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) 0; }
.doc-row + .doc-row { border-top: 1px solid var(--c-border); }
.doc-row .doc-meta { flex: 1; min-width: 0; }
.dialog::backdrop { background: rgba(14, 19, 27, .45); backdrop-filter: blur(2px); }
.dialog[open] { animation: pop var(--t-med) var(--ease); }
.dialog-header { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-6) var(--s-6) 0; }
.dialog-header h2 { font-size: var(--fs-xl); flex: 1; }
.dialog-body { padding: var(--s-5) var(--s-6); }
.dialog-footer { display: flex; justify-content: flex-end; gap: var(--s-3); padding: 0 var(--s-6) var(--s-6); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Modální okno vykreslené komponentou (Blazor Modal) */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: var(--s-4);
  background: rgba(14, 19, 27, .45); backdrop-filter: blur(2px); animation: fade var(--t-med) var(--ease);
}
.modal-backdrop .dialog { display: block; overflow: auto; animation: pop var(--t-med) var(--ease); }

/* Výpadek spojení se serverem (Blazor přidává třídy components-reconnect-*) */
.reconnect { display: none; position: fixed; inset: 0; z-index: 200; place-items: center; padding: var(--s-4); background: rgba(14, 19, 27, .35); }
.reconnect.components-reconnect-show, .reconnect.components-reconnect-failed, .reconnect.components-reconnect-rejected { display: grid; }
.reconnect-card { display: flex; align-items: flex-start; gap: var(--s-4); max-width: 420px; padding: var(--s-5); background: var(--c-surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.reconnect-card [class^="reconnect-text-"] { display: none; }
.reconnect.components-reconnect-show .reconnect-text-show,
.reconnect.components-reconnect-failed .reconnect-text-failed,
.reconnect.components-reconnect-rejected .reconnect-text-rejected { display: block; }
.reconnect.components-reconnect-failed .reconnect-spinner, .reconnect.components-reconnect-rejected .reconnect-spinner { display: none; }
.reconnect-spinner { flex: none; }

.toasts { position: fixed; right: var(--s-6); bottom: var(--s-6); display: flex; flex-direction: column; gap: var(--s-3); z-index: 100; pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: var(--s-3); min-width: 280px; max-width: 420px; padding: var(--s-4);
  background: var(--c-text); color: var(--c-text-inverse); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); pointer-events: auto; animation: pop var(--t-med) var(--ease);
}
.toast .icon { color: #7ee2ae; }
.toast.is-error .icon { color: #ff9b9b; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: all var(--t-med) var(--ease); }

/* ---------- 14. Přihlášení ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s-6) var(--s-4);
  background: radial-gradient(1200px 600px at 10% -10%, var(--c-primary-soft) 0%, transparent 60%), var(--c-bg); }
.auth-card { width: min(460px, 100%); }
.user-option {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; padding: var(--s-3) var(--s-4);
  border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); color: var(--c-text);
  font: inherit; text-align: left; cursor: pointer; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.user-option:hover { border-color: var(--c-primary); background: var(--c-primary-soft); }
.user-option .chev { margin-left: auto; color: var(--c-text-3); }

/* ---------- 15. Responzivita ---------- */
@media (max-width: 1080px) {
  .layout-detail { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 50; transform: translateX(-100%); transition: transform var(--t-med) var(--ease); box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(14, 19, 27, .4); z-index: 40; }
  .topbar-mobile { display: flex; align-items: center; gap: var(--s-3); position: sticky; top: 0; z-index: 30; padding: var(--s-3) var(--s-4); background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
  .page { padding: var(--s-6) var(--s-4) var(--s-8); }
  .page-header.is-sticky { top: 57px; }   /* pod mobilní horní lištou */
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  h1 { font-size: var(--fs-xl); }
}
@media (max-width: 640px) {
  /* Tabulky se mění na karty */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: var(--s-4); border-bottom: 1px solid var(--c-border); }
  .table.responsive td { border: 0; padding: 2px 0; }
  .table.responsive td[data-label]::before { content: attr(data-label) ": "; color: var(--c-text-3); font-size: var(--fs-xs); }
  .table.responsive td .row-sm, .table.responsive td .row { display: inline-flex; vertical-align: middle; }
  .card-body { padding: var(--s-5); }
  .card-header { padding: var(--s-5) var(--s-5) 0; }
  .stepper .step { font-size: var(--fs-xs); }
  .toasts { left: var(--s-4); right: var(--s-4); bottom: var(--s-4); }
  .toast { min-width: 0; max-width: none; }
  .page-header .btn, .page-header form, .page-header .row-sm { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Hledání v obsahu příloh – úryvek se zvýrazněnou shodou */
.search-hit { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4); border-bottom: 1px solid var(--c-border); }
.search-hit:last-child { border-bottom: 0; }
.search-hit .snippet { font-size: var(--fs-sm); color: var(--c-text-2, var(--c-text)); line-height: 1.5; overflow-wrap: anywhere; }
.search-hit mark { background: var(--c-warning-soft); color: inherit; padding: 0 2px; border-radius: 3px; font-weight: 600; }

/* Řazení výsledku vyhledávání kliknutím na hlavičku (NSESSS 5.1.8). */
.th-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.th-sort:hover { color: var(--c-primary); }
/* Cesta zařazení entity (NSESSS 5.2.1 a). */
.placement-path { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-1); }
.placement-path li { display: flex; gap: var(--s-2); align-items: baseline; font-size: var(--fs-sm); }
.placement-path .kind { min-width: 7.5em; color: var(--c-text-2, var(--c-text)); font-size: var(--fs-xs, 12px); }

/* ------------------------------------------------ SPIOS CMS: rozcestník modulů */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s-5); }
.module-tile h2 { font-size: var(--fs-lg); }
.module-tile.is-planned { opacity: .65; }
.module-tile .stat-icon { flex: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

/* ------------------------------------------------------------------ Barvy modulů (ModuleAccents)
   Jen pro orientaci, kde uživatel je: okraj postranního panelu, nadpis a aktivní položka menu, vodoznak, dlaždice modulů.
   Tlačítka, chyby, úspěch a varování zůstávají v systémových barvách. Dvojice odstínů: barva a jemný podklad. */
.accent-blue     { --c-module: #1f5bd8; --c-module-soft: #e8effc; }
.accent-bordeaux { --c-module: #9b2335; --c-module-soft: #f8e9ec; }
.accent-ochre    { --c-module: #8a5a10; --c-module-soft: #f6eedf; }
.accent-coral    { --c-module: #b8461f; --c-module-soft: #fbece6; }
.accent-teal     { --c-module: #0f6e64; --c-module-soft: #e1f3f0; }
.accent-green    { --c-module: #3b6d11; --c-module-soft: #eaf3de; }
.accent-violet   { --c-module: #534ab7; --c-module-soft: #eeedfe; }
.accent-graphite { --c-module: #4a5260; --c-module-soft: #eef0f3; }
.accent-magenta  { --c-module: #a3346e; --c-module-soft: #f9e8f1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .accent-blue     { --c-module: #7aa3f4; --c-module-soft: #1a2640; }
  :root:not([data-theme="light"]) .accent-bordeaux { --c-module: #f08a9a; --c-module-soft: #36191f; }
  :root:not([data-theme="light"]) .accent-ochre    { --c-module: #e2b25e; --c-module-soft: #2e2413; }
  :root:not([data-theme="light"]) .accent-coral    { --c-module: #f2967a; --c-module-soft: #36201a; }
  :root:not([data-theme="light"]) .accent-teal     { --c-module: #5fcfbf; --c-module-soft: #102b28; }
  :root:not([data-theme="light"]) .accent-green    { --c-module: #97c459; --c-module-soft: #1c2a10; }
  :root:not([data-theme="light"]) .accent-violet   { --c-module: #aea8ec; --c-module-soft: #23214a; }
  :root:not([data-theme="light"]) .accent-graphite { --c-module: #b0b8c6; --c-module-soft: #212a37; }
  :root:not([data-theme="light"]) .accent-magenta  { --c-module: #ee93c2; --c-module-soft: #351a29; }
}
:root[data-theme="dark"] .accent-blue     { --c-module: #7aa3f4; --c-module-soft: #1a2640; }
:root[data-theme="dark"] .accent-bordeaux { --c-module: #f08a9a; --c-module-soft: #36191f; }
:root[data-theme="dark"] .accent-ochre    { --c-module: #e2b25e; --c-module-soft: #2e2413; }
:root[data-theme="dark"] .accent-coral    { --c-module: #f2967a; --c-module-soft: #36201a; }
:root[data-theme="dark"] .accent-teal     { --c-module: #5fcfbf; --c-module-soft: #102b28; }
:root[data-theme="dark"] .accent-green    { --c-module: #97c459; --c-module-soft: #1c2a10; }
:root[data-theme="dark"] .accent-violet   { --c-module: #aea8ec; --c-module-soft: #23214a; }
:root[data-theme="dark"] .accent-graphite { --c-module: #b0b8c6; --c-module-soft: #212a37; }
:root[data-theme="dark"] .accent-magenta  { --c-module: #ee93c2; --c-module-soft: #351a29; }

/* Pruh je na všech stránkách (mimo modul v barvě panelu), aby se panel ani obsah při přechodu do modulu neposouval. */
.sidebar { border-left: 4px solid var(--c-sidebar); }
.app.has-module .sidebar { border-left-color: var(--c-module); }
.app.has-module .nav-label { color: var(--c-module); display: flex; align-items: center; gap: var(--s-2); }
.app.has-module .nav-label svg { width: 14px; height: 14px; }
.app.has-module .nav-item.is-active { background: var(--c-module-soft); color: var(--c-module); }
.app.has-module .nav { position: relative; z-index: 1; }
/* Vodoznak: velká ikona modulu v prázdném místě panelu (nikdy za obsahem stránky). */
.sidebar-watermark { position: absolute; right: var(--s-3); bottom: 96px; width: 120px; height: 120px; color: var(--c-module); opacity: .07; pointer-events: none; z-index: 0; }
.sidebar-watermark svg { width: 100%; height: 100%; }
.module-tile[class*="accent-"] .stat-icon { background: var(--c-module-soft); color: var(--c-module); }
.module-tile[class*="accent-"]:not(.is-planned):hover { border-color: var(--c-module); }
/* Znak obce v záhlaví úvodní stránky a na přihlášení (znaky počítají se světlým podkladem). */
.org-coat { height: 56px; width: auto; flex: none; background: #fff; border-radius: var(--r-md); padding: 3px; border: 1px solid var(--c-border); }
.auth-org { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); text-align: center; }
.auth-org .org-coat { height: 72px; }
