:root {
  /* Core Mint-Black Theme (Light Mode Refined) */
  --bg-app: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-sub: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: rgba(16, 185, 129, 0.1);
  --nav-hover: #f8fafc;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --card-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.2);
  --error: #ef4444;
  --warning: #f59e0b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

body.dark-mode {
  --bg-app: #0a0f1e;
  --bg-sidebar: rgba(10, 15, 30, 0.85);
  --bg-card: #151e30;
  --text-main: #f0f4ff;
  --text-sub: #94a3b8;
  --text-muted: #64748b;
  --border-color: rgba(255, 255, 255, 0.08);
  --primary: #3ecf8e;
  --primary-hover: #2aad72;
  --primary-light: rgba(62, 207, 142, 0.12);
  --nav-hover: rgba(255, 255, 255, 0.03);
  --input-bg: #111827;
  --input-border: #1e293b;
  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --glass-bg: rgba(21, 30, 48, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --skeleton-bg: #1e293b;
}

*, *::before, *::after { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.2s ease;
}

html, body { min-height: 100vh; }
body {
  font-family: 'Inter', 'IBM Plex Sans', sans-serif;
  background: var(--bg-app);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Global Background Magic ─── */
body.dark-mode::before {
  content: "";
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 0% 0%, rgba(0, 255, 163, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(0, 255, 163, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* ─── App Shell ─────────────────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; align-items: stretch; }
#main-content { flex: 1; min-width: 0; }
.flex-row { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

.pdf-line-item {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-color);
  user-select: none;
  background: var(--bg-app);
  color: var(--text-sub);
  margin: 1px;
}
.pdf-line-item:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

/* ─── Sidebar and Header Layout Helpers ─── */
.btn-lock-mobile {
  padding: 6px;
  min-width: 36px;
  margin-left: auto;
  color: inherit;
}
.sidebar-brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  margin-right: 8px;
}
.sidebar-brand-text {
  flex: 1;
}
.sidebar-brand-sub {
  font-size: 10px;
  line-height: 1.2;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.7);
}
.theme-toggle-btn {
  padding: 6px;
  min-width: 32px;
}
.theme-icon-blue {
  display: none;
  color: #3b82f6;
}
.sidebar-footer-inner {
  width: 100%;
}
.sidebar-footer-brand-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-footer-brand-title {
  font-size: 11px;
}
.sidebar-footer-meta {
  display: flex;
  gap: 6px;
  align-items: center;
}
.sidebar-footer-version,
.sidebar-footer-dot,
.sidebar-footer-terms {
  font-size: 9px;
  color: var(--text-muted);
}
.sidebar-footer-terms {
  text-decoration: underline;
}
.sidebar-footer-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.sidebar-footer-btn {
  padding: 4px;
  min-width: 32px;
  color: var(--text-muted);
}

/* ─── Strak UI Components ─── */
.strak-box, .strak-box-sm, .strak-box-global, .thermo-box-global, .zrm-box-global {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.strak-box:hover, .strak-box-sm:hover, .strak-box-global:hover, .zrm-box-global:hover {
  border-color: var(--primary) !important;
  background: var(--bg-card) !important;
  transform: translateY(-1px);
}

input:checked + .strak-box, 
input:checked + .strak-box-sm, 
input:checked + .strak-box-global,
input:checked + .thermo-box-global, 
input:checked + .zrm-box-global {
  background: var(--primary) !important;
  color: #020617 !important;
  border-color: var(--primary) !important;
  box-shadow: 0 4px 12px var(--primary-light);
  font-weight: 800;
}

.card-strak {
  border: none !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05) !important;
  border-radius: 16px !important;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  background: var(--bg-card);
}

.card-strak:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.08) !important;
}
/* --- Utilities --- */
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-error { color: var(--error) !important; }
.text-success { color: var(--primary) !important; }

.btn-ai-premium, .btn-ai {
  background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  color: #fff !important;
  border: none;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 12px;
  padding: 10px 20px;
}

.btn-ai-premium:hover, .btn-ai:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  filter: brightness(1.1);
}

body.dark-mode .btn-ai-premium, body.dark-mode .btn-ai {
  background: linear-gradient(135deg, #00ffa3 0%, #00d1ff 100%);
  color: #020617 !important;
  box-shadow: 0 4px 14px rgba(0, 255, 163, 0.3);
}

.btn-ai-premium:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 8px 25px rgba(0, 255, 163, 0.4);
  filter: brightness(1.05);
}

.btn-ai-premium:active {
  transform: translateY(0) scale(0.98);
}

.ai-sparkle {
  display: inline-flex;
  animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; filter: drop-shadow(0 0 5px rgba(255,255,255,0.8)); }
  100% { transform: scale(1); opacity: 0.8; }
}

