/* NRG Cockpit v2.2 - Light theme, squared edges
   Based on NRG Branding Guidelines v1.0
   Font: DM Sans (Silka substitute)
   Colors: NRG brand palette with white as base */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  /* NRG Brand Colors */
  --nrg-lichtgrijs: #EEF0F2;
  --nrg-donkergroen: #00AF70;
  --nrg-felgroen: #59CC7D;
  --nrg-zeegroen: #7DC4B0;
  --nrg-blauwgroen: #007D8C;
  --nrg-diep-blauwgroen: #004D59;
  --nrg-diepblauw: #002434;
  --nrg-grafiet: #1D1D1B;
  
  /* Source-specific colors (consistent throughout app) */
  --src-grid: #002434;        /* diepblauw */
  --src-solar: #59CC7D;       /* felgroen */
  --src-ev: #7DC4B0;          /* zeegroen */
  --src-worksite: #004D59;    /* diep-blauwgroen */
  --src-bess: #007D8C;        /* blauwgroen */
  
  /* Functional colors - LIGHT theme */
  --color-bg: #FAFBFC;
  --color-bg-card: #FFFFFF;
  --color-bg-subtle: #F5F7F8;
  --color-text: var(--nrg-grafiet);
  --color-text-muted: #6B7280;
  --color-text-light: #9CA3AF;
  --color-border: #E5E7EB;
  --color-border-light: #F0F2F5;
  --color-border-strong: #D1D5DB;
  
  /* Status colors */
  --color-critical: #DC2626;
  --color-critical-bg: #FEF2F2;
  --color-warning: #D97706;
  --color-warning-bg: #FEF3E2;
  --color-healthy: var(--nrg-donkergroen);
  --color-healthy-bg: #ECFDF5;
  --color-info: var(--nrg-blauwgroen);
  --color-info-bg: #ECFEFF;
  
  /* SQUARE EVERYTHING - all radius = 0 */
  --radius-sm: 0;
  --radius-md: 0;
  --radius-lg: 0;
  --radius-xl: 0;
  
  /* Subtle shadows for depth in light theme */
  --shadow-sm: 0 1px 2px rgba(0, 36, 52, 0.03);
  --shadow-md: 0 2px 8px rgba(0, 36, 52, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 36, 52, 0.08);
  
  /* Typography */
  --font-display: 'DM Sans', -apple-system, system-ui, sans-serif;
  --font-body: 'DM Sans', -apple-system, system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app { display: flex; min-height: 100vh; }

/* ============================================
   SIDEBAR - LIGHT
   ============================================ */

.sidebar {
  width: 240px;
  background: white;
  color: var(--nrg-diepblauw);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  border-right: 1px solid var(--color-border);
}

.sidebar-logo-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}

.sidebar-logo-link:hover {
  background: var(--color-bg-subtle);
}

.sidebar-logo {
  padding: 24px 22px 20px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-logo-wrap {
  background: white;
  padding: 4px 0;
  display: flex;
  align-items: center;
  min-height: 48px;
}

.sidebar-logo-img {
  height: 40px;
  width: auto;
  max-width: 100%;
  display: block;
  object-fit: contain;
}

.sidebar-logo-product {
  font-size: 10px;
  color: var(--color-text-muted);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 10px;
}

.sidebar-org {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-org-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.sidebar-org-select {
  width: 100%;
  background: var(--color-bg-subtle);
  color: var(--nrg-diepblauw);
  border: 1px solid var(--color-border);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23002434' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar-nav-section { margin-bottom: 20px; }

.sidebar-nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-light);
  padding: 6px 12px;
  margin-bottom: 2px;
  font-weight: 600;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 1px;
  border-left: 2px solid transparent;
  transition: all 0.12s;
}

.sidebar-nav-item:hover {
  background: var(--color-bg-subtle);
  color: var(--nrg-diepblauw);
}

.sidebar-nav-item.active {
  background: var(--color-bg-subtle);
  color: var(--nrg-diep-blauwgroen);
  font-weight: 600;
  border-left-color: var(--nrg-donkergroen);
}

.sidebar-nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.sidebar-user { padding: 14px 20px; border-top: 1px solid var(--color-border); }
.sidebar-user-info { display: flex; align-items: center; gap: 10px; }

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  background: var(--nrg-donkergroen);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}

