:root {
  --header-bg: #0f2a43;
  --header-fg: #ffffff;
}

body {
  background: #f4f6f9;
}

/* Aanmelden: app volledig verborgen tot er een geldige sessie is. */
body.locked > header,
body.locked > main,
body.locked > footer {
  display: none !important;
}

.login-view {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--header-bg);
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.35);
}

.app-header {
  background: var(--header-bg);
  color: var(--header-fg);
}

.app-header .text-muted {
  color: rgba(255, 255, 255, 0.65) !important;
}

.brandlink {
  color: var(--header-fg);
  text-decoration: none;
}

.brandlink:hover {
  color: #cfe0f2;
}

.navlink {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.9rem;
}

.navlink:hover, .navlink.active {
  color: #fff;
  text-decoration: underline;
}

#dbStatus.ok {
  color: #7dd3a8 !important;
}

#dbStatus.fail {
  color: #f2a3a3 !important;
}

/* zoekresultaten */
.pat-card {
  cursor: pointer;
}

.pat-card:hover {
  border-color: #0d6efd;
  background: #f0f6ff;
}

.pat-photo {
  width: 56px;
  height: 70px;
  object-fit: cover;
  border-radius: 0.375rem;
  background: #dee2e6;
  flex-shrink: 0;
}

.pat-photo-missing {
  width: 56px;
  height: 70px;
  border-radius: 0.375rem;
  background: #dee2e6;
  color: #6c757d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

/* dossierkop */
.dossier-photo {
  width: 120px;
  height: 150px;
  object-fit: cover;
  border-radius: 0.5rem;
  background: #dee2e6;
}

.kv {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0.15rem 0.75rem;
}

.kv dt {
  color: #6c757d;
  font-weight: 500;
}

.kv dd {
  margin-bottom: 0.15rem;
  overflow-wrap: anywhere;
}

.tabcount {
  background: #e9eef4;
  color: #495057;
  font-weight: 600;
}

.nav-link.active .tabcount {
  background: #0d6efd;
  color: #fff;
}

.cancelled {
  text-decoration: line-through;
  color: #6c757d;
}

.card + .card {
  margin-top: 0.75rem;
}

.table td {
  overflow-wrap: anywhere;
}

.msg-full {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 0.75rem;
  max-height: 50vh;
  overflow: auto;
}

.fileicon {
  display: inline-block;
  width: 2rem;
  text-align: center;
  margin-right: 0.5rem;
}

/* thumbnails bij beeldbestanden: max 300px breed of hoog */
.file-thumb {
  max-width: 300px;
  max-height: 300px;
  border-radius: 0.375rem;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
  object-fit: contain;
  flex-shrink: 0;
}

.thumb-btn {
  border: none;
  background: none;
  padding: 0;
  cursor: zoom-in;
  flex-shrink: 0;
}

.dossier-photo[data-lb-src] {
  cursor: zoom-in;
}

/* ---------- ortho-boom ---------- */
.ortho-tree, .ortho-vals {
  list-style: none;
  padding-left: 1.1rem;
}

.ortho-tree > li {
  margin-bottom: 0.25rem;
}

.ortho-tree > li > span {
  font-weight: 600;
}

.ortho-vals li {
  margin-bottom: 0.15rem;
}

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

.cal-head > div {
  text-align: center;
  font-weight: 600;
  color: #6c757d;
  font-size: 0.85rem;
  padding: 0.25rem 0;
}

.cal-day {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  min-height: 86px;
  padding: 0.25rem 0.3rem;
  cursor: pointer;
  overflow: hidden;
}

.cal-day:hover {
  border-color: #0d6efd;
}

.cal-day.other-month {
  background: #f1f3f5;
  color: #adb5bd;
}

.cal-day.today .cal-num {
  background: #0d6efd;
  color: #fff;
  border-radius: 50%;
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  text-align: center;
  line-height: 1.5rem;
}

.cal-day.selected {
  border-color: #0d6efd;
  box-shadow: 0 0 0 1px #0d6efd;
}

.cal-num {
  font-weight: 600;
  font-size: 0.85rem;
}

.cal-chip {
  font-size: 0.72rem;
  line-height: 1.3;
  background: #e7f1ff;
  border-radius: 0.25rem;
  padding: 0 0.25rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-chip.cancelled {
  background: #e9ecef;
  color: #6c757d;
  text-decoration: line-through;
}

.cal-more {
  font-size: 0.72rem;
  color: #6c757d;
}

/* ---------- statistiekbalken ---------- */
.stat-row {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
}

.stat-row .lbl {
  color: #6c757d;
  text-align: right;
}

.stat-row .bar {
  background: #e9ecef;
  border-radius: 0.25rem;
  height: 1.1rem;
  position: relative;
}

.stat-row .bar > span {
  display: block;
  background: #0d6efd;
  border-radius: 0.25rem;
  height: 100%;
  min-width: 2px;
}

.stat-row .val {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- geografische spreiding (kaart + geanimeerde balken) ---------- */
.geo-map {
  height: 420px;
  border-radius: 0.375rem;
  background: #e9ecef;
}

@keyframes geoGrow {
  from { transform: scaleX(0); }
}

.geo-bar-anim > span {
  animation: geoGrow 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-origin: left center;
}

/* ---------- sorteerbare omzet-tabel (alle jaren) ---------- */
#omzetAllTable th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

#omzetAllTable th.sortable:hover {
  color: #0d6efd;
  text-decoration: underline;
}

#omzetAllTable td {
  font-variant-numeric: tabular-nums;
}

/* ---------- modals (bericht + patiëntenlijst) ---------- */
#msgModal, #patModal {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#msgModal.d-none, #patModal.d-none {
  display: none;
}

.pat-dialog {
  max-width: 560px;
}

.pat-list li {
  margin-bottom: 0.3rem;
  break-inside: avoid;
}

.pat-cols-2 { columns: 2; column-gap: 1.5rem; }
.pat-cols-3 { columns: 3; column-gap: 1.5rem; }

.geo-map .leaflet-interactive { cursor: pointer; }

.msg-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-dialog-custom {
  position: relative;
  background: #fff;
  border-radius: 0.5rem;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.4);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #dee2e6;
}

.modal-meta {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #dee2e6;
  background: #f8f9fa;
  font-size: 0.85rem;
}

.modal-body-custom {
  padding: 1rem;
  overflow: auto;
}

.msg-iframe {
  width: 100%;
  height: 55vh;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  background: #fff;
}

/* ---------- lightbox ---------- */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lightbox.d-none {
  display: none;
}

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.lb-figure {
  position: relative;
  margin: 0;
  max-width: 92vw;
  text-align: center;
}

.lb-figure img {
  max-width: 92vw;
  max-height: 82vh;
  border-radius: 0.5rem;
  background: #222;
}

.lb-figure figcaption {
  color: #ddd;
  padding-top: 0.5rem;
  font-size: 0.9rem;
}

.lb-btn {
  position: absolute;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 50%;
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.lb-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lb-close {
  top: 1rem;
  right: 1rem;
}

.lb-prev {
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.lb-next {
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

/* ---------- PWA-toast (installatietip / nieuwe versie) ---------- */
.pwa-toast {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: min(92vw, 480px);
  background: #0f2a43;
  color: #fff;
  border-radius: 0.5rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
}

.pwa-toast .btn {
  flex-shrink: 0;
}

.pwa-toast .pwa-close {
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.25rem;
  cursor: pointer;
}

.pwa-toast .pwa-close:hover {
  color: #fff;
}
