:root {
  --bg: #0f172a;
  --card: #111827;
  --muted: #9ca3af;
  --text: #e5e7eb;
  --brand: #22d3ee;
  --accent: #2dd4bf;
  --danger: #ef4444;
  --border: #1f2937;
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Noto Sans', 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji'; color:var(--text); background:linear-gradient(180deg, #0b1220 0%, #0f172a 100%); }

.container { width: 1200px; margin: 0 auto; padding: 16px; }

.topbar { background: rgba(17,24,39,.6); border-bottom: 1px solid var(--border); backdrop-filter: blur(6px); position: sticky; top:0; z-index:10; }
.topbar .container { display:flex; align-items:center; gap:16px; }
.brand { font-weight: 700; letter-spacing:.4px; color: var(--brand); }
.topbar nav { margin-left:auto; display:flex; align-items:center; gap:16px; }
.topbar a { color: var(--text); text-decoration:none; opacity:.9; }
.topbar a:hover { opacity:1; }
.welcome { color: var(--muted); margin-right:8px; }

.card { background: linear-gradient(180deg, #111827, #0b1220); border:1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25);}
.card.narrow { max-width: 420px; margin: 40px auto; }

.card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom: 12px; }
.card h1 { margin:0 0 8px 0; font-size: 22px; }
.muted { color: var(--muted); }

.form label { display:block; margin-bottom:12px; }
.form input[type="email"],
.form input[type="password"],
.form input[type="text"],
.form input[type="search"] { width:100%; padding:10px 12px; border-radius:10px; border:1px solid var(--border); background:#0b1220; color:var(--text); }

.btn { display:inline-block; padding:10px 14px; border-radius:10px; border:1px solid var(--border); background: linear-gradient(180deg, var(--brand), var(--accent)); color:#05202a; text-decoration:none; font-weight:600; }
.btn:hover { filter: brightness(1.05); }
.btn-sm { padding:6px 10px; font-size: 14px; }

.alert { padding:10px 12px; border-radius:10px; margin-bottom:12px; }
.alert-danger { background: rgba(239,68,68,.15); border:1px solid rgba(239,68,68,.35); color:#fecaca; }

.table-wrapper { overflow:auto; border:1px solid var(--border); border-radius: 12px; }
.table { width:100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { text-align:left; color: var(--muted); font-weight:600; font-size: 13px; }
.table tbody tr:hover { background: rgba(34,211,238,.08); cursor: pointer; }
.table code { background:#061018; border:1px solid #0b2030; padding:2px 6px; border-radius:6px; }

.table-row-link td:last-child,
.table-row-link .btn { cursor: pointer; }

.actions { display:flex; align-items:center; gap: 8px; }
#tableFilter { width: 300px; }

.pre-scroll { background:#0b1220; border:1px solid var(--border); border-radius:10px; padding:12px; max-height: 420px; overflow:auto; }

/* --- sorteerbare kolommen --- */
th a.sortable {
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
th a.sortable:hover { color: var(--text); }
th a.sortable.active.asc .arrow { opacity: 1; }
th a.sortable.active.desc .arrow { opacity: 1; }
th a.sortable .arrow { opacity: .6; }



.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap:16px; }
@media (max-width: 900px){ .grid-2 { grid-template-columns: 1fr; } }

.status-grid { display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
@media (max-width: 900px){ .status-grid { grid-template-columns: 1fr; } }
.status-card { border:1px solid var(--border); border-radius:12px; padding:12px; background:#0b1220; }
.status-title { color:var(--muted); margin-bottom:6px; font-weight:600; }
.status-pill { display:inline-block; padding:6px 10px; border-radius:999px; font-weight:700; }
.status-pill.pending { background:#1f2937; color:#9ca3af; }
.status-pill.ok { background:#064e3b; color:#a7f3d0; }
.status-pill.bad { background:#4c0519; color:#fecaca; }

.btn-row { display:flex; gap:10px; flex-wrap:wrap; margin-top:12px; }
.btn.btn-outline { background: transparent; border:1px solid var(--brand); color: var(--text); }

.pre-scroll.small { max-height: 200px; }

.swal2-popup ol li { margin:8px 0; }
.swal2-popup ol li.doing { color:#ffd166; }
.swal2-popup ol li.ok    { color:#34d399; }
.swal2-popup ol li.bad   { color:#ef4444; }
.swal2-popup ol li .step-dot { opacity:.9; }


/* Logbalk onderin */
.logbar {
  position: sticky;
  bottom: 0;
  z-index: 9;
  background: #05101a;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 16px;
  padding: 0;
  box-shadow: 0 -8px 24px rgba(0,0,0,.25);
}
.logbar-head {
  padding: 8px 12px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.logpre {
  margin: 0; padding: 10px 12px;
  max-height: 180px; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px; line-height: 1.4;
  white-space: pre-wrap;
}


/* ====== Baselay-out: 100% hoogte ====== */
:root { --logbar-h: 220px; }

html, body { height: 100%; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* main container neemt resterende ruimte in */
main.container { flex: 1 0 auto; }

/* Alleen als er een logbalk is, ruimte onderaan vrijhouden */
body.has-logbar main.container { padding-bottom: var(--logbar-h); }

/* ====== Zoekbalk / dashboard input ====== */
.searchbar {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 360px;
  max-width: 100%;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}
.searchbar .icon {
  position: absolute;
  left: 10px;
  width: 18px; height: 18px;
  opacity: .6;
  pointer-events: none;
}
.searchbar input[type="search"] {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: none;
  background: transparent;
  color: var(--text);
  outline: none;
  border-radius: 12px;
}
.searchbar:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(34,211,238,.12);
}

/* ====== Logbalk vast onderin ====== */
.logbar {
  position: fixed; /* vast aan viewport */
  left: 0; right: 0; bottom: 0;
  z-index: 9;
  background: #05101a;
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(0,0,0,.25);
  height: var(--logbar-h);
  display: flex;
  flex-direction: column;
}

.logbar-head {
  padding: 8px 12px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.logpre {
  margin: 0; padding: 10px 12px;
  flex: 1 1 auto;             /* neemt beschikbare hoogte */
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px; line-height: 1.4;
  white-space: pre-wrap;
}

/* (bestaande status/tafels etc. mogen blijven zoals je die al had) */

/* ——————————————— Detailpagina facelift ——————————————— */
:root {
  --ok: #10b981;      /* emerald-500 */
  --bad: #ef4444;     /* red-500 */
  --pending: #f59e0b; /* amber-500 */
}

.section-sep {
  margin: 16px 0;
  border: 0;
  border-top: 1px solid var(--border);
  opacity: .7;
}

.status-grid { display:grid; grid-template-columns: 1fr 1fr; gap:14px; }
@media (max-width: 900px){ .status-grid { grid-template-columns: 1fr; } }

.status-card {
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background: linear-gradient(180deg,#0c1525,#0a121f);
  box-shadow: 0 10px 25px rgba(0,0,0,.2);
}

.status-title {
  display:flex; align-items:center; gap:8px;
  color:var(--muted); font-weight:700; letter-spacing:.2px; margin-bottom:8px;
}

.status-line {
  display:flex; align-items:center; gap:12px;
  border:1px solid var(--border);
  background:#0b1220; padding:10px 12px; border-radius:12px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}
.status-line .sl-icon { width:22px; height:22px; display:inline-flex; }
.status-line .sl-text { font-weight:700; letter-spacing:.2px; }
.status-line.pending { border-color: rgba(245,158,11,.45); background: rgba(245,158,11,.08); color:#fde68a; }
.status-line.ok      { border-color: rgba(16,185,129,.4);  background: rgba(16,185,129,.08);  color:#a7f3d0; }
.status-line.bad     { border-color: rgba(239,68,68,.45);  background: rgba(239,68,68,.08);  color:#fecaca; }

.details summary { cursor:pointer; color:var(--muted); }
.details[open] summary { color:var(--text); }

.spin { animation: spin 1.1s linear infinite; transform-origin: 50% 50%; }
@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }

/* optioneel: badge in de titel */
.badge {
  padding:2px 8px; border-radius:999px; font-size:12px; font-weight:800;
  background: #0b2030; border:1px solid #113046; color:#8bd5ff;
}

/* voorkom dat lange inhoud de grid oprekt */
.status-grid { width: 100%; }
.status-card,
.status-card .details { min-width: 0; }  /* <<< belangrijk in CSS Grid */

/* details-pane: forceer binnen de 50% kolom te blijven */
.details .pre-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;

  /* laat brede regels scrollen i.p.v. layout oprekken */
  overflow-x: auto;
  overflow-y: auto;

  /* houd JSON netjes; geen hard wrap binnen tokens */
  white-space: pre;          /* behoudt indents/linebreaks */
  word-break: normal;
  overflow-wrap: normal;
}

/* optioneel: als je toch wilt afbreken binnen extreem lange tokens:
.details .pre-scroll { white-space: pre-wrap; word-break: break-all; overflow-wrap: anywhere; }
*/


/* ——— kleine knopvariant ——— */
.btn-xs { padding: 5px 9px; font-size: 12px; border-radius: 8px; }
.status-actions { margin-top: 10px; }

/* ——— fullscreen JSON-modal ——— */
.json-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.json-modal {
  width: 92vw; height: 88vh;
  max-width: 1400px;
  background: linear-gradient(180deg, #101826, #0c1422);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  display: flex; flex-direction: column; overflow: hidden;
}
.json-modal-header {
  padding: 10px 14px; display: flex; gap: 10px; align-items: center;
  border-bottom: 1px solid var(--border);
}
.json-modal-title { font-weight: 800; letter-spacing: .2px; }
.json-modal-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.json-modal-search {
  display: inline-flex; align-items: center; gap: 8px;
  background: #0b1220; border:1px solid var(--border); border-radius: 10px;
  padding: 6px 10px;
}
.json-modal-search input {
  background: transparent; border:0; outline: none; color: var(--text);
  width: 240px;
}

.json-modal-body {
  flex: 1 1 auto; overflow: auto; padding: 12px 14px;
}
.json-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px; line-height: 1.5;
  white-space: pre; /* geen wrap, horizontaal scrollen */
  overflow: auto; padding: 12px;
  border: 1px solid var(--border); border-radius: 12px; background: #07111b;
}
.json-code mark {
  background: #fde68a; color: #111827; padding: 0 1px; border-radius: 2px;
}

/* modal knoppen */
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 10px; font-size: 13px;
}
.btn-ghost:hover { border-color: var(--brand); }

/* Basisgegevens-tabel typografie */
.table {
  font-size: 14px;
  line-height: 1.35;
}

.table th {
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  vertical-align: top;
  padding: 8px 12px;
}

.table td {
  font-weight: 500;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  padding: 8px 12px;
}

.table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  background: rgba(255,255,255,0.04);
  padding: 2px 6px;
  border-radius: 6px;
  word-break: break-all;
}
.badge {
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  background: var(--accent);
  color:#0b1020;
  font-weight:600;
  font-size:12px;
}
/* Links in tabellen wit en zonder underline */
.table a {
  color: #fff;
  text-decoration: none;
}

.table a:hover {
  text-decoration: underline;
  color: var(--brand); /* optioneel: geef bij hover de merk/accentkleur */
}

.sql-form textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  background: #0b1220;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.result-block { margin: 14px 0 24px; }
.result-head { display:flex; flex-direction:column; gap:6px; }
.sql-pre {
  margin:0; padding:10px 12px; border-radius:8px;
  background: #0b1220; border:1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.table-compact td, .table-compact th { padding: 6px 8px; }

/* Tabel-links (zoals mailto) wit en zonder underline */
.table a {
  color: #fff;
  text-decoration: none;
}
.table a:hover,
.table a:focus {
  text-decoration: underline;
}

/* ——— SQL tabs / panes ——— */
.tabs {
  display: inline-flex; gap: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border);
}
.tab {
  background: transparent; border: 1px solid var(--border);
  border-bottom: none; color: var(--text);
  padding: 6px 10px; border-top-left-radius: 8px; border-top-right-radius: 8px;
  opacity: .7; cursor: pointer;
}
.tab.active { opacity: 1; background: #0b1220; }
.tab + .tab { margin-left: -1px; } /* nette naad */

.tabpanes { border:1px solid var(--border); border-radius: 0 8px 8px 8px; background:#0b1220; padding:12px; }
.tabpane { display:none; }
.tabpane.active { display:block; }

/* ——— SQL editor + preview ——— */
.sql-form textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px; line-height: 1.5;
  background: #0b1220; color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 220px;
}

.sql-preview-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.sql-preview {
  margin: 0; padding: 12px;
  background: #0b1220;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px; line-height: 1.5;
  max-height: 360px; overflow: auto;
}

/* ——— Result tables net wat chiquer ——— */
.result-block { margin: 14px 0 24px; }
.result-head { display:flex; flex-direction:column; gap:6px; }
.sql-pre {
  margin:0; padding:10px 12px; border-radius:8px;
  background: #0b1220; border:1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.table-compact { width:100%; border-collapse: collapse; }
.table-compact th, .table-compact td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table-compact tbody tr:nth-child(odd){ background: rgba(255,255,255,.02); }
.table-compact tbody tr:hover { background: rgba(34,211,238,.08); }

/* (reeds aanwezig, maar laten staan voor consistentie) */
.table a { color: #fff; text-decoration: none; }
.table a:hover, .table a:focus { text-decoration: underline; color: var(--brand); }

.editable-edition {
  display: inline-block;
  padding: 2px 6px;
  border: 1px dashed rgba(255,255,255,.25);
  border-radius: 6px;
  cursor: pointer;
}
.editable-edition:hover {
  border-color: var(--brand);
  background: rgba(34,211,238,.08);
}