.sidebar-user-text { flex: 1; min-width: 0; }

.sidebar-user-name {
  color: var(--nrg-diepblauw);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  color: var(--color-text-muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
  max-width: calc(100vw - 240px);
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--color-border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.breadcrumb a { color: var(--color-text-muted); text-decoration: none; transition: color 0.12s; }
.breadcrumb a:hover { color: var(--nrg-diep-blauwgroen); }
.breadcrumb-current { color: var(--color-text); font-weight: 500; }
.breadcrumb-separator { color: var(--color-text-light); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  padding: 7px 12px;
  width: 260px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--color-text);
}

.icon-button {
  background: white;
  border: 1px solid var(--color-border);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-muted);
  position: relative;
  transition: all 0.12s;
  font-size: 14px;
}

.icon-button:hover {
  background: var(--color-bg-subtle);
  border-color: var(--nrg-zeegroen);
  color: var(--nrg-diep-blauwgroen);
}

.icon-button.has-critical {
  border-color: var(--color-critical);
  color: var(--color-critical);
}

.icon-button.has-critical:hover {
  background: var(--color-critical);
  color: white;
  border-color: var(--color-critical);
}

.icon-button .badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--color-critical);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  min-width: 18px;
  text-align: center;
  border: 2px solid white;
}

/* ============================================
   PAGE
   ============================================ */

.page { padding: 28px; max-width: 1600px; }

.page-header { margin-bottom: 24px; position: relative; padding-left: 16px; }

.page-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 10px;
  width: 3px;
  background: var(--nrg-donkergroen);
}

.page-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  color: var(--nrg-diepblauw);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  text-transform: lowercase;
  line-height: 1.1;
}

.page-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
}

/* ============================================
   CARDS - SQUARE
   ============================================ */

.card {
  background: white;
  border: 1px solid var(--color-border);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--nrg-diepblauw);
  text-transform: lowercase;
  letter-spacing: -0.01em;
}

.card-action {
  font-size: 12px;
  color: var(--nrg-blauwgroen);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

.card-action:hover { text-decoration: underline; }

/* ============================================
   STATUS PILLS - SQUARE
   ============================================ */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-pill.healthy {
  background: var(--color-healthy-bg);
  color: var(--color-healthy);
  border-color: #A7F3D0;
}

.status-pill.warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border-color: #FCD34D;
  cursor: pointer;
}

.status-pill.warning:hover {
  background: var(--color-warning);
  color: white;
}

.status-pill.critical {
  background: var(--color-critical-bg);
  color: var(--color-critical);
  border-color: #FCA5A5;
  cursor: pointer;
}

.status-pill.critical:hover {
  background: var(--color-critical);
  color: white;
}

.status-pill.info {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-dot.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.3); }
}

/* ============================================
   BUTTONS - SQUARE
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--nrg-diep-blauwgroen);
  color: white;
}

.btn-primary:hover {
  background: var(--nrg-diepblauw);
}

.btn-secondary {
  background: white;
  color: var(--nrg-diep-blauwgroen);
  border-color: var(--color-border-strong);
}

.btn-secondary:hover {
  border-color: var(--nrg-diep-blauwgroen);
  background: var(--color-bg-subtle);
}

.btn-accent {
  background: var(--nrg-donkergroen);
  color: white;
}

.btn-accent:hover {
  background: var(--nrg-diep-blauwgroen);
}

.btn-critical {
  background: var(--color-critical);
  color: white;
}

.btn-critical:hover {
  background: #991B1B;
}

/* ============================================
   METRICS
   ============================================ */

.metric-large {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  color: var(--nrg-diepblauw);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.metric-large .unit {
  font-size: 15px;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-left: 4px;
}

.metric-medium {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--nrg-diepblauw);
  letter-spacing: -0.02em;
}

.metric-label {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 4px;
}

/* ============================================
   GRID UTILITIES
   ============================================ */

.grid { display: grid; gap: 20px; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1200px) {
  .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .grid-cols-3, .grid-cols-2 { grid-template-columns: 1fr; }
}

