:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #687581;
  --line: #dfe5e8;
  --paper: #ffffff;
  --surface: #fbfcfb;
  --background: #f2f4f1;
  --accent: #336FAC;
  --accent-dark: #1f4a78;
  --accent-soft: rgba(51, 111, 172, 0.14);
  --green: #287a65;
  --danger: #c62828;
  --warning: #fff3dc;
  --warning-ink: #7a4e18;
  --radius: 10px;
  --radius-sm: 7px;
  --focus-ring: 0 0 0 3px var(--accent-soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
}

button,
input,
select { font: inherit; }

button { cursor: pointer; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:where(a, summary, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 72px;
}

.unlock-shell { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: var(--background); }
.unlock-card { width: min(460px, 100%); padding: 30px; border: 1px solid rgba(23,33,43,0.08); border-radius: 20px; background: var(--paper); box-shadow: 0 18px 45px rgba(23,33,43,0.1); }
.unlock-card h1 { margin: 0; font-size: 2rem; }
.unlock-card > p:not(.eyebrow) { color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.unlock-card form { margin-top: 24px; }

.hero {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 32px;
  border: 1px solid rgba(23, 33, 43, 0.08);
  border-top: 3px solid var(--accent);
  border-radius: calc(var(--radius) + 8px);
  background: var(--paper);
  box-shadow: 0 9px 30px rgba(23, 33, 43, 0.05);
}

.hero-content { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.hero-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-left: auto;
  align-self: stretch;
  min-width: 160px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero .eyebrow { margin: 0 0 6px; color: var(--accent); }

h1,
h2 { margin: 0; letter-spacing: -0.04em; }

.hero h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1; letter-spacing: -0.03em; }
.hero h1 span { color: var(--accent); }
h1 { font-size: clamp(2.4rem, 5vw, 4.8rem); line-height: 0.95; }
h1 span { color: var(--accent); }
h2 { font-size: 1.3rem; }

.hero-copy {
  max-width: 560px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.nav-wrap { position: relative; }
.main-navigation { display: flex; gap: 6px; margin: 18px 0 0; padding: 6px; border: 1px solid rgba(23,33,43,0.08); border-radius: 12px; background: white; }
.nav-tab { flex: 1; min-height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 0.82rem; font-weight: 750; transition: background 0.15s ease, color 0.15s ease; }
.nav-tab:hover { background: var(--accent-soft); color: var(--ink); }
.nav-tab.is-active { background: var(--accent); color: white; }
.nav-hamburger { display: none; width: 42px; height: 42px; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0; border: 1px solid rgba(23,33,43,0.08); border-radius: 10px; background: white; cursor: pointer; }
.nav-hamburger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink); transition: transform 0.18s ease, opacity 0.18s ease; }
.nav-hamburger.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-hamburger.is-open span:nth-child(2) { opacity: 0; }
.nav-hamburger.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6dd0a5;
  box-shadow: 0 0 0 4px rgba(109,208,165,0.15);
}

.notice {
  padding: 12px 15px;
  border-radius: 12px;
  background: #e6f2ed;
  color: #21604f;
  font-size: 0.88rem;
  line-height: 1.45;
}

.notice-warning {
  background: var(--warning);
  color: var(--warning-ink);
}

