/* Minimal styles for CMS search widget */
.cms-search {
  color: #222;
}
.cms-search .controls2 {
  display: grid;
  grid-template-columns: 120px 1fr 120px 1fr;
  gap: 8px 10px;
  align-items: center;
  margin: 12px 0;
}
.cms-search label {
  font-size: 12px;
  color: #333;
  display: block;
  text-align: right;
  padding-right: 6px;
}
.cms-search input,
.cms-search select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #8a8a8a;
  border-radius: 4px;
  font-size: 14px;
}
.cms-search input.invalid,
.cms-search select.invalid {
  border-color: rgb(228, 8, 46);
}
.cms-search input:focus,
.cms-search select:focus,
.cms-search .btn:focus {
  outline: 3px solid #1e398d;
  outline-offset: 1px;
}
.cms-search .btn {
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid rgb(178, 166, 0);
  background: rgb(178, 166, 0);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}
.cms-search .btn:hover {
  background: rgb(228, 8, 46);
  border-color: rgb(228, 8, 46);
}
.cms-search .btn.secondary {
  border-color: #ddd;
  background: #fff;
  color: #575757;
}
.cms-search .btn.secondary:hover {
  background: #eee;
  border-color: rgb(228, 8, 46);
  color: rgb(228, 8, 46);
}
.cms-search .right {
  justify-self: end;
}
/* Enforce inline-size for action buttons to avoid stretching */
.cms-search .btn,
.cms-results .btn,
.cms-results .btn.secondary,
.cms-results.list .item .right .btn,
.cms-results.grid .card .btn {
  display: inline-flex !important;
  width: auto !important;
  max-width: max-content;
}

.cms-search .toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 4px;
}
.cms-search .instructions {
  margin: 4px 0 6px;
  padding: 8px 10px;
  background: #fafafa;
  border: 1px solid #eee;
  border-left: 4px solid rgb(178, 166, 0);
  border-radius: 4px;
  color: #444;
  font-size: 13px;
}
.cms-search .instructions .mono {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
    monospace;
  background: #f0f0f0;
  border: 1px solid #e6e6e6;
  border-radius: 3px;
  padding: 0 3px;
}
.cms-search .input-wrap {
  position: relative;
}
.cms-search .input-wrap input {
  padding-right: 36px;
}
.cms-search .input-wrap select {
  padding-right: 36px;
}
.cms-search .input-wrap .clear-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
}
.cms-search .input-wrap.date input {
  padding-right: 72px;
}
.cms-search .input-wrap .append-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cms-search .input-wrap.date .clear-btn {
  right: 40px;
}
.cms-search .view-toggle .btn {
  margin-left: 6px;
}
.cms-search .icon-btn {
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  line-height: 0;
  color: #575757;
}
.cms-search .icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.cms-search .view-toggle .icon-btn {
  margin-left: 6px;
}
.cms-search .view-toggle .icon-btn {
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cms-search .icon-btn[aria-pressed='true'] {
  border-color: rgb(178, 166, 0);
  background: #fff;
  color: rgb(178, 166, 0);
}
.cms-search .muted {
  color: #666;
  font-size: 13px;
}

.cms-results {
  margin: 8px 0 24px;
}
.cms-results.list .item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid #eee;
}
.cms-results.list .item {
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
}
.cms-results.list .name {
  font-weight: 600;
}
.cms-results.list .meta {
  color: #555;
  font-size: 13px;
}

.cms-results.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.cms-results.grid .card {
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
}
.cms-results.grid .name {
  font-weight: 600;
  margin-bottom: 4px;
}
.cms-results.grid .meta {
  color: #555;
  font-size: 13px;
}
.cms-results.grid .card .btn {
  align-self: flex-end;
}

/* Ensure grid card frames persist even after view toggles */
.cms-results.grid .card {
  border: 1px solid #ddd !important;
  border-radius: 6px !important;
}
/* Payment info */
.cms-results .payment.valid {
  color: #333;
}
.cms-results .payment.expired {
  color: #b71c1c;
}
.cms-results .payment.unknown {
  color: #666;
}
.cms-results .payment {
  display: inline-flex;
  align-items: center;
}
.cms-results .payment .icon {
  width: 14px;
  height: 14px;
  margin-right: 6px;
  fill: currentColor;
}
/* Cemetery name on a single line */
.cms-results .meta.cemetery {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal (details) */
.cms-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}
.cms-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: auto;
}
.cms-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0 16px;
}
.cms-modal-title {
  margin: 0;
  font-size: 18px;
}
.cms-modal .icon-btn {
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
}
.cms-modal .icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.cms-modal-body {
  padding: 8px 16px 4px;
}
.cms-modal-body .row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  padding: 6px 8px; /* dodany prawy/lewy padding, aby pola nie stykały się z krawędzią */
  border-bottom: 1px solid #f1f1f1;
}
.cms-modal-body .row .label {
  color: #666;
}
.cms-modal-body .row .value {
  color: #222;
  font-weight: 600;
}
.cms-modal-body input[type='text'],
.cms-modal-body input[type='tel'],
.cms-modal-body input[type='email'],
.cms-modal-body select,
.cms-modal-body textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}
.cms-modal-body .row.error .label {
  color: #b71c1c;
}
.cms-modal-body .row.error input,
.cms-modal-body .row.error textarea,
.cms-modal-body .row.error select {
  border-color: #b71c1c;
  border-width: 2px;
}
.cms-modal-body .row.error .value {
  border-left: 2px solid #b71c1c;
  padding-left: 8px;
}
.cms-modal-body .row.hidden {
  display: none;
}
.cms-modal-body .others-list {
  padding: 8px 0 0 4px;
  margin-left: 50px;
}
.cms-modal-body .others-list .other {
  padding: 4px 0;
  border-bottom: 1px dashed #eee;
}
.cms-modal-body .others-list .other .name {
  font-weight: 600;
}
.cms-modal-body .others-list .other .meta {
  color: #666;
  font-size: 13px;
}
.cms-modal-body .payment .icon {
  width: 16px;
  height: 16px;
}
.cms-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px 16px;
}
.cms-modal .close-btn {
  border-color: #ddd;
  background: #fff;
  color: #575757;
}
.cms-modal .close-btn:hover {
  background: #eee;
  border-color: rgb(228, 8, 46);
  color: rgb(228, 8, 46);
}

