/* =========================================================
   Cloxx dashboard — licht thema, Paxxon-groen accent
   ========================================================= */

:root {
  --accent: #87bd25;           /* Paxxon-groen (te licht voor witte tekst!) */
  --accent-text-dark: #182605; /* tekst óp een groen vlak */
  --accent-deep: #4a6b12;      /* groene tekst op wit/licht (≥ 4.5:1) */
  --accent-hover: #74a41f;     /* hover/active-toestand */
  --accent-soft: #f1f8e2;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1e2430;
  --text-muted: #6b7280;
  --border: #e2e5ea;
  --green: #4a6b12;      /* afgestemd op het merk-groen */
  --green-soft: #eef6d8;
  --grey: #6b7280;
  --grey-soft: #eef0f3;
  --red: #dc2626;
  --red-soft: #fdecea;
  --orange-soft: #fff4e5;
  --warn: #b45309;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(20, 24, 32, 0.08), 0 1px 2px rgba(20, 24, 32, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.accent { color: var(--accent-deep); } /* accent-tekst op wit: donkerder groen */
.spacer { flex: 1 1 auto; }

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  background: var(--grey-soft);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ===== Topbar & tabs ===== */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--surface);
  border-bottom: 3px solid var(--accent);
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.7rem 0;
  white-space: nowrap;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.tab {
  appearance: none;
  border: none;
  background: none;
  font: inherit;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.95rem 0.9rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px; /* over de topbar-rand heen */
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--accent-deep);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

#logout-btn { margin-left: auto; }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem;
}

/* ===== Knoppen ===== */

.btn {
  appearance: none;
  font: inherit;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { background: var(--grey-soft); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text-dark); /* geen witte tekst op het lichte groen */
}

.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover { color: var(--text); background: var(--grey-soft); }

.btn-small {
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ===== Filterbalk & formulieren ===== */

.filterbar {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.filterbar label,
.inline-form label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filterbar label.checklabel {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  padding-bottom: 0.5rem;
}

input[type="date"],
input[type="text"],
input[type="number"],
input[type="password"],
input[type="datetime-local"],
select {
  font: inherit;
  color: var(--text);
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}

input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--accent-deep); /* donkerder groen: zichtbaar op wit */
  outline-offset: 1px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}

.card-narrow { max-width: 480px; }

/* Tussentitel boven een tabel (bv. Devices / Locaties in dezelfde view) */
.section-title {
  margin: 1.25rem 0 0.6rem;
  font-size: 1.05rem;
}

/* Subtiele hint, bv. locatie zonder Bright enterprise-id */
.subtle-hint {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-style: italic;
  font-weight: 400;
  white-space: nowrap;
}

.cards-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stacked-form label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-error {
  color: var(--red);
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}

/* ===== Tabellen ===== */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  max-height: calc(100vh - 240px);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface);
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: #fafbfc; }

td.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty-row td {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
  font-style: italic;
}

/* Onbekende kaart: warme rood/oranje markering */
tr.row-onbekend { background: var(--red-soft); }
tr.row-onbekend:hover { background: #fbdfdb; }
tr.row-onbekend .onbekend-label {
  color: var(--red);
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* Totaalrij in urenoverzicht */
tr.row-total { background: var(--accent-soft); font-weight: 600; }
tr.row-total:hover { background: var(--accent-soft); }
tr.row-total td { border-top: 2px solid var(--accent); }

/* ===== Badges ===== */

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge-in { background: var(--green-soft); color: var(--green); }
.badge-uit { background: var(--grey-soft); color: var(--grey); }
.badge-none { background: var(--grey-soft); color: var(--text-muted); font-weight: 500; }
.badge-warn { background: var(--orange-soft); color: var(--warn); }
.badge-rood { background: var(--red-soft); color: var(--red); }

.warn-text { color: var(--warn); font-size: 0.85rem; }
.rood { color: var(--red); font-weight: 600; }
.oranje { color: var(--warn); font-weight: 600; }

/* ===== Login ===== */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.login-card h1 {
  margin: 0;
  font-size: 1.6rem;
  text-align: center;
}

.login-card p { margin: 0 0 0.8rem; text-align: center; }

.login-card label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ===== Modal ===== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 32, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(20, 24, 32, 0.25);
  padding: 1.5rem;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow: auto;
}

.modal h2 { margin: 0 0 1rem; font-size: 1.15rem; }

.modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.apikey-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--grey-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  margin: 0.75rem 0;
}

.apikey-box code {
  background: none;
  padding: 0;
  font-size: 0.95rem;
  word-break: break-all;
  flex: 1;
}

.apikey-warning {
  background: var(--orange-soft);
  color: var(--warn);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
}

/* ===== Toasts ===== */

.toasts {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 100;
  max-width: 360px;
}

.toast {
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  box-shadow: 0 4px 16px rgba(20, 24, 32, 0.25);
  animation: toast-in 0.18s ease-out;
}

.toast-error { background: var(--red); }
.toast-success { background: var(--green); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Responsief (tablet) ===== */

@media (max-width: 900px) {
  .topbar { gap: 0.5rem; padding: 0 0.75rem; }
  .brand { font-size: 1.1rem; }
  .tab { padding: 0.8rem 0.6rem; font-size: 0.9rem; }
  main { padding: 0.75rem; }
  .cards-2col { grid-template-columns: 1fr; }
  .filterbar { gap: 0.5rem; }
  table { font-size: 0.88rem; }
  thead th, tbody td { padding: 0.45rem 0.55rem; }
}
