/* ===========================================================
   Inflow Coaching — Cliëntvolgsysteem
   Tokens
   Kleur:   achtergrond #F7F4EF · oppervlak #FFFFFF · tekst #2E2C28
            sage (primair) #5B7A63 · sage-donker #47614C
            klei (accent)  #C97B4A · lijn #E3DED2 · gedempt #7A756B
            waarschuwing/verwijderen #B5533C
   Type:    Fraunces (koppen, terughoudend) · Inter (interface/body)
   =========================================================== */

:root {
  --bg: #F7F4EF;
  --surface: #FFFFFF;
  --text: #2E2C28;
  --muted: #7A756B;
  --border: #E3DED2;
  --sage: #5B7A63;
  --sage-dark: #47614C;
  --sage-tint: #EAF0E9;
  --clay: #C97B4A;
  --clay-tint: #FBEDE3;
  --danger: #B5533C;
  --danger-tint: #FBECE7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(46,44,40,0.06), 0 6px 20px rgba(46,44,40,0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}

.hidden { display: none !important; }

button {
  font-family: inherit;
  cursor: pointer;
}

input, textarea, select {
  font-family: inherit;
  font-size: 16px; /* voorkomt zoom-in op iPad/iOS bij focus */
}

a { color: var(--sage-dark); }

/* ---------- Buttons ---------- */

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--sage);
  color: #fff;
}
.btn-primary:hover { background: var(--sage-dark); }

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

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger-tint); }

.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }

/* ---------- Auth screen ---------- */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  text-align: center;
}

.auth-mark {
  width: 48px; height: 48px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--sage-tint);
  color: var(--sage-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 18px;
}

.auth-title { font-size: 24px; }
.auth-sub { color: var(--muted); margin: 4px 0 24px; font-size: 14px; }
.auth-hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; text-align: left; }

.auth-form { text-align: left; display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.auth-form input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  color: var(--text);
  background: var(--bg);
}
.auth-form input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--sage);
  outline-offset: 1px;
}
.auth-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 0; }

/* ---------- App shell ---------- */

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

.topbar {
  height: 60px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-mark {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--sage-tint); color: var(--sage-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 13px;
}
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-user { display: flex; align-items: center; gap: 14px; }
.topbar-username { color: var(--muted); font-size: 14px; }

.layout { flex: 1; display: flex; min-height: 0; }

.sidenav {
  width: 200px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: none; text-align: left;
  padding: 11px 12px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500; color: var(--muted);
  min-height: 44px;
}
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.nav-item.active { background: var(--sage-tint); color: var(--sage-dark); }
.nav-item.active .nav-dot { background: var(--sage); }
.nav-item:hover:not(.active) { background: var(--bg); }

.content { flex: 1; overflow-y: auto; padding: 28px 32px 60px; min-width: 0; }

.view-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.view-header h1 { font-size: 26px; }
.section-title { font-size: 17px; margin: 28px 0 12px; color: var(--text); }

/* ---------- Stats ---------- */

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; min-width: 150px; flex: 1;
}
.stat-value { font-family: 'Fraunces', serif; font-size: 30px; color: var(--sage-dark); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------- Lists ---------- */

.list { display: flex; flex-direction: column; gap: 8px; }

.list-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; min-height: 44px;
}
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { border-color: var(--sage); }
.list-item.selected { border-color: var(--sage); background: var(--sage-tint); }

.item-title { font-weight: 600; font-size: 15px; }
.item-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

.badge {
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  white-space: nowrap;
}
.badge-sage { background: var(--sage-tint); color: var(--sage-dark); }
.badge-clay { background: var(--clay-tint); color: var(--clay); }
.badge-muted { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }

.empty-state { color: var(--muted); text-align: center; padding: 40px 20px; font-size: 14px; }

/* ---------- Master / detail (Cliënten) ---------- */

.master-detail { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }

.master-panel { min-width: 0; }
.detail-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; min-height: 400px;
}

.search-input {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 14px; margin-bottom: 14px; background: var(--surface); color: var(--text);
}

/* ---------- Client detail ---------- */

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.detail-head h2 { font-size: 22px; }
.detail-actions { display: flex; gap: 8px; }
.back-link {
  display: none; align-items: center; gap: 6px; background: none; border: none;
  color: var(--sage-dark); font-weight: 600; font-size: 14px; margin-bottom: 14px; padding: 4px 0;
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
  background: none; border: none; padding: 10px 14px; font-size: 14px; font-weight: 600;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn.active { color: var(--sage-dark); border-bottom-color: var(--sage); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; margin-bottom: 6px; }
.field-grid .full { grid-column: 1 / -1; }
.field-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 4px; }
.field-value { font-size: 15px; white-space: pre-wrap; }

.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-header h3 { font-size: 16px; }

/* goal status steps — echte volgorde: open → in behandeling → afgerond */
.goal-steps { display: flex; align-items: center; gap: 4px; }
.goal-step { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.goal-step.filled { background: var(--sage); }

.entry-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 10px;
}
.entry-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 10px; }
.entry-date { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.entry-content { font-size: 14px; white-space: pre-wrap; line-height: 1.5; }
.entry-row-actions { display: flex; gap: 6px; }
.icon-btn {
  background: none; border: none; color: var(--muted); font-size: 13px; padding: 4px 6px; min-height: auto;
}
.icon-btn:hover { color: var(--danger); }

/* ---------- Modal / forms ---------- */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(46,44,40,0.35);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal {
  background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 480px;
  max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; }
.modal-close { background: none; border: none; font-size: 16px; color: var(--muted); min-height: 36px; }
.modal-body { padding: 20px 22px 24px; overflow-y: auto; }

.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.form-field input, .form-field textarea, .form-field select {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 12px;
  color: var(--text); background: var(--bg); width: 100%;
}
.form-field textarea { min-height: 100px; resize: vertical; font-family: inherit; }
.form-row { display: flex; gap: 12px; }
.form-row .form-field { flex: 1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.form-error { color: var(--danger); font-size: 13px; margin: 0 0 10px; }

/* ---------- Responsive: iPad portrait & narrower ---------- */

@media (max-width: 900px) {
  .sidenav {
    width: 100%; flex-direction: row; border-right: none; border-bottom: 1px solid var(--border);
    padding: 8px 12px; overflow-x: auto;
  }
  .layout { flex-direction: column; }
  .content { padding: 20px 16px 50px; }

  .master-detail { display: block; }
  .detail-panel { margin-top: 0; }

  /* op smalle schermen: toon lijst óf detail, nooit beide */
  .master-detail.showing-detail .master-panel { display: none; }
  .master-detail:not(.showing-detail) .detail-panel { display: none; }
  .back-link.visible { display: inline-flex; }

  .field-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stat-row { flex-direction: column; }
  .form-row { flex-direction: column; }
}
