:root {
  --blue: #378ADD;
  --blue-dark: #185FA5;
  --amber: #BA7517;
  --pink: #D4537E;
  --green: #639922;
  --red: #E24B4A;
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --border: #e2e0d8;
  --text: #2c2c2a;
  --text-muted: #6b6a64;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a18;
    --surface: #262625;
    --surface-2: #2f2f2d;
    --border: #3a3a37;
    --text: #eceae3;
    --text-muted: #a3a29b;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: 70px;
}

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px 16px; position: sticky; top: 0; z-index: 50;
}
.brand { font-weight: 700; color: var(--blue); text-decoration: none; font-size: 18px; }
.mainnav { display: flex; gap: 14px; flex: 1; }
.mainnav a { color: var(--text-muted); text-decoration: none; font-size: 14px; padding: 4px 0; }
.mainnav a:hover { color: var(--text); }
.topbar-right { display: flex; gap: 12px; }
.icon-link { text-decoration: none; font-size: 18px; color: var(--text-muted); }
@media (max-width: 700px) { .mainnav { display: none; } }

/* Bottom nav (mobiel) */
.bottomnav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  justify-content: space-around; padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  z-index: 50;
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text-muted); text-decoration: none; font-size: 11px;
}
.bottomnav a span { font-size: 20px; }
@media (max-width: 700px) { .bottomnav { display: flex; } }

/* Container */
.container { max-width: 900px; margin: 0 auto; padding: 20px 16px; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue); color: #fff; border: none;
  border-radius: var(--radius); padding: 9px 16px; font-size: 14px;
  cursor: pointer; text-decoration: none; font-weight: 500;
}
.btn:hover { background: var(--blue-dark); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* Forms */
label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2); color: var(--text);
  font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
textarea { resize: vertical; min-height: 70px; }
.form-row { margin-bottom: 12px; }
.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.form-inline > div { flex: 1; min-width: 120px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; }

/* Flash */
.flash-wrap { margin-bottom: 16px; }
.flash { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 8px; font-size: 14px; }
.flash-success { background: #e7f3d9; color: #3b6d11; }
.flash-error { background: #fbe5e5; color: #a32d2d; }
.flash-warning { background: #faeeda; color: #854f0b; }
.flash-info { background: #e6f1fb; color: #185fa5; }
@media (prefers-color-scheme: dark) {
  .flash-success { background: #27500a; color: #c0dd97; }
  .flash-error { background: #791f1f; color: #f7c1c1; }
  .flash-warning { background: #633806; color: #fac775; }
  .flash-info { background: #0c447c; color: #b5d4f4; }
}

/* Lists */
.list { list-style: none; padding: 0; margin: 0; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; }
.muted { color: var(--text-muted); font-size: 13px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .big { font-size: 40px; margin-bottom: 10px; }

/* Badges */
.badge {
  display: inline-block; font-size: 12px; padding: 2px 9px;
  border-radius: 20px; background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-blue { background: #e6f1fb; color: #185fa5; border-color: #b5d4f4; }
.badge-warning { background: #faeeda; color: #854f0b; border-color: #fac775; }
.badge-danger { background: #fbe5e5; color: #a32d2d; border-color: #f7c1c1; }

/* Progress */
.progress { height: 8px; background: var(--border); border-radius: 20px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--green); border-radius: 20px; }
.progress-bar.over { background: var(--red); }
.progress-bar.warn { background: var(--amber); }

/* Metric cards */
.metric { background: var(--surface-2); border-radius: var(--radius); padding: 14px; }
.metric .label { font-size: 12px; color: var(--text-muted); }
.metric .value { font-size: 24px; font-weight: 600; }

/* Tables */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
table.data th { color: var(--text-muted); font-weight: 500; font-size: 13px; }

/* Calendar grid */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { text-align: center; font-size: 12px; color: var(--text-muted); padding: 4px; }
.cal-cell {
  min-height: 78px; background: var(--surface-2); border-radius: 8px; padding: 5px;
  font-size: 12px; border: 1px solid var(--border);
}
.cal-cell.today { border-color: var(--blue); border-width: 2px; }
.cal-daynum { font-weight: 600; font-size: 12px; }
.cal-event { font-size: 11px; padding: 2px 5px; border-radius: 5px; margin-top: 3px;
  color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Weekmenu */
.weekday-card { background: var(--surface-2); border-radius: var(--radius); padding: 12px; }
.weekday-card h4 { margin: 0 0 8px; font-size: 14px; }

.quick-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.quick-chip { display: inline-flex; align-items: center; gap: 6px; }
.quick-chip input { width: auto; }
.quick-chip label { margin: 0; cursor: pointer; }

.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: #eeedfe; color: #3c3489; margin: 2px; }
@media (prefers-color-scheme: dark) { .tag { background: #26215c; color: #cecbf6; } }

.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.row-actions { display: flex; gap: 6px; }
details.tool { margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; background: var(--surface-2); }
details.tool summary { cursor: pointer; font-weight: 500; }
details.tool[open] { padding-bottom: 14px; }
