body {
            font-family: Arial, sans-serif;
            padding: 10px 30px 30px;
        }

        h1 { margin: 0 0 10px; }

        .filters {
            border: 1px solid #ccc;
            padding: 10px;
            margin-bottom: 15px;
            font-size: 14px;
        }

        .filters label { display: inline-block; width: 160px; }
        .filters select { width: 320px; }
        .filters input[type="text"] { width: 160px; text-transform: uppercase; }

        #grave, #deceased, #owner { width: 260px; }

        .filters-row { margin-bottom: 8px; }

        .filters label,
        .filter-row label,
        .checkbox label {
            white-space: nowrap;
        }

        .date-wrapper { display: inline-flex; align-items: center; }
        .date-wrapper input[type="text"] { width: 110px; text-transform: none; }
        .date-icon { display: inline-flex; margin-left: 4px; }
        .date-icon button.date-picker-btn { padding: 2px 6px; cursor: pointer; }

        button { padding: 6px 12px; cursor: pointer; margin-right: 5px; }

        #message { margin: 4px 0; font-size: 13px; color: red; min-height: 14px; line-height: 1.2; }
        #message.info { color: #333; }
        #message:empty { display: none; }

        table { border-collapse: collapse; width: 100%; font-size: 12px; }
        th, td { border: 1px solid #ccc; padding: 4px 6px; text-align: left; vertical-align: top; }
        th { background-color: #f0f0f0; cursor: pointer; user-select: none; }
        th.sortable span.sort-indicator { margin-left: 4px; font-size: 10px; }

        .pager { margin-top: 10px; font-size: 12px; }
          .pager button { padding: 4px 8px; }

        .grave-link {
            color: #0b57d0;
            text-decoration: underline;
            cursor: pointer;
        }

        .modal-backdrop {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.55);
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
            z-index: 9999;
        }
        .modal-backdrop.open { display: flex; }

        .modal-card {
            background: #fff;
            width: min(1000px, 96vw);
            max-height: 92vh;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 10px 30px rgba(0,0,0,0.25);
            display: flex;
            flex-direction: column;
        }

        /* Mini modal kad nema slike */
        .modal-card.no-image {
            width: min(520px, 96vw);
            max-height: none;
        }

        .modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 10px 12px;
            border-bottom: 1px solid #e5e5e5;
            background: #fafafa;
            font-size: 13px;
        }
        .modal-header strong { font-size: 13px; }

        .modal-close {
            border: 1px solid #ccc;
            background: #fff;
            border-radius: 6px;
            padding: 4px 10px;
            cursor: pointer;
        }

        .modal-body {
            padding: 10px 12px 14px;
            overflow: auto;
            overflow-x: hidden;
        }
        .modal-status {
            font-size: 12px;
            color: #444;
            margin-bottom: 8px;
            overflow-wrap: anywhere;
            word-break: break-word;
        }

        .grave-img {
            width: 100%;
            max-width: 100%;
            height: auto;
            display: block;
            border: 1px solid #ddd;
            border-radius: 6px;
        }

        /* Sitni “loading” indikator */
        .busy {
            opacity: .65;
            pointer-events: none;
        }
    
        /* --- UX: bez "skakanja" tablice pri brzom učitavanju --- */
        #message { min-height: 18px; } /* rezerviraj prostor i kad je poruka prazna */

        .results-wrap { position: relative; }

        .loading-overlay{
            position: fixed;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(255,255,255,0);
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transition: opacity 140ms ease, visibility 0s linear 140ms;
            z-index: 9999;
        }

        .loading-overlay.open{
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
            background: rgba(255,255,255,0.35);
            transition: opacity 140ms ease;
        }

        /* glatka zamjena podataka bez treperenja */
        #results-body { transition: opacity 120ms ease; }
        #results-body.is-updating { opacity: 0.35; }

        .loading-box{
            background:#fff;
            border: 1px solid #ddd;
            border-radius: 12px;
            padding: 14px 18px;
            box-shadow: 0 6px 18px rgba(0,0,0,0.08);
            display: flex;
            align-items: center;
            gap: 10px;
            font-weight: 600;
        }
        .spinner{
            width:18px;
            height:18px;
            border:2px solid #bbb;
            border-top-color:#333;
            border-radius:50%;
            animation: spin 0.8s linear infinite;
        }
        @keyframes spin { to { transform: rotate(360deg); } }

    
        /* --- Smooth updates: keep table, show overlay --- */
        #resultsWrap.loading table { opacity: 0.6; transition: opacity 120ms ease; }
        #resultsWrap.loading { position: relative; }

