:root {
  --brand: #01666B; --brand-soft: #E6F2F2; --ink: #1F2A2E; --muted: #6B7780;
  --bg: #F5F7F8; --card: #FFFFFF; --line: #E3E8EB; --late: #B42318; --late-soft: #FEF3F2;
  --radius: 14px; --tabbar: 64px;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #E8EEF0; --muted: #9AA7AE; --bg: #0F1517; --card: #182124; --line: #26343A;
          --brand-soft: #12302F; --late-soft: #3A1714; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); margin: 0; }
.error { color: var(--late); min-height: 1.2em; margin: 0; }
h1 { font-size: 1.35rem; margin: 0; color: var(--brand); }
h2 { font-size: 1rem; margin: 0 0 .5rem; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
button.primary { background: var(--brand); color: #fff; border-radius: 10px; padding: .65rem 1rem; font-weight: 600; }
button.icon { width: 42px; height: 42px; border-radius: 50%; font-size: 1.15rem; }
button.icon:hover { background: var(--brand-soft); }
input { font: inherit; width: 100%; padding: .65rem .75rem; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--ink); }
input:focus { outline: 2px solid var(--brand); border-color: transparent; }

/* Inloggen */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(360px, 100%); display: grid; gap: .8rem; }
.login-card label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }

/* Opbouw */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.topbar { display: flex; justify-content: space-between; align-items: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem .5rem; max-width: 1100px; margin: 0 auto; }
.topbar-actions { display: flex; gap: .25rem; }
.content { max-width: 1100px; margin: 0 auto; padding: .5rem 1rem calc(var(--tabbar) + 90px); display: grid; gap: 1rem; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line); z-index: 10; }
.tabs button { display: grid; place-items: center; gap: 2px; font-size: .72rem; color: var(--muted); }
.tabs button span { font-size: 1.2rem; }
.tabs button.active { color: var(--brand); font-weight: 700; }

.quick-add { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  display: flex; gap: .5rem; padding: .6rem 1rem; background: var(--bg); border-top: 1px solid var(--line); z-index: 9; }
.quick-add .primary { width: 46px; padding: 0; font-size: 1.3rem; }
#mic.listening { background: var(--late-soft); color: var(--late); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

.grid-2 { display: grid; gap: 1rem; }

/* Tegels */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; text-align: left; }
.tile .num { font-size: 1.9rem; font-weight: 700; color: var(--brand); line-height: 1.1; }
.tile .lbl { color: var(--muted); font-size: .85rem; }
.tile.warn .num { color: var(--late); }

/* Lijsten */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: .75rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .main { flex: 1; min-width: 0; }
.list .main a { color: inherit; text-decoration: none; font-weight: 600; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { color: var(--muted); font-size: .85rem; }
.list .when { color: var(--muted); font-size: .85rem; white-space: nowrap; text-align: right; }
.badge { font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 99px;
  background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.badge.late { background: var(--late-soft); color: var(--late); }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.check:hover { border-color: var(--brand); background: var(--brand-soft); }
.day-head { font-weight: 700; color: var(--brand); margin: .75rem 0 .25rem; font-size: .9rem; }
.empty { color: var(--muted); padding: .5rem 0; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 80px); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: .55rem 1rem; border-radius: 99px; font-size: .9rem;
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--line), var(--card), var(--line));
  background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Groter scherm: tabbladen bovenaan, tegels op één rij */
@media (min-width: 820px) {
  .tabs { position: sticky; top: 0; bottom: auto; height: auto; max-width: 1100px; margin: 0 auto;
    display: flex; gap: .25rem; padding: .25rem 1rem; border: 0; background: var(--bg); }
  .tabs button { display: flex; gap: .4rem; font-size: .95rem; padding: .5rem .8rem; border-radius: 99px; }
  .tabs button.active { background: var(--brand-soft); }
  .tabs button span { font-size: 1rem; }
  .tiles { grid-template-columns: repeat(6, 1fr); }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
  .quick-add { bottom: 0; max-width: 1100px; margin: 0 auto; border: 0; }
  .content { padding-bottom: 90px; }
  .toast { bottom: 80px; }
}