.pdf-line-item.active {
  background: var(--goal-color, var(--primary)) !important;
  color: #fff !important;
  font-weight: 700;
  border-color: var(--goal-color, var(--primary)) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* --- Goal Oriented Reporting UI --- */
.report-goal-tag {
  cursor: pointer;
  user-select: none;
}
.report-goal-tag input {
  display: none;
}
.tag-badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-sub);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.report-goal-tag:hover .tag-badge-pill {
  border-color: var(--goal-color);
  color: var(--goal-color);
  background: var(--nav-hover);
}
.report-goal-tag.active .tag-badge-pill {
  background: var(--goal-color);
  color: #020617;
  border-color: var(--goal-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.report-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.btn-icon-vitals {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--primary);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-icon-vitals:hover {
  background: var(--nav-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.loader {
  border: 3px solid var(--primary-light);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 0.8s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
  box-shadow: 0 0 15px rgba(0, 229, 153, 0.1);
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
::selection {
  background: var(--primary-light);
  color: var(--primary);
}

.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary:active {
  transform: scale(0.96);
}

/* ─── Dashboard Specifics ─── */
.dashboard-card-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.stat-card-premium {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 110px;
}
.stat-card-premium:hover {
  border-color: var(--primary);
  box-shadow: 0 10px 25px -10px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}
.stat-card-premium .label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-card-premium .value {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1;
  margin-top: 8px;
}
.stat-card-premium .trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-card-premium .trend.up { color: var(--primary); }
.stat-card-premium .trend.down { color: var(--error); }

.quick-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.quick-action-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.02);
}
.quick-action-btn .icon {
  font-size: 20px;
}
.quick-action-btn span {
  font-size: 12px;
  font-weight: 700;
}

.patient-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.patient-badge-row .badge {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────────── */
#sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 32px 24px 28px;
}
.brand-icon {
  width: 42px; height: 42px;
  background: var(--primary);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(0, 229, 153, 0.3);
}
.brand-name {
  font-family: 'Manrope', sans-serif;
  font-size: 18px; font-weight: 800;
  color: var(--text-main); letter-spacing: -0.03em;
  line-height: 1;
}
.brand-sub {
  font-size: 12px; color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

#sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 2px 0;
  border-radius: 12px;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-sub);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 1px solid transparent;
}
.nav-link:active {
  transform: scale(0.96);
}
.nav-link:hover { 
  background: var(--nav-hover); 
  color: var(--text-main);
  border-color: var(--border-color);
}
.nav-link.active { 
  background: var(--primary-light); 
  color: var(--primary); 
  font-weight: 600; 
  box-shadow: 0 4px 12px rgba(0, 229, 153, 0.1);
}
.nav-link svg { 
  flex-shrink: 0; 
  transition: transform 0.2s ease;
}
.nav-link:hover svg {
  transform: translateX(2px);
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-muted);
}

.theme-icon-dark { display: none; }
body.dark-mode .theme-icon-light { display: none; }
body.dark-mode .theme-icon-dark { display: inline-block; }

/* ─── Page wrapper (inside main-content) ─────────────────────────────────── */
.page-wrap {
  padding: 32px 48px;
  max-width: 1720px;
  width: 100%;
  box-sizing: border-box;
  animation: pageEntrance 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@media (min-width: 1200px) {
  .page-wrap {
    max-width: 1720px !important;
    padding: 36px 56px !important;
    box-sizing: border-box;
    width: 100%;
  }
}

@media (min-width: 1920px) {
  .page-wrap {
    max-width: 1840px !important;
    padding: 36px 64px !important;
    box-sizing: border-box;
    width: 100%;
  }
}

.page-wrap.page-wrap-narrow {
  max-width: 800px !important;
  margin: 0 auto;
}
@keyframes pageEntrance {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes lockShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.page-wrap-narrow { max-width: 800px; }

/* ─── Page header ────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 40px;
  gap: 8px;
}
.page-title {
  font-family: 'Manrope', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.page-sub {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* ─── Back link ──────────────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  cursor: pointer;
  margin-bottom: 22px;
  background: none;
  border: none;
  font-family: inherit;
  text-decoration: none;
  padding: 0;
  transition: color 0.12s;
}
.back-link:hover { color: #1A241D; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-4px) scale(1.005);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.15);
}
.card-header {
  padding: 24px 28px 12px;
  border-bottom: 1px solid var(--border-color);
}
.card-title {
  font-family: 'Manrope', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}
.card-body { padding: 24px 28px 28px; }
.card-header + .card-body { padding-top: 16px; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active {
  transform: scale(0.95);
}
.btn-primary { 
  background: var(--primary); 
  color: #020617; 
  box-shadow: 0 4px 14px rgba(0, 229, 153, 0.3);
}
.btn-primary:hover { 
  background: var(--primary-hover); 
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 229, 153, 0.4);
}
.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-outline:hover { 
  background: var(--nav-hover); 
  border-color: var(--text-muted);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover { 
  background: #ef4444; 
  color: white; 
}
.btn-outline-red {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-outline-red:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}
.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-sub);
  padding: 6px 8px;
  border-radius: 6px;
}
.btn-ghost:hover { background: var(--nav-hover); color: var(--text-main); }
.btn-ghost-red { color: #D97757; }
.btn-ghost-red:hover { background: rgba(217, 119, 87, 0.1); color: #C55B3C; }
.btn-sm { padding: 6px 13px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { flex-shrink: 0; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.grid-3 { 
  display: grid !important; 
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important; 
  gap: 20px !important; 
}
.template-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0; /* Prevents overflow */
}
.template-card .card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.form-group { margin-bottom: 20px; }
.lbl {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--input-bg);
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
textarea {
  min-height: 72px;
  line-height: 1.5;
  resize: vertical;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus {
  outline: none !important;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
  transform: translateY(-1px);
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238CA58F' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%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: 32px; }

/* ─── Custom Select ──────────────────────────────────────────────────────── */
.custom-select-container {
  position: relative;
  width: 100%;
}
.custom-select-trigger {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: #1A2E21;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  position: relative;
}
.custom-select-trigger:after {
  content: "";
  width: 12px; height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238CA58F' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  position: absolute;
  right: 10px;
}
.custom-select-container.open .custom-select-trigger {
  border-color: var(--text-muted);
  box-shadow: 0 0 0 2px rgba(140, 165, 143, 0.2);
}
.custom-select-options {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-top: 4px;
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  display: none;
}
.custom-select-container.open .custom-select-options {
  display: block;
}
.custom-select-option {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  color: #1A2E21;
  transition: background 0.1s;
}
.custom-select-option:hover, .custom-select-option.selected {
  background-color: var(--primary);
  color: #ffffff;
}

/* ─── Grid helpers ───────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 14px; }

/* ─── Search bar ─────────────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  margin-bottom: 22px;
}
.search-wrap input {
  padding-left: 38px;
  height: 40px;
  border-color: var(--border-color);
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}

/* ─── Recent Patients Bar (Quick Access) ────────────────────────────────── */
.recent-patients-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 14px 0 18px 0;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  animation: fadeInRecent 0.25s ease;
}

@keyframes fadeInRecent {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.recent-patients-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
  height: 32px;
}

.recent-patients-header svg {
  color: var(--primary);
  flex-shrink: 0;
}

.recent-patients-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  flex: 1;
}

.recent-patient-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px 0 6px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  font-family: inherit;
}

.recent-patient-chip:hover {
  border-color: var(--primary);
  background: var(--nav-hover);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

.recent-patient-chip .chip-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.recent-patient-chip .chip-name {
  font-weight: 600;
  color: var(--text-main);
}

.recent-patient-chip:hover .chip-name {
  color: var(--primary);
}

.recent-patient-chip .chip-time {
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 500;
}

body.dark-mode .recent-patient-chip .chip-time {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-sub);
}

.recent-patient-chip:hover .chip-time {
  background: var(--primary-light);
  color: var(--primary);
}

.recent-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.2s, color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.recent-clear-btn:hover {
  opacity: 1;
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* ─── Patient list cards ─────────────────────────────────────────────────── */
.patient-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 12px;
}
.patient-card:hover {
  border-color: var(--primary);
  transform: translateX(4px);
  background: var(--nav-hover);
  box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.1);
}
.avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
  font-weight: 700;
  font-size: 16px;
}
.avatar-lg { width: 64px; height: 64px; border-radius: 18px; font-size: 24px; }
.patient-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}
.patient-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 3px;
}
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-sub);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  background: var(--bg-app);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── Info rows (patient detail view) ───────────────────────────────────── */
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--nav-hover);
}
.info-row:last-child { border-bottom: none; }
.info-icon { color: var(--text-muted); margin-top: 1px; flex-shrink: 0; }
.info-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1;
  margin-bottom: 4px;
}
.info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

