/* ── Duonido — app.css ── */

/* ── Reset & base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal:        #2D7D9A;
  --teal-dark:   #1f5f75;
  --teal-light:  #e8f4f8;
  --sand:        #F5F0E8;
  --sand-dark:   #e8e0d0;
  --parent-a:    #2D7D9A;
  --parent-b:    #4CAF6E;
  --ai-purple:   #7C5CBF;
  --ai-light:    #f0ebfa;
  --warning:     #E8963A;
  --danger:      #D64045;
  --success:     #4CAF6E;
  --text:        #1a1a2e;
  --text-muted:  #6b7280;
  --border:      #e5e7eb;
  --bg:          #f8f9fb;
  --white:       #ffffff;
  --radius:      10px;
  --radius-lg:   16px;
  --shadow:      0 1px 4px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
  --sidebar-w:   220px;
  --font:        'Inter', system-ui, sans-serif;
}

html { font-size: 15px; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-dark); text-decoration: underline; }
img { max-width: 100%; }

/* ── App shell ───────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

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

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon { font-size: 24px; line-height: 1; }
.logo-text { font-size: 18px; font-weight: 700; color: var(--teal); letter-spacing: -.3px; }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: var(--teal-light); color: var(--teal); text-decoration: none; }
.nav-item.active { background: var(--teal); color: var(--white); }
.nav-item.active:hover { background: var(--teal-dark); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-label { flex: 1; }
.nav-badge {
  background: var(--warning);
  color: white;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.sidebar-family {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
}

.user-link { color: var(--text-muted); font-size: 13px; }
.user-link:hover { color: var(--teal); }
.logout-link { color: var(--text-muted); font-size: 16px; }
.logout-link:hover { color: var(--danger); text-decoration: none; }

/* ── Main wrapper ────────────────────────────────────── */
.main-wrapper { min-height: 100vh; background: var(--bg); }
.main-content { padding: 28px 32px; max-width: 1100px; }

/* ── Page header ─────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title { font-size: 22px; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 2px; }

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-value { font-size: 28px; font-weight: 700; color: var(--teal); }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, box-shadow .15s;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover { text-decoration: none; box-shadow: var(--shadow); }
.btn-primary   { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); color: #fff; }
.btn-secondary { background: var(--white); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b83035; }
.btn-success   { background: var(--success); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-outline { background: transparent; color: var(--teal); border-color: var(--teal); }
.btn-outline:hover { background: var(--teal-light); }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-hint  { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.form-control {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}

.form-control:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45,125,154,.15);
}

textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* ── Tables ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--teal-light); cursor: pointer; }

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success   { background: #dcfce7; color: #166534; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-info      { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f3f4f6; color: #6b7280; }
.badge-ai        { background: var(--ai-light); color: var(--ai-purple); }

/* ── Tone badges ─────────────────────────────────────── */
.tone-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.tone-green  { background: #dcfce7; color: #166534; }
.tone-orange { background: #fef3c7; color: #92400e; }
.tone-red    { background: #fee2e2; color: #991b1b; }

/* ── AI suggestion box ───────────────────────────────── */
.ai-box {
  background: var(--ai-light);
  border: 1px solid #c4b0e8;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  margin: 12px 0;
}
.ai-box-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--ai-purple);
  margin-bottom: 8px;
  font-size: 13px;
}

/* ── Alerts ──────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success  { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-warning  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-danger   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info     { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Pagination ──────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 8px; margin-top: 20px; }
.page-info  { font-size: 13px; color: var(--text-muted); }

/* ── Public pages (login / register) ────────────────── */
body.public-page { background: var(--sand); display: flex; align-items: center; justify-content: center; min-height: 100vh; }

.public-container { width: 100%; max-width: 420px; padding: 24px 16px; }

.public-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}
.public-logo .logo-icon { font-size: 36px; }
.public-logo .logo-text { font-size: 26px; font-weight: 700; color: var(--teal); }

.auth-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
}
.auth-card h1 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.auth-card p  { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }

/* ── Divider ─────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Empty state ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3   { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state p    { font-size: 14px; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { padding: 16px; }
}

/* ── Datum DD/MM/YYYY ──────────────────────────────────── */
.date-dmy { display: flex; align-items: center; gap: 6px; }
.date-dmy .form-control { text-align: center; padding: 8px 4px; }
.date-sep { color: var(--text-muted); font-size: 18px; font-weight: 300; }

