:root {
  --cc-green: #1b7a3d;
  --cc-green-dark: #145f2f;
  --cc-green-light: #e8f5ec;
  --cc-green-muted: #3d9a5c;
  --cc-bg: #f4f7f5;
  --cc-card: #ffffff;
  --cc-border: #d4e5da;
  --cc-text: #1a2e22;
  --cc-bottomnav-h: 4.5rem;
  --cc-bottomnav-safe: env(safe-area-inset-bottom, 0px);
  --cc-bottomnav-total-h: calc(var(--cc-bottomnav-h) + var(--cc-bottomnav-safe));
  --cc-submitbar-h: 3.5rem;
  --cc-mobile-chrome-h: calc(var(--cc-bottomnav-total-h) + var(--cc-submitbar-h));
  /* biała przestrzeń nad dolną belką — nic nie może wchodzić pod nav */
  --cc-content-end-gap: 2.75rem;
  --cc-list-scroll-pad: calc(var(--cc-bottomnav-total-h) + var(--cc-content-end-gap));
  --cc-radius: 12px;
  --cc-shadow: 0 2px 12px rgba(27, 122, 61, 0.08);
}

* { box-sizing: border-box; }

body.app-body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--cc-bg);
  color: var(--cc-text);
  min-height: 100dvh;
}

.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }

.app-topbar {
  background: var(--cc-card);
  border-bottom: 1px solid var(--cc-border);
  padding: 0.6rem 1rem;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--cc-shadow);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--cc-green);
}
.app-brand i { font-size: 1.4rem; }
.app-brand small { font-weight: 400; font-size: 0.7rem; }

.app-topnav { display: flex; flex: 1; gap: 0.25rem; flex-wrap: wrap; }
.app-topnav-link {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--cc-text);
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}
.app-topnav-link:hover { background: var(--cc-green-light); color: var(--cc-green-dark); }
.app-topnav-link.active {
  background: var(--cc-green);
  color: #fff;
  font-weight: 600;
}

.app-main { flex: 1; max-width: 1400px; width: 100%; }
.pb-nav-safe {
  padding-bottom: calc(var(--cc-bottomnav-total-h) + var(--cc-content-end-gap));
}
body.page-dodaj .pb-nav-safe,
body.page-szybka-dodaj .pb-nav-safe {
  padding-bottom: calc(var(--cc-mobile-chrome-h) + var(--cc-content-end-gap) + 1.25rem);
}
@media (min-width: 768px) {
  .pb-nav-safe { padding-bottom: 1rem; }
  body.page-dodaj .pb-nav-safe,
  body.page-szybka-dodaj .pb-nav-safe { padding-bottom: 1rem; }
}

@media (max-width: 767.98px) {
  html {
    scroll-padding-bottom: var(--cc-list-scroll-pad);
  }
  body.app-body {
    overscroll-behavior-y: contain;
  }
  .app-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }
  body.page-formularze .app-main.pb-nav-safe,
  body.page-szybka-lista .app-main.pb-nav-safe {
    padding-bottom: var(--cc-list-scroll-pad);
  }
  body.page-formularze.bulk-bar-open .app-main.pb-nav-safe {
    padding-bottom: calc(var(--cc-list-scroll-pad) + 3.25rem);
  }
  /* zawsze biały bufor nad belką — na końcu treści */
  .app-main-end-spacer {
    display: block;
    height: var(--cc-content-end-gap);
    flex-shrink: 0;
    pointer-events: none;
    background: transparent;
  }
}

.app-main-end-spacer { display: none; }
@media (max-width: 767.98px) {
  .app-main-end-spacer { display: block; }
}
.app-bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: var(--cc-bottomnav-h);
  background: var(--cc-card);
  border-top: 1px solid var(--cc-border);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  z-index: 200;
  padding-bottom: var(--cc-bottomnav-safe);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
  touch-action: manipulation;
}
.app-bottomnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  text-decoration: none;
  color: #5a6b60;
  font-size: 0.65rem;
  padding: 0.4rem 0.2rem 0.35rem;
  min-height: var(--cc-bottomnav-h);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.app-bottomnav-item i { font-size: 1.25rem; }
