/* === PIN gate === */
.pin-gate {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #f5f5f0 0%, #e8efe9 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.pin-box {
  background: #fff;
  padding: 32px 36px;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  width: 320px;
  text-align: center;
}
.pin-brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.pin-dot { color: #0b6e3f; }
.pin-subtitle { font-size: 12px; color: #6b6b6b; margin-bottom: 20px; }
#pinInput {
  width: 100%;
  padding: 12px;
  font-size: 22px;
  text-align: center;
  letter-spacing: 0.4em;
  border: 1px solid #d4d4d0;
  border-radius: 8px;
  font-family: ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  background: #fafaf8;
}
#pinInput:focus { outline: 2px solid #0b6e3f; outline-offset: 1px; border-color: #0b6e3f; }
.pin-btn {
  width: 100%;
  padding: 11px;
  margin-top: 14px;
  background: #0b6e3f;
  color: white;
  border: 0;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.pin-btn:hover { background: #095a32; }
.pin-error {
  margin-top: 10px;
  color: #b91c1c;
  font-size: 12px;
  min-height: 16px;
}
.shake { animation: shake 0.35s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-6px); }
  40%,80% { transform: translateX(6px); }
}

/* === LGGM Sluitingstijd-dashboard === */
:root {
  --bg: #fafaf8;
  --panel: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e3e3e3;
  --accent: #0b6e3f;
  --accent-light: #cfe3d8;
  --warn: #a85b00;
  --warn-bg: #fff7eb;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --pos: #15803d;
  --pos-bg: #eaf5ee;
  --orange: #ea580c;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: -apple-system, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.app { display: grid; grid-template-columns: 320px 1fr; min-height: 100vh; }
aside.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 18px 24px;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
}
main.content { padding: 18px 24px 64px; max-width: 1400px; }

/* === Sidebar === */
.brand {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.brand .dot { color: var(--accent); }
.subtitle { font-size: 11px; color: var(--muted); margin-bottom: 18px; }
.filter-group { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.filter-group:last-of-type { border-bottom: none; }
.filter-group h4 {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}
.filter-row { margin-bottom: 8px; }
.filter-row label {
  display: block;
  font-size: 12px;
  color: var(--ink);
  margin-bottom: 3px;
}
.filter-row input[type="range"] { width: 100%; }
.filter-row .value {
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.filter-row input[type="date"],
.filter-row input[type="number"],
.filter-row select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  font-size: 12px;
  color: var(--ink);
}
.weekday-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.weekday-grid label {
  text-align: center;
  padding: 6px 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  background: var(--bg);
  user-select: none;
}
.weekday-grid label.active { background: var(--accent); color: white; border-color: var(--accent); }
.weekday-grid input { display: none; }
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 4px 0;
}
.toggle-row input[type="checkbox"] { transform: scale(1.1); cursor: pointer; }
.preset-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.preset-row button {
  flex: 1;
  padding: 4px 6px;
  font-size: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink);
}
.preset-row button:hover { background: var(--accent-light); border-color: var(--accent); }
.btn-primary, .btn-secondary {
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  width: 100%;
  margin-bottom: 6px;
  font-weight: 500;
}
.btn-primary { background: var(--accent); color: white; border: 0; }
.btn-primary:hover { background: #095a32; }
.btn-secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { background: var(--accent-light); }

/* === Main content === */
.section { margin-bottom: 24px; }
.section h2 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.section h2 .subhead {
  font-weight: 400;
  color: var(--muted);
  margin-left: 8px;
  font-size: 13px;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.kpi .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 5px;
}
.kpi .value {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kpi.pos .value { color: var(--pos); }
.kpi.warn .value { color: var(--warn); }
.kpi.neg .value { color: var(--danger); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

/* === Heatmap === */
.heatmap-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
  font-size: 11px;
}
.toggle-btn-group {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}
.toggle-btn-group button {
  padding: 4px 10px;
  background: var(--panel);
  border: none;
  font-size: 11px;
  cursor: pointer;
  border-right: 1px solid var(--line);
  color: var(--ink);
}
.toggle-btn-group button:last-child { border-right: none; }
.toggle-btn-group button.active { background: var(--accent); color: white; }
.heatmap {
  display: grid;
  gap: 2px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.hcell {
  text-align: center;
  padding: 8px 0;
  border-radius: 3px;
  color: var(--ink);
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: outline 0.1s;
}
.hcell:hover { outline: 2px solid var(--accent); outline-offset: -1px; z-index: 1; }
.hcell.label-cell {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  cursor: default;
}
.hcell.label-cell:hover { outline: none; }

/* === Charts === */
.chart-wrap { width: 100%; }
svg.chart { width: 100%; height: auto; display: block; }

/* === Scenario table === */
.table-scroll { overflow-x: auto; }
table.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  min-width: 600px;
}
table.matrix th, table.matrix td {
  padding: 7px 9px;
  text-align: right;
  border-bottom: 1px solid var(--line);
}
table.matrix th {
  font-weight: 600;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg);
}
table.matrix th:first-child, table.matrix td:first-child { text-align: left; font-weight: 500; }
table.matrix td.pos { color: var(--pos); font-weight: 600; }
table.matrix td.neg { color: var(--danger); }
table.matrix td.best { background: var(--accent-light); font-weight: 700; }

/* === Wat-als builder === */
.whatif {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
@media (max-width: 1100px) { .whatif { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); } }
.whatif-day {
  background: var(--bg);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.whatif-day .dayname {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 600;
}
.whatif-day select {
  width: 100%;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
}
.whatif-day .projected {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* === Day-detail modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--panel);
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal h3 { margin-bottom: 10px; }
.modal .close-btn {
  float: right;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
}
.modal table { width: 100%; font-size: 12px; border-collapse: collapse; }
.modal th, .modal td { padding: 4px 6px; text-align: right; border-bottom: 1px solid var(--line); }
.modal th:first-child, .modal td:first-child { text-align: left; }

/* === Misc === */
.small { font-size: 12px; color: var(--muted); }
.warn-box {
  background: var(--warn-bg);
  border-left: 3px solid var(--warn);
  padding: 8px 12px;
  border-radius: 0 4px 4px 0;
  margin-bottom: 12px;
  font-size: 12px;
}
.info-box {
  background: var(--pos-bg);
  border-left: 3px solid var(--pos);
  padding: 8px 12px;
  border-radius: 0 4px 4px 0;
  margin-bottom: 12px;
  font-size: 12px;
}
.row-actions { display: flex; gap: 6px; margin-top: 10px; }
.tag {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  margin-left: 6px;
}
.tag.warn { background: #fff3cd; color: #856404; }
.tag.danger { background: var(--danger-bg); color: var(--danger); }
.info-icon {
  display: inline-block;
  width: 14px; height: 14px; line-height: 14px;
  border-radius: 50%; background: var(--muted); color: white;
  text-align: center; font-size: 10px; font-weight: 600;
  cursor: help; margin-left: 2px;
}

/* Responsive — sidebar collapses on narrow */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  aside.sidebar { position: relative; height: auto; }
}

/* Print */
@media print {
  aside.sidebar { display: none; }
  .app { grid-template-columns: 1fr; }
  main.content { padding: 12mm; }
  .panel { box-shadow: none; }
  button { display: none; }
}
