/* =====================================================================
   Farní knihovna — vzhled „katalogový lístek“
   Teplý papír, inkoust a liturgická červeň. Literata (písmo navržené
   pro čtení knih) + Instrument Sans pro ovládací prvky.
   ===================================================================== */

:root {
  color-scheme: light;

  --font-serif: "Literata", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "DejaVu Sans Mono", Menlo, monospace;

  /* Papír a inkoust */
  --bg-body: #f4eee2;
  --bg-card: #fffcf6;
  --bg-subtle: #efe7d8;
  --text-main: #231d16;
  --text-muted: #6a5d4d;
  --text-light: #978a77;
  --border-color: #e2d7c3;
  --border-strong: #cfc0a6;

  /* Liturgická červeň + zlato */
  --primary: #8c1d2c;
  --primary-hover: #6e1522;
  --primary-light: #f4e4e0;
  --primary-border: #e3bfb9;
  --primary-ink: #fffaf3;
  --gold: #a07a32;

  --badge-green-bg: #e5ebd6;
  --badge-green-text: #3d5520;
  --badge-amber-bg: #f5e4c1;
  --badge-amber-text: #7a4b09;
  --badge-red-bg: #f4dcd7;
  --badge-red-text: #8c1d2c;
  --badge-blue-bg: #e2e5ea;
  --badge-blue-text: #3a4a5e;

  --shadow-sm: 0 1px 0 rgb(60 40 20 / 0.06);
  --shadow-md: 0 1px 0 rgb(60 40 20 / 0.05), 0 6px 18px -8px rgb(60 40 20 / 0.18);
  --shadow-lg: 0 2px 0 rgb(60 40 20 / 0.05), 0 18px 40px -18px rgb(60 40 20 / 0.32);

  --radius-sm: 3px;
  --radius-md: 5px;
  --radius-lg: 8px;
  --radius-full: 9999px;
}

/* Tmavý režim — podle systému (pokud si uživatel nevybral jinak) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-body: #14110d;
    --bg-card: #1d1914;
    --bg-subtle: #25201a;
    --text-main: #eee5d3;
    --text-muted: #b4a68f;
    --text-light: #85796a;
    --border-color: #352d24;
    --border-strong: #4a3f32;
    --primary: #e0828b;
    --primary-hover: #eea2a8;
    --primary-light: #36191c;
    --primary-border: #5a2a2f;
    --primary-ink: #1a0b0d;
    --gold: #d2ac62;
    --badge-green-bg: #26301a;
    --badge-green-text: #b9cf8f;
    --badge-amber-bg: #3a2a10;
    --badge-amber-text: #ecc172;
    --badge-red-bg: #3d1a1e;
    --badge-red-text: #f0a1a8;
    --badge-blue-bg: #232a34;
    --badge-blue-text: #a9b9cf;
    --shadow-sm: 0 1px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 1px 0 rgb(0 0 0 / 0.3), 0 8px 20px -10px rgb(0 0 0 / 0.6);
    --shadow-lg: 0 2px 0 rgb(0 0 0 / 0.3), 0 20px 40px -18px rgb(0 0 0 / 0.75);
  }
}

/* Tmavý režim — ručně zvolený */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-body: #14110d;
  --bg-card: #1d1914;
  --bg-subtle: #25201a;
  --text-main: #eee5d3;
  --text-muted: #b4a68f;
  --text-light: #85796a;
  --border-color: #352d24;
  --border-strong: #4a3f32;
  --primary: #e0828b;
  --primary-hover: #eea2a8;
  --primary-light: #36191c;
  --primary-border: #5a2a2f;
  --primary-ink: #1a0b0d;
  --gold: #d2ac62;
  --badge-green-bg: #26301a;
  --badge-green-text: #b9cf8f;
  --badge-amber-bg: #3a2a10;
  --badge-amber-text: #ecc172;
  --badge-red-bg: #3d1a1e;
  --badge-red-text: #f0a1a8;
  --badge-blue-bg: #232a34;
  --badge-blue-text: #a9b9cf;
  --shadow-sm: 0 1px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 1px 0 rgb(0 0 0 / 0.3), 0 8px 20px -10px rgb(0 0 0 / 0.6);
  --shadow-lg: 0 2px 0 rgb(0 0 0 / 0.3), 0 20px 40px -18px rgb(0 0 0 / 0.75);
}