.app-bottomnav-item.active { color: var(--cc-green); font-weight: 600; }

.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(160deg, var(--cc-green-light) 0%, var(--cc-bg) 50%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--cc-card);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
  border: 1px solid var(--cc-border);
  padding: 2rem;
}
.login-card .brand { color: var(--cc-green); font-weight: 700; font-size: 1.25rem; }

.card-cc {
  background: var(--cc-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
}
.card-cc .card-header {
  background: var(--cc-green-light);
  border-bottom: 1px solid var(--cc-border);
  font-weight: 600;
  color: var(--cc-green-dark);
}

.btn-success, .btn-cc-primary {
  --bs-btn-bg: var(--cc-green);
  --bs-btn-border-color: var(--cc-green);
  --bs-btn-hover-bg: var(--cc-green-dark);
  --bs-btn-hover-border-color: var(--cc-green-dark);
}
.btn-outline-success {
  --bs-btn-color: var(--cc-green);
  --bs-btn-border-color: var(--cc-green);
  --bs-btn-hover-bg: var(--cc-green);
}

.form-control:focus, .form-select:focus {
  border-color: var(--cc-green-muted);
  box-shadow: 0 0 0 0.2rem rgba(27, 122, 61, 0.2);
}

.page-title { font-size: 1.35rem; font-weight: 700; color: var(--cc-green-dark); margin-bottom: 0.25rem; }
.page-subtitle { color: #5a6b60; font-size: 0.9rem; margin-bottom: 1rem; }

.filters-bar {
  background: var(--cc-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.status-pills .btn { font-size: 0.8rem; }

/* Tabela formularzy — desktop */
.forms-table-wrap { overflow-x: auto; }
.forms-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.forms-table th {
  background: var(--cc-green);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.65rem 0.5rem;
  white-space: nowrap;
}
.forms-table th:first-child { border-radius: 8px 0 0 0; }
.forms-table th:last-child { border-radius: 0 8px 0 0; }
.forms-table td {
  vertical-align: top;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--cc-border);
  font-size: 0.85rem;
  background: var(--cc-card);
}
.forms-table tr:hover td { background: #fafdfb; }
.forms-table .col-check { width: 36px; text-align: center; }
.forms-table .col-photos { width: 72px; }
.forms-table .col-menu { width: 120px; white-space: nowrap; }

.thumb-stack { display: flex; flex-direction: column; gap: 4px; }
.thumb-stack img {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--cc-border);
  background: #eee;
  display: block;
}
.thumb-clickable {
  cursor: zoom-in;
  border-radius: 6px;
  line-height: 0;
}
.thumb-clickable:focus-visible {
  outline: 2px solid var(--cc-green);
  outline-offset: 2px;
}
.thumb-clickable img { pointer-events: none; }
.thumb-placeholder {
  width: 56px; height: 42px;
  background: var(--cc-green-light);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--cc-green-muted);
  font-size: 0.7rem;
}

.info-block dt, .details-block dt {
  font-weight: 600;
  color: var(--cc-green-dark);
  display: inline;
}
.info-block dd, .details-block dd { display: inline; margin: 0 0 0 0.2rem; }
.info-block dd::after, .details-block dd::after { content: "\A"; white-space: pre; }
.info-block dl, .details-block dl { margin: 0; }

.row-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.row-actions .btn { padding: 0.2rem 0.45rem; font-size: 0.85rem; }

.bulk-bar {
  position: sticky;
  bottom: calc(var(--cc-bottomnav-total-h) + 0.5rem);
  z-index: 175;
  background: var(--cc-green-dark);
  color: #fff;
  border-radius: var(--cc-radius);
  padding: 0.6rem 1rem;
  display: none;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
@media (max-width: 767.98px) {
  .bulk-bar.visible {
    position: fixed;
    left: 0.65rem;
    right: 0.65rem;
    bottom: calc(var(--cc-bottomnav-total-h) + 0.4rem);
    margin: 0;
    z-index: 185;
  }
}
@media (min-width: 768px) {
  .bulk-bar { bottom: 1rem; }
}
.bulk-bar.visible { display: flex; }
.bulk-sum-wrap {
  font-size: 0.85rem;
  padding: 0.15rem 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}
.bulk-sum-wrap #bulk-sum-lines { font-weight: 600; }

.tablica-with-check {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.btn-scroll-top {
  position: fixed;
  right: 0.85rem;
  bottom: calc(var(--cc-bottomnav-total-h) + 0.85rem);
  z-index: 190;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: none;
  background: var(--cc-green);
  color: #fff;
  box-shadow: 0 4px 14px rgba(27, 122, 61, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  padding: 0;
}
.btn-scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.btn-scroll-top:hover { background: var(--cc-green-dark); color: #fff; }
@media (min-width: 768px) {
  .btn-scroll-top { bottom: 1.25rem; }
}

/* Wzorzec — wybór formularza */
.wzorzec-table-wrap { overflow-x: auto; max-height: 50vh; }
.wzorzec-table thead { position: sticky; top: 0; z-index: 2; background: var(--cc-card); }
.wzorzec-filter-row th { padding: 0.35rem; background: var(--cc-green-light); border-bottom: 1px solid var(--cc-border); }
.wzorzec-head-labels th {
  font-size: 0.75rem;
  background: var(--cc-green);
  color: #fff;
  white-space: nowrap;
}
.wzorzec-data-row { cursor: pointer; }
.wzorzec-data-row:hover td { background: var(--cc-green-light); }
.wzorzec-data-row.selected td { background: #c8e6c9; font-weight: 600; }
.wzorzec-mobile-search .form-control { font-size: 1rem; }
.wzorzec-mobile-list { max-height: 45vh; overflow-y: auto; padding: 0.5rem; }
.lift-check-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-height: 2.375rem;
  padding-top: 0.1rem;
}
.lift-check-field .form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  min-height: auto;
}
.lift-check-field .form-check-input {
  float: none;
  margin: 0;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}
.lift-check-field .form-check-label {
  margin: 0;
  padding: 0;
  line-height: 1.25;
  font-weight: 500;
}
.lift-check-hint {
  font-size: 0.72rem;
  line-height: 1.2;
}
.wzorzec-mobile-card {
  display: block;
  width: 100%;
  text-align: left;
  border: 2px solid var(--cc-border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.5rem;
  background: var(--cc-card);
}
.wzorzec-mobile-card.selected { border-color: var(--cc-green); background: var(--cc-green-light); }
.wzorzec-apply-list { display: flex; flex-direction: column; gap: 0.4rem; }
.wzorzec-apply-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: 2px solid var(--cc-border);
  border-radius: 8px;
  cursor: pointer;
  background: var(--cc-card);
}
.wzorzec-apply-item:has(.wzorzec-field-cb:checked) {
  border-color: var(--cc-green);
  background: var(--cc-green-light);
}
.wzorzec-apply-item .form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
}
.wzorzec-apply-item-text { display: flex; flex-direction: column; font-size: 0.9rem; }
.wzorzec-apply-item-text .text-muted { font-size: 0.8rem; }
@media (max-width: 767.98px) {
  .wzorzec-table-wrap { display: none; }
}
@media (min-width: 768px) {
  .wzorzec-mobile-list { display: none !important; }
}

body.page-dodaj .btn-scroll-top {
  left: 0.75rem;
  right: auto;
  bottom: calc(var(--cc-mobile-chrome-h) + 0.4rem + env(safe-area-inset-bottom, 0px));
  z-index: 179;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1rem;
}
@media (min-width: 768px) {
  body.page-dodaj .btn-scroll-top {
    left: auto;
    right: 0.85rem;
    bottom: 1.25rem;
    width: 2.75rem;
    height: 2.75rem;
    z-index: 190;
  }
}

/* Mobile cards */
.forms-mobile-list { display: none; }
@media (max-width: 767.98px) {
  .forms-table-wrap { display: none; }
  .forms-mobile-list {
    display: block;
    padding-bottom: 0.25rem;
  }
  .forms-page-end-spacer {
    display: block;
    height: var(--cc-content-end-gap);
    flex-shrink: 0;
    pointer-events: none;
  }
  body.page-formularze .pagination {
    margin-bottom: 0.5rem;
  }
}
.forms-page-end-spacer { display: none; }
@media (max-width: 767.98px) {
  .forms-page-end-spacer { display: block; }
}.form-mobile-card {
  background: var(--cc-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--cc-shadow);
}
.form-mobile-card.selected { border-color: var(--cc-green); box-shadow: 0 0 0 2px rgba(27,122,61,0.25); }
.form-mobile-card .card-top { display: flex; gap: 0.75rem; }
.form-mobile-card .thumbs { flex-shrink: 0; }

.form-mobile-layout {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.form-mobile-body { flex: 1; min-width: 0; }
.form-mobile-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 0.25rem;
}
.form-mobile-actions .btn,
.form-mobile-actions .form-mobile-action-form .btn {
  width: 2.85rem;
  height: 2.85rem;
  min-width: 2.85rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border-radius: 10px;
}
.form-mobile-actions .form-mobile-action-form {
  display: block;
  margin: 0;
}

.badge-status-aktywny { background: var(--cc-green); }
.badge-status-archiwum { background: #6c757d; }

.status-dd { margin-bottom: 0; }
.status-meta {
  display: block;
  font-size: 0.72rem;
  line-height: 1.35;
  margin-top: 0.25rem;
}
.status-meta .btn-status-history {
  color: var(--cc-green);
  vertical-align: baseline;
  text-decoration: none;
}
.status-meta .btn-status-history:hover { color: var(--cc-green-dark); }

.status-history-item .sh-time { font-weight: 600; color: var(--cc-green-dark); }
.status-history-item .sh-arrow { color: #6c757d; margin: 0 0.25rem; }

.admin-tabs .nav-link { color: var(--cc-green-dark); }
.admin-tabs .nav-link.active { background: var(--cc-green); color: #fff; }

.placeholder-build {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--cc-green-muted);
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}

.lock-banner {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: var(--cc-radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.stat-tile {
  background: var(--cc-green-light);
  border-radius: var(--cc-radius);
  padding: 1rem;
  text-align: center;
}
.stat-tile .num { font-size: 1.75rem; font-weight: 700; color: var(--cc-green-dark); }
.stat-tile .num-sm { font-size: 1.15rem; line-height: 1.25; word-break: break-word; }

/* Pulpit */
.dash-trip-card {
  border: 2px solid var(--cc-green);
  background: linear-gradient(135deg, #e8f5ec 0%, #fff 55%);
}
.dash-trip-code {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--cc-green-dark);
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.dash-recent-card {
  display: block;
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding: 0.75rem;
  background: var(--cc-card);
  color: inherit;
  height: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dash-recent-card:hover {
  border-color: var(--cc-green);
  box-shadow: var(--cc-shadow);
  color: inherit;
}
.dash-recent-thumbs { margin-bottom: 0.5rem; }
.dash-recent-thumbs .thumb-stack { pointer-events: none; }
.dash-recent-meta strong { color: var(--cc-green-dark); }
.dash-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #5a6b60;
  background: #f7faf8;
}
.dash-table td { font-size: 0.9rem; }

.extra-fields { display: none; }
.extra-fields.show { display: block; }

/* Kafelki pól części */
.field-tiles {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.field-tile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 0.65rem 0.85rem;
  border: 2px solid var(--cc-border);
  border-radius: 10px;
  background: var(--cc-card);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.field-tile:has(.field-tile-check:checked) {
  border-color: var(--cc-green);
  background: var(--cc-green-light);
}
.field-tile-check {
  width: 1.65rem;
  height: 1.65rem;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--cc-green);
  cursor: pointer;
}
.field-tile-label {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.3;
}

/* Numer formularza */
.numer-form-box .form-control {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* Modale wolnych numerów */
.number-slots-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.number-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 4.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 2px solid var(--cc-border);
  font-size: 0.8rem;
}
.number-slot-num { font-weight: 700; font-size: 0.95rem; }
.number-slot-label { font-size: 0.65rem; text-transform: uppercase; margin-top: 0.15rem; }
.number-slot-free {
  background: #fff8e1;
  border-color: #ffc107;
  color: #856404;
}
.number-slot-free .number-slot-label { color: #b8860b; font-weight: 700; }
.number-slot-occupied {
  background: var(--cc-green-light);
  border-color: var(--cc-green);
}
.number-slot-gap-arrow {
  color: var(--cc-green-muted);
  font-size: 1.25rem;
  padding: 0 0.15rem;
}

/* Pasek zapisu nad dolnym menu (telefon) */
.form-bottom-spacer {
  flex-shrink: 0;
  min-height: calc(var(--cc-submitbar-h) + 4.5rem);
  height: calc(var(--cc-submitbar-h) + 4.5rem);
}
.form-submit-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--cc-bottomnav-total-h);
  z-index: 200;
  padding: 0.5rem 0.65rem;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  background: var(--cc-card);
  border-top: 1px solid var(--cc-border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}
.form-submit-bar-inner {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
  max-width: 1400px;
  margin: 0 auto;
}
.form-submit-save {
  flex: 3 1 0;
  min-width: 0;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.form-submit-btn.is-pending,
.form-submit-btn.is-pending.btn-secondary {
  background-color: #6c757d;
  border-color: #6c757d;
  color: #fff;
  opacity: 1;
}
.form-submit-btn.is-ready.btn-success {
  background-color: var(--cc-green);
  border-color: var(--cc-green);
}
.form-submit-btn.is-submitting {
  background-color: #6c757d;
  border-color: #6c757d;
  color: #fff;
  opacity: 1;
}
.form-submit-cancel {
  flex: 1 0 0;
  max-width: 4.25rem;
  min-width: 3.25rem;
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1;
  padding: 0;
}
@media (min-width: 768px) {
  .form-bottom-spacer { display: none; }
  .form-submit-bar {
    position: static;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    margin-top: 0.5rem;
  }
}

/* Podgląd zdjęć */
.photo-preview-content {
  background: #111;
  color: #fff;
  border: none;
  display: flex;
  flex-direction: column;
}
.photo-preview-content .modal-header { border-color: #333; flex-shrink: 0; }
.photo-preview-footer {
  border-color: #333;
  flex-shrink: 0;
  background: #1a1a1a;
}
.photo-preview-body {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: #000;
}
.photo-preview-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
@media (max-width: 767.98px) {
  #modalPhotoPreview .modal-dialog {
    margin: 0;
    max-width: 100%;
    height: 100%;
  }
  .photo-preview-content {
    min-height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .photo-preview-body {
    max-height: none;
  }
  .photo-preview-close-btn {
    min-height: 3rem;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
  }
  .photo-preview-footer {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
  }
}
@media (min-width: 768px) {
  .photo-preview-body {
    min-height: 40vh;
    max-height: 75vh;
  }
  .photo-preview-img { max-height: 72vh; }
}

#toast-container { z-index: 9999; }
@media (max-width: 767.98px) {
  #toast-container {
    left: 0.5rem;
    right: 0.5rem;
    bottom: calc(var(--cc-bottomnav-total-h) + 0.5rem);
  }
}

/* ===== Szybka lista ===== */
body.page-szybka-lista:not(.page-szybka-dodaj) .pb-nav-safe {
  padding-bottom: var(--cc-list-scroll-pad);
}
.ql-trip-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.ql-code {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--cc-green-dark);
  letter-spacing: 0.02em;
}
.ql-actions-primary {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
}
.ql-actions-primary .ql-btn-add {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  min-height: 3.5rem;
}
.ql-code-frame {
  flex: 0 0 auto;
  width: 5.5rem;
  min-height: 3.5rem;
  border: 2.5px solid var(--cc-green);
  border-radius: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.35rem;
  box-shadow: 0 0 0 3px rgba(27, 122, 61, 0.12);
}
.ql-code-frame-lg {
  width: 6.25rem;
  min-height: 4.1rem;
}
.ql-code-frame-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--cc-green-dark);
  line-height: 1;
}
.ql-code-frame-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--cc-green);
  line-height: 1.15;
  margin-top: 0.15rem;
  word-break: break-all;
  text-align: center;
}
.ql-code-frame-lg .ql-code-frame-value { font-size: 1.35rem; }
.ql-lookup-row.selected td {
  background: var(--cc-green-light) !important;
  font-weight: 600;
  border-top: 2px solid var(--cc-green) !important;
  border-bottom: 2px solid var(--cc-green) !important;
}
.ql-lookup-row.selected td:first-child {
  border-left: 2px solid var(--cc-green) !important;
  border-radius: 8px 0 0 8px;
}
.ql-lookup-row.selected td:last-child {
  border-right: 2px solid var(--cc-green) !important;
  border-radius: 0 8px 8px 0;
}
.ql-lookup-card {
  display: block;
  width: 100%;
  text-align: left;
  border: 2px solid var(--cc-border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.5rem;
  background: var(--cc-card);
}
.ql-lookup-card.selected {
  border: 3px solid var(--cc-green);
  background: var(--cc-green-light);
  box-shadow: 0 0 0 3px rgba(27, 122, 61, 0.2);
}
.ql-rozbiorka-main {
  border: 2px solid var(--cc-border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  background: var(--cc-card);
  cursor: pointer;
}
.ql-rozbiorka-main:has(.field-tile-check:checked) {
  border-color: var(--cc-green);
  background: var(--cc-green-light);
}
.ql-rozbiorka-tiles {
  max-height: none;
}
.ql-rozbiorka-tiles .field-tile {
  font-size: 0.95rem;
}
.ql-inny-row .field-tile {
  width: 100%;
}
.ql-inny-input-wrap {
  margin-top: 0.35rem;
}
.ql-badge-rozbiorka {
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffecb5;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.ql-badge-incomplete {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  border: 1px solid #000;
  animation: ql-incomplete-blink 1.8s ease-in-out infinite;
}
@keyframes ql-incomplete-blink {
  0%, 100% {
    background: #ff8c00;
    color: #111;
    border-color: #111;
  }
  50% {
    background: #111;
    color: #ff8c00;
    border-color: #ff8c00;
  }
}
.ql-item-incomplete {
  border-color: #ff8c00;
  box-shadow: 0 0 0 1px rgba(255, 140, 0, 0.35);
}
.ql-filters .form-label { font-weight: 600; color: #5a6b60; }
@media (prefers-reduced-motion: reduce) {
  .ql-badge-incomplete { animation: none; background: #ff8c00; color: #111; }
}

.ql-btn-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  font-weight: 700;
  min-height: 3.25rem;
}
.ql-next-code {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 0.15rem 0.55rem;
  font-size: 0.95rem;
}
.ql-item-card {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  background: var(--cc-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding: 0.75rem;
  margin-bottom: 0.65rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--cc-shadow);
}
.ql-item-card:active { background: var(--cc-green-light); }
.ql-item-thumb {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--cc-green-light);
}
.ql-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ql-item-thumb-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cc-green-muted);
  font-size: 1.4rem;
}
.ql-item-body { flex: 1; min-width: 0; }
.ql-item-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.15rem;
}
.ql-item-code { color: var(--cc-green-dark); }
.ql-item-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
}
.ql-item-note, .ql-item-meta {
  font-size: 0.78rem;
  margin-top: 0.2rem;
  line-height: 1.3;
}
.ql-item-chevron {
  align-self: center;
  color: #8aa193;
  font-size: 1.1rem;
}
.ql-history > summary {
  cursor: pointer;
  list-style: none;
}
.ql-history > summary::-webkit-details-marker { display: none; }

.ql-photo-previews {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.ql-photo-preview {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--cc-border);
  background: #eee;
}
.ql-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ql-photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 1.6rem;
  height: 1.6rem;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
}
.ql-add-spacer {
  height: calc(4.75rem + var(--cc-bottomnav-total-h));
}
.ql-add-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--cc-bottomnav-total-h);
  z-index: 180;
  display: flex;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem;
  padding-bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
  background: var(--cc-card);
  border-top: 1px solid var(--cc-border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}
.ql-add-bar .btn { font-weight: 700; min-height: 3rem; }
@media (min-width: 768px) {
  .ql-add-spacer { height: 1rem; }
  .ql-add-bar {
    position: static;
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
    margin-top: 0.5rem;
  }
}
.ql-edit-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.ql-edit-photo {
  width: 88px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--cc-border);
}
.ql-edit-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
body.page-szybka-dodaj .btn-scroll-top {
  bottom: calc(var(--cc-bottomnav-total-h) + 4.5rem);
}

/* Duże litery we wszystkich polach tekstowych (oprócz notatek) */
input.form-control:not([type="password"]):not([type="email"]):not([type="number"]):not([type="file"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="color"]):not([type="date"]):not([type="datetime-local"]):not([type="time"]),
input.form-control[type="text"],
input.form-control[type="search"],
input.form-control[type="tel"],
input.form-control:not([type]) {
  text-transform: uppercase;
}
textarea.form-control:not([name="uwagi"]):not([name="note"]):not(#ql-note):not(.cc-allow-normal-case) {
  text-transform: uppercase;
}
textarea.form-control[name="uwagi"],
textarea.form-control[name="note"],
textarea#ql-note,
.cc-allow-normal-case {
  text-transform: none !important;
}
.login-page input.form-control,
.login-page input[type="text"],
.login-page input[type="password"] {
  text-transform: none !important;
}

/* Kafle zdjęć — formularz Dodaj */
.form-photo-tools { margin-top: 0.25rem; }
.form-photo-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
}
@media (min-width: 576px) {
  .form-photo-tiles { grid-template-columns: repeat(5, 1fr); }
}
.form-photo-tile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-photo-tile-media {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--cc-border);
  background: #e9eee9;
  cursor: pointer;
}
.form-photo-tile-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.form-photo-tile-num {
  position: absolute;
  left: 6px;
  top: 6px;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.form-photo-tile-ok {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  background: #fff;
  color: var(--cc-green);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  z-index: 2;
}
.form-photo-tile.is-ready .form-photo-tile-ok { display: flex; }
.form-photo-tile-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: rgba(255, 255, 255, 0.45);
  z-index: 2;
  overflow: hidden;
}
.form-photo-tile-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--cc-green);
  transition: width 0.2s ease;
}
.form-photo-tile.is-ready .form-photo-tile-bar { display: none; }
.form-photo-tile-remove {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.4rem;
}

/* Walidacja — wyraźne czerwone podświetlenie brakujących pól */
#form-add .is-invalid,
#form-add .form-control.is-invalid,
#form-add .form-select.is-invalid {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
  background-color: #fff5f5;
}

.plate-check-emoji {
  font-size: 1.05em;
  line-height: 1;
}
.plate-check-btns .btn { min-width: 2rem; }
.ql-perm-box {
  max-width: 22rem;
}