/* ─── Care plan list cards ───────────────────────────────────────────────── */
.cp-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: 10px;
  transition: all 0.2s ease;
}
.cp-card:hover { 
  border-color: var(--primary); 
  transform: scale(1.01);
  background: var(--nav-hover);
}
.cp-card-left { display: flex; align-items: center; gap: 12px; }
.cp-card-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.cp-card-title { font-size: 13px; font-weight: 600; color: #1A241D; }
.cp-card-sub { font-size: 11px; color: var(--text-sub); margin-top: 2px; }

/* ─── Section bar (care plan) ────────────────────────────────────────────── */
.section-bar {
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}
.diag-bar {
  background: var(--border-color);
  color: #1A241D;
  padding: 10px 16px;
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

/* ─── Omaha score grid ───────────────────────────────────────────────────── */
.score-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 10px 0;
}
.score-cell { text-align: center; }
.score-cell .lbl { text-align: center; font-size: 10px; }
.score-cell input { text-align: center; padding: 6px 4px; }

/* ─── Interventions table ────────────────────────────────────────────────── */
.iv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}
.iv-table thead { background: var(--bg-sidebar); }
.iv-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}
.iv-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--nav-hover);
  vertical-align: top;
}
.iv-table tr:last-child td { border-bottom: none; }
.iv-table tr:nth-child(even) td { background: #FAFCFB; }
.iv-table td input, .iv-table td select, .iv-table td textarea {
  margin: 0;
}
.iv-table td textarea { min-height: 56px; }

.error-msg {
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  color: #ef4444;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 20px;
  text-align: center;
  animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* ─── Toast notifications ────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 22px; right: 22px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 14px 24px;
  border-radius: 14px;
  color: #020617;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  animation: toastIn .4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.success { background: var(--primary); }
.toast.error   { background: #ef4444; color: white; }
@keyframes toastIn { 
  from { transform: translateX(100%) scale(.9); opacity: 0; } 
  to { transform: translateX(0) scale(1); opacity: 1; } 
}

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,36,29,.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998;
  backdrop-filter: blur(2px);
}
.modal-overlay.hidden { display: none; }
#modal-box, .modal-card {
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
  width: 1100px; max-width: 95vw;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  border: 1px solid var(--glass-border);
  animation: modalScaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalScaleIn {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 32px; border-bottom: 1px solid var(--border-color); }
.modal-title { font-family: 'Manrope', sans-serif; font-size: 20px; font-weight: 800; color: var(--text-main); letter-spacing: -0.02em; }
.modal-body  { font-size: 14px; color: var(--text-sub); overflow-y: auto; padding: 32px; flex: 1; display: flex; flex-direction: column; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; padding: 24px 32px; border-top: 1px solid var(--border-color); background: rgba(0,0,0,0.02); border-radius: 0 0 24px 24px; }
.btn-close { background: none; border: none; font-size: 24px; color: var(--text-muted); cursor: pointer; line-height: 1; }
.btn-close:hover { color: var(--text-main); }
.row-warning { background-color: #fff9e6 !important; }
.row-warning td { color: #856404; }
.warning-icon { margin-left: 8px; cursor: help; }

/* ─── Empty states ───────────────────────────────────────────────────────── */
.empty-state { 
  text-align: center; 
  padding: 64px 24px; 
  animation: gentleFadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
  transform: translateY(10px);
}
@keyframes gentleFadeUp {
  to { opacity: 1; transform: translateY(0); }
}
.empty-state img { width: 180px; height: 180px; object-fit: cover; border-radius: 12px; margin-bottom: 20px; opacity: .85; }
.empty-state h3 { font-size: 20px; font-weight: 800; color: var(--text-main); margin-bottom: 8px; letter-spacing: -0.02em; }
.empty-state p  { font-size: 14px; color: var(--text-sub); margin-bottom: 24px; }

/* ─── Skeleton loading ───────────────────────────────────────────────────── */
.skeleton {
  background: var(--skeleton-bg);
  background: linear-gradient(90deg, var(--skeleton-bg) 25%, var(--nav-hover) 50%, var(--skeleton-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── Flex helpers ───────────────────────────────────────────────────────── */
.flex-row     { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-end     { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

/* ─── Separator ──────────────────────────────────────────────────────────── */
hr.sep { border: none; border-top: 1px solid var(--border-color); margin: 16px 0; }

/* ─── Section title row ──────────────────────────────────────────────────── */
.section-title {
  font-family: 'Manrope', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 12px;
}

/* ─── Care plan editor container ─────────────────────────────────────────── */
.cp-editor {
  max-width: 1720px;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 1200px) {
  .cp-editor {
    max-width: 1720px !important;
    width: 100%;
  }
}

@media (min-width: 1920px) {
  .cp-editor {
    max-width: 1840px !important;
    width: 100%;
  }
}

.cp-shell {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 60px);
}
.cp-scroll {
  flex: 1;
}

.cp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  position: sticky;
  bottom: 24px;
  z-index: 1000;
  gap: 12px;
  margin: 24px 0 0 0;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}
.cp-footer-total {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
}

/* ─── PV / VP badges ─────────────────────────────────────────────────────── */
.pv-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
}
.pv-badge strong { font-weight: 700; }
.pv-badge .tag {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.pv-badge.pv .tag { background: rgba(0, 102, 204, 0.1); color: #3b82f6; }
.pv-badge.vp .tag { background: var(--primary-light); color: var(--primary); }

.cp-footer-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 10px;
}

.total-box {
  padding: 24px;
  border-radius: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.total-box-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-sub);
}
.total-box-main {
  font-size: 32px;
  font-weight: 800;
}
.total-box-sub {
  font-size: 13px;
  font-weight: 500;
}

.total-box.pv { background: #E1F0FF; color: #0066CC; }
.total-box.vp { background: #E8F5E9; color: var(--primary); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */



/* ─── Facturatie module ──────────────────────────────────────────────────── */
.lines-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.lines-table th { text-align: left; padding: 10px; border-bottom: 2px solid var(--border-color); color: var(--text-sub); font-weight: 700; }
.lines-table td { padding: 10px; border-bottom: 1px solid var(--nav-hover); vertical-align: middle; }
.lines-table input, .lines-table select { border-color: #eee; box-shadow: none; padding: 6px 8px; }
.lines-table input:focus { border-color: var(--primary); }

#pdf-lines-container { flex:1; overflow-y:scroll !important; display:block; background:var(--nav-hover); border-radius:12px; padding:16px; border:1px solid var(--border-color); margin-top:8px; }

.totals-block { background: var(--bg-card); padding: 20px; border-radius: 10px; border: 1px solid var(--border-color); }
.total-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--text-sub); }
.total-row.grand { margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--border-color); font-size: 16px; font-weight: 800; color: var(--text-main); }

.invoice-meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.invoice-meta-item { background: #fff; border: 1px solid var(--border-color); padding: 12px 16px; border-radius: 8px; }
.iml { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.imv { font-size: 14px; font-weight: 600; color: #1A241D; }

.status-concept { background: var(--nav-hover); color: var(--text-sub); border-color: var(--border-color); }
.status-definitief { background: #f3e8ff; color: #7e22ce; border-color: #d8b4fe; }
.status-verzonden { background: #E8F5E9; color: #0066CC; border-color: #B3D7FF; } /* Changed background to match betaald */
.status-betaald { background: #E8F5E9; color: var(--primary); border-color: #C8E6C9; }
.status-vervallen { background: #FEF2F0; color: #D97757; border-color: #FAD7D1; }

.td-actions { display: flex; gap: 4px; }
.full { grid-column: 1 / -1; }

/* Invoicing Dashboard */
.f-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.f-stat-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.f-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.04);
}
.f-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 700;
}
.f-stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
}
.f-stat-value.status-paid { color: #2e7d32; background: transparent; border: none; }
.f-stat-value.status-verzonden { color: #0066CC; background: transparent; border: none; }
.f-stat-value.status-vervallen { color: #D97757; background: transparent; border: none; }

/* ─── Login Page ───────────────────────────────────────────────────────────── */
.login-page {
  position: fixed;
  inset: 0;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  padding: 40px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-title { font-size: 24px; font-weight: 800; color: var(--text-main); margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: var(--text-sub); }
.login-footer { margin-top: 32px; font-size: 12px; color: var(--text-muted); text-align: center; }

.otp-input {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-main);
}
.otp-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-light); }

/* Hide sidebar and main content when logging in */
body.is-logging-in #sidebar { display: none; }
body.is-logging-in #main-content { background: var(--bg-app); }

/* ─── Page Transitions ───────────────────────────────────────────────────── */
.page-enter {
  opacity: 0;
  transform: translateY(12px);
}
.page-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Slate Dark Mode Overrides ─────────────────────────────────────────── */
body.dark-mode .btn-primary {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
  border: none;
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
}
body.dark-mode .btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}
body.dark-mode .card:hover, 
body.dark-mode .patient-card:hover, 
body.dark-mode .cp-card:hover, 
body.dark-mode .f-stat-card:hover {
  box-shadow: 0 15px 35px rgba(0,0,0,0.6);
  border-color: #475569;
}
body.dark-mode .nav-link.active {
  box-shadow: inset 3px 0 0 var(--primary);
  background: var(--nav-hover);
  color: var(--primary);
}
body.dark-mode input:focus, 
body.dark-mode select:focus, 
body.dark-mode textarea:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  border-color: var(--primary);
  outline: none;
}

body.dark-mode .status-concept { background: rgba(255,255,255,0.1); color: #cbd5e1; border-color: transparent; }
body.dark-mode .status-definitief { background: rgba(147, 51, 234, 0.2); color: #c084fc; border-color: transparent; }
body.dark-mode .status-verzonden { background: rgba(34, 197, 94, 0.2); color: #93c5fd; border-color: transparent; }
body.dark-mode .status-betaald { background: rgba(34, 197, 94, 0.2); color: #86efac; border-color: transparent; }
body.dark-mode .status-vervallen { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border-color: transparent; }

body.dark-mode .f-stat-value.status-paid { color: #4ade80; background: transparent; border: none; }
body.dark-mode .f-stat-value.status-verzonden { color: #60a5fa; background: transparent; border: none; }
body.dark-mode .f-stat-value.status-vervallen { color: #f87171; background: transparent; border: none; }

body.dark-mode .lbl, body.dark-mode .section-title { color: #4ade80; }
body.dark-mode .total-box.vp { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
body.dark-mode .total-box.pv { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }

/* ─── Visual Mapping ─────────────────────────────────────────────────────── */
.mapping-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--primary);
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.mapping-dot:hover { background: #ff4d4d; }
.mapping-dot span {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
}

/* ─── Indicaties Workflow ─────────────────────────────────────────────────── */
.indicatie-task-card {
  transition: transform 0.2s, box-shadow 0.2s;
}
.indicatie-task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.indicatie-workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  background: var(--nav-hover);
  padding: 15px;
  border-radius: 8px;
  align-items: center;
}
.workflow-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.workflow-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.inline-date-input {
  border: none;
  background: transparent;
  font-weight: 600;
  font-family: inherit;
  font-size: 15px;
  color: var(--text-main);
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  text-align: right;
  width: auto;
}
.inline-date-input:hover {
  background: var(--border-color);
}
.inline-date-input:focus {
  outline: 2px solid var(--primary);
  background: var(--bg-card);
}
.text-error { color: var(--error); }
.text-warning { color: #f59e0b; }
.border-urgent { border-left: 4px solid var(--error) !important; }

.inline-select {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
}
.inline-select:hover {
  border-color: var(--primary);
}

.status-dropdown {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  min-width: 180px;
}
.status-dropdown:hover { border-color: var(--primary); }

.status-gefactureerd {
  opacity: 0.8;
}
.status-gefactureerd .status-dropdown {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* ─── Indicaties Modal Patient Picker ───────────────────────────────────────── */
.modal-patient-item {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
}
.modal-patient-item:last-child { border-bottom: none; }
.modal-patient-item:hover { background: var(--nav-hover); }
.btn-block { width: 100%; justify-content: center; }

/* ─── Template Mapping Editor ────────────────────────────────────────────────── */
#mapping-markers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.mapping-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--primary);
  border: 2px solid white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.1s;
}

.mapping-dot:hover {
  transform: translate(-50%, -50%) scale(1.2);
  background: var(--error-color);
}

.mapping-dot span {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
}

/* Barthel Index */
.barthel-total-score {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-light);
  padding: 8px 16px;
  border-radius: 12px;
}
.barthel-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.barthel-option {
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.barthel-option:hover {
  border-color: var(--primary-light);
  background: #F9FBF9;
}
.barthel-option.active {
  border-color: var(--primary);
  background: var(--primary-light);
}
.barthel-opt-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}
.barthel-opt-val {
  font-size: 11px;
  color: var(--primary);
  font-weight: 700;
}

/* Risicoscan */
.radio-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f0f4f1;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.radio-pill:has(input:checked) {
  background: var(--primary);
  color: white;
}
.radio-pill input {
  margin: 0;
}

/* Ensure scrollbars appear automatically when needed with high-contrast styling */
.modal-body, #pdf-lines-container, #sidebar-nav, iframe, div[style*="overflow:auto"], div[style*="overflow: scroll"], .cp-editor-container {
  scrollbar-width: thin !important;
  scrollbar-color: var(--primary) transparent !important;
}

/* Global scrollbar override for Webkit browsers - VISIBLE WHEN NEEDED */
::-webkit-scrollbar { 
  width: 10px !important; 
  height: 10px !important; 
  display: block !important;
}
::-webkit-scrollbar-track { 
  background: transparent !important; 
}
::-webkit-scrollbar-thumb { 
  background: #94a3b8 !important; 
  border-radius: 10px !important;
  border: 2px solid transparent !important;
  background-clip: padding-box !important;
}
::-webkit-scrollbar-thumb:hover { 
  background: var(--primary) !important; 
  background-clip: padding-box !important;
}

/* Hardcoded scrollbar for iframes specifically */
iframe {
    scrollbar-width: auto !important;
}

/* Removed grain effect to ensure scrollbar visibility */

.skeleton {
  background: linear-gradient(90deg, var(--nav-hover) 25%, var(--border-color) 50%, var(--nav-hover) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite linear;
  border-radius: 8px;
}

@keyframes skeleton-wave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Status Badges ────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}
.status-badge.actueel { background: var(--primary-light); color: var(--primary); border-color: rgba(0, 229, 153, 0.2); }
.status-badge.vervallen { background: rgba(239, 68, 68, 0.1); color: #ef4444; border-color: rgba(239, 68, 68, 0.2); }
.status-badge.concept { background: var(--nav-hover); color: var(--text-muted); border-color: var(--border-color); }
.status-badge.definitief { background: rgba(147, 51, 234, 0.1); color: #7e22ce; border-color: rgba(147, 51, 234, 0.25); }
.status-badge.betaald { background: var(--primary-light); color: var(--primary); }
.status-badge.verzonden { background: rgba(59, 130, 246, 0.1); color: #3b82f6; border-color: rgba(59, 130, 246, 0.2); }

/* ─── Facturatie Dashboard ─── */
.f-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.f-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}
.f-stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.f-stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  font-family: 'Manrope', sans-serif;
  letter-spacing: -0.02em;
}
.f-stat-value.status-paid      { color: var(--primary); }
.f-stat-value.status-verzonden { color: #3b82f6; }
.f-stat-value.status-vervallen { color: #ef4444; }


/* ─── Workflow Dashboard ─── */
.workflow-container {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 4px 10px 4px;
  height: calc(100vh - 250px);
  align-items: flex-start;
}

.workflow-column {
  min-width: 360px;
  flex: 0 0 360px;
  background: rgba(240, 244, 241, 0.4);
  border-radius: 20px;
  padding: 16px;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  display: flex;
  flex-direction: column;
  max-height: 100%;
}

.workflow-cards {
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

[data-theme="dark"] .workflow-column {
  background: rgba(255, 255, 255, 0.02);
}

.workflow-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 4px 10px;
}

.workflow-column-title {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary);
  font-weight: 900;
  opacity: 0.8;
}

.workflow-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.04);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workflow-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 25px rgba(0,0,0,0.08);
  border-color: var(--primary);
}

.workflow-card.border-urgent {
  border-left: 4px solid #ef4444 !important;
}

.workflow-card .card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.workflow-card .avatar-circle {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 12px;
  background: var(--nav-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.workflow-card .patient-info {
  flex: 1;
  min-width: 0;
}

.workflow-card .patient-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workflow-card .meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.workflow-card .deadline-section {
  text-align: right;
  flex-shrink: 0;
}

.workflow-card .deadline-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.workflow-card .deadline-date {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  border: none;
  background: transparent;
  padding: 0;
  width: 125px;
  text-align: right;
  cursor: pointer;
  font-family: inherit;
}

.indicatie-type-badge-select {
  width: 100%;
  max-width: 155px;
  height: 32px;
  padding: 4px 26px 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.indicatie-type-badge-select:hover {
  filter: brightness(0.97);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.indicatie-type-badge-select.is-indicatie {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23047857' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.indicatie-type-badge-select.is-herindicatie {
  background-color: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231d4ed8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.indicatie-type-badge-select.is-uitbreiding {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b45309' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.workflow-card .card-bottom {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.status-dropdown-sleek {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  appearance: none;
}

.btn-action-round {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-danger {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}
.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}
.btn-danger-hover:hover {
  color: #ef4444 !important;
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.05) !important;
}/* ─── Braden Scale UI ─────────────────────────────────────────────────────── */
.braden-radio-label {
  cursor: pointer;
}
.braden-radio-box {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
  height: 100%;
}
.braden-radio-label input:checked + .braden-radio-box {
  background: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.braden-val {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--primary);
  font-size: 13px;
}
.braden-radio-label input:checked + .braden-radio-box .braden-val {
  background: var(--primary);
  color: #020617;
  border-color: var(--primary);
}
.braden-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  line-height: 1.2;
}
.braden-radio-label input:checked + .braden-radio-box .braden-label {
  color: var(--text-main);
}

/* BDBL Assistent */
.bdbl-card { transition: transform 0.2s, box-shadow 0.2s; cursor: default; }
.bdbl-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.bdbl-doen { border-left: 4px solid #10b981 !important; }
.bdbl-laten { border-left: 4px solid #f43f5e !important; }
.badge-success, .badge-actueel { background: #10b981 !important; color: #ffffff !important; border: 1px solid #059669 !important; font-weight: 800 !important; box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3) !important; }
.badge-warning, .badge-concept { background: #f59e0b !important; color: #ffffff !important; border: 1px solid #d97706 !important; font-weight: 800 !important; box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25) !important; }
.badge-vervallen { background: #64748b !important; color: #ffffff !important; border: 1px solid #475569 !important; font-weight: 600 !important; }
.badge-danger { background: rgba(244, 63, 94, 0.1); color: #f43f5e; }
  
/* ZRM Matrix Styles */  
.zrm-summary-grid { margin-top: 10px; }  
.zrm-summary-grid  { border: 1px solid var(--border-color); transition: transform 0.2s; } 

.hidden { display: none !important; }

/* ─── Switch Toggle ─── */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider {
  background-color: var(--primary);
}
input:checked + .slider:before {
  transform: translateX(20px);
}
.slider.round {
  border-radius: 34px;
}
.slider.round:before {
  border-radius: 50%;
}

/* Premium AI Button Style */
.btn-ai {
  background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  color: white !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600 !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px !important;
  border-radius: 8px !important;
}

.btn-ai:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
  filter: brightness(1.1);
}

.btn-ai:active {
  transform: translateY(0);
}

.btn-ai svg {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.btn-ai-outline {
  background: white;
  color: #10b981 !important;
  border: 2px solid #10b981 !important;
  font-weight: 600 !important;
  transition: all 0.2s ease;
}

.btn-ai-outline:hover {
  background: #10b981;
  color: white !important;
}

/* ─── Collapsible Trend Panels ─── */
details.card {
  transition: all 0.2s ease;
}
details.card summary {
  list-style: none;
  outline: none;
  user-select: none;
}
details.card summary::-webkit-details-marker {
  display: none;
}
details.card[open] summary {
  border-bottom: 1px solid var(--border-color);
}
details.card[open] .expand-icon {
  transform: rotate(180deg);
}
details.card:not([open]) .card-body {
  display: none;
}

/* AI Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(16, 185, 129, 0.2);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s ease-in-out infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.markdown-body {
  line-height: 1.6;
  color: var(--text-main);
  font-size: 14px;
}
.markdown-body br {
  display: block;
  margin-bottom: 8px;
  content: "";
}






/* --- Reporting Timeline -------------------------------------------------- */
.report-timeline {
  position: relative;
  margin-top: 24px;
}
.report-timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}
.report-timeline.no-line::before {
  display: none;
}
.report-timeline.no-line .report-item {
  padding-left: 36px;
}
.report-timeline.no-line .report-dot {
  left: 4px;
}
.report-item {
  position: relative;
  padding-left: 56px;
  margin-bottom: 24px;
}
.report-dot {
  position: absolute;
  left: 13px;
  top: 10px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--primary);
  z-index: 1;
}
.report-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--card-shadow);
}
.report-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.report-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary);
}

/* Dossier Tabs & Dashboard */
.dossier-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
  background: var(--bg-card);
  padding: 0 20px;
  margin: -24px -24px 24px -24px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.tab-item {
  padding: 16px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tab-item:hover {
  color: var(--primary);
  background: var(--primary-light);
}
.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}
.tab-content.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Specific Styles */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.stat-card {
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}


/* --- Mobile Navigation Defaults --- */
#mobile-header {
  display: none;
}
#mobile-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#mobile-sidebar-overlay.show {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  #app {
    flex-direction: column;
  }
  #mobile-header {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 80;
  }
  .mobile-brand {
    font-family: 'Manrope', sans-serif;
    font-size: 18px;
    font-weight: 800;
    margin-left: 16px;
    color: var(--text-main);
  }
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 280px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }
  #sidebar.open {
    transform: translateX(0);
  }
  .page-wrap {
    padding: 24px 16px;
  }
  /* Grid overwrites */
  .grid-2, .grid-3, .grid-4, .dashboard-card-wrap {
    grid-template-columns: 1fr !important;
  }
  /* Tables */
  .table-wrapper {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .table {
    min-width: 600px; /* Force minimum width to enable scroll */
  }
  /* Modals */
  #modal-box {
    width: 95%;
    max-width: 95vw;
    margin: 16px;
    max-height: 90vh;
  }
  .modal-body {
    padding: 16px;
  }
  .modal-footer {
    padding: 16px;
  }
  .card-header, .card-body {
    padding: 16px;
  }
}
/* Custom Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}
/* --- Blue Theme (Landing Page Style) --- */
body.theme-blue {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59,130,246,.12);
  --bg-app: #0a0f1e;
  --bg-sidebar: rgba(10, 15, 30, 0.85);
  --bg-card: #151e30;
  --nav-hover: rgba(59, 130, 246, 0.1);
}
body.theme-blue::before {
  background: 
    radial-gradient(circle at 0% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.08) 0%, transparent 50%);
}
body.theme-blue .btn-ai-premium, body.theme-blue .btn-ai {
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}
body.theme-blue .btn-ai-premium:hover {
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}
body.theme-blue .theme-icon-light { display: none; }
body.theme-blue .theme-icon-dark { display: none; }
body.theme-blue .theme-icon-blue { display: inline-block !important; }

/* --- AI Text Selection Floating Badge & Popover --- */
#ai-selection-badge {
  position: absolute;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #ffffff;
  font-family: var(--font-main, 'Inter', sans-serif);
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  animation: aiBadgePopIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#ai-selection-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}
@keyframes aiBadgePopIn {
  0% { opacity: 0; transform: scale(0.8) translateY(6px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

#ai-selection-popover {
  position: absolute;
  z-index: 100000;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 190px;
  animation: aiPopoverFade 0.15s ease-out;
}
@keyframes aiPopoverFade {
  0% { opacity: 0; transform: translateY(-4px); }
  100% { opacity: 1; transform: translateY(0); }
}
.ai-popover-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-color, #1f2937);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.ai-popover-item:hover {
  background-color: rgba(16, 185, 129, 0.1);
  color: #059669;
}

/* ─── Admin Users Filter Pills ─── */
.btn-filter {
  background: var(--bg-main, #F1F5F9);
  color: var(--text-sub, #64748B);
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-filter:hover {
  background: var(--bg-secondary, #E2E8F0);
  color: var(--text-main, #1E293B);
}
.btn-filter.active {
  background: var(--primary, #0284C7);
  color: #ffffff;
  border-color: var(--primary, #0284C7);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

/* ─── Assessment Generic Engine Choice Tiles ─── */
.choice-tile {
  border: 1.5px solid var(--border-color, #E2E8F0);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--bg-card, #ffffff);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.choice-tile:hover {
  border-color: var(--primary, #10B981);
  background: rgba(16, 185, 129, 0.03);
  transform: translateY(-1px);
}

.choice-tile.selected,
label:has(input[type="radio"]:checked) .choice-tile {
  border-color: var(--primary, #10B981) !important;
  background: rgba(16, 185, 129, 0.08) !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25), 0 2px 6px rgba(16, 185, 129, 0.1) !important;
}

/* ─── Global Print Styles ─── */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }
  
  #sidebar, .sidebar, #mobile-header, .no-print, .back-link, #save-assessment-btn, button, .modal, .toast, #f-header {
    display: none !important;
  }
  
  #main-content, .page-wrap {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .card {
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    break-inside: avoid;
    margin-bottom: 15px !important;
    background: #ffffff !important;
  }

  .choice-tile {
    border: 1px solid #ccc !important;
    background: #ffffff !important;
  }

  .choice-tile.selected, label:has(input:checked) .choice-tile {
    border: 2px solid #059669 !important;
    background: #f0fdf4 !important;
  }
}

/* ─── Debiteuren & Wijkteam Payment Overview Styles ─── */
.deb-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.deb-kpi-card {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}
.deb-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--border-color, #E2E8F0);
}
.deb-kpi-card.kpi-open::before { background: #0284C7; }
.deb-kpi-card.kpi-overdue::before { background: #DC2626; }
.deb-kpi-card.kpi-paid::before { background: #16A34A; }
.deb-kpi-card.kpi-alert::before { background: #D97706; }

.deb-kpi-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-sub, #64748B);
}
.deb-kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main, #0F172A);
  letter-spacing: -0.5px;
  margin: 4px 0 2px 0;
}
.deb-kpi-sub {
  font-size: 11px;
  color: var(--text-muted, #94A3B8);
}

.deb-team-card {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: 14px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  transition: all 0.2s ease;
  overflow: hidden;
}
.deb-team-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}
.deb-team-card.is-overdue {
  border-left: 5px solid #DC2626;
}
.deb-team-card.is-open {
  border-left: 5px solid #D97706;
}
.deb-team-card.is-paid {
  border-left: 5px solid #16A34A;
}

.deb-team-header {
  padding: 16px 20px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 24px;
  cursor: pointer;
  background: var(--bg-card, #ffffff);
}
.deb-team-header:hover {
  background: rgba(2, 132, 199, 0.02);
}

.deb-team-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 380px;
  min-width: 380px;
  max-width: 380px;
}
.deb-team-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0284C7, #0369A1);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.2);
  flex-shrink: 0;
}
.deb-team-avatar.avatar-danger {
  background: linear-gradient(135deg, #EF4444, #B91C1C);
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

.deb-team-figures {
  display: grid;
  grid-template-columns: 130px 120px 160px 220px;
  gap: 20px;
  align-items: center;
  flex: 0 0 auto;
}
.deb-fig-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.deb-fig-lbl {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-sub, #64748B);
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.deb-fig-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main, #0F172A);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.deb-fig-badge {
  display: flex;
  align-items: center;
}

.deb-team-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.deb-team-actions .btn {
  white-space: nowrap;
}

/* Single focus team card override */
.deb-team-focus-header .deb-team-info {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}
.deb-team-focus-header .deb-team-figures {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

@media (max-width: 1280px) {
  .deb-team-header {
    flex-wrap: wrap;
    gap: 14px;
  }
  .deb-team-info {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
  }
  .deb-team-figures {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    width: 100%;
    gap: 12px;
  }
  .deb-team-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
}

.deb-team-body {
  border-top: 1px solid var(--border-color, #E2E8F0);
  background: #F8FAFC;
  padding: 20px;
}

.deb-tab-pill {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border-color, #E2E8F0);
  background: var(--bg-card, #ffffff);
  color: var(--text-sub, #64748B);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.deb-tab-pill:hover {
  color: var(--text-main, #0F172A);
  border-color: #CBD5E1;
}
.deb-tab-pill.active {
  background: var(--primary, #0284C7);
  color: #ffffff;
  border-color: var(--primary, #0284C7);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

/* ─── Bankafschriften & Mutaties KPI & Interactieve Cards ─── */
.bank-kpi-card {
  -webkit-user-select: none;
  user-select: none;
}
.bank-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08) !important;
  border-color: #cbd5e1 !important;
}
.bank-tab-btn:hover {
  color: var(--primary, #2563eb) !important;
}