/* ============================================
   SCROLLBAR
   ============================================ */

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--color-border); }

/* ============================================
   ANIMATIONS
   ============================================ */

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

.animate-in { animation: slideIn 0.3s ease-out forwards; }

/* ============================================
   ROLE SWITCHER
   ============================================ */

.role-switcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: white;
  border: 1px solid var(--color-border);
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  gap: 6px;
  align-items: center;
}

.role-switcher-label {
  color: var(--color-text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-right: 4px;
}

.role-switcher-btn {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  font-family: var(--font-body);
}

.role-switcher-btn:hover {
  background: white;
  color: var(--nrg-diep-blauwgroen);
  border-color: var(--nrg-zeegroen);
}

.role-switcher-btn.active {
  background: var(--nrg-donkergroen);
  color: white;
  border-color: var(--nrg-donkergroen);
}

/* ============================================
   TOAST
   ============================================ */

.toast {
  position: fixed;
  top: 80px;
  right: 28px;
  background: var(--nrg-diepblauw);
  color: white;
  padding: 12px 18px;
  font-size: 13px;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s ease-out;
  max-width: 360px;
  border-left: 3px solid var(--nrg-donkergroen);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.upcoming-tag {
  margin-left: auto;
  font-size: 9px;
  background: var(--color-border-light);
  padding: 2px 5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

/* ============================================
   TIME RANGE SELECTOR (matches screenshot style)
   ============================================ */

.time-range {
  display: inline-flex;
  gap: 4px;
  background: transparent;
}

.time-range button {
  padding: 6px 14px;
  background: white;
  border: 1px solid var(--color-border);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  transition: all 0.1s;
  min-width: 44px;
  text-align: center;
}

.time-range button:hover {
  border-color: var(--nrg-diep-blauwgroen);
  color: var(--nrg-diep-blauwgroen);
}

.time-range button.active {
  background: var(--nrg-diepblauw);
  color: white;
  border-color: var(--nrg-diepblauw);
  font-weight: 600;
}

/* ============================================
   SERIES TOGGLE (legend) — matches time-range style
   ============================================ */

.series-toggle-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
}

.series-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--color-border);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.1s;
}

.series-toggle:hover {
  border-color: var(--nrg-diep-blauwgroen);
}

.series-toggle.off {
  opacity: 0.45;
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
}

.series-toggle.off .series-color { opacity: 0.3; }

.series-color {
  width: 14px;
  height: 3px;
  flex-shrink: 0;
}

.series-color.dashed {
  background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px);
  height: 3px;
}

.series-color.area {
  height: 10px;
  opacity: 0.3;
}

/* ============================================
   SECTION TITLE
   ============================================ */

.section-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--nrg-diepblauw);
  margin: 28px 0 14px;
  text-transform: lowercase;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.section-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============================================
   ALERT ITEM (shared across pages)
   ============================================ */

.alert-item {
  padding: 10px 12px;
  margin-bottom: 4px;
  cursor: pointer;
  border-left: 3px solid transparent;
  background: white;
  transition: all 0.12s;
}

.alert-item:hover { background: var(--color-bg-subtle); }

.alert-item.critical {
  border-left-color: var(--color-critical);
  background: var(--color-critical-bg);
}

.alert-item.critical:hover {
  background: #FEE2E2;
  border-left-width: 5px;
}

.alert-item.warning {
  border-left-color: var(--color-warning);
  background: var(--color-warning-bg);
}

.alert-item.warning:hover {
  background: #FDE68A;
}

.alert-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.alert-item-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
}

.alert-item-time {
  font-size: 10px;
  color: var(--color-text-light);
  flex-shrink: 0;
}

.alert-item-project {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.alert-item-desc {
  font-size: 11px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.alert-item-cta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--color-critical);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.alert-item.warning .alert-item-cta { color: var(--color-warning); }

/* ============================================
   CRITICAL ELEMENTS (everything red clickable)
   ============================================ */

.critical-ring {
  position: relative;
}

.critical-ring::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid var(--color-critical);
  animation: ringPulse 2s infinite;
  pointer-events: none;
}

@keyframes ringPulse {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.4); }
}