/* =====================================================================
   Základ
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

::selection { background: var(--primary); color: var(--primary-ink); }

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

/* Nadpisy v obsahu (i v administraci) sázíme patkovým písmem */
.main-content h1, .main-content h2 {
  font-family: var(--font-serif);
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
  color: var(--text-main);
  line-height: 1.2;
}

/* =====================================================================
   Horní lišta
   ===================================================================== */
.topbar {
  background-color: var(--bg-body);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
}
@supports (backdrop-filter: blur(8px)) {
  .topbar { background-color: color-mix(in srgb, var(--bg-body) 88%, transparent); backdrop-filter: blur(8px); }
}

.topbar-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { color: var(--text-main); text-decoration: none; }
.brand-icon { color: var(--primary); display: inline-flex; }

.nav-links { display: flex; list-style: none; gap: 1.6rem; }

.nav-link {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
}
.nav-link:hover { color: var(--text-main); text-decoration: none; border-bottom-color: var(--border-strong); }
.nav-link.active { color: var(--primary); border-bottom-color: var(--primary); }

.nav-actions { display: flex; align-items: center; gap: 0.6rem; }

/* Přepínač motivu: systém / světlý / tmavý */
.theme-switch {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 2px;
  background: var(--bg-card);
}
.theme-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-light);
  width: 28px;
  height: 26px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.theme-switch button:hover { color: var(--text-main); }
.theme-switch button[aria-pressed="true"] { background: var(--bg-subtle); color: var(--text-main); }

/* Lišta administrace (jen po přihlášení) */
.adminbar {
  background: var(--text-main);
  color: var(--bg-body);
}
.adminbar .topbar-container { padding-top: 0.45rem; padding-bottom: 0.45rem; gap: 1rem; }
.adminbar-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.6;
  white-space: nowrap;
}
.adminbar nav { overflow-x: auto; scrollbar-width: none; flex: 1; }
.adminbar ul { display: flex; list-style: none; gap: 0.25rem; }
.adminbar a {
  display: block;
  color: var(--bg-body);
  opacity: 0.78;
  font-size: 0.88rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.adminbar a:hover { opacity: 1; text-decoration: none; background: color-mix(in srgb, var(--bg-body) 12%, transparent); }
.adminbar a.active { opacity: 1; background: color-mix(in srgb, var(--bg-body) 20%, transparent); }
.adminbar-user { font-size: 0.82rem; opacity: 0.75; white-space: nowrap; display: flex; gap: 0.75rem; align-items: center; }
.adminbar-user a { padding: 0; opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.adminbar-user a:hover { background: none; }

/* =====================================================================
   Tlačítka
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.15rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); color: var(--primary-ink); }
.btn-secondary { background: transparent; color: var(--text-main); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-subtle); color: var(--text-main); border-color: var(--text-light); }
.btn-danger { background: var(--badge-red-text); color: var(--bg-card); }
.btn-danger:hover { filter: brightness(0.92); color: var(--bg-card); }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.82rem; }

/* =====================================================================
   Hlavní obsah
   ===================================================================== */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.25rem 1.25rem 4rem;
}

.flash-message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
  border-left: 3px solid currentColor;
}
.flash-success { background: var(--badge-green-bg); color: var(--badge-green-text); }
.flash-error { background: var(--badge-red-bg); color: var(--badge-red-text); }
.flash-message > span { font-weight: 700; }

/* =====================================================================
   Úvod katalogu — citát
   ===================================================================== */
.hero-section {
  padding: 2.5rem 0 2.75rem;
  max-width: 900px;
}

.hero-tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 1.1rem;
}
.hero-tag em { font-style: normal; color: var(--text-light); letter-spacing: 0.08em; text-transform: none; font-weight: 500; }

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4.6vw, 3.6rem);
  font-weight: 500 !important;
  line-height: 1.08;
  letter-spacing: -0.02em !important;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.hero-quote { position: relative; }
