/* Cmentarz parafialny - system projektowy (Odoo-style, paleta Government/Public Service) */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Serif:wght@500;600&display=swap');

:root {
  --navy: #0F172A;        /* pasek, nagłówki */
  --navy-700: #1E293B;
  --slate: #334155;       /* tekst drugorzędny, groby zajęte */
  --accent: #0369A1;      /* akcje, linki */
  --accent-hover: #075985;
  --bg: #F1F5F9;          /* tło strony */
  --panel: #FFFFFF;
  --line: #E2E8F0;        /* obramowania */
  --line-strong: #CBD5E1;
  --ink: #0F172A;         /* tekst */
  --muted: #64748B;       /* tekst wyciszony */
  --ok: #15803D;
  --ok-bg: #DCFCE7;
  --warn: #B45309;
  --warn-bg: #FEF3C7;
  --danger: #B91C1C;
  --danger-bg: #FEE2E2;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.55;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: "IBM Plex Serif", Georgia, serif; }

/* --- górny pasek (app bar) --- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.25rem; height: 56px;
}
.appbar-brand { display: flex; align-items: center; gap: 0.6rem; font-family: "IBM Plex Serif", serif;
  font-weight: 600; font-size: 1.05rem; color: #fff; text-decoration: none; white-space: nowrap; }
.appbar-brand .icon { color: #94A3B8; }
.appbar-nav { margin-left: auto; display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.appbar-nav a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: #CBD5E1; text-decoration: none; font-size: 0.9rem; font-weight: 500;
  padding: 0.45rem 0.7rem; border-radius: 6px; transition: background .15s, color .15s;
}
.appbar-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.appbar-nav a.primary { background: var(--accent); color: #fff; }
.appbar-nav a.primary:hover { background: var(--accent-hover); }

/* --- kontener strony --- */
.page { max-width: 1140px; margin: 0 auto; padding: 1.25rem; }
.breadcrumb { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.85rem;
  margin-bottom: 1rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 0.3rem; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--line-strong); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-title { font-size: 1.35rem; margin: 0; display: flex; align-items: center; gap: 0.6rem; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* --- karty / panele --- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 1.1rem; padding: 1.1rem 1.25rem; }
.panel > h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  margin: 0 0 0.9rem; font-family: "IBM Plex Sans", sans-serif; font-weight: 600; }
.empty { color: var(--muted); }
.ref-note { color: var(--muted); font-size: 0.85rem; margin: 0.6rem 0 0; }

/* --- KPI / statystyki --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.9rem; margin-bottom: 1.1rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 0.9rem 1.1rem; }
.stat b { font-size: 1.7rem; font-weight: 600; display: block; color: var(--navy); line-height: 1.1; }
.stat span { color: var(--muted); font-size: 0.82rem; }
.stat-actions { margin-left: auto; display: flex; gap: 0.5rem; }

/* --- przyciski --- */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--slate);
  padding: 0.5rem 0.9rem; border-radius: 6px; cursor: pointer; font: inherit; font-size: 0.9rem;
  font-weight: 500; text-decoration: none; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: #F8FAFC; border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-danger { color: var(--danger); border-color: var(--line-strong); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.83rem; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.icon-link { display: inline-flex; align-items: center; color: var(--accent); text-decoration: none; }

/* --- ikony --- */
.icon { vertical-align: middle; flex-shrink: 0; }