/* --- Inline-style replacements --- */
.inline-label {
  margin-left: 10px;
  width: auto;
}
.between {
  margin: 0 5px;
}

/* --- Responsive improvements --- */
.results-wrap {
  overflow-x: auto;
}

@media (max-width: 900px) {
  body { padding: 10px 14px 24px; }
  .filters label { width: auto; display: block; margin-bottom: 4px; }
  .filters select,
  .filters input[type="text"],
  #grave, #deceased, #owner { width: 100%; max-width: 100%; }
  .filters-row { margin-bottom: 12px; }
  .results-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .results-wrap table { min-width: 760px; }
  .results-cards { display: none; }
  .pager button { width: 100%; max-width: 360px; margin: 6px 0 0; }
}

@media (max-width: 520px) {
  h1 { font-size: 18px; }
  .modal-header strong { font-size: 12px; }
  .modal-close { padding: 6px 10px; }
}


.grave-img[hidden] { display: none; }

body.modal-open { overflow: hidden; }

/* --- Mobile card results --- */
.results-cards { display: none; margin-top: 10px; }
.result-card {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.result-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 8px;
}
.result-card-cemetery { font-weight: 700; font-size: 13px; }
.result-card-grave { font-weight: 700; font-size: 13px; }
.result-card-body { display: grid; gap: 8px; }
.card-field { display: grid; grid-template-columns: 120px 1fr; gap: 8px; }
.card-label { font-size: 12px; color: #444; font-weight: 700; }
.card-value { font-size: 12px; color: #111; }

/* --- Layout for filter rows (desktop) --- */
@media (min-width: 901px) {
  .filters-row{
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }
  .filters-row > label:first-child{
    min-width: 185px;
  }
}

/* --- Date range row: keep label close to inputs --- */
.date-range-row{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.date-range-row > label{
  width: auto;
  min-width: unset;
  display: inline-block;
  margin-right: 2px;
}
.date-range-row .between{ margin: 0 4px; }

/* --- Actions row (buttons) --- */
.filters-actions{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filters-actions > label{
  width: auto;
  min-width: unset;
}
.filters-actions button{ margin-right: 0; }

/* Small screens: keep both buttons in one row */
@media (max-width: 450px) {
  .filters-actions{ flex-wrap: nowrap; }
  .filters-actions > label{ display: none; }
  .filters-actions button{
    flex: 1 1 0;
    white-space: normal;
  }
}

/* Ensure results table is never hidden on mobile */
#resultsWrap table{ display: table !important; }

/* Hint "ⓘ"  */
.hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: rgba(80, 170, 255, 0.18); /* svijetlo plava podloga */
    color: #2f7edb; /* plava ikona */

    font-weight: 700;
    font-size: 0.85em;
    line-height: 1;
    cursor: help;
    user-select: none;
}

    .hint:hover,
    .hint:focus {
        background: rgba(80, 170, 255, 0.28);
        color: #1f66c2;
        outline: none;
    }

/* Placeholder  */
input::placeholder {
    opacity: 0.55;
}

/* Hover thumbnail tooltip for grave images */
.grave-thumb-tooltip{
  position: fixed;
  width: 160px;
  height: 160px;
  z-index: 9999;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  pointer-events: none;
}

.grave-thumb-tooltip img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
