/* Bootstrap zet display:block via JS-inline-style bij modal tonen.
   Bij server-side PRG-heropening (PHP) wordt .show class al gezet —
   deze regel vervangt de inline style en voorkomt CSP-blokkering. */
.modal.show { display: block; }

/* Geometrie-iconen in render_tabel — vervangt inline style="color:#1e90ff" */
.geo-icon { color: #1e90ff; }

#mapOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #fff;
}

.geometry-map-canvas {
  width: 100vw;
  height: 100vh;
}

.geometry-map-actions {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1001;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── Energieflow builder ─────────────────────────────────────────────────── */
/* --kae-navbar-height wordt door menu.js op elke pagina ingesteld.
   Energieflow builder hergebruikt dezelfde variabele. */

.energy-builder-shell {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(260px, 340px);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  align-items: stretch;
  overflow: hidden;
}

.energy-builder-page {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--kae-navbar-height, 56px));
  min-height: 0 !important;
  padding-bottom: 0 !important;
  overflow: hidden;
}

.energy-builder-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.energy-builder-sidebar,
.energy-builder-main,
.energy-builder-detail {
  background: #fff;
  border: 1px solid #d8dee4;
  border-radius: 8px;
  padding: 16px;
  min-width: 0;
  min-height: 0;
}

.energy-builder-sidebar,
.energy-builder-detail {
  overflow: auto;
}

.energy-builder-main {
  display: flex;
  flex-direction: column;
  overflow: auto;
  height: 100%;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.energy-builder-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  padding-bottom: 8px;
}

.energy-flow-board {
  display: grid;
  gap: 14px;
  flex: 0 0 auto;
  overflow: visible;
  height: auto;
  min-height: 0;
  padding-right: 4px;
  align-content: start;
}

.energy-flow-section {
  border: 1px solid #d8dee4;
  border-radius: 8px;
  overflow: hidden;
  background: #fbfcfd;
}

.energy-flow-section-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #d8dee4;
  background: #f2f5f8;
}

.energy-step-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.energy-step {
  border: 1px solid #cfd7df;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.energy-step.is-selected {
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.14);
}

.energy-step-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.energy-step-title { font-weight: 700; }

.energy-step-meta {
  color: #5f6b76;
  font-size: 0.875rem;
}

.energy-stream-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.energy-stream-box {
  border: 1px solid #e1e6eb;
  border-radius: 6px;
  padding: 10px;
  background: #fcfcfd;
}