.confirm-undo-bar { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 18px; margin: 0 0 16px; }
.confirm-undo-copy { display: flex; flex: 1 1 260px; flex-direction: column; gap: 3px; min-width: 0; }
.confirm-undo-copy strong { font-size: 0.9rem; }
.confirm-undo-bar .muted { font-size: 0.76rem; line-height: 1.45; }
.confirm-undo-picker { display: flex; flex: 0 1 auto; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.confirm-undo-picker-label { color: var(--ink); font-size: 0.78rem; font-weight: 750; white-space: nowrap; }
.confirm-undo-options { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.confirm-undo-options .button { width: auto; }

.global-warning { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 18px 0; }
.global-warning > span { flex: 1; }
.notice-close { flex: 0 0 auto; width: 36px; height: 36px; margin: -7px -8px -7px 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: currentColor; font-size: 1.3rem; line-height: 1; }
.notice-close:hover { background: rgba(23,33,43,0.09); }
.notice-close:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.version-footer {
  margin-top: 32px;
  padding: 12px 0 24px;
  text-align: center;
  font-size: 11px;
  color: var(--muted, #94a3b8);
}

.print-range-root { display: inline-flex; }

.hero-logo {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.08));
  align-self: center;
}

.hero-logo--with-text {
  width: 132px;
  height: auto;
  max-height: 110px;
  align-self: flex-end;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
}

@media (max-width: 860px) {
  .hero-logo { width: 48px; height: 48px; }
  .hero-logo--with-text { width: 110px; max-height: 92px; }
  .hero-right { min-width: 140px; }
}

@media (max-width: 620px) {
  .hero { flex-direction: column; align-items: stretch; padding: 22px; }
  .hero-content { padding-left: 52px; }
  .hero-right {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-left: 0;
    min-width: 0;
    width: 100%;
  }
  .hero-logo--with-text {
    width: 110px;
    height: auto;
    max-height: 76px;
    align-self: center;
    margin-top: 4px;
  }
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.driver-popover {
  font-family: inherit;
  max-width: min(340px, calc(100vw - 32px));
}

.history-report-panel { margin-bottom: 20px; padding: 24px; }

.history-report-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-report-summary::-webkit-details-marker { display: none; }

.history-report-summary h2 {
  margin: 0;
  font-size: 1.05rem;
}

.history-report-summary .muted {
  flex: 1;
  text-align: right;
  min-width: 0;
}

.history-report-summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

details[open] .history-report-summary::after { transform: rotate(225deg); }

.history-report-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.settings-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.settings-summary h2 {
  margin: 0;
  font-size: 1.05rem;
}

.settings-summary .muted {
  flex: 1;
  text-align: right;
  min-width: 0;
}

.settings-summary::after {
  content: '';
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

details[open] .settings-summary::after { transform: rotate(225deg); }

.wrp { position: relative; display: inline-flex; }

.wrp-trigger { gap: 8px; max-width: 260px; }

.wrp-trigger-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wrp-caret { font-size: 10px; opacity: 0.7; }

.rdp-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  width: min(322px, calc(100vw - 48px));
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-sm, 7px);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  font-size: 13px;
}

.rdp-popover.hidden { display: none; }

.rdp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.rdp-header strong {
  font-size: 14px;
  text-transform: capitalize;
}

.rdp-nav {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border, #e2e8f0);
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.rdp-nav:hover { background: var(--accent-soft, rgba(51, 111, 172, 0.14)); }

.rdp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.rdp-weekday {
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted, #94a3b8);
  padding: 4px 0 6px;
}

.rdp-day {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12.5px;
  color: inherit;
  font-variant-numeric: tabular-nums;
  transition: background 0.1s ease;
}

button.rdp-day:not(:disabled):hover {
  box-shadow: inset 0 0 0 1.5px var(--accent, #336fac);
}

.rdp-day.is-out { opacity: 0.3; }
.rdp-day.is-off { opacity: 0.28; }

.rdp-day.is-today span::after {
  content: '';
  display: block;
  width: 4px;
  height: 4px;
  margin: 1px auto 0;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

.rdp-day.is-in,
.rdp-day.is-edge {
  background: var(--accent-soft, rgba(51, 111, 172, 0.16));
  border-radius: 0;
}

.rdp-day.is-edge {
  background: var(--accent, #336fac);
  color: #fff;
}

.rdp-day.is-edge-l { border-radius: 999px 0 0 999px; }
.rdp-day.is-edge-r { border-radius: 0 999px 999px 0; }

.rdp-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border, #e2e8f0);
  font-size: 12px;
  color: var(--muted, #64748b);
}

.program-panel { margin-bottom: 20px; padding: 24px; }
.program-import-form { display: grid; grid-template-columns: minmax(150px, 0.35fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.week-count-field { min-width: 150px; }
.video-tag { color: #c62828; font-weight: 800; white-space: nowrap; }
.required-tag { color: #8a4b00; font-weight: 800; white-space: nowrap; }
.context-tag {
  color: var(--accent, #336FAC);
  font-weight: 800;
  white-space: nowrap;
}
.context-tag[data-tooltip] { cursor: help; }
.context-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--accent, #336FAC);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}
.field--toggle, .setting-toggle { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 400; margin: 10px 0; font-size: 0.85rem; cursor: pointer; user-select: none; }
.field--toggle input, .setting-toggle input { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; border: none; background: transparent; accent-color: var(--accent); cursor: pointer; }
.field--toggle span, .setting-toggle span { font-weight: 400; }
.context-ai-status { margin: 14px 0 6px; font-size: 0.85rem; color: var(--muted); }
.context-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.program-list { margin-top: 24px; }
.program-list-heading { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.program-list-heading .eyebrow { margin: 0; }
.program-collapse { border: 1px solid var(--line); border-radius: 10px; background: white; margin-bottom: 10px; overflow: hidden; }
.program-collapse summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
.program-collapse summary::-webkit-details-marker { display: none; }
.program-collapse summary::before { content: '▸'; color: var(--muted); transition: transform 0.15s ease; }
.program-collapse[open] summary::before { transform: rotate(90deg); }
.program-collapse summary strong { font-size: 0.85rem; }
.program-collapse-bible { font-size: 0.78rem; color: var(--accent-dark); font-weight: 700; }
.program-collapse-songs { font-size: 0.75rem; color: var(--muted); }
.program-event-controls { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.event-check { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--ink); cursor: pointer; user-select: none; }
.event-check input { accent-color: var(--accent); cursor: pointer; }
.event-check:has(input:disabled) { opacity: 0.45; }
.program-co-talk, .program-co-speaker { padding: 5px 8px; font-size: 0.75rem; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); width: 190px; }
.program-collapse .program-result { margin-top: 0; padding: 0 14px 14px; }
.import-button { width: auto; min-width: 160px; }
.import-button:disabled { cursor: wait; opacity: 0.65; }
.library-launch { display: flex; align-items: center; gap: 12px; margin-top: 13px; }
.library-browser { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfb; }
.library-browser-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 0.8rem; }
.library-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 0.8rem; }
.crumb-link { border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; background: white; color: var(--ink); font-size: 0.78rem; font-weight: 700; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease; }
.crumb-link:hover { border-color: var(--accent); background: #f5f8fc; box-shadow: var(--focus-ring); }
.crumb-sep { color: var(--muted); font-weight: 700; }
.crumb-current { padding: 5px 8px; color: var(--muted); font-weight: 600; }
.library-suggestion { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px dashed #b8960b; border-radius: 10px; background: #fdf8e8; color: #6b5309; font-size: 0.82rem; font-weight: 600; animation: suggestion-glow 2.4s ease-in-out infinite; }
@keyframes suggestion-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 150, 11, 0); border-color: #b8960b; }
  50% { box-shadow: 0 0 0 5px rgba(184, 150, 11, 0.16); border-color: #d9b13a; }
}
.library-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.library-item { display: grid; gap: 5px; min-height: 58px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); text-align: left; }
.library-item:hover { border-color: var(--accent); background: #f5f8fc; }
.library-item span { font-size: 0.8rem; font-weight: 750; }
.library-item small { font-size: 0.68rem; }
.library-week-item { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.library-week-item:hover { border-color: var(--accent); background: #fff9f6; }
.library-week-item input { grid-row: 1 / span 2; accent-color: var(--accent); }
.library-week-item span { font-size: 0.8rem; font-weight: 750; }
.library-week-item small { color: var(--muted); font-size: 0.68rem; }
.library-week-item .button { grid-column: 3; grid-row: 1 / span 2; }
.library-selection-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 0.85rem; }
.library-basket { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.library-basket ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.library-basket li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: 0.85rem; }
.library-selection-actions button:disabled { cursor: not-allowed; opacity: 0.5; }
.program-empty { margin-top: 18px; }
.program-result { margin-top: 24px; }
.program-meta { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.program-meta h3 { margin: 0; font-size: 1.35rem; letter-spacing: -0.03em; }
.program-bible { margin: 7px 0 0; color: var(--green); font-weight: 750; }
.song-list { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.program-section { margin-top: 20px; }
.program-section h4 { margin: 0 0 8px; color: var(--accent-dark); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.program-point { padding: 11px 0; border-top: 1px solid var(--line); }
.program-point-title { display: flex; justify-content: space-between; gap: 12px; }
.program-point-title span { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.program-point-title span.video-tag { color: #c62828; font-size: inherit; white-space: nowrap; }
.program-point-type { margin-top: 4px; color: var(--green); font-size: 0.73rem; font-weight: 750; }
.program-point-detail { margin-top: 4px; color: var(--muted); font-size: 0.75rem; line-height: 1.45; }
.source-link { display: inline-block; margin-top: 18px; color: var(--accent-dark); font-size: 0.8rem; font-weight: 750; }
.program-actions { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.program-actions .button { width: auto; }
.schedule-result { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.schedule-conflict { padding: 16px; border: 1px solid #f1d5a7; border-radius: 12px; background: #fffaf0; }
.schedule-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.schedule-heading h3 { margin: 0; font-size: 1.05rem; letter-spacing: -0.02em; }
.schedule-subtitle { margin: 7px 0 0; color: var(--green); font-size: 0.82rem; font-weight: 750; }
.schedule-state { margin-right: 8px; color: var(--green); font-size: 0.72rem; font-weight: 750; text-transform: uppercase; }
.tag-success { background: #e4f1eb; color: #276c59; }
.tag.tag-warning { background: #fdecea; color: #c62828; }
.conflict-list { margin: 0; padding-left: 18px; color: var(--warning-ink); font-size: 0.8rem; line-height: 1.6; }
.conflict-list span { color: #9a7444; }

.eligibility-steps { margin: 10px 0 18px; padding-left: 20px; line-height: 1.7; font-size: 0.85rem; }
.eligibility-steps li { margin-bottom: 6px; }

.eligibility-simulator { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 16px; margin-bottom: 14px; }

.eligibility-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; font-size: 0.75rem; color: var(--muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid var(--line); }
.legend-dot--pass { background: #bfe3cf; border-color: #7fbf9a; }
.legend-dot--fail { background: #f3c4bd; border-color: #e99a90; }
.legend-dot--muted { background: #e9edea; border-color: #d0d8d2; }

/* Drzewo genealogiczne — 4 gałęzie jak w docs/SCHEDULER_ALGORITHM.md */
.eligibility-tree { display: grid; gap: 14px; }
.tree-empty { padding: 16px; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--muted); font-size: 0.85rem; text-align: center; background: #fbfcfb; }
.tree-root { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 4px 16px rgba(23,33,43,0.06); }
.tree-root--pass { border-color: #bfe3cf; background: #f0f8f3; }
.tree-root--fail { border-color: #f3c4bd; background: #fdf2f0; }
.tree-root-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-weight: 800; font-size: 0.9rem; flex: 0 0 auto; }
.tree-root--pass .tree-root-icon { background: #276c59; color: #fff; }
.tree-root--fail .tree-root-icon { background: #c0392b; color: #fff; }
.tree-root-main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.tree-root-main strong { font-size: 0.88rem; }
.tree-root-main small { color: var(--muted); font-size: 0.72rem; }
.tree-root-badge { padding: 6px 10px; border-radius: 999px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.badge--pass { background: #eaf5ef; color: #276c59; border: 1px solid #bfe3cf; }
.badge--fail { background: #fdecea; color: #c0392b; border: 1px solid #f3c4bd; }

/* Gałęzie — linie jak drzewo genealogiczne */
.tree-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; position: relative; }
.tree-branches::before { content: ''; position: absolute; left: 50%; top: -8px; width: 2px; height: 8px; background: var(--line); transform: translateX(-50%); }
.tree-branch { position: relative; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.tree-branch::before { content: ''; position: absolute; left: 50%; top: -8px; width: 2px; height: 8px; background: var(--line); }
.tree-branch--pass { border-color: #cfe3da; }
.tree-branch--fail { border-color: #f3c4bd; background: #fffafa; }
.tree-branch--muted { opacity: 0.72; border-style: dashed; }
.tree-branch-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 0.78rem; font-weight: 800; }
.tree-branch-head.is-fail { color: #c0392b; }
.tree-branch-icon { color: var(--muted); font-size: 0.72rem; }
.tree-branch-title { flex: 1; }
.tree-branch-status { font-size: 0.72rem; }
.tree-leaves { display: grid; gap: 6px; }
.tree-leaf { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 8px; border-radius: var(--radius-sm); font-size: 0.78rem; border: 1px solid transparent; }
.tree-leaf--pass { background: #f0f8f3; border-color: #e0efe6; }
.tree-leaf--fail { background: #fdf2f0; border-color: #f3c4bd; color: #7a2b2b; }
.tree-leaf-name { font-weight: 650; }
.tree-leaf-reason { color: var(--muted); }
.tree-leaf--fail .tree-leaf-reason { color: #9a4a4a; font-weight: 600; }
.tree-leaf-link { margin-left: auto; color: var(--accent); font-size: 0.7rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.tree-leaf-link:hover { text-decoration: underline; }
.tree-footer { margin-top: 4px; font-size: 0.72rem; text-align: center; }

.eligibility-trace { display: grid; gap: 8px; }
.trace-step { padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); font-size: 0.85rem; }
.trace-step--pass { background: #eaf5ef; border-color: #bfe3cf; color: #276c59; }
.trace-step--fail { background: #fdecea; border-color: #f3c4bd; color: #c0392b; }
.trace-step strong { font-weight: 750; }
.trace-step small { display: block; margin-top: 3px; font-weight: 400; }

.explain-conflict-wrap { margin: 8px 0 4px; padding: 10px 12px; background: #fbf6f2; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.explain-conflict .muted { font-size: 0.78rem; }
.explain-conflict-list { margin: 8px 0 0; padding-left: 18px; font-size: 0.8rem; line-height: 1.6; }
.explain-conflict-list li { margin-bottom: 4px; }
.schedule-list { display: grid; gap: 0; }
.schedule-point { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 10px 0 6px; border-bottom: 1px solid var(--line); }
.schedule-point:first-child { margin-top: 0; }
.schedule-point span { color: var(--muted); font-size: 0.75rem; }
.schedule-section-heading { margin-top: 20px; padding: 7px 0; color: var(--accent-dark); border-bottom: 2px solid #eac5b8; font-size: 0.75rem; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; }
.schedule-section-heading:first-child { margin-top: 0; }
.schedule-assignment { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 8px 0 0; font-size: 0.82rem; }
.schedule-assignment span { color: var(--muted); }
.assignment-person { display: flex; align-items: center; gap: 8px; }
.schedule-override { min-height: 36px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); font-size: 0.8rem; }
.locked-label { color: var(--accent-dark); font-size: 0.68rem; }
.schedule-panel { min-width: 0; margin-bottom: 25px; padding: 24px; }
.schedule-grid { width: 100%; min-width: 0; }
.s140-sheet { width: 100%; max-width: 8.5in; min-width: 0; margin: 0 auto; padding: 0.2in; border: 1px solid #aeb4b6; background: #fff; color: #111; font-family: Arial, Helvetica, sans-serif; font-size: 0.72rem; position: relative; overflow: hidden; }
.jw-emblem { fill: var(--accent); }
  .s140-sheet--kongres > :not(.s140-event-band), .s140-sheet--pamiatka > :not(.s140-event-band) { opacity: 0.3; }
  .s140-event-band { position: absolute; left: -12%; right: -12%; top: 50%; height: 0; transform: rotate(-10deg); z-index: 2; }
  .s140-event-line { position: absolute; left: 0; right: 0; top: -1.25px; height: 2.5px; background: var(--accent); }
  .s140-sheet--pamiatka .s140-event-line { background: #A43D3B; }
  .s140-event-chip { position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%); display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 6px; background: #fff; color: var(--accent); border: 1.5px solid var(--accent); border-radius: 999px; padding: 3px 12px; font-weight: 800; font-size: 0.78rem; letter-spacing: 2px; text-transform: uppercase; white-space: nowrap; }
  .s140-sheet--pamiatka .s140-event-chip { color: #A43D3B; border-color: #A43D3B; }
  .s140-sheet--pamiatka .s140-event-chip .jw-emblem path { fill: #A43D3B; }
  .s140-event-chip .jw-emblem { height: 3.15em; width: 3.15em; display: block; overflow: hidden; }
.s140-header { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding-bottom: 9px; border-bottom: 1.5px solid #222; font-size: 0.85rem; }
.s140-header > *,
.s140-line > *,
.s140-info-grid > *,
.s140-point-main > * { min-width: 0; overflow-wrap: anywhere; }
  .s140-header strong { text-align: right; font-weight: 700; }
  .s140-header span { font-weight: 700; }
.s140-info-grid { display: grid; grid-template-columns: 1fr; gap: 15px; padding: 9px 0; border-bottom: 1px solid #777; line-height: 1.45; }
.s140-line { display: grid; grid-template-columns: 45px 1fr 1fr; gap: 8px; min-height: 27px; align-items: center; border-bottom: 1px solid #bfc3c4; }
.s140-time { color: #555; text-align: right; white-space: nowrap; }
.s140-section-header { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 10px; padding: 6px 8px; background: #e5edf0; border-top: 1px solid #6f7d82; border-bottom: 1px solid #6f7d82; font-size: 0.68rem; text-transform: uppercase; }
.s140-section-header span { text-align: center; font-weight: 400; text-transform: none; }
.s140-section-header--skarby { background: rgba(197, 168, 61, 0.20); border-top-color: #c5a83d; border-bottom-color: #c5a83d; }
.s140-section-header--ulepszajmy { background: rgba(164, 61, 59, 0.13); border-top-color: #A43D3B; border-bottom-color: #A43D3B; }
.s140-section-header--christian_life { background: rgba(51, 111, 172, 0.13); border-top-color: #336FAC; border-bottom-color: #336FAC; }
.s140-point-row { display: grid; grid-template-columns: 45px 1fr; gap: 8px; min-height: 34px; padding: 5px 0; border-bottom: 1px solid #c8cccd; position: relative; }
.s140-point-row::before { content: ''; position: absolute; left: -1px; top: 50%; transform: translateY(-50%); width: 5px; height: 5px; border-radius: 50%; background: #c5a83d; }
.s140-point-row--skarby::before { background: #c5a83d; }
.s140-point-row--ulepszajmy::before { background: #A43D3B; }
.s140-point-row--christian_life::before { background: #336FAC; }
.s140-point-row--skarby { background: rgba(197, 168, 61, 0.08); }
.s140-point-row--ulepszajmy { background: rgba(164, 61, 59, 0.055); }
.s140-point-row--christian_life { background: rgba(51, 111, 172, 0.055); }
.s140-point-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 1fr); gap: 8px; align-items: start; }
.s140-point-main > div { color: #555; font-size: 0.67rem; }
.s140-point-main > div span { font-style: italic; }
.s140-point-main > div strong { color: #111; font-weight: 600; }
.s140-people-row { display: flex; flex-wrap: wrap; gap: 14px; }
.s140-people-row:has(> .s140-person-slot:only-child) { justify-content: flex-end; }
.s140-people-row:has(> .s140-person-slot:only-child) .s140-select { min-width: 180px; text-align: right; }
.s140-person-slot { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.s140-person-slot small { font-size: 0.58rem; color: #666; font-style: italic; }
.s140-person-slot .s140-select { min-width: 0; width: 100%; box-sizing: border-box; }
.s140-people-row + .s140-people-row { margin-top: 0; }
.s140-select { min-height: 36px; padding: 5px 6px; border: 1px solid #ccc; border-radius: 5px; background: #f9fafb; color: #111; font-size: 0.72rem; font-family: Arial, Helvetica, sans-serif; }
.s140-person-wrap { display: inline-flex; align-items: center; gap: 4px; }
.s140-unlock { min-height: 32px; padding: 4px 7px; font-size: 0.64rem; }
.s140-title-editor { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; vertical-align: middle; }
.s140-title-view { min-width: 0; }
.s140-title-input { width: min(420px, 100%); min-height: 32px; padding: 4px 6px; border: 1px solid #9aa7af; border-radius: 4px; background: #fffdf7; color: #111; font: inherit; font-weight: 700; }
.s140-title-edit-button { flex: none; min-height: 32px; padding: 4px 7px; font-size: 0.64rem; }

.s140-person-preview { display: inline; font-size: 0.8rem; font-weight: 600; }
.s140-person-print { display: none; }
.s140-mixed-pair { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; margin-top: 3px; font-size: 0.64rem; color: #666; cursor: pointer; user-select: none; }
.s140-mixed-pair .tag { font-size: 0.58rem; padding: 1px 6px; }
.s140-divider { display: none; }
.quick-people-panel { margin: 20px 0; padding: 24px; }
.quick-people-summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; margin-bottom: 0; }
.quick-people-summary::-webkit-details-marker { display: none; }
.quick-people-summary h2 { font-size: 1.05rem; margin: 0; }
.quick-people-summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.15s ease; }
details[open] .quick-people-summary::after { transform: rotate(225deg); }
.quick-people-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.quick-people-grid textarea { width: 100%; min-height: 150px; padding: 10px; resize: vertical; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfb; color: var(--ink); font: inherit; font-size: 0.84rem; line-height: 1.5; }
.quick-people-grid textarea:focus { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent); }
.quick-people-actions { display: flex; align-items: center; gap: 14px; }
.quick-people-actions .button { width: auto; }
.import-copy { margin: -8px 0 18px; color: var(--muted); font-size: 0.84rem; line-height: 1.5; }
.preview-stat { padding: 13px; border-radius: 10px; background: #f4f7f5; }
.preview-stat strong, .preview-stat span { display: block; }
.preview-stat strong { color: var(--green); font-size: 1.4rem; }
.preview-stat span { margin-top: 3px; color: var(--muted); font-size: 0.72rem; }
code { padding: 2px 5px; border-radius: 4px; background: #edf1ef; color: #3d6258; font-size: 0.78rem; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.7fr) minmax(520px, 1.3fr);
  gap: 20px;
  align-items: start;
}

.people-toolbar { display: grid; grid-template-columns: minmax(180px, 1fr) 160px 190px auto; gap: 8px; margin-bottom: 16px; }
.people-toolbar input, .people-toolbar select { min-height: 37px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; color: var(--ink); }
.columns-switch { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #e9edea; }
.columns-switch .button { min-height: 31px; border: none; background: transparent; color: var(--muted); white-space: nowrap; }
.columns-switch .button:hover { background: #f7f9f8; }
.columns-switch .button.is-active { background: var(--ink); color: white; }
.bulk-toolbar { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; overflow: hidden; margin-bottom: 12px; padding: 10px 14px; border-radius: 10px; background: #eef4f0; }
.bulk-toolbar .button { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: center; }
.bulk-count { flex: 0 0 auto; white-space: nowrap; font-size: 0.78rem; font-weight: 700; color: var(--ink); }
.bulk-divider { flex: 0 0 1px; width: 1px; height: 20px; background: var(--line); }
tr.row-selected { background: #f0f7f3; }
tr.row-selected td:first-child { background: #f0f7f3; }
.person-name-button { padding: 0; border: 0; background: transparent; color: var(--ink); font-size: 0.82rem; font-weight: 800; text-align: left; }
.person-name-button:hover { color: var(--accent-dark); text-decoration: underline; }
.checkbox-cell { width: 36px; text-align: center; vertical-align: middle; }
.checkbox-cell input { width: 16px; height: 16px; accent-color: var(--accent); }
.interval-input { width: 68px; min-height: 31px; padding: 5px; border: 1px solid var(--line); border-radius: 7px; text-align: center; }
.empty-view { padding: 32px; }
.plan-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 0.65fr) minmax(0, 2fr);
  align-items: center;
  gap: 16px 20px;
  margin-bottom: 20px;
  padding: 20px 24px;
  border: 1px solid rgba(23,33,43,0.08);
  border-radius: calc(var(--radius) + 8px);
  background: white;
}
.plan-toolbar-title { min-width: 0; }
.plan-toolbar h2 { margin: 0; }
.plan-toolbar-summary { margin: 4px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.plan-toolbar-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 10px 16px; align-items: center; min-width: 0; }
.plan-toolbar-primary,
.plan-toolbar-secondary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.plan-toolbar-secondary { justify-content: flex-end; }
.plan-toolbar-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.plan-toolbar .button { width: auto; min-width: 0; }
.plan-toolbar .button-primary { width: auto; }
.schedule-guide { grid-column: 1 / -1; margin: 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.schedule-guide strong { color: var(--ink); }
.calendar-panel { padding: 24px; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; color: var(--muted); font-size: 0.74rem; }
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 8px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  opacity: 0.92;
}
.legend-item:hover { background: rgba(255, 255, 255, 0.06); }
.legend-item.is-active { border-color: currentColor; opacity: 1; background: rgba(255, 255, 255, 0.08); }
.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex: none;
  display: inline-block;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.legend-swatch.is-planned {
  background: transparent;
  border: 2px dashed #7e8c9a;
}
.calendar-table.has-filter .calendar-mark:not(.is-dimmed) { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5); }
.calendar-table.has-filter .calendar-mark.is-dimmed { opacity: 0.15; }
.calendar-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  max-height: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.calendar-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.calendar-table { min-width: 920px; border-collapse: separate; border-spacing: 0; }
.calendar-table th, .calendar-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calendar-table thead th { position: sticky; top: 0; z-index: 2; padding: 10px; background: #eef2f0; color: var(--ink); text-transform: none; letter-spacing: 0; white-space: nowrap; }
.calendar-table thead th:first-child { left: 0; z-index: 3; min-width: 190px; text-align: left; }
.calendar-table tbody th { position: sticky; left: 0; z-index: 1; min-width: 190px; padding: 8px 10px; background: white; color: var(--ink); font-size: 0.78rem; text-align: left; text-transform: none; letter-spacing: 0; }
.calendar-table tbody th small { display: block; margin-top: 3px; font-size: 0.67rem; font-weight: 400; text-transform: none; }
.calendar-table tbody th .person-interval { display: block; margin-top: 2px; font-size: 0.64rem; font-weight: 600; color: var(--accent); text-transform: none; }
.calendar-cell { width: auto; min-width: 76px; height: 39px; padding: 5px; background: white; text-align: center; vertical-align: middle; }
.week-strip { display: flex; gap: 3px; align-items: stretch; }
.week-slot { flex: 1 0 14px; min-width: 14px; display: flex; flex-direction: column; gap: 3px; justify-content: center; align-items: stretch; min-height: 26px; border-radius: 3px; background: rgba(23, 33, 43, 0.05); }
.calendar-mark { display: flex; flex: 1; min-height: 10px; border-radius: 3px; background: #eef1ef; align-items: center; justify-content: center; touch-action: manipulation; }
.calendar-mark[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; z-index: 4; }
.calendar-mark-icon { width: 12px; height: 12px; flex: none; color: #fff; opacity: 0.95; pointer-events: none; }
.calendar-mark[data-tooltip-icon="ulepszajmy"] .calendar-mark-icon { width: 15px; height: 15px; }
.calendar-mark + .calendar-mark { margin-top: 0; }
.calendar-mark.role-helper { background: #68ff3e; }
.calendar-mark.role-participant { background: #f2a037; }
.calendar-mark.role-reading, .calendar-mark.role-lector { background: #5c83d6; }
.calendar-mark.role-speech { background: #15a7a7; }
.calendar-mark.role-study { background: #df32df; }
.calendar-mark.role-chair { background: #7b4fc0; }
.calendar-mark.role-prayer { background: #aeb8bc; }
.calendar-mark.is-planned { outline: 2px solid var(--ink); outline-offset: -2px; }
.calendar-mark.is-required { box-shadow: inset 0 0 0 2px #8a4b00; }
/* Tydzień kongresu/pamiątki w matrycy — przekreślenie kratki u każdej osoby. */
.week-slot--kongres,
.week-slot--pamiatka {
  position: relative;
  background-color: rgba(123, 79, 192, 0.10);
  background-image: repeating-linear-gradient(45deg, rgba(123, 79, 192, 0.20) 0 5px, transparent 5px 10px);
  box-shadow: inset 0 0 0 1px rgba(123, 79, 192, 0.55);
}
.week-slot--kongres::after,
.week-slot--pamiatka::after {
  content: '';
  position: absolute;
  left: 1px; right: 1px; top: 50%;
  height: 2px;
  background: #7b4fc0;
  transform: translateY(-50%) rotate(-20deg);
  border-radius: 2px;
}
.week-slot--kongres .calendar-mark,
.week-slot--pamiatka .calendar-mark { opacity: 0.4; }
.legend-kongres-swatch { width: 16px; height: 16px; flex: none; min-width: 0; min-height: 0; margin: 0; border-radius: 3px; }
/* Wzory tła dla przemówień (role-speech) rozróżniające sekcje, w której był punkt. */
.calendar-mark.role-speech.speech-pat-skarby {
  background-color: #15a7a7;
  background-image: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.26) 0 2px, transparent 2px 9px);
}
.calendar-mark.role-speech.speech-pat-ulepszajmy {
  background-color: #d4a017;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.28) 1.4px, transparent 1.8px);
  background-size: 8px 8px;
}
.calendar-mark.role-speech.speech-pat-christian_life {
  background-color: #c0392b;
  background-image: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.20) 0 2px, transparent 2px 8px);
}
.panel {
  border: 1px solid rgba(23,33,43,0.08);
  border-radius: calc(var(--radius) + 8px);
  background: var(--paper);
  box-shadow: 0 9px 30px rgba(23,33,43,0.05);
}

.form-panel,
.people-panel,
.rules-panel,
.eligibility-panel,
.settings-panel,
.drive-panel,
.history-report-panel,
.context-panel,
.appearance-panel { padding: 24px; }

.rules-panel,
.eligibility-panel,
.settings-panel,
.drive-panel,
.history-report-panel,
.context-panel,
.appearance-panel { margin-top: 20px; }

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
  margin-bottom: 22px;
}
.panel-heading > * { min-width: 0; }
.panel-heading h2 { overflow-wrap: anywhere; }

.muted,
small { color: var(--muted); }

.muted { font-size: 0.78rem; }

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfb;
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent); }

.field select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23687581' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.color-field { display: inline-flex; align-items: center; gap: 12px; }
.color-field input[type="color"] {
  width: 52px;
  min-height: 38px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfb;
  cursor: pointer;
}
.color-field input[type="color"]:focus-visible { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent); }
.color-field code { font-size: 0.8rem; color: var(--muted); letter-spacing: 0.02em; }

.field input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }

.appearance-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 16px; }
.appearance-actions .button-primary { width: auto; }

.form-grid { display: grid; gap: 12px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.fieldset {
  margin: 20px 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.fieldset legend {
  padding: 0 6px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
}

.check-grid { display: grid; gap: 9px; }

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 500;
}

.check-item input { margin-top: 2px; accent-color: var(--accent); }
.badge { display: inline-block; margin-top: 4px; padding: 2px 7px; border-radius: 4px; font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-baptized { background: #d4edda; color: #155724; }
.badge-unbaptized { background: #f8d7da; color: #721c24; }
.badge-suspended { background: #e2e3e5; color: #383d41; }
.check-item.is-disabled { opacity: 0.42; }
.check-item.is-disabled input { cursor: not-allowed; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 39px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease, color 0.15s ease;
}

.button:hover { border-color: #b6c1c7; background: #f7f9f8; }
.button:focus-visible { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent); }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.button-primary { width: 100%; border-color: var(--accent); background: var(--accent); color: white; }
.button-primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
.button-small { min-height: 31px; padding: 5px 9px; font-size: 0.74rem; }
.button-danger { color: #a23e30; }
.button-danger:hover { border-color: #a23e30; background: #fbeeec; }
.button-ghost { background: transparent; }

.table-wrap { overflow: auto; max-height: 72vh; max-width: 100%; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.table-wrap table { width: 100%; min-width: max-content; border-collapse: collapse; font-size: 0.82rem; }
.col-select { width: 46px; min-width: 46px; max-width: 46px; }
.col-person { width: 240px; min-width: 240px; max-width: 240px; }
.cap-col { width: 46px; min-width: 46px; }
.col-interval { width: 92px; min-width: 92px; }
.col-actions { width: 210px; min-width: 210px; }
.table-scroll-hint { display: none; margin: 8px 0 0; color: var(--muted); font-size: 0.72rem; text-align: center; }
.table-wrap th { padding: 10px 12px; color: var(--muted); font-size: 0.7rem; text-align: left; text-transform: uppercase; letter-spacing: 0.08em; background: #eef2f0; }
.table-wrap thead tr.cap-group-row th { position: sticky; top: 0; z-index: 4; }
.table-wrap thead tr:not(.cap-group-row) th { position: sticky; top: 30px; z-index: 3; }
.table-wrap td { padding: 13px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.table-wrap .checkbox-cell { width: 46px; min-width: 46px; max-width: 46px; box-sizing: border-box; padding-left: 8px; padding-right: 8px; }
.cap-group-row th { background: #eef2f0; }
.cap-group-head { height: 30px; box-sizing: border-box; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.03em; text-align: center; padding: 6px 8px; }
.cap-group-head--skarby { background: rgba(197, 168, 61, 0.32); color: #6b581a; }
.cap-group-head--ulepszajmy { background: rgba(164, 61, 59, 0.22); color: #7a2b29; }
.cap-group-head--christian_life { background: rgba(51, 111, 172, 0.22); color: #1f4a78; }
.table-wrap .cap-group-row th.cap-group-head--skarby { background: rgba(197, 168, 61, 0.32); }
.table-wrap .cap-group-row th.cap-group-head--ulepszajmy { background: rgba(164, 61, 59, 0.22); }
.table-wrap .cap-group-row th.cap-group-head--christian_life { background: rgba(51, 111, 172, 0.22); }
.capability-cell--skarby { background: rgba(197, 168, 61, 0.10); }
.capability-cell--ulepszajmy { background: rgba(164, 61, 59, 0.07); }
.capability-cell--christian_life { background: rgba(51, 111, 172, 0.07); }
.table-wrap td:first-child,
.table-wrap th:first-child { position: sticky; left: 0; z-index: 6; background: #fff; }
.table-wrap th:first-child { z-index: 9; background: #eef2f0; }
.table-wrap td:nth-child(2),
.table-wrap th:nth-child(2) { position: sticky; left: 46px; z-index: 6; background: #fff; box-shadow: 3px 0 6px -6px rgba(23, 33, 43, 0.55); }
.table-wrap thead th:nth-child(2) { z-index: 10; background: #eef2f0; }
.table-wrap thead tr:not(.cap-group-row) th:first-child { z-index: 12; background: #eef2f0; }
.table-wrap thead tr:not(.cap-group-row) th:nth-child(2) { z-index: 13; background: #eef2f0; }
.table-wrap thead tr.cap-group-row th:first-child { position: sticky; left: 0; z-index: 11; background: #eef2f0; }
td small { display: block; margin-top: 4px; font-size: 0.72rem; }
.table-wrap td:nth-child(2) { max-width: 240px; overflow-wrap: anywhere; }
.person-name-button { display: inline-block; max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.table-wrap .badge { white-space: nowrap; }
tr.is-suspended td,
tr.is-suspended .person-name-button { color: #a6adb4; background: #f5f6f7; }
tr.is-suspended .person-name-button:hover { color: #a6adb4; text-decoration: none; }
tr.is-suspended .badge { opacity: 0.55; }
tr.is-suspended td:first-child { background: #f5f6f7; }
tr.is-suspended td:first-child small { color: #a6adb4; }
.actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; white-space: nowrap; }
.count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; margin-left: 5px; border-radius: 50%; background: #edf1ef; color: var(--green); font-size: 0.72rem; vertical-align: middle; }
.tag { display: inline-block; margin: 0 3px 3px 0; padding: 4px 6px; border-radius: 5px; background: #edf1ef; color: #3d6258; font-size: 0.68rem; }
.empty-state { padding: 35px 20px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }

.rules-list { display: grid; gap: 4px; }
.rule-row { display: flex; flex-direction: column; gap: 8px; padding: 11px 0; border-top: 1px solid var(--line); }
.rule-row:first-child { border-top: 0; }
.rule-main { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.rule-row strong,
.rule-row small { display: block; }
.rule-row strong { font-size: 0.85rem; }
.rule-row small { margin-top: 4px; font-size: 0.72rem; }
.rule-controls { display: flex; align-items: end; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.rule-control { display: grid; gap: 4px; color: var(--muted); font-size: 0.65rem; font-weight: 700; }
.rule-control select { max-width: 160px; min-height: 31px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfb; color: var(--ink); font-size: 0.7rem; }
.rule-control input[type="number"] { max-width: 72px; min-height: 31px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfb; color: var(--ink); font-size: 0.7rem; text-align: center; }
.rule-interval { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 2px; }
.rule-interval .interval-field { display: flex; flex: 1; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; text-align: right; }
.rule-interval .interval-label { flex: 1; min-width: 0; font-size: 0.72rem; color: var(--muted); text-align: right; overflow-wrap: anywhere; word-break: break-word; }
.rule-interval input[type="number"] { max-width: 72px; min-height: 31px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfb; color: var(--ink); font-size: 0.7rem; text-align: center; }
.compact-field { max-width: 360px; }
.backup-box { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.backup-box h3 { margin: 0; font-size: 0.95rem; }
.backup-box p { color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.backup-box form { display: grid; gap: 9px; max-width: 520px; }
.backup-box input { min-height: 37px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; }
.backup-actions { display: flex; gap: 8px; }
.secure-local-box { margin-top: 22px; padding: 16px; border: 1px solid #cfe3da; border-radius: 11px; background: #f2f9f5; }
.secure-local-box h3 { margin: 0; font-size: 0.95rem; }
.secure-local-box p { margin: 7px 0 12px; }
.secure-local-box form { display: flex; gap: 8px; }
.secure-local-box input { min-width: 0; flex: 1; min-height: 37px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: white; }

.loading-overlay { position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.88); backdrop-filter: blur(4px); }
.loading-overlay.hidden { display: none; }
.loading-spinner { width: 48px; height: 48px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.loading-text { margin-top: 14px; color: var(--ink); font-size: 0.92rem; font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-overlay { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(23, 33, 43, 0.45); }
.modal-panel { position: relative; width: min(640px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; border-radius: 16px; background: var(--paper); box-shadow: 0 20px 60px rgba(23, 33, 43, 0.25); }

.panel-heading-actions { display: flex; gap: 10px; align-items: center; }

.print-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.print-autofit-toggle { display: flex; gap: 5px; align-items: center; font-size: 11px; color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap; }
.print-autofit-toggle input { cursor: pointer; }

.snapshots-panel { margin-top: 28px; padding: 24px; }
.snapshot-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.snapshot-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.snapshot-meta { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.snapshot-meta strong { overflow-wrap: anywhere; }
.snapshot-meta small { color: var(--muted); font-size: 0.75rem; line-height: 1.45; }
.snapshot-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.s140-person-wrap--conflict { background: #fdecea; border-radius: 4px; outline: 1px solid #ef9a9a; }

.snapshot-preview-overlay { position: fixed; inset: 0; z-index: 9000; overflow-y: auto; padding: 24px; background: rgba(23, 33, 43, 0.6); }
.snapshot-preview-panel { width: min(880px, 100%); margin: 0 auto; padding: 20px; border-radius: 16px; background: var(--paper); box-shadow: 0 20px 60px rgba(23, 33, 43, 0.3); }
.snapshot-preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.snapshot-preview-toolbar > div { display: flex; gap: 8px; }

@media screen and (max-width: 950px) {
  .content-grid { grid-template-columns: 1fr; }

  /* Tablet: najpierw tytuł, potem dwa poziomy narzędzi. */
  .plan-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
  }
  .plan-toolbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 10px;
  }
  .plan-toolbar-primary,
  .plan-toolbar-secondary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }
  .plan-toolbar-status,
  .plan-toolbar-primary #print-range-root { grid-column: 1 / -1; }
  .plan-toolbar-primary .button,
  .plan-toolbar-secondary .button { width: 100%; }
  .plan-toolbar-secondary { justify-content: stretch; }

  .panel-heading { flex-direction: column; }
  .panel-heading-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    align-items: start;
    gap: 8px;
  }
  .panel-heading-actions > * { min-width: 0; }
  .panel-heading-actions .print-actions { min-width: 0; align-items: flex-start; }
  .panel-heading-actions .button { width: 100%; }

  .schedule-panel,
  .schedule-grid,
  .s140-sheet { min-width: 0; max-width: 100%; }
  .s140-point-main { grid-template-columns: 1fr; gap: 8px; }
  .s140-person-slot { min-width: 0; }
  .schedule-override,
  .s140-select { min-height: 36px; }
  .s140-unlock,
  .s140-title-edit-button { min-height: 32px; }
  .s140-mixed-pair { min-height: 32px; }

  .button-small { min-height: 36px; }
  .legend-item { min-height: 36px; padding: 5px 8px; }
  .calendar-person-sort-button { width: 36px; height: 36px; min-height: 36px; }
  .calendar-toolbar { align-items: stretch; }
  .calendar-toolbar-filters,
  .calendar-toolbar-clear { min-width: 0; }
  .calendar-toolbar-clear { width: 100%; align-items: flex-start; flex-direction: column; }
  .calendar-toolbar-clear .button { align-self: flex-start; }
  .history-report-actions { align-items: stretch; }
  .history-report-actions .button { width: auto; }
  .snapshot-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .snapshot-actions .button { width: 100%; }
  .notice-close { width: 36px; height: 36px; }
  .cal-move-hint { white-space: normal; }
}

@media (max-width: 620px) {
  .app-shell { width: min(100% - 24px, 1440px); padding-top: 12px; }
  .hero { align-items: flex-start; flex-direction: column; padding: 22px; }
  .hero-content { padding-left: 52px; }
  .hero-actions { width: 100%; flex-direction: column-reverse; align-items: stretch; }
  .hero-actions .button { width: 100%; }
  .hero-badge { justify-content: center; }
  .nav-hamburger { display: inline-flex; position: absolute; top: 16px; left: 16px; z-index: 2; }
  .main-navigation { display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0; flex-direction: column; margin: 0; padding: 8px; z-index: 40; box-shadow: 0 12px 30px rgba(23,33,43,0.12); overflow: visible; }
  .main-navigation.is-open { display: flex; }
  .nav-tab { min-width: 0; width: 100%; padding: 12px 14px; text-align: left; }
  .form-panel, .people-panel, .rules-panel, .settings-panel { padding: 17px; }
  .drive-panel { padding: 17px; }
  .history-report-panel { padding: 17px; }
  .context-panel { padding: 17px; }
  .appearance-panel { padding: 17px; }
  .schedule-panel { padding: 17px; }
  .calendar-panel { padding: 17px; }
  .two-columns { grid-template-columns: 1fr; }
  .program-import-form { grid-template-columns: 1fr; }
  .import-button { width: 100%; }
  .library-launch { align-items: stretch; flex-direction: column; }
  .library-launch .button { width: 100%; }
  .library-selection-actions { align-items: stretch; flex-direction: column; }
  .library-selection-actions .button, .library-basket .button { width: 100%; }
  .quick-people-grid { grid-template-columns: 1fr; }
  .quick-people-actions { align-items: stretch; flex-direction: column; }
  .quick-people-actions .button { width: 100%; }
  .program-meta { align-items: flex-start; flex-direction: column; }
  .song-list { white-space: normal; }
  .program-actions { align-items: stretch; flex-direction: column; }
  .program-actions .button { width: 100%; }
  .schedule-assignment { grid-template-columns: 1fr; gap: 2px; }
  .schedule-override { width: 100%; }
  .backup-actions { flex-direction: column; }
  .secure-local-box form { align-items: stretch; flex-direction: column; }
  .people-toolbar { grid-template-columns: 1fr; gap: 10px; }
  .people-toolbar .columns-switch { width: 100%; }
  .people-toolbar .columns-switch .button { flex: 1; min-width: 0; padding: 5px 4px; font-size: 0.7rem; }
  .panel-heading { flex-direction: column; gap: 12px; }
  .panel-heading-actions { width: 100%; flex-direction: column; align-items: stretch; }
  .panel-heading-actions .button { width: 100%; }
  .plan-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .plan-toolbar .button { width: 100%; }
  .plan-toolbar-actions { display: grid; grid-template-columns: 1fr; gap: 8px; width: 100%; }
  .confirm-undo-bar { flex-direction: column; align-items: stretch; justify-content: flex-start; }
  .confirm-undo-copy { flex: 0 0 auto; }
  .confirm-undo-picker { width: 100%; flex-direction: column; align-items: stretch; }
  .confirm-undo-picker-label { text-align: left; }
  .confirm-undo-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .confirm-undo-options .button { width: 100%; }
  .rule-row { align-items: stretch; flex-direction: column; }
  .rule-main { flex-direction: column; align-items: stretch; }
  .rule-controls { width: 100%; align-items: stretch; justify-content: flex-start; }
  .rule-interval { flex-direction: column; align-items: stretch; }
  .rule-interval input[type="number"] { max-width: none; }
  .rule-control select { max-width: none; }
  .rule-control input[type="number"] { max-width: none; }
  .snapshot-preview-toolbar { align-items: stretch; flex-direction: column; gap: 10px; }
  .snapshot-preview-toolbar > div { flex-wrap: wrap; justify-content: flex-start; }
  .snapshot-preview-toolbar .print-actions { align-items: stretch; width: 100%; }
  .settings-summary,
  .quick-people-summary,
  .history-report-summary { flex-wrap: wrap; position: relative; padding-right: 20px; }
  .settings-summary .muted,
  .history-report-summary .muted { flex: 1 1 100%; order: 3; margin-top: 4px; text-align: left; white-space: normal; }
  .settings-summary::after,
  .quick-people-summary::after,
  .history-report-summary::after { position: absolute; right: 4px; top: 50%; transform: translateY(-50%) rotate(45deg); }
  details[open] .settings-summary::after,
  details[open] .quick-people-summary::after,
  details[open] .history-report-summary::after { transform: translateY(-50%) rotate(225deg); }
  .table-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; border: 1px solid var(--line); border-radius: 8px; }
  .table-wrap::-webkit-scrollbar { height: 8px; }
  .table-wrap::-webkit-scrollbar-thumb { background: #cbd5d1; border-radius: 4px; }
  .table-wrap::-webkit-scrollbar-track { background: #f2f4f1; }
  .table-wrap table { table-layout: fixed; }
  .table-wrap th { white-space: normal; word-break: break-word; line-height: 1.2; font-size: 0.6rem; }
  .table-wrap td { padding: 8px 6px; font-size: 0.75rem; }
  .cap-group-head { font-size: 0.5rem !important; padding: 4px 2px !important; line-height: 1.1; }
  .table-scroll-hint { display: block !important; margin: 10px 0 8px; font-size: 0.72rem; text-align: center; }
  .col-person { width: 160px !important; min-width: 160px !important; max-width: 160px !important; }
  .col-actions { width: 140px !important; min-width: 140px !important; }
  .cap-col { width: 38px !important; min-width: 38px !important; }
  .col-interval { width: 70px !important; min-width: 70px !important; }
  .actions { gap: 4px; }
  .actions .button { padding: 4px 6px; font-size: 0.7rem; min-height: 28px; }
  .calendar-toolbar-spacer { display: none; }
  .calendar-toolbar-filters,
  .calendar-toolbar-clear { width: 100%; }
  #calendar-search { flex: 1 0 100%; width: 100%; }
  .calendar-scroll { -webkit-overflow-scrolling: touch; }
  .calendar-table { min-width: 332px; width: max-content; table-layout: fixed; }
  .calendar-table thead th { white-space: normal; word-break: break-word; font-size: 0.65rem; padding: 6px 4px; }
  .calendar-table thead th:first-child,
  .calendar-table tbody th { min-width: 110px !important; max-width: 110px !important; width: 110px !important; padding: 6px 6px; font-size: 0.68rem; }
  .calendar-cell { width: auto !important; min-width: 70px !important; max-width: none !important; height: 32px !important; padding: 3px !important; }
  .week-slot { min-height: 20px !important; min-width: 12px !important; }
  .calendar-mark { min-height: 8px !important; }
  .calendar-mark-icon { width: 10px; height: 10px; }
  .calendar-mark[data-tooltip-icon="ulepszajmy"] .calendar-mark-icon { width: 12px; height: 12px; }
  .calendar-legend { gap: 8px; font-size: 0.68rem; flex-wrap: wrap; }
  .s140-point-main { grid-template-columns: 1fr; gap: 8px; }
  .s140-people-row { flex-direction: column; gap: 8px; }
  .s140-people-row:has(> .s140-person-slot:only-child) { justify-content: flex-start; }
  .s140-person-slot .s140-select { text-align: left; }
  .s140-sheet { padding: 12px; }
  .s140-header { grid-template-columns: 1fr; gap: 4px; text-align: center; }
  .s140-header strong { text-align: center; }
  .rdp-popover { left: 50% !important; transform: translateX(-50%); }
}

@media screen and (max-width: 620px) {
  .hero h1 { font-size: clamp(1.55rem, 8vw, 1.8rem); }
  .hero-copy { font-size: 0.88rem; }
  .panel-heading-actions { display: grid; grid-template-columns: 1fr; }
  .plan-toolbar-primary,
  .plan-toolbar-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-toolbar-secondary .button:last-child { grid-column: 1 / -1; }
  .plan-toolbar-primary .button,
  .plan-toolbar-secondary .button { min-height: 42px; white-space: normal; }
  .plan-toolbar .button-primary { width: 100%; }
  .snapshot-row { align-items: stretch; flex-direction: column; }
  .snapshot-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-report-actions { flex-direction: column; align-items: stretch; }
  .history-report-actions .button { width: 100%; }
  .calendar-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .legend-item { width: 100%; justify-content: flex-start; }
  .calendar-toolbar-clear .button,
  .calendar-toolbar-filters .button { width: 100%; }
  .calendar-table { min-width: 332px; width: max-content; }
  .calendar-mark[role="button"] { min-width: 0; }
  .cal-move-hint {
    left: 12px;
    right: 12px;
    bottom: 128px;
    transform: none;
    align-items: flex-start;
    flex-wrap: wrap;
    border-radius: 12px;
  }
  .cal-move-hint button { min-height: 36px; }
  .app-shell { padding-bottom: 132px; }
  .drive-save-float__btn { max-width: 100%; white-space: normal; text-align: center; }
  .drive-save-float__hint { max-width: 100%; white-space: normal; text-align: center; }
}

@media screen and (max-width: 360px) {
  .hero-content { padding-left: 48px; }
  .hero-copy { max-width: 100%; }
}

@media screen and (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
  .calendar-mark.is-moving { animation: none; }
}

@media print {
  @page { size: A4 portrait; margin: 0.2in 1.08in; }
  body { background: white; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .video-tag { display: none !important; }
  .app-shell { width: auto; margin: 0; padding: 0; }
  .hero,
  .global-warning,
  .nav-wrap,
  .main-navigation,
  .program-panel,
  .content-grid,
  .rules-panel,
  .settings-panel,
  .snapshots-panel { display: none !important; }
  .plan-toolbar { display: none !important; }
  .notice { display: none !important; }
  .schedule-grid { display: flex; flex-direction: column; gap: 3px; }
  .schedule-panel { display: block; margin: 0; padding: 0; border: 0; box-shadow: none; }
  .schedule-panel > .panel-heading { display: none !important; }

  /* S-140 sheet: week container with border */
  .s140-sheet {
    max-width: none; margin: 0; padding: 0.03in 0.06in;
    border: 1px solid #ccc; background: #fff; color: #111;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 8.5pt; line-height: 1.05;
    page-break-inside: avoid; break-inside: avoid;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    position: relative; overflow: hidden;
  }

  /* Header bar: dark background with white text */
  .s140-header {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 4px; padding: 2px 6px; margin-bottom: 2px;
    background: #374151 !important; color: #fff !important;
    font-size: 9.5pt; font-weight: 700;
    border-bottom: 0; border-radius: 0;
  }
.s140-header strong { text-align: right; font-weight: 700; }
  .s140-header span { text-align: left; font-weight: 700; }

  /* Info grid: week title + chairman */
  .s140-info-grid { padding: 1px 0; gap: 1px; border-bottom: 0.5px solid #999; line-height: 1.3; }

  /* Time lines (songs, opening/closing) */
  .s140-line { display: grid; grid-template-columns: 40px 1fr 1fr; gap: 3px; min-height: 7px; align-items: center; border-bottom: 0.5px solid #ccc; padding: 0 0; }
  .s140-time { color: #555; font-size: 7.5pt; text-align: right; white-space: nowrap; align-self: center; }

  /* Section headers: different colors per section */
  .s140-section-header {
    margin-top: 0; padding: 1px 5px;
    color: #fff !important;
    font-size: 8pt; font-weight: 700;
    text-transform: uppercase;
    border-top: 0; border-bottom: 0;
    border-radius: 0;
  }
  .s140-section-header--skarby { background: #556b2f !important; }
  .s140-section-header--ulepszajmy { background: #b8960b !important; }
  .s140-section-header--christian_life { background: #a52a2a !important; }
.s140-section-header span { text-align: center; font-weight: 400; text-transform: none; }
.s140-section-header--skarby { background: #556b2f; color: #fff; }
.s140-section-header--ulepszajmy { background: #b8960b; color: #fff; }
.s140-section-header--christian_life { background: #a52a2a; color: #fff; }
.s140-point-row--skarby::before,
.s140-point-row--ulepszajmy::before { background: #c5a83d; }
.s140-point-row--christian_life::before { background: #a52a2a; }

  /* Point rows */
  .s140-point-row {
    display: grid; grid-template-columns: 40px 1fr; gap: 3px;
    min-height: 7px; padding: 0.5px 0;
    border-bottom: 0.5px solid #ccc;
    position: relative;
    align-items: center;
  }
  /* Red bullet dot on the left */
  .s140-point-row::before {
    content: '';
    position: absolute; left: -1px; top: 50%; transform: translateY(-50%);
    width: 4px; height: 4px; border-radius: 50%;
    background: #c5a83d !important;
  }
  /* Red dots for Christian Life section */
  .s140-point-row--christian_life::before {
    background: #a52a2a !important;
  }
  .s140-point-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 1fr); gap: 3px; align-items: center; font-size: 7.5pt; }
  .s140-point-main strong { font-weight: 700; }
  .s140-point-main > div { color: #555; font-size: 7pt; }
  .s140-point-main > div span { font-style: italic; }
  .s140-point-main > div strong { color: #111; font-weight: 600; }

  /* People row */
  .s140-people-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
  .s140-people-row:has(> .s140-person-slot:only-child) { justify-content: flex-end; }
  .s140-person-slot { display: flex; flex-direction: column; gap: 1px; min-width: 80px; flex: 1; }
  .s140-person-slot small { font-size: 6pt; color: #666; font-style: italic; }
  .s140-person-print { font-size: 8pt; font-weight: 600; }

  /* Hide selects, show print names */
  .s140-select { display: none; font-family: Arial, Helvetica, sans-serif; }
  .s140-unlock,
  .s140-title-input,
  .s140-title-edit-button { display: none !important; }
  .s140-title-view[hidden] { display: inline !important; }
  .s140-person-print { display: inline; font-family: Arial, Helvetica, sans-serif; }
  .s140-person-preview { font-size: 8pt; font-weight: 600; }
  .s140-mixed-pair { display: none; }
  .locked-label { display: none; }

  /* Conflict highlighting is screen-only */
  .s140-person-wrap--conflict { background: transparent !important; outline: none !important; }
  /* Komunikaty walidacji („wymaga korekty", „Nie udało się utworzyć…") służą tylko
     do pracy nad grafikiem w przeglądarce — nigdy nie drukujemy ich do PDF. */
  .schedule-conflict, .schedule-result.schedule-conflict { display: none !important; }

  .snapshot-preview-open .main-schedule-grid { display: none !important; }
  .snapshot-preview-overlay { position: static !important; overflow: visible !important; padding: 0 !important; background: none !important; }
  .snapshot-preview-panel { width: auto !important; margin: 0 !important; padding: 0 !important; border-radius: 0 !important; background: none !important; box-shadow: none !important; }
  .snapshot-preview-toolbar { display: none !important; }
  .snapshot-preview-toolbar > div { display: none !important; }

  /* Wydruk mobilny: przeglądarki mobilne potrafią zignorować druk iframe i wydrukować
     całą stronę. Wtedy print.js zakłada html.print-isolate i pokazujemy wyłącznie
     docelowy grafik — bez nawigacji, paneli i przycisków. */
  html.print-isolate #app > *:not(.schedule-grid):not(.snapshot-preview-overlay) { display: none !important; }
  html.print-isolate .snapshot-preview-panel > *:not(.schedule-grid) { display: none !important; }
  html.print-isolate .schedule-grid > .print-skip { display: none !important; }
  html.print-isolate #ui-tooltip,
  html.print-isolate .confirm-overlay,
  html.print-isolate .notice { display: none !important; }

  .schedule-result { margin: 0; padding: 0; border-top: 0; }
  .schedule-heading { display: none; }
  .schedule-point { break-after: avoid; }
  .schedule-assignment { break-inside: avoid; }
  .s140-divider { display: none; }
  .s140-divider svg { display: block; margin: 0 auto; opacity: 0.1; }
}

.ui-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 260px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(23, 33, 43, 0.22);
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.ui-tooltip.is-visible { opacity: 1; transform: translateY(0); transition: opacity 0.16s ease, transform 0.16s ease; }

.ui-tooltip--with-icon { display: flex; gap: 7px; align-items: flex-start; }
.ui-tooltip--with-icon svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.ui-tooltip-text { min-width: 0; }

/* Calendar toolbar + clear-history confirm modal */
.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.calendar-toolbar .calendar-hint { color: var(--muted); font-size: 0.85rem; line-height: 1.4; }
.calendar-toolbar-filters,
.calendar-toolbar-clear { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.calendar-toolbar-spacer { flex: 1 1 24px; }
#calendar-search {
  width: min(280px, 100%);
  min-height: 39px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
  color: var(--ink);
  font: inherit;
}
#calendar-search:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.calendar-no-results { padding: 28px 16px; color: var(--muted); text-align: center; }
.calendar-person-heading { display: inline-flex; align-items: center; gap: 8px; }
.calendar-person-sort-controls { display: inline-flex; align-items: center; gap: 3px; }
.calendar-person-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 1px solid #aab8b4;
  border-radius: 5px;
  background: transparent;
  color: #53645f;
  font: inherit;
  font-size: 0.62rem;
  line-height: 1;
  cursor: pointer;
}
.calendar-person-sort-button:hover,
.calendar-person-sort-button:focus-visible { border-color: var(--accent); color: var(--accent-dark); }
.calendar-person-sort-button.is-active { border-color: var(--accent); background: #dcebf0; color: var(--accent-dark); }
.calendar-table tbody tr.is-suspended { opacity: 0.48; }
.calendar-table tbody tr.is-suspended th { background: #f5f7f6; color: #7c858c; }

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(23, 33, 43, 0.55);
  backdrop-filter: blur(2px);
  animation: confirm-fade 0.16s ease;
}
.confirm-overlay--final { background: rgba(120, 12, 12, 0.62); }

@keyframes confirm-fade { from { opacity: 0; } to { opacity: 1; } }

.confirm-modal {
  width: min(460px, 100%);
  background: #fff;
  border-radius: calc(var(--radius) + 6px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  padding: 24px;
  border-top: 4px solid var(--danger);
}
.confirm-modal h3 { margin: 0 0 8px; font-size: 1.12rem; }
.confirm-modal p { margin: 0 0 10px; color: var(--muted); line-height: 1.55; }
.confirm-modal strong { color: var(--danger); }
.confirm-modal--final { border-top-width: 6px; }
.confirm-modal--final h3 { color: var(--danger); }

.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* Przenoszenie zadań w kalendarzu (prawy-klik na kafelek planowanego tygodnia).
   Kafelek się trzęsie, wolne pola docelowe podświetlają się na zielono,
   najlepsze sugestie dostają odznaki ★1–★3. */
@keyframes cal-shake {
  0%, 100% { transform: rotate(0deg) scale(1.25); }
  25% { transform: rotate(-14deg) scale(1.25); }
  75% { transform: rotate(14deg) scale(1.25); }
}
.calendar-mark.is-moving {
  animation: cal-shake 0.45s ease-in-out infinite;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  cursor: grabbing;
}
.week-slot.is-move-source { outline: 2px dashed var(--accent); outline-offset: -2px; }
.week-slot.is-drop-ok {
  background: rgba(52, 168, 83, 0.22);
  box-shadow: inset 0 0 0 2px rgba(52, 168, 83, 0.75);
  cursor: copy;
  position: relative;
}
.week-slot.is-drop-best::after {
  content: '★' attr(data-suggest);
  position: absolute;
  top: -9px;
  right: -5px;
  z-index: 5;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  color: #3a3000;
  background: #ffd84d;
  border: 1px solid #c99800;
  border-radius: 999px;
  padding: 2px 5px;
  pointer-events: none;
}
.week-slot.is-drop-off { opacity: 0.45; }

/* Lewy-klik na kafelek: podświetlenie tej samej aktywności w całym kalendarzu
   (przyciemnianie reuse z filtra legendy: .has-filter + .is-dimmed). */
.calendar-table .calendar-mark:not(.legend-swatch) { cursor: pointer; }
.calendar-mark.is-picked {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  filter: brightness(1.12);
  position: relative;
  z-index: 2;
}
.calendar-howto { margin: 0 0 12px; font-size: 0.8rem; line-height: 1.55; }
.cal-move-hint {
  position: fixed;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  z-index: 9500;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 24px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(23, 33, 43, 0.92);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}
.cal-move-hint .muted { color: rgba(255, 255, 255, 0.65); }
.cal-move-hint button {
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: #fff;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  cursor: pointer;
}
.cal-move-hint button:hover { background: rgba(255, 255, 255, 0.15); }

/* Ręczny zapis na Dysk Google — pływający żółty przycisk na dole na środku.
   Widoczny tylko gdy Dysk połączony. Zapis lokalny jest automatyczny,
   na Dysk wysyłamy wyłącznie tym przyciskiem (zabezpieczenie przed
   nadpisaniem dobrej kopii popsutymi lokalnie danymi). */
.drive-save-float {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: calc(100vw - 24px);
}
.drive-save-float__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffd84d;
  border: 1px solid #c99800;
  color: #3a3000;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.15s ease;
}
.drive-save-float__btn:hover { background: #ffde6e; }
.drive-save-float__btn:active { transform: scale(0.98); }
.drive-save-float__btn:disabled { opacity: 0.75; cursor: wait; }
.drive-save-float__btn:focus-visible { outline: 2px solid #3a3000; outline-offset: 2px; }
.drive-save-float__btn--ghost {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(23, 33, 43, 0.28);
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 5px 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.drive-save-float__btn--ghost:hover { background: #fff; }
.drive-save-float__btn--ghost:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.drive-save-float__ok {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(23, 33, 43, 0.22);
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  cursor: default;
  white-space: nowrap;
}
.drive-save-float__hint {
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  background: rgba(23, 33, 43, 0.75);
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.app-shell { padding-bottom: 76px; }
@media (max-width: 640px) {
  .drive-save-float { bottom: 10px; }
  .drive-save-float__btn { font-size: 0.74rem; padding: 7px 12px; }
  .drive-save-float__hint { font-size: 0.6rem; }
}
@media print {
  .drive-save-float { display: none; }
  .cal-move-hint { display: none; }
  .app-shell { padding-bottom: 0; }
}