.hero-quote blockquote {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.9rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--text-main);
  text-wrap: balance;
}
.hero-quote.is-long blockquote { font-size: clamp(1.7rem, 3.6vw, 2.8rem); line-height: 1.15; }
.hero-quote blockquote::before {
  content: "„";
  color: var(--primary);
  margin-right: 0.02em;
}
.hero-quote blockquote::after { content: "“"; color: var(--primary); }
.hero-quote figcaption {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.hero-quote figcaption::before {
  content: "";
  width: 2.5rem;
  height: 1px;
  background: var(--gold);
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 560px;
  margin-top: 1.5rem;
}

/* =====================================================================
   Vyhledávání a filtry
   ===================================================================== */
.search-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.search-form { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

.search-input-wrapper { position: relative; flex: 1 1 280px; }

.search-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-light);
  font-size: 0; /* skryje případný emoji text */
  pointer-events: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.search-input, .form-control {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text-main);
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.search-input { padding-left: 2.6rem; font-size: 1.02rem; }
.search-input::placeholder, .form-control::placeholder { color: var(--text-light); }
.search-input:focus, .form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--primary-light);
}
select.form-control {
  appearance: none;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23978a77' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 16px;
}

/* Žánry jako záložky lístkového katalogu */
.genre-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.35rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
}
.genre-chip {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.15rem 0;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}
.genre-chip:hover { color: var(--text-main); text-decoration: none; border-bottom-color: var(--border-strong); }
.genre-chip.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.chip-count {
  font-size: 0.75rem;
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
  margin-left: 0.15rem;
}

.results-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.results-info strong { color: var(--text-main); font-family: var(--font-serif); font-size: 1.15rem; }

/* =====================================================================
   Kniha = katalogový lístek
   ===================================================================== */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.book-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
/* děrování lístku */
.book-card::after {
  content: "";
  position: absolute;
  bottom: 0.55rem;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--bg-body);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.15);
}
.book-card:hover {
  transform: translateY(-3px) rotate(-0.25deg);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.book-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.6rem;
  margin-bottom: 0.85rem;
  border-bottom: 2px solid var(--primary);
}

.book-sig-badge {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-main);
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-volna { color: var(--badge-green-text); }
.status-pujcena { color: var(--badge-amber-text); }
.status-jiny { color: var(--badge-blue-text); }

.book-title {
  font-family: var(--font-serif);
  font-size: 1.14rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-main);
  margin-bottom: 0.3rem;
  text-wrap: pretty;
}
.book-title a { color: inherit; }
.book-title a::before { content: ""; position: absolute; inset: 0; } /* celý lístek je klikací */
.book-title a:hover { text-decoration: none; }
.book-card:hover .book-title { color: var(--primary); }

.book-author {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.97rem;
  margin-bottom: 1rem;
}

.book-meta {
  margin-top: auto;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-light);
}

/* =====================================================================
   Detail knihy
   ===================================================================== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.book-detail {
  max-width: 760px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: clamp(1.5rem, 4vw, 3rem);
  position: relative;
}
.book-detail .book-card-head { margin-bottom: 1.75rem; }
.book-detail .book-sig-badge { font-size: 1rem; }
.book-detail h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.12;
  margin-bottom: 0.6rem;
  text-wrap: balance;
}
.book-detail .book-author { font-size: 1.25rem; margin-bottom: 2rem; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.75rem;
}
.detail-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 0.2rem;
}
.detail-value { font-weight: 500; }
.detail-note { grid-column: 1 / -1; }

.detail-footer { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.detail-hint { color: var(--text-muted); font-size: 0.95rem; max-width: 420px; }

/* =====================================================================
   Panely, tabulky (administrace)
   ===================================================================== */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-title { font-size: 1.1rem; font-weight: 600; }

.table-responsive { width: 100%; overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
  white-space: nowrap;
}
.table td {
  padding: 0.8rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--bg-subtle) 55%, transparent); }