/* ── Kind avatar ─────────────────────────────────────────── */
.child-avatar-img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.child-detail-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.child-detail-avatar--initials { display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff; }

/* ── Kalenderwijziging banner ──────────────────────────── */
.request-banner { background: #fff8e1; border: 1px solid #ffe082; border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }

/* ── MT940 tabel ───────────────────────────────────────── */
.tx-relevant { background: #f0faf4; }
.tx-skip     { background: #fafafa; color: var(--text-muted); }
.amount-debit  { color: var(--danger); font-weight: 600; }
.amount-credit { color: var(--success); font-weight: 600; }
.table-responsive { overflow-x: auto; }

/* ── AI alternatief blok ───────────────────────────────── */
.ai-alternative { background: var(--ai-light); border: 1px solid #d0c0f0;
  border-radius: var(--radius); padding: 16px; margin-top: 12px; }
.ai-alt-label { font-weight: 600; color: var(--ai-purple); margin-bottom: 8px; font-size: 13px; }
.ai-alt-text  { white-space: pre-wrap; font-size: 14px; line-height: 1.6; margin-bottom: 12px;
  padding: 12px; background: #fff; border-radius: 6px; border: 1px solid #e0d0f8; }
.ai-alt-actions { display: flex; gap: 8px; }

/* ── Kalender maandgrid ────────────────────────────────── */
.cal-grid { margin-top: 16px; }
.cal-header { display: grid; grid-template-columns: repeat(7,1fr);
  background: var(--teal); border-radius: var(--radius) var(--radius) 0 0; }
.cal-day-name { text-align: center; padding: 8px 4px; color: #fff;
  font-size: 12px; font-weight: 600; }
.cal-cells { display: grid; grid-template-columns: repeat(7,1fr);
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius); }
.cal-cell { min-height: 80px; padding: 4px 6px; border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border); background: #fff; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell--empty { background: var(--bg); }
.cal-cell--today { background: var(--teal-light); }
.cal-day-num { font-size: 12px; font-weight: 600; color: var(--text-muted);
  margin-bottom: 4px; }
.cal-cell--today .cal-day-num { color: var(--teal); font-size: 14px; }
.cal-dots { display: flex; flex-direction: column; gap: 2px; }
.cal-dot { font-size: 11px; padding: 1px 4px; border-radius: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none; color: #fff; display: block; }
.cal-more { font-size: 10px; color: var(--text-muted); }
.cat-medical  { background: #ef9a9a; }
.cat-school   { background: #90caf9; }
.cat-sport    { background: #a5d6a7; }
.cat-social   { background: #ffcc80; }
.cat-custody  { background: #2D7D9A; }
.cat-other    { background: #b0bec5; }

/* ── Wisselschema ──────────────────────────────────────── */
.schema-header { display: grid; grid-template-columns: repeat(7,1fr);
  background: var(--teal); border-radius: var(--radius) var(--radius) 0 0; }
.schema-day-name { text-align: center; padding: 6px 2px; color: #fff; font-size: 12px; font-weight: 600; }
.schema-cells { display: grid; grid-template-columns: repeat(7,1fr);
  border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); }
.schema-cell { min-height: 56px; padding: 4px; border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border); text-align: center; }
.schema-cell:nth-child(7n) { border-right: none; }
.schema-cell--today { box-shadow: inset 0 0 0 2px var(--teal); }
.schema-cell-day { font-size: 11px; color: var(--text-muted); }
.schema-cell-owner { font-size: 18px; margin-top: 2px; }
.schema-legend { display: flex; gap: 16px; margin-bottom: 12px; }
.schema-legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.schema-legend-dot { width: 14px; height: 14px; border-radius: 50%; }
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.color-btn { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent;
  cursor: pointer; transition: border-color .15s; }
.color-btn.active { border-color: var(--text); }

/* ── Overdrachten ──────────────────────────────────────── */
.handover-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.handover-row:hover { background: var(--bg); }
.handover-icon { font-size: 24px; }
.handover-type { font-weight: 600; }
.handover-meta { font-size: 13px; color: var(--text-muted); }
.handover-notes { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.time-hm { display: flex; align-items: center; gap: 6px; }

/* ── Fotoalbum ─────────────────────────────────────────── */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 16px; }
.photo-thumb { display: block; border-radius: var(--radius); overflow: hidden;
  text-decoration: none; background: var(--bg); }
.photo-thumb img { width: 100%; height: 160px; object-fit: cover; display: block; }
.photo-caption { font-size: 12px; padding: 6px 8px; color: var(--text-muted); }
.photo-detail { text-align: center; }
.photo-full { max-width: 100%; max-height: 70vh; border-radius: var(--radius); }
.photo-meta { margin-top: 12px; font-size: 13px; color: var(--text-muted); }

/* ── Balans ────────────────────────────────────────────── */
.balans-card { background: var(--teal-light); border: 2px solid var(--teal);
  border-radius: var(--radius-lg); padding: 32px; text-align: center; margin-bottom: 24px; }
.balans-card--b { background: #f0faf4; border-color: var(--success); }
.balans-amount { font-size: 48px; font-weight: 700; color: var(--teal); }
.balans-card--b .balans-amount { color: var(--success); }
.balans-label { font-size: 16px; color: var(--text-muted); margin-top: 8px; }
.balans-even { background: #f0faf4; border: 2px solid var(--success);
  border-radius: var(--radius); padding: 24px; text-align: center;
  font-size: 18px; font-weight: 600; color: var(--success); margin-bottom: 24px; }

/* ── Leesbevestigingen ─────────────────────────────────── */
.read-receipt { font-size: 12px; color: var(--teal); margin-left: 6px; }
.read-receipt .read-time { font-size: 11px; color: var(--text-muted); }
.unread-receipt { font-size: 12px; color: var(--text-muted); margin-left: 6px; }
.read-receipt-bar { background: #f0faf4; border: 1px solid var(--success);
  border-radius: var(--radius); padding: 8px 14px; font-size: 13px;
  color: var(--success); margin: 8px 0 16px; }

/* ── Detail card (overdrachten) ────────────────────────── */
.detail-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; }
.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; }
.detail-list dt { font-weight: 600; color: var(--text-muted); font-size: 13px; padding-top: 2px; }
.detail-list dd { margin: 0; }

/* ── Wisselschema instellen ────────────────────────────── */
.form-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; max-width: 600px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── Nav badges (ongelezen tellers) ────────────────────── */
.nav-badge { background: #e53935; color: #fff; border-radius: 10px;
  font-size: 10px; font-weight: 700; padding: 1px 5px; margin-left: 4px;
  min-width: 16px; text-align: center; line-height: 14px; display: inline-block; }

/* ── Kalender wisselschema border ──────────────────────── */
.cal-cell { border-left: 3px solid transparent; transition: border-color .1s; }

/* ── Recurrence divider ─────────────────────────────────── */
.form-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Flash berichten ───────────────────────────────────── */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.flash-success { background: #f0faf4; border: 1px solid var(--success); color: #2e7d32; }
.flash-error   { background: #fff5f5; border: 1px solid var(--danger);  color: #c62828; }
.flash-info    { background: var(--teal-light); border: 1px solid var(--teal); color: var(--teal); }

/* ── Verlanglijst ──────────────────────────────────────── */
.wish-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.wish-item { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.wish-main { display: flex; align-items: flex-start; gap: 10px; flex: 1; }
.wish-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.wish-title { font-weight: 600; font-size: 15px; }
.wish-child { font-size: 13px; color: var(--teal); margin-top: 2px; }
.wish-desc  { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.wish-price { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 4px; }
.wish-link  { font-size: 12px; color: var(--teal); text-decoration: none; margin-top: 4px; display: inline-block; }
.wish-meta  { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.wish-actions { display: flex; flex-shrink: 0; }
.wish-purchased { font-size: 13px; color: var(--text-muted); padding: 6px 0;
  text-decoration: line-through; border-bottom: 1px solid var(--border); }
.btn-danger-outline { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-danger-outline:hover { background: #fff5f5; }
.input-prefix { display: flex; align-items: center; }
.input-prefix > span { padding: 8px 12px; background: var(--bg); border: 1px solid var(--border);
  border-right: none; border-radius: var(--radius) 0 0 var(--radius); color: var(--text-muted); }
.input-prefix .form-control { border-radius: 0 var(--radius) var(--radius) 0; }

/* ── Toegang & rechten ─────────────────────────────────── */
.access-list { display: flex; flex-direction: column; }
.access-row { display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--border); }
.access-row:last-child { border-bottom: none; }
.access-name  { font-weight: 600; }
.access-email { font-size: 13px; color: var(--text-muted); }
.access-meta  { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.access-date  { font-size: 12px; color: var(--text-muted); }
.access-info-box { background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; font-size: 13px;
  color: var(--text-muted); margin-bottom: 16px; }