/* Service report section */
.cms-report {
  border-top: 1px solid #eee;
  margin: 6px 16px 4px;
  padding: 8px 0 0;
}
.cms-report.hidden {
  display: none;
}
.cms-report .rpt-title {
  font-weight: 600;
  margin-bottom: 4px;
}
.cms-report .rpt-hint {
  color: #666;
  font-size: 12px;
  margin-bottom: 8px;
}
.cms-report .rpt-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}
.cms-report .rpt-row .label {
  color: #666;
}
.cms-report input[type='text'],
.cms-report input[type='tel'],
.cms-report input[type='email'],
.cms-report select,
.cms-report textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}
.cms-report textarea {
  resize: vertical;
}
.cms-report .rpt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.cms-report .rpt-status {
  margin-top: 6px;
  font-size: 13px;
  color: #555;
}
.cms-report .rpt-status.ok {
  color: #2e7d32;
}
.cms-report .rpt-status.err {
  color: #b71c1c;
}
.cms-report .rpt-pow {
  font-size: 12px;
  color: #666;
  margin: 4px 0 10px;
}
/* PoW status (w modalu CMS) */
.cms-modal-body .rpt-pow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #666;
}
.cms-modal-body .rpt-pow .icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  flex: 0 0 auto;
}
.cms-modal-body .rpt-pow.ok .icon {
  fill: #2e7d32;
}
.cms-modal-body .rpt-pow.err .icon {
  fill: #b71c1c;
}
.cms-modal-body .rpt-pow .btn {
  padding: 4px 8px;
  font-size: 12px;
}

/* Datepicker */
.cms-datepicker {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  width: 260px;
}
.cms-datepicker .dp-header {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  margin-bottom: 4px;
}
.cms-datepicker .dp-title {
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}
.cms-datepicker .dp-nav {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
}
.cms-datepicker .dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cms-datepicker .dp-w {
  text-align: center;
  font-size: 12px;
  color: #666;
  padding: 2px 0;
}
.cms-datepicker .dp-pad {
  height: 0;
}
.cms-datepicker .dp-day {
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  padding: 4px 0;
  cursor: pointer;
  font-size: 13px;
}
.cms-datepicker .dp-day:hover {
  border-color: rgb(228, 8, 46);
  color: rgb(228, 8, 46);
}
.cms-datepicker .dp-day.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cms-search .error {
  color: #b71c1c;
  font-size: 13px;
  margin: 6px 0;
}
.cms-search .empty {
  color: #666;
  font-size: 13px;
  margin: 10px 0;
}

.cms-search .sr-only {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}
.cms-search .controls2 .full-span {
  grid-column: 1 / -1;
  display: contents;
}
.cms-search .controls2 .submit-wrap {
  grid-column: 4 / 5;
  justify-self: end;
}

@media (max-width: 640px) {
  .cms-search .controls2 {
    grid-template-columns: 100px 1fr;
  }
  .cms-search .controls2 .submit-wrap {
    grid-column: 2 / 3;
  }
}

/* Mobile tweaks */
@media (max-width: 480px) {
  .cms-search .icon-btn {
    width: 36px;
    height: 36px;
  }
  .cms-search .input-wrap .clear-btn,
  .cms-search .input-wrap .append-btn {
    width: 36px;
    height: 34px;
  }
  .cms-datepicker {
    width: calc(100vw - 32px);
    right: 0;
  }
}
.cms-report .rpt-cat {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.cms-report .rpt-cat input {
  margin-top: 3px;
}
/* Kategorię w dialogu (po przeniesieniu do .cms-modal-body) ustaw w jednej linii z checkboxem */
.cms-modal-body .rpt-cat {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.cms-modal-body .rpt-cat input {
  margin-top: 6px;
}
.cms-modal-body .rpt-cat label {
  flex: 1;
}