.table .book-sig-badge {
  display: inline-block;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.4rem;
  font-size: 0.8rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green { background: var(--badge-green-bg); color: var(--badge-green-text); }
.badge-amber { background: var(--badge-amber-bg); color: var(--badge-amber-text); }
.badge-red { background: var(--badge-red-bg); color: var(--badge-red-text); }
.badge-blue { background: var(--badge-blue-bg); color: var(--badge-blue-text); }

/* Statistiky nástěnky */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0;
  margin-bottom: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.stat-card {
  padding: 1.35rem 1.5rem;
  border-right: 1px solid var(--border-color);
  margin-right: -1px;
}
.stat-icon { display: none; }
.stat-value {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums tabular-nums;
}
.stat-label {
  margin-top: 0.45rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* =====================================================================
   Formuláře
   ===================================================================== */
.form-group { margin-bottom: 1.15rem; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
input[type="checkbox"] { accent-color: var(--primary); width: 1rem; height: 1rem; }

/* Přihlášení */
.login-box {
  max-width: 420px;
  margin: 2rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2.25rem;
  border-top: 3px solid var(--primary);
}
.login-header { margin-bottom: 1.75rem; }
.login-header h1 { font-size: 2rem; margin-bottom: 0.4rem; }
.login-header p { color: var(--text-muted); font-size: 0.95rem; }

/* =====================================================================
   Stránkování
   ===================================================================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}
.page-item {
  min-width: 2.3rem;
  height: 2.3rem;
  padding: 0 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}
.page-item:hover { background: var(--bg-subtle); color: var(--text-main); text-decoration: none; }
.page-item.active { background: var(--text-main); color: var(--bg-body); font-weight: 600; }
.page-item.disabled { opacity: 0.35; pointer-events: none; }
.page-gap { color: var(--text-light); padding: 0 0.2rem; }

/* =====================================================================
   O knihovně
   ===================================================================== */
.prose-page { max-width: 760px; }
.prose-page h2 { font-size: 1.55rem; margin: 2.5rem 0 0.75rem; }
.prose-page p { font-family: var(--font-serif); font-size: 1.1rem; line-height: 1.7; color: var(--text-main); margin-bottom: 1rem; }
.info-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin: 1.75rem 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}
.info-columns h3 {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.info-columns p { font-family: var(--font-sans); font-size: 1rem; line-height: 1.6; margin: 0; }

/* =====================================================================
   Patička
   ===================================================================== */
.footer {
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.25rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.footer-title { font-family: var(--font-serif); font-size: 1.1rem; color: var(--text-main); margin-bottom: 0.2rem; }
.footer a { color: var(--text-main); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.footer a:hover { color: var(--primary); text-decoration-color: var(--primary); }

/* =====================================================================
   Mobil
   ===================================================================== */
@media (max-width: 760px) {
  .topbar-container { padding: 0.7rem 1rem; gap: 0.75rem; flex-wrap: wrap; }
  .topbar nav { order: 3; width: 100%; }
  .nav-links { gap: 1.25rem; }
  .brand { font-size: 1.15rem; }
  .adminbar .topbar-container { flex-wrap: nowrap; }
  .adminbar-label { display: none; }
  .adminbar-user span { display: none; }
  .main-content { padding: 1.5rem 1rem 3rem; }
  .hero-section { padding: 1rem 0 1.75rem; }
  .search-card { padding: 1rem; }
  .search-form > .btn, .search-form > select { flex: 1 1 auto; }
  .books-grid { grid-template-columns: 1fr; gap: 0.9rem; }
  .genre-filter-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -1rem; margin-right: -1rem; padding-left: 1rem; padding-right: 1rem; -webkit-mask: linear-gradient(to right, transparent 0, #000 1rem, #000 calc(100% - 2rem), transparent); mask: linear-gradient(to right, transparent 0, #000 1rem, #000 calc(100% - 2rem), transparent); }
  .genre-filter-bar::-webkit-scrollbar { display: none; }
  .hero-desc { font-size: 1rem; }
  .book-card { min-height: 0; }
  .stat-card { border-bottom: 1px solid var(--border-color); }
  .table th, .table td { padding-left: 0.85rem; padding-right: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* =====================================================================
   Našeptávač (výpůjčky)
   ===================================================================== */
.form-hint { display: block; margin-top: 0.35rem; color: var(--text-muted); font-size: 0.82rem; }

.ac { position: relative; }
.ac.is-chosen .ac-input {
  border-color: var(--badge-green-text);
  background: var(--bg-card);
  font-weight: 600;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233d5520' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
}
.ac-chosen { margin-top: 0.35rem; font-size: 0.85rem; color: var(--badge-green-text); }

.ac-list {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 340px;
  overflow-y: auto;
  list-style: none;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.3rem;
}
.ac-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.ac-item.is-active { background: var(--primary-light); }
.ac-item.is-disabled { cursor: not-allowed; opacity: 0.5; }
.ac-main { display: flex; align-items: baseline; gap: 0.5rem; }
.ac-code { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.ac-label { font-weight: 600; color: var(--text-main); }
.ac-note { margin-left: auto; font-size: 0.75rem; color: var(--badge-amber-text); white-space: nowrap; }
.ac-meta { font-size: 0.82rem; color: var(--text-muted); }
.ac-empty { padding: 0.6rem 0.7rem; color: var(--text-muted); font-size: 0.9rem; }

/* Rychlé vrácení knihy */
.return-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.return-box-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.return-box-row { display: flex; gap: 0.6rem; align-items: flex-start; }
.return-box-row .ac { flex: 1; }
.return-box-row .btn { padding-top: 0.68rem; padding-bottom: 0.68rem; }

/* =====================================================================
   Administrace — hlavička stránky, nástěnka, grafy
   ===================================================================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 2rem; margin-bottom: 0.2rem; }
.page-head p { color: var(--text-muted); }

.dashboard-stats.is-secondary { margin-top: -1rem; }
.dashboard-stats.is-secondary .stat-value { font-size: 1.8rem; }
.stat-link { color: inherit; display: block; transition: background-color 0.15s ease; }
.stat-link:hover { text-decoration: none; color: inherit; background: var(--bg-subtle); }
.stat-link .stat-label::after { content: " →"; opacity: 0; transition: opacity 0.15s ease; }
.stat-link:hover .stat-label::after { opacity: 1; }
.stat-value.is-warn { color: var(--badge-amber-text); }
.stat-unit { font-size: 0.5em; color: var(--text-muted); letter-spacing: 0; }
.stat-sub { margin-top: 0.25rem; font-size: 0.82rem; color: var(--text-light); }

.dash-panel { margin-bottom: 1.5rem; }
.panel-hint { font-size: 0.82rem; color: var(--text-light); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.5rem; }
.dash-note { font-size: 0.78rem; color: var(--text-light); padding: 0 1.25rem 0.75rem; }
.dash-table { padding: 0 1.25rem 1rem; font-size: 0.85rem; }
.dash-table summary { cursor: pointer; color: var(--text-muted); }
.dash-table table { margin-top: 0.5rem; max-width: 320px; }
.dash-table .table td, .dash-table .table th { padding: 0.35rem 0.75rem; }

/* Sloupcový graf po letech */
.year-chart {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 1.5rem 1.25rem 0.5rem;
}
.year-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0.3rem;
  position: relative;
  cursor: default;
}
.year-bar {
  width: 100%;
  max-width: 44px;
  flex-shrink: 0;
  background: var(--primary);
  opacity: 0.82;
  border-radius: 4px 4px 0 0;
  transition: opacity 0.15s ease;
}
.year-col.is-current .year-bar {
  opacity: 0.45;
  background-image: repeating-linear-gradient(45deg, transparent 0 4px, color-mix(in srgb, var(--bg-card) 45%, transparent) 4px 6px);
}
.year-col:hover .year-bar { opacity: 1; }
.year-value {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.year-col:hover .year-value { opacity: 1; color: var(--text-main); font-weight: 600; }
.year-label { font-size: 0.72rem; color: var(--text-light); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Vodorovné pruhy (žebříčky) */
.hbars { list-style: none; padding: 0.75rem 1.25rem 1.1rem; }
.hbars li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 3.2rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
  font-size: 0.9rem;
}
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-label a { color: var(--text-main); }
.hbar-label small { color: var(--text-light); margin-left: 0.25rem; }
.hbar-track { height: 8px; background: var(--bg-subtle); border-radius: 4px; overflow: hidden; }
.hbar { display: block; height: 100%; background: var(--primary); opacity: 0.82; border-radius: 4px; }
.hbars li:hover .hbar { opacity: 1; }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 0.85rem; }

/* Poslední pohyby */
.activity { list-style: none; padding: 0.4rem 0; }
.activity li {
  display: grid;
  grid-template-columns: 6.5rem 5.5rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.55rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.92rem;
}
.activity li:last-child { border-bottom: 0; }
.activity-date { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.activity-kind { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.activity-kind.is-out { color: var(--badge-amber-text); }
.activity-kind.is-in { color: var(--badge-green-text); }
.activity-text a { color: var(--text-main); }
.activity-muted { color: var(--text-light); }
.activity-who { font-size: 0.82rem; }

/* Řazení v tabulkách */
.sort-link { color: inherit; display: inline-flex; align-items: center; gap: 0.3rem; }
.sort-link:hover { color: var(--text-main); text-decoration: none; }
.sort-link.is-active { color: var(--primary); }
.sort-arrow { font-size: 0.8em; opacity: 0.35; }
.sort-link.is-active .sort-arrow { opacity: 1; }

/* Záložky (Výpůjčky: aktuální / po termínu) */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border-color); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tab {
  padding: 0.6rem 1rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
}
.tab:hover { color: var(--text-main); text-decoration: none; }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .tab-count {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.45rem;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.tab.is-warn .tab-count { background: var(--badge-amber-bg); color: var(--badge-amber-text); }

/* Akční box: Půjčit / Vrátit / Prodloužit */
.action-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.75rem;
}
.action-tabs { display: flex; border-bottom: 1px solid var(--border-color); }
.action-tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0.8rem 1.25rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-muted);
  cursor: pointer;
}
.action-tab:hover { color: var(--text-main); }
.action-tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.action-panel { padding: 1.1rem 1.25rem 1.25rem; }
.action-row { display: flex; gap: 0.75rem; align-items: flex-start; flex-wrap: wrap; }
.action-row .ac { flex: 1 1 260px; min-width: 0; }
.action-row .days { flex: 0 0 120px; }
.action-row .btn { padding-top: 0.68rem; padding-bottom: 0.68rem; }
.action-help { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.6rem; }

.row-actions { display: inline-flex; gap: 0.35rem; justify-content: flex-end; flex-wrap: nowrap; white-space: nowrap; }
.row-actions form { display: inline; }

@media (max-width: 760px) {
  .activity li { grid-template-columns: 1fr auto; }
  .activity-text { grid-column: 1 / -1; }
  .activity-who { display: none; }
  .year-chart { padding-left: 0.6rem; padding-right: 0.6rem; }
  .year-label { font-size: 0.62rem; }
  .action-row .days { flex: 1 1 100px; }
}

@media (max-width: 760px) {
  .dashboard-stats { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 1rem; }
  .stat-value { font-size: 1.9rem; }
  .dashboard-stats.is-secondary .stat-value { font-size: 1.5rem; }
}

/* O knihovně */
.about-title { font-size: clamp(1.8rem, 3.6vw, 2.9rem); }
@media (min-width: 761px) { .about-title { white-space: nowrap; } }
.contact { font-style: normal; font-family: var(--font-serif); font-size: 1.1rem; line-height: 1.75; margin-bottom: 1rem; }

/* O knihovně: kontakt + mapa */
.prose-page { max-width: 1040px; }
.prose-page > p, .prose-page > .info-columns, .prose-page > h2, .prose-page > .hero-section { max-width: 760px; }
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 2rem;
  align-items: start;
  margin: 2.5rem 0 0.5rem;
}
.contact-grid h2 { margin-top: 0; }
.map-links { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; }
.map-links .btn { font-family: var(--font-sans); }
.map-frame {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: var(--bg-subtle);
  aspect-ratio: 16 / 11;
}
.map-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 760px) {
  .contact-grid { grid-template-columns: 1fr; gap: 1.25rem; }
}