.energy-stream-heading {
  font-size: 0.78rem;
  color: #5f6b76;
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.energy-stream {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  background: #fff;
  padding: 7px 8px;
  margin-top: 6px;
  color: #1f2933;
}

.energy-stream:hover { border-color: #0d6efd; }

.energy-stream.is-open {
  border-color: #b76e00;
  background: #fff8e8;
}

.energy-stream-main {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.energy-stream-link {
  color: #5f6b76;
  font-size: 0.8rem;
  margin-top: 3px;
}

.energy-warning {
  border-left: 3px solid #b76e00;
  background: #fff8e8;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.875rem;
}

@media (max-width: 1100px) {
  .energy-builder-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: auto;
  }
}

/* bijv. in main.css */
.form-dirty .modal-header {
  border-bottom: 3px solid #ffc107;
}


/* Achtergrond */
.bg-app-green {
  background-color: #76B72A !important;
}

/* Body als flex-kolom zodat main exact de resterende viewport vult —
   geen JS of CSS-variabele nodig voor de navbar-hoogte. */
body.bg-app-green {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: 0;
}

/* Main groeit tot de resterende ruimte na de navbar. */
main.bg-app-green {
  flex: 1 0 auto;
  padding-top: 0;
  padding-bottom: 2rem;
}

/* Navbar en submenu's */
.kae-navbar {
  top: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.navbar * {
  position: relative;
  z-index: 1000 !important;
  pointer-events: auto !important;
  /* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); */
}

.dropdown-submenu {
  position: relative;
}

.dropdown-submenu>.dropdown-menu {
  top: 0;
  left: 100%;
  margin-top: -0.25rem;
  margin-left: 0.1rem;
}

.dropdown-submenu>a::after {
  content: "▸";
  float: right;
}

/* Graph container */
.energy-graph-page {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--energy-graph-nav-height, 0px));
  min-height: 0 !important;
  padding-bottom: 0 !important;
  overflow: hidden;
}

.energy-graph-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.energy-graph-shell {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.graph-view {
  position: relative;
  z-index: 10;
  flex: 1 1 auto;
  min-height: 360px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

#network {
  position: absolute;
  inset: 0;
  border: none;
  border-radius: 0.5rem;
  z-index: 1;
}

.password-meter {
  height: .5rem;
  width: 0%;
}

/* ===== Utility: tekst opmaak ===== */
.text-prewrap {
  white-space: pre-wrap;
  word-break: break-word;
}

.text-break-all {
  word-break: break-all;
}

/* ===== Utility: scrollbare containers ===== */
.pre-scrollable-sm {
  max-height: 300px;
  overflow: auto;
}

.pre-scrollable-lg {
  max-height: 32rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.scrollable-20 {
  max-height: 20rem;
  overflow-y: auto;
}

/* ===== Utility: cursor ===== */
.cursor-help {
  cursor: help;
}

/* ===== Utility: avatar cirkel navbar ===== */
.avatar-circle {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(0, 0, 0, .1);
}

/* ===== Utility: vierkante icoknop ===== */
.btn-icon-md {
  width: 2.25rem;
  height: 2.25rem;
}

/* ===== Utility: formulier max-breedte ===== */
.mw-form-sm  { max-width: 400px; }
.mw-form-md  { max-width: 440px; }
.mw-card-md  { max-width: 600px; }

/* ===== Utility: vaste kolombreedte ===== */
.col-w-130 { width: 130px; }

/* ===== Kaartcontainer ===== */
.geometry-map-page {
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100dvh - var(--kae-navbar-height, 80px));
  overflow: hidden;
  background: #cfe7f1;
}

.map-fullpage {
  height: 100%;
  width: 100%;
}

/* ===== Autocomplete suggestiebox ===== */
.suggestion-dropdown {
  display: none;
  position: absolute;
  z-index: 9999;
  max-height: 300px;
  overflow-y: auto;
}

/* ===== Bulk tabel kolombreedtes ===== */
.bulk-col-meter    { width: 24%; }
.bulk-col-prev     { width: 14%; }
.bulk-col-value    { width: 18%; }
.bulk-col-datetime { width: 20%; }

#toolbar {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

#mapOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1056;
  /* boven de modal */
  background: #fff;
}

.disclaimer-text {
    white-space: pre-wrap;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.table th,
.table td {
  vertical-align: middle;
}

.table th.text-center input {
  margin: 0;
}

.table-new-indicator {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  background: #e8f4d9;
  color: #3d6b12;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  vertical-align: middle;
}

/* ===== Rechtenmatrix layout ===== */

.rechten-matrix {
  table-layout: fixed;
}

.rechten-matrix th:nth-child(1),
.rechten-matrix td:nth-child(1) {
  width: 60%;
}

.rechten-matrix th:nth-child(2),
.rechten-matrix td:nth-child(2),
.rechten-matrix th:nth-child(3),
.rechten-matrix td:nth-child(3) {
  width: 20%;
  text-align: center;
}

.rechten-matrix input[type="checkbox"] {
  margin: 0;
  vertical-align: middle;
}

.rechten-matrix thead .small {
  line-height: 1.1;
}

.rechten-matrix-filter-select {
  max-width: 320px;
}

.readonly-field {
  background-color: #f5f5f5 !important;
  color: #555;
  cursor: not-allowed;
}
.readonly-field:focus {
  box-shadow: none;
}

.api-key-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(17, 24, 39, 0.68);
  user-select: text;
}

.api-key-overlay__panel {
  width: min(42rem, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: #ffffff;
  color: #111827;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.35);
  padding: 1.25rem;
}

.api-key-overlay__title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.api-key-overlay__notice {
  margin-bottom: 0.75rem;
  color: #8a5a00;
}

.api-key-overlay__text {
  width: 100%;
  min-height: 7rem;
  max-height: 18rem;
  overflow: auto;
  margin: 0;
  padding: 0.85rem;
  border: 1px solid #9ca3af;
  border-radius: 6px;
  background: #f9fafb;
  color: #111827;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: text;
}

.api-key-overlay__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.modal-readable-tooltip .tooltip-inner {
  text-align: left !important;
  line-height: 1.45;
  white-space: normal;
  width: max-content;
  max-width: min(42rem, calc(100vw - 2rem));
}

.modal-force-open {
  display: block;
}

@media (max-width: 768px) {
  .modal-readable-tooltip .tooltip-inner {
    max-width: calc(100vw - 1.5rem);
  }
}

/* ── Help offcanvas ──────────────────────────────────────────────────────── */
.offcanvas .help-doc-content h1,
.offcanvas .help-doc-content h2,
.offcanvas .help-doc-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.offcanvas .help-doc-content h1:first-child,
.offcanvas .help-doc-content h2:first-child,
.offcanvas .help-doc-content h3:first-child {
  margin-top: 0;
}

.offcanvas .help-doc-content p,
.offcanvas .help-doc-content ul,
.offcanvas .help-doc-content pre {
  margin-bottom: 1rem;
}

.offcanvas .help-doc-content pre {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
}

.offcanvas .help-doc-content h4 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.offcanvas .help-doc-menu-list {
  padding-left: 1.1rem;
  margin-bottom: 0.75rem;
}

.offcanvas .help-doc-menu-list li {
  margin-bottom: 0.25rem;
}

.offcanvas .help-doc-screen-link {
  margin-left: 0.35rem;
  color: #6c757d;
  font-size: 0.85rem;
  white-space: nowrap;
}