/* --- odznaki --- */
.badge { display: inline-flex; align-items: center; padding: 0.15rem 0.6rem; border-radius: 20px;
  font-size: 0.75rem; font-weight: 500; background: #F1F5F9; color: var(--slate); border: 1px solid var(--line); }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge-err { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

/* --- pola formularzy --- */
input, select, textarea { font: inherit; font-size: 0.92rem; padding: 0.5rem 0.65rem;
  border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(3,105,161,.12); }
input::placeholder { color: #94A3B8; }

/* --- tabele / listy --- */
table { width: 100%; border-collapse: collapse; }
td { padding: 0.6rem 0.6rem; border-top: 1px solid var(--line); vertical-align: middle; }
tr:first-child td { border-top: none; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline; }
.thumb { width: 60px; height: 44px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }

/* --- wyszukiwarka w panelu --- */
.upload-form { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; }
.upload-form label { color: var(--muted); font-size: 0.88rem; }

/* --- komunikat --- */
.toast { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 1.1rem;
  padding: 0.6rem 0.95rem; background: var(--ok-bg); color: var(--ok); border-radius: var(--radius);
  font-size: 0.9rem; border: 1px solid #bbf7d0; }

/* --- formularze edycji grobu --- */
.grave-form { display: flex; gap: 0.9rem; align-items: flex-end; flex-wrap: wrap; }
.grave-form label { display: flex; flex-direction: column; font-size: 0.78rem; color: var(--muted);
  gap: 4px; font-weight: 500; }
.grave-form input[type=text] { min-width: 240px; }

.person-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; flex-wrap: wrap;
  padding: 0.45rem; border-radius: 6px; background: #F8FAFC; border: 1px solid var(--line); }
.person-row input { flex: 1; min-width: 120px; }
.person-row input[name=nazwisko], .person-row input[name=imie] { flex: 1.3; }
.person-add { background: #fff; border-style: dashed; border-color: var(--line-strong); }

.upload-row { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.9rem; flex-wrap: wrap; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.7rem; }
.photo-grid img { width: 100%; height: 200px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }
.photo-item { position: relative; }
.photo-item form { margin: 0; }
.photo-del { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.92); padding: 0.3rem; }

/* --- dodaj grob (rozwijane) --- */
.add-grave summary { cursor: pointer; color: var(--accent); font-weight: 600; display: inline-flex;
  align-items: center; gap: 0.4rem; font-size: 0.9rem; }
.add-grave summary::-webkit-details-marker { display: none; }
.add-grave[open] summary { margin-bottom: 0.6rem; }

/* --- siatka grobów --- */
.legend { color: var(--muted); font-size: 0.83rem; margin-bottom: 0.8rem; display: flex; gap: 1rem;
  align-items: center; flex-wrap: wrap; }
.dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: middle; }
.legend-photo { display: inline-flex; align-items: center; gap: 5px; }
.sektor-title { font-family: "IBM Plex Sans", sans-serif; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin: 1.1rem 0 0.5rem; }
.cem-row { display: flex; align-items: center; gap: 5px; margin-bottom: 5px; flex-wrap: wrap; }
.cem-row-label { width: 40px; text-align: right; color: var(--muted); font-size: 0.78rem; padding-right: 6px; flex-shrink: 0; }
.cem-cell { display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  min-width: 40px; height: 34px; padding: 0 8px; border-radius: 5px; font-size: 0.85rem; font-weight: 500;
  background: var(--slate); color: #fff; text-decoration: none; transition: outline .1s, filter .15s; }
.cem-cell:hover { filter: brightness(1.15); outline: 2px solid var(--navy); }
.cem-cell.cem-free { background: var(--ok); }
.cem-cell.cem-res { background: var(--warn); }
.cem-cell .icon { opacity: 0.85; }

/* --- raporty --- */
.year-chart { display: flex; flex-direction: column; gap: 0.35rem; }
.year-row { display: flex; align-items: center; gap: 0.6rem; }
.year-label { width: 46px; text-align: right; font-size: 0.88rem; color: var(--muted); flex-shrink: 0; }
.year-bar { height: 18px; background: var(--accent); border-radius: 3px; min-width: 2px; }
.year-count { font-size: 0.88rem; font-weight: 600; color: var(--navy); }
.free-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.free-cell { display: inline-flex; align-items: center; padding: 0.3rem 0.6rem; border-radius: 5px;
  background: var(--ok); color: #fff; text-decoration: none; font-size: 0.83rem; font-weight: 500; }
.free-cell:hover { filter: brightness(1.1); }
.free-cell.free-res { background: var(--warn); }

/* --- kody QR --- */
.qr-img { width: 240px; height: 240px; background: #fff; }
.qr-sm { width: 150px; height: 150px; }
.qr-inline { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.qr-url { font-family: "IBM Plex Mono", monospace; font-size: 0.85rem; color: var(--accent); word-break: break-all; }
.qr-poster { text-align: center; padding: 1.5rem; }
.qr-poster h2 { color: var(--navy); font-size: 1.5rem; }
.qr-poster p { color: var(--muted); }

/* --- widok publiczny (dla rodzin) --- */
body.pub { background: var(--bg); }
.pub-wrap { max-width: 680px; margin: 0 auto; padding: 2.5rem 1.2rem 3rem; }
.pub-header { text-align: center; margin-bottom: 1.8rem; }
.pub-header h1 { font-size: 1.6rem; color: var(--navy); margin: 0 0 0.5rem; }
.pub-header p { color: var(--muted); margin: 0; }
.pub-search { display: flex; align-items: center; gap: 0.5rem; background: #fff; border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 0.4rem 0.4rem 0.4rem 0.9rem; box-shadow: var(--shadow); }
.pub-search-icon { color: var(--muted); display: inline-flex; }
.pub-search input { flex: 1; border: none; font-size: 1.05rem; padding: 0.5rem 0.3rem; background: transparent; }
.pub-search input:focus { outline: none; box-shadow: none; }
.pub-count { color: var(--muted); font-size: 0.9rem; margin: 1.5rem 0 0.7rem; }
.pub-results { display: flex; flex-direction: column; gap: 0.7rem; }
.pub-card { display: flex; gap: 1rem; align-items: center; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 0.85rem; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  transition: border-color .15s; }
.pub-card:hover { border-color: var(--accent); }
.pub-thumb { width: 66px; height: 66px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.pub-thumb-empty { display: flex; align-items: center; justify-content: center; background: #F1F5F9; color: var(--muted); }
.pub-card-body { display: flex; flex-direction: column; gap: 3px; }
.pub-name { font-size: 1.05rem; font-family: "IBM Plex Serif", serif; }
.pub-dates { color: var(--muted); font-size: 0.9rem; }
.pub-loc { color: var(--accent); font-size: 0.9rem; font-weight: 500; }
.pub-empty { text-align: center; color: var(--muted); padding: 2rem 0; }
.pub-back { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--accent); text-decoration: none;
  margin-bottom: 1.2rem; font-size: 0.95rem; }
.pub-grave { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.5rem; box-shadow: var(--shadow); }
.pub-loc-big { text-align: center; background: var(--navy); color: #fff; border-radius: 10px; padding: 1.3rem;
  margin-bottom: 1.4rem; display: flex; flex-direction: column; gap: 4px; }
.pub-loc-label { text-transform: uppercase; letter-spacing: 0.09em; font-size: 0.72rem; color: #94A3B8; }
.pub-loc-big b { font-size: 1.7rem; font-family: "IBM Plex Serif", serif; }
.pub-people { list-style: none; padding: 0; margin: 0 0 1rem; }
.pub-people li { padding: 0.7rem 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.pub-people li:first-child { border-top: none; }
.pub-people b { font-family: "IBM Plex Serif", serif; }
.pub-people span { color: var(--muted); font-size: 0.9rem; }
.pub-footer { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 2rem; }

/* --- druk --- */
@media print {
  .no-print, .appbar { display: none !important; }
  body { background: #fff; }
  .panel { border: none; box-shadow: none; }
  .qr-poster h2 { font-size: 2rem; }
  .qr-img { width: 320px; height: 320px; }
}

/* --- responsywność --- */
@media (max-width: 640px) {
  .appbar { flex-wrap: wrap; height: auto; padding: 0.6rem 1rem; }
  .appbar-nav { width: 100%; }
  .page { padding: 1rem; }
}

/* --- okno modalne --- */
dialog.modal { border: none; border-radius: var(--radius); padding: 0; max-width: 540px; width: 92%;
  box-shadow: 0 12px 48px rgba(15,23,42,.28); color: var(--ink); }
dialog.modal::backdrop { background: rgba(15,23,42,.45); }
.modal-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line);
  font-family: "IBM Plex Serif", serif; font-size: 1.15rem; font-weight: 600; }
.modal-body { padding: 1.25rem; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.modal-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem;
  color: var(--muted); font-weight: 500; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem;
  padding: 0.9rem 1.25rem; border-top: 1px solid var(--line); background: #F8FAFC; }

/* --- mapa graficzna --- */
.map-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 0.6rem; }
.map-layers { display: flex; gap: 1rem; align-items: center; }
.map-layers label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem;
  color: var(--slate); cursor: pointer; }
.map-tools { display: flex; align-items: center; gap: 0.8rem; }
.map-counter { font-size: 0.9rem; color: var(--muted); }
.map-counter b { color: var(--navy); }
.map-hint { font-size: 0.85rem; color: var(--muted); margin: 0 0 0.7rem;
  background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 0.5rem 0.8rem; }
.map-hint.draw-active { background: var(--warn-bg); border-color: #fde68a; color: var(--warn); }

.map-viewer { position: relative; overflow: hidden; height: 72vh; min-height: 420px;
  background: #1e293b; border: 1px solid var(--line); border-radius: var(--radius);
  cursor: grab; user-select: none; }
.map-viewer.grabbing { cursor: grabbing; }
.map-viewer.draw-mode { cursor: crosshair; }
.map-wrap { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
#map-img { display: block; -webkit-user-drag: none; }
.map-svg { position: absolute; top: 0; left: 0; pointer-events: none; }

.grob-shape { pointer-events: all; cursor: pointer; stroke-width: 2.5; transition: filter .12s; }
.grob-shape:hover { filter: brightness(1.3); }
.map-viewer.draw-mode .grob-shape { pointer-events: none; }
.status-zajety { fill: rgba(51,65,85,.55); stroke: #334155; }
.status-wolne { fill: rgba(21,128,61,.5); stroke: #15803d; }
.status-rezerwacja { fill: rgba(180,83,9,.55); stroke: #b45309; }
.grob-label { pointer-events: none; fill: #fff; font-size: 22px; font-weight: 600;
  text-anchor: middle; dominant-baseline: central;
  font-family: "IBM Plex Sans", sans-serif; paint-order: stroke; stroke: rgba(15,23,42,.5); stroke-width: 3px; }
.draw-temp { fill: rgba(3,105,161,.25); stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 6 4; }

.sektor-title { display: flex; align-items: center; gap: 0.8rem; }
.sektor-map-link { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem;
  font-family: "IBM Plex Sans", sans-serif; text-transform: none; letter-spacing: 0; font-weight: 500; }

/* --- picker: wyszukiwanie + lista grobow --- */
#pick-search { width: 100%; margin-bottom: 0.6rem; }
.pick-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; }
.pick-item { padding: 0.5rem 0.7rem; cursor: pointer; font-size: 0.92rem; border-bottom: 1px solid var(--line); }
.pick-item:last-child { border-bottom: none; }
.pick-item:hover { background: #F1F5F9; }
.pick-item.selected { background: var(--accent); color: #fff; }
.pick-item.placed { color: var(--muted); }
.pick-item.selected.placed { color: #e0e7ef; }
.pick-empty { padding: 0.7rem; color: var(--muted); font-size: 0.9rem; }
.pick-new { margin-top: 0.8rem; }
.pick-new > summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 0.9rem;
  display: inline-flex; align-items: center; gap: 0.35rem; }
.pick-new > summary::-webkit-details-marker { display: none; }
.pick-new-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 0.7rem; margin-top: 0.7rem; }
.pick-new-fields input, .pick-new-fields select { width: 100%; }
.pick-new-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.pick-error { color: var(--danger); font-size: 0.85rem; margin-right: auto; align-self: center; }

/* --- siatka: sektory obok siebie jak na zdjeciu --- */
.sektory-row { display: flex; gap: 2.5rem; align-items: stretch; overflow-x: auto; padding-bottom: 0.5rem; }
.sektor-block { flex: 0 0 auto; display: flex; flex-direction: column; }
.sektor-rows { display: flex; flex-direction: column-reverse; justify-content: flex-start; flex: 1; gap: 5px; }
.sektor-B .sektor-title { justify-content: flex-end; }
.sektor-B .cem-row { flex-direction: row-reverse; }
.sektory-row .cem-cell { min-width: 30px; height: 28px; padding: 0 5px; font-size: 0.78rem; }
.sektory-row .cem-row-label { width: 34px; }

/* --- zakladki mapy --- */
.map-tabs { display: flex; gap: 0.25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.map-tab { display: inline-flex; align-items: center; gap: 0.4rem; background: none; border: none; cursor: pointer;
  padding: 0.55rem 0.9rem; font: inherit; font-size: 0.9rem; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.map-tab:hover { color: var(--accent); }
.map-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* --- naglowek mapy z zakladkami + przycisk dodaj --- */
.map-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem;
  border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.map-header .map-tabs { border-bottom: none; margin-bottom: 0; }
.map-add-btn { margin-bottom: 0.35rem; }

/* --- system: pasek modulow, uzytkownik, podnawigacja modulu --- */
.appbar-modules { margin-left: 0.75rem; }
.appbar-nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.appbar-user { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.appbar-username { display: inline-flex; align-items: center; gap: 0.35rem; color: #CBD5E1; font-size: 0.85rem; }
.appbar-logout { display: inline-flex; align-items: center; gap: 0.35rem; color: #CBD5E1; text-decoration: none;
  font-size: 0.85rem; padding: 0.4rem 0.6rem; border-radius: 6px; border: 1px solid rgba(255,255,255,.18);
  transition: background .15s, color .15s; }
.appbar-logout:hover { background: rgba(255,255,255,.1); color: #fff; }
.subnav { background: var(--panel); border-bottom: 1px solid var(--line); }
.subnav-inner { max-width: 1140px; margin: 0 auto; padding: 0 1.25rem; display: flex; gap: 0.25rem; overflow-x: auto; }
.subnav a { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.7rem 0.8rem; color: var(--muted);
  text-decoration: none; font-size: 0.88rem; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap;
  transition: color .15s; }
.subnav a:hover { color: var(--ink); }
.subnav a.active { color: var(--accent); border-bottom-color: var(--accent); }
.subnav a.subnav-ext { margin-left: auto; }

/* --- logowanie --- */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; box-sizing: border-box; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; max-width: 380px; padding: 2rem; }
.login-brand { display: flex; align-items: center; gap: 0.6rem; color: var(--navy); font-family: "IBM Plex Serif", Georgia, serif;
  font-weight: 600; font-size: 1.15rem; margin-bottom: 0.25rem; }
.login-brand .icon { color: var(--accent); }
.login-sub { color: var(--muted); font-size: 0.88rem; margin: 0 0 1.4rem; }
.login-form { display: flex; flex-direction: column; gap: 0.9rem; }
.login-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 500; color: var(--slate); }
.login-form input { padding: 0.55rem 0.7rem; border: 1px solid var(--line-strong); border-radius: 6px; font: inherit; }
.login-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.login-form .btn { justify-content: center; padding: 0.6rem; }
.login-error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); border-radius: 6px;
  padding: 0.55rem 0.7rem; font-size: 0.88rem; }
.login-foot { color: var(--muted); font-size: 0.78rem; margin: 1.4rem 0 0; text-align: center; }

/* --- pulpit (moduly) --- */
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.module-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; }
.module-card h2 { margin: 0; font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; color: var(--navy); }
.module-card h2 .icon { color: var(--accent); }
.module-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.module-stats { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; margin: 0.3rem 0; }
.module-stats b { display: block; font-size: 1.3rem; color: var(--navy); font-family: "IBM Plex Serif", Georgia, serif; white-space: nowrap; }
.module-stats span { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.module-links { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; }
.module-card.soon { opacity: 0.75; }
.badge-soon { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .05em; background: var(--bg); color: var(--muted);
  padding: 0.15rem 0.45rem; border-radius: 999px; border: 1px solid var(--line); margin-left: auto; font-family: "IBM Plex Sans", sans-serif; font-weight: 600; }

/* --- ksiegi: lista --- */
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-err { background: var(--danger-bg); color: var(--danger); }
.thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); display: block; }
.muted { color: var(--muted); }

/* --- ksiegi: weryfikacja aktu (widok pelnej szerokosci) --- */
.page-wide { max-width: none; padding: 0; }
.act-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.55rem 1.25rem;
  background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.act-toolbar h1 { font-size: 1.05rem; margin: 0; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.act-split { display: flex; height: calc(100vh - 56px - 46px - 54px); min-height: 480px; }
.image-pane { flex: 1.2; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #1E293B; min-width: 0; }
.image-tabs { padding: 0.4rem 0.6rem; background: var(--panel); display: flex; gap: 0.4rem; align-items: center; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.image-tabs .hint { color: var(--muted); font-size: 0.75rem; margin-left: auto; }
.tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#viewer { flex: 1; overflow: hidden; position: relative; cursor: grab; }
#viewer:active { cursor: grabbing; }
.page-img { display: none; position: absolute; top: 0; left: 0; max-width: 100%; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; }
.page-img.active { display: block; }
.form-pane { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; background: var(--panel); }
.conf-legend { margin-bottom: 0.8rem; }
.dot.conf-high { background: var(--ok); }
.dot.conf-medium { background: var(--warn); }
.dot.conf-low { background: var(--danger); }
.field { margin-bottom: 0.6rem; padding: 0.45rem 0.6rem; border-radius: 6px; border-left: 4px solid var(--ok); background: #F0FDF4; }
.field.conf-medium { border-left-color: var(--warn); background: #FFFBEB; }
.field.conf-low { border-left-color: var(--danger); background: #FEF2F2; }
.field.edited { outline: 2px solid var(--accent); }
.field label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 2px; }
.field .key { color: #94A3B8; font-size: 0.7rem; }
.field textarea { width: 100%; resize: none; overflow: hidden; }
.ai-was { color: var(--muted); font-size: 0.75rem; }
.annotations { margin-top: 1rem; padding: 0.7rem 0.9rem; background: var(--bg); border-radius: 6px; font-size: 0.85rem; }
.annotations h3 { margin: 0 0 0.4rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  font-family: "IBM Plex Sans", sans-serif; font-weight: 600; }
.annotations ul { margin: 0; padding-left: 1.2rem; }
.act-actions { margin-top: 1.2rem; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.act-actions .inline { display: inline; }
#save-status { color: var(--muted); font-size: 0.85rem; }
@media (max-width: 900px) {
  .act-split { flex-direction: column; height: auto; }
  .image-pane { min-height: 45vh; border-right: none; border-bottom: 1px solid var(--line); }
}

/* --- formularz recznego aktu --- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 0.8rem 1rem; }
.form-grid-narrow { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); max-width: 520px; }
.form-grid label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: var(--slate); font-weight: 500; }
.form-grid label .key { color: #94A3B8; font-size: 0.7rem; font-weight: 400; }
.form-grid input { width: 100%; }

/* --- cmentarz: dysponenci, waznosc, historia --- */
.dysp-box { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 0.7rem 0.9rem;
  background: #F8FAFC; border: 1px solid var(--line); border-radius: 6px; flex-wrap: wrap; }
.dysp-form { margin-top: 0.8rem; }
.dysp-form > summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; font-weight: 500; display: inline-flex; align-items: center; gap: 0.35rem; }
.waz-box { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { padding: 0.35rem 0 0.35rem 0.9rem; position: relative; font-size: 0.9rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 0.75rem; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.tl-date { display: inline-block; min-width: 92px; color: var(--muted); font-variant-numeric: tabular-nums; }
.free-cell.free-err { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.free-cell.free-muted { background: #F1F5F9; color: var(--slate); border-color: var(--line); }

/* --- cmentarz: statusy, kreator pochowku --- */
.cem-cell.cem-lik { background: var(--danger); }
.status-wolny { fill: rgba(21,128,61,.5); stroke: #15803d; }
.status-do_likwidacji, .status-zlikwidowany { fill: rgba(185,28,28,.45); stroke: #b91c1c; }
.warn-panel { border-color: #fde68a; background: var(--warn-bg); }
.warn-panel > h2 { color: var(--warn); }
.warn-list { margin: 0; padding-left: 1.2rem; color: var(--warn); font-size: 0.92rem; }
.warn-list li { margin-bottom: 0.3rem; }
.form-grid label.check { flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 400; color: var(--ink); }
.form-grid label.check input { width: auto; }
.act-actions label.check { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.form-grid label small { font-weight: 400; }

/* mapa graficzna: data w zakładce i podpis źródła */
.map-tab-date { font-size: 0.78em; opacity: 0.7; margin-left: 0.3em; font-variant-numeric: tabular-nums; }
.map-source { color: var(--muted); font-size: 0.86rem; margin-right: 0.8rem; }

/* etap 3: zgloszenia opiekunow */
.nav-count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.3em; height: 1.3em;
  padding: 0 0.35em; border-radius: 1em; background: var(--warn); color: #fff; font-size: 0.72rem; font-weight: 600; margin-left: 0.25rem; }
.module-stat-alert b { color: var(--warn); }
.toast-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.toast-warn a { color: inherit; }
.pub-cta { text-align: center; margin-top: 1.5rem; padding: 1.3rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.pub-cta p { margin: 0 0 0.8rem; color: var(--slate); }
.pub-note { text-align: center; color: var(--muted); font-size: 0.9rem; margin-top: 1.8rem; }
.pub-note a { color: var(--accent); }
.pub-form { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.5rem; box-shadow: var(--shadow); }
.pub-form h2 { font-size: 1.05rem; margin: 1.2rem 0 0.6rem; color: var(--navy); }
.pub-form h2:first-child { margin-top: 0; }
.pub-form .form-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.pub-form textarea { width: 100%; min-height: 80px; font: inherit; padding: 0.5rem; border: 1px solid var(--line-strong); border-radius: 6px; }
.pub-form .check { flex-direction: row; align-items: flex-start; gap: 0.6rem; font-weight: 400; color: var(--text); font-size: 0.9rem; }
.pub-form .check input { margin-top: 0.2rem; }
.pub-errors { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); border-radius: 8px; padding: 0.8rem 1rem; margin-bottom: 1rem; }
.pub-errors ul { margin: 0.3rem 0 0 1.1rem; padding: 0; }
.pub-klauzula { font-size: 0.8rem; color: var(--muted); line-height: 1.5; margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: 0.9rem; }
.pub-klauzula summary { cursor: pointer; color: var(--accent); }
.pub-grave-pick { display: flex; flex-direction: column; gap: 0.3rem; background: var(--bg); border-radius: 8px; padding: 0.8rem 1rem; margin-bottom: 1rem; }
.pub-grave-pick b { font-family: "IBM Plex Serif", serif; font-size: 1.1rem; }
.pub-card-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; margin-left: auto; flex-shrink: 0; }
.pub-card-static { cursor: default; }
.pub-card-static:hover { border-color: var(--line); }
.pub-others { color: var(--muted); font-size: 0.82rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.zgl-list { display: flex; flex-direction: column; gap: 0.8rem; }
.zgl-card { border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; background: #fff; }
.zgl-head { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: baseline; margin-bottom: 0.5rem; }
.zgl-head b { font-size: 1.05rem; }
.zgl-meta { color: var(--muted); font-size: 0.85rem; }
.zgl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.3rem 1.2rem; font-size: 0.9rem; margin: 0.5rem 0; }
.zgl-grid span { color: var(--muted); font-size: 0.78rem; display: block; }
.zgl-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.zgl-actions form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; }
.zgl-actions label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.78rem; color: var(--slate); font-weight: 500; }
.zgl-tabs { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 1rem; }
.zgl-tabs a { padding: 0.35rem 0.8rem; border-radius: 6px; text-decoration: none; color: var(--slate); border: 1px solid var(--line); font-size: 0.88rem; }
.zgl-tabs a.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* --- ksiega zmarlych w kreatorze pochowku --------------------------------------- */
.form-sub { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 1.1rem 0 0.5rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--line); }
.akt-link { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.78rem; color: var(--accent); white-space: nowrap; text-decoration: none; }
.akt-link:hover { text-decoration: underline; }

/* --- przegladanie ksiag: polka i rocznik ---------------------------------------- */
.polka { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; align-items: start; }
.polka-ksiega h2 { display: flex; align-items: center; gap: 0.4rem; }
.polka-zakres { margin: -0.3rem 0 0.7rem; font-size: 0.85rem; }
.roczniki { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.roczniki a { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--ink); transition: border-color 150ms, background 150ms; }
.roczniki a:hover { border-color: var(--accent); background: #F0F7FF; }
.roczniki a b { font-size: 1.05rem; min-width: 3.2em; }
.roczniki a span { color: var(--muted); font-size: 0.85rem; }
.roczniki a .badge { margin-left: auto; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.rocznik th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 500; }
table.rocznik td.nr { font-weight: 600; white-space: nowrap; width: 3em; }
table.rocznik tr.luka td { color: var(--warn); background: var(--warn-bg); font-size: 0.85rem; }

/* --- etap 4: oplaty i cennik ----------------------------------------------------- */
.wplata-anulowana td { color: var(--muted); }
.wplata-anulowana td b { text-decoration: line-through; font-weight: 500; }
.cennik-wylaczona td { color: var(--muted); }
.cennik-form { display: flex; gap: 0.3rem; align-items: center; }
.cennik-form input { padding: 0.3rem 0.45rem; font-size: 0.85rem; }
table.cennik td, table.cennik th { vertical-align: middle; }