/* ============================================
   FORMS — Metrix v01
   ============================================ */

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid.cols-2 {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
  .form-grid.cols-2 {
    grid-template-columns: 1fr;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.form-field label .required {
  color: var(--color-critical);
  margin-left: 2px;
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: 9px 12px;
  border: 1px solid var(--color-border-strong);
  background: white;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-text);
  transition: border-color 0.12s, box-shadow 0.12s;
  width: 100%;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--nrg-diep-blauwgroen);
  box-shadow: 0 0 0 3px rgba(0, 77, 89, 0.08);
}

.form-field input.mono,
.form-field textarea.mono {
  font-family: monospace;
  font-size: 12px;
}

.form-field .help {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.form-field .error {
  font-size: 11px;
  color: var(--color-critical);
  margin-top: 2px;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

/* ============================================
   MODAL
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 36, 52, 0.4);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: white;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--nrg-diepblauw);
  letter-spacing: -0.01em;
  text-transform: lowercase;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

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

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ============================================
   DETAIL VIEW
   ============================================ */

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px 20px;
  font-size: 13px;
}

.detail-label {
  color: var(--color-text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding-top: 2px;
}

.detail-value {
  color: var(--color-text);
}

.detail-value.mono {
  font-family: monospace;
  font-size: 12px;
}

.detail-value .empty {
  color: var(--color-text-light);
}

@media (max-width: 600px) {
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }
  .detail-label {
    margin-top: 12px;
  }
}

/* ============================================
   CLICKABLE TABLE ROWS
   ============================================ */

tbody tr.clickable {
  cursor: pointer;
}

tbody tr.clickable:hover {
  background: var(--color-bg-subtle);
}

/* ============================================
   INLINE EDIT BUTTONS
   ============================================ */

.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.row-action-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  background: white;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-muted);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: all 0.12s;
}

.row-action-btn:hover {
  border-color: var(--nrg-diep-blauwgroen);
  color: var(--nrg-diep-blauwgroen);
}

.row-action-btn.danger:hover {
  border-color: var(--color-critical);
  color: var(--color-critical);
}

/* ============================================
   SEARCH & FILTER BAR
   ============================================ */

.searchable-table {
  background: white;
  border: 1px solid var(--color-border);
  margin-bottom: 20px;
}

.search-filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
}

.search-input {
  flex: 1;
  min-width: 220px;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--color-border);
  background: white;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-text);
  transition: border-color 0.12s, box-shadow 0.12s;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

.search-input:focus {
  outline: none;
  border-color: var(--nrg-diep-blauwgroen);
  box-shadow: 0 0 0 3px rgba(0, 77, 89, 0.08);
}

.filter-select {
  padding: 8px 30px 8px 12px;
  border: 1px solid var(--color-border);
  background: white;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23002434' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 150px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--nrg-diep-blauwgroen);
}

.search-result-count {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-left: auto;
  white-space: nowrap;
}

.searchable-table .data-table {
  border: none;
  margin: 0;
}

/* No results inside table */
.no-results-row td {
  padding: 40px 20px !important;
  text-align: center;
  color: var(--color-text-muted);
  cursor: default;
}

.no-results-row {
  cursor: default !important;
}

.no-results-row:hover {
  background: white !important;
}

/* ============================================================
   Sidebar navigation count badge (Aanmeldingen etc)
   ============================================================ */
.nav-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  background: #d94f4f;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  line-height: 1;
}
.sidebar-nav-item { display: flex; align-items: center; }

/* ============================================================
   Kwartierwaarden chart controls
   ============================================================ */
.qc-toggle-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.qc-toggle-btn.active {
  background: var(--nrg-donkergroen, #00af70);
  color: white;
}
.qc-toggle-btn:not(.active):hover {
  color: var(--color-text);
}

.qc-period-btn {
  padding: 5px 11px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.qc-period-btn:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}
.qc-period-btn.active {
  background: var(--nrg-diep-blauwgroen, #002434);
  color: white;
  border-color: var(--nrg-diep-blauwgroen, #002434);
}

#qc-search:focus,
#qc-from:focus,
#qc-to:focus,
#qc-page-size:focus {
  outline: none;
  border-color: var(--nrg-donkergroen, #00af70);
}
