/* ---------------------------------------------------------------
   Tokens — shadcn/ui "zinc" thema, licht en donker
   --------------------------------------------------------------- */
:root {
  --background:        0 0% 100%;
  --foreground:        240 10% 3.9%;
  --card:              0 0% 100%;
  --card-foreground:   240 10% 3.9%;
  --popover:           0 0% 100%;
  --primary:           240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary:         240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted:             240 4.8% 95.9%;
  --muted-foreground:  240 3.8% 46.1%;
  --accent:            240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --destructive:       0 72% 51%;
  --border:            240 5.9% 90%;
  --input:             240 5.9% 90%;
  --ring:              240 5.9% 10%;

  /* Typekleuren voor de badges en rails */
  --task:         217 91% 60%;
  --deadline:     38 92% 50%;
  --appointment:  262 83% 58%;
  --news:         240 5% 64.9%;
  --notification: 142 71% 45%;

  --radius: 0.625rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow:    0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);

  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --sans: 'Geist', 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background:        240 10% 3.9%;
    --foreground:        0 0% 98%;
    --card:              240 10% 5.5%;
    --card-foreground:   0 0% 98%;
    --popover:           240 10% 5.5%;
    --primary:           0 0% 98%;
    --primary-foreground: 240 5.9% 10%;
    --secondary:         240 3.7% 15.9%;
    --secondary-foreground: 0 0% 98%;
    --muted:             240 3.7% 15.9%;
    --muted-foreground:  240 5% 64.9%;
    --accent:            240 3.7% 15.9%;
    --accent-foreground: 0 0% 98%;
    --destructive:       0 72% 60%;
    --border:            240 3.7% 15.9%;
    --input:             240 3.7% 15.9%;
    --ring:              240 4.9% 83.9%;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .4);
    --shadow:    0 1px 3px 0 rgb(0 0 0 / .5);
    --shadow-lg: 0 10px 30px -6px rgb(0 0 0 / .6);

    color-scheme: dark;
  }
}

* { box-sizing: border-box; border-color: hsl(var(--border)); }

html, body {
  margin: 0;
  padding: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  font-feature-settings: 'rlig' 1, 'calt' 1;
}

body { padding-bottom: calc(var(--nav-h) + var(--safe-b)); }

h1, h2, h3 { font-weight: 600; letter-spacing: -.025em; margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
button:disabled { opacity: .5; pointer-events: none; }

:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

::selection { background: hsl(var(--primary) / .15); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------------------------------------------------------------
   Formulierelementen (Input, Label, Button)
   --------------------------------------------------------------- */
.field { display: block; margin-bottom: 16px; }
.field span {
  display: block;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  margin-bottom: 8px;
}

.field input, .field select, .field textarea,
.sheet input, .sheet select, .sheet textarea, .input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 44px;               /* touch-vriendelijk, desktop gaat naar 40 */
  padding: 0 12px;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  box-shadow: var(--shadow-sm);
  font-size: 16px;            /* voorkomt inzoomen op iOS */
  transition: box-shadow .15s, border-color .15s;
  -webkit-appearance: none;
  appearance: none;
}
.sheet textarea { height: auto; min-height: 80px; padding: 10px 12px; }
.field select, .sheet select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5M7 9l5-5 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.field select option, .sheet select option { background: hsl(var(--popover)); color: hsl(var(--foreground)); }
.field input[type="color"], .sheet input[type="color"] { padding: 4px; cursor: pointer; }
.field input::placeholder, .sheet input::placeholder, .input::placeholder { color: hsl(var(--muted-foreground)); }

.field input:focus-visible, .field select:focus-visible,
.sheet input:focus-visible, .sheet select:focus-visible, .sheet textarea:focus-visible, .input:focus-visible {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / .15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background-color .15s, opacity .15s, transform .1s;
}
.btn:hover  { background: hsl(var(--primary) / .9); }
.btn:active { transform: scale(.98); }
.btn-blue   { /* primair; naam behouden voor bestaande markup */ }
.btn-ghost, .btn-outline {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border-color: hsl(var(--input));
}
.btn-ghost:hover, .btn-outline:hover { background: hsl(var(--accent)); }
.btn-destructive { background: hsl(var(--destructive)); color: #fff; }
.btn-destructive:hover { background: hsl(var(--destructive) / .9); }
.btn-danger { color: hsl(var(--destructive)); }
.btn-danger:hover { background: hsl(var(--destructive) / .08); }
.btn-sm { width: auto; height: 36px; padding: 0 12px; font-size: 13px; }

.error {
  min-height: 20px;
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: hsl(var(--destructive));
}

/* ---------------------------------------------------------------
   Login
   --------------------------------------------------------------- */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(hsl(var(--border)) 1px, transparent 1px) 0 0 / 22px 22px,
    hsl(var(--background));
}

.login-card {
  width: min(400px, 100%);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 4px);
  padding: 28px 24px 24px;
  box-shadow: var(--shadow-lg);
}
.login-card .brand {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--radius);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  margin-bottom: 20px;
}
.login-card h1 { font-size: 24px; line-height: 1.2; margin-bottom: 6px; }
.login-card p  { color: hsl(var(--muted-foreground)); margin: 0 0 24px; font-size: 14px; }
.login-card .btn { margin-top: 8px; }

/* ---------------------------------------------------------------
   App-frame
   --------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: hsl(var(--background) / .8);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid hsl(var(--border));
}
.topbar h1 { font-size: 18px; line-height: 1.2; }
.topbar .date {
  font-size: 12px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  padding: 3px 10px;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
}
.topbar .date::first-letter { text-transform: uppercase; }

main { width: 100%; max-width: 720px; margin: 0 auto; }

.view { padding: 16px 16px 32px; display: none; }
.view.is-active { display: block; animation: fade-in .2s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 10px;
}
.section-head:first-child { margin-top: 4px; }
.section-head h2 {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: hsl(var(--muted-foreground));
}
.section-head h2::first-letter { text-transform: uppercase; }
.section-head button {
  height: 32px;
  padding: 0 12px;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background-color .15s;
}
.section-head button:hover { background: hsl(var(--accent)); }

.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

/* Focuskaart bovenaan de inbox */
.focus {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.focus .label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}
.focus .label::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: hsl(var(--notification));
  box-shadow: 0 0 0 3px hsl(var(--notification) / .2);
}
.focus .count {
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.04em;
  margin: 12px 0 6px;
  font-variant-numeric: tabular-nums;
}
.focus .sub { font-size: 14px; color: hsl(var(--muted-foreground)); }
.focus .strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 20px -20px -20px;
  border-top: 1px solid hsl(var(--border));
}
.focus .strip div { padding: 14px 20px; }
.focus .strip div + div { border-left: 1px solid hsl(var(--border)); }
.focus .strip div span { display: block; }
.focus .strip .n { font-size: 20px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.focus .strip .t { font-size: 12px; color: hsl(var(--muted-foreground)); }

/* Lijstitems: een gekleurde stip + badge codeert het type */
.row {
  --kind: var(--news);
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px 14px 12px 16px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: background-color .15s;
}
.row::before {
  content: '';
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: hsl(var(--kind));
}
.row[data-kind="task"]         { --kind: var(--task); }
.row[data-kind="deadline"]     { --kind: var(--deadline); }
.row[data-kind="appointment"]  { --kind: var(--appointment); }
.row[data-kind="news"]         { --kind: var(--news); }
.row[data-kind="notification"] { --kind: var(--notification); }
/* Bewerkbare rijen en kaarten */
[data-edit-item], [data-edit-notif], [data-edit-countdown], [data-edit-project] { cursor: pointer; }
.row[data-edit-item]:active, .row[data-edit-notif]:active, .countdown[data-edit-countdown]:active { background: hsl(var(--accent)); }
@media (hover: hover) {
  .row[data-edit-item]:hover, .row[data-edit-notif]:hover, .countdown[data-edit-countdown]:hover { background: hsl(var(--accent) / .6); }
}
.project-head[data-edit-project] { margin: -6px -8px; padding: 6px 8px; border-radius: calc(var(--radius) - 2px); }
.project-head[data-edit-project]:active { background: hsl(var(--accent)); }
.project-head[data-edit-project] h3::after {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  margin-left: 6px;
  vertical-align: -1px;
  opacity: .45;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.row.is-done .row-title { text-decoration: line-through; color: hsl(var(--muted-foreground)); }
.row.is-done .row-meta, .row.is-done .row-when { opacity: .6; }

.row-body { flex: 1; min-width: 0; }
.row-title { font-weight: 500; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.row-meta  { font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 3px; line-height: 1.4; }
.row-when  {
  flex: none;
  font-size: 12px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
  padding: 2px 8px;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.row-when:empty { display: none; }
.row-when.is-overdue {
  color: hsl(var(--destructive));
  border-color: hsl(var(--destructive) / .3);
  background: hsl(var(--destructive) / .08);
}

/* Checkbox / icoonknop */
.check {
  flex: none;
  position: relative;
  width: 20px; height: 20px;
  margin-top: 1px;
  padding: 0;
  border: 1px solid hsl(var(--primary));
  border-radius: 5px;
  background: transparent;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 12px;
  line-height: 1;
  box-shadow: var(--shadow-sm);
  transition: background-color .15s, color .15s;
}
.check::after { content: ''; position: absolute; inset: -12px; } /* groter tikvlak */
.check[aria-pressed="true"] { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.check[data-notif-del], .check[data-cd-del] {
  width: 32px; height: 32px;
  margin: -6px -6px -6px 0;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  box-shadow: none;
  color: hsl(var(--muted-foreground));
  font-size: 18px;
}
.check[data-notif-del]:hover, .check[data-cd-del]:hover { background: hsl(var(--accent)); color: hsl(var(--destructive)); }
.check[data-notif-del]::after, .check[data-cd-del]::after { inset: 0; }

/* Filters als Tabs */
.filters {
  display: flex;
  gap: 2px;
  margin: 0 0 8px;
  padding: 3px;
  overflow-x: auto;
  background: hsl(var(--muted));
  border-radius: var(--radius);
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.pill {
  flex: 1 0 auto;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: calc(var(--radius) - 3px);
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  font-weight: 500;
  transition: background-color .15s, color .15s;
}
.pill.is-active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: var(--shadow);
}

/* Projecten */
.project { margin-bottom: 12px; }
.project-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.project-head h3 { font-size: 16px; }
.project-pct {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: hsl(var(--secondary));
  font-variant-numeric: tabular-nums;
}
.bar { height: 8px; border-radius: 999px; background: hsl(var(--secondary)); margin: 14px 0 8px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: hsl(var(--primary)); transition: width .4s ease-out; }
.project-count { font-size: 13px; color: hsl(var(--muted-foreground)); }
.project-items { margin: 14px -16px -16px; border-top: 1px solid hsl(var(--border)); }
.project-items .row {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 11px 16px 11px 16px;
  margin: 0;
}
.project-items .row + .row { border-top: 1px solid hsl(var(--border)); }
.project-items .row::before { top: 12px; bottom: 12px; }

/* Tegels op Meer */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile {
  text-align: left;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: background-color .15s, border-color .15s;
}
.tile:hover { background: hsl(var(--accent)); }
.tile:active { transform: scale(.99); }
.tile .glyph {
  width: 36px; height: 36px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  display: grid; place-items: center;
}
.tile .name { display: block; font-weight: 600; font-size: 15px; }
.tile .hint { display: block; font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 2px; line-height: 1.35; }

/* Countdown */
.countdown { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.countdown .days {
  flex: none;
  min-width: 64px;
  padding: 8px 6px;
  border-radius: var(--radius);
  background: hsl(var(--secondary));
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.countdown .days small { display: block; margin-top: 4px; font-size: 11px; font-weight: 500; letter-spacing: 0; color: hsl(var(--muted-foreground)); }
.countdown.is-past .days { color: hsl(var(--muted-foreground)); }

/* Grafiek */
.chart { width: 100%; height: 160px; display: block; color: hsl(var(--foreground)); }
.chart .line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .area { fill: url(#fade); }
.chart .grid { stroke: hsl(var(--border)); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.chart .dot  { fill: hsl(var(--background)); stroke: currentColor; stroke-width: 2; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.stat-row > div { padding: 10px 12px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
.stat-row .n { font-size: 20px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-row .t { font-size: 12px; color: hsl(var(--muted-foreground)); }

.empty {
  text-align: center;
  padding: 36px 20px;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  border: 1px dashed hsl(var(--border));
  border-radius: calc(var(--radius) + 2px);
}
.empty strong { display: block; color: hsl(var(--foreground)); font-weight: 600; margin-bottom: 4px; }
.card .empty { border: 0; padding: 28px 12px; }

/* ---------------------------------------------------------------
   Onderbalk (mobiel) / zijbalk (desktop)
   --------------------------------------------------------------- */
.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 6px 6px var(--safe-b);
  background: hsl(var(--background) / .85);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid hsl(var(--border));
}
.nav button {
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 2px;
  border-radius: var(--radius);
  color: hsl(var(--muted-foreground));
  font-size: 11px;
  font-weight: 500;
  transition: color .15s, background-color .15s;
}
.nav button.is-active { color: hsl(var(--foreground)); }
.nav button.is-active svg { background: hsl(var(--secondary)); }
.nav svg {
  width: 44px; height: 28px;
  padding: 4px 12px;
  border-radius: 999px;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  transition: background-color .15s;
}

/* Zwevende knop */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  z-index: 25;
  width: 52px; height: 52px;
  border: 0;
  border-radius: 50%;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-lg);
  display: none;
  place-items: center;
  transition: transform .1s, background-color .15s;
}
.fab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.fab:hover { background: hsl(var(--primary) / .9); }
.fab:active { transform: scale(.95); }
.fab.is-visible { display: grid; }

/* ---------------------------------------------------------------
   Sheet (Drawer op mobiel, Dialog op desktop)
   --------------------------------------------------------------- */
.scrim {
  position: fixed; inset: 0;
  z-index: 40;
  background: rgb(0 0 0 / .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.scrim.is-open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 41;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 16px calc(24px + var(--safe-b));
  background: hsl(var(--background));
  border-top: 1px solid hsl(var(--border));
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform .3s cubic-bezier(.32, .72, 0, 1), visibility 0s linear .3s;
}
.sheet.is-open { transform: translateY(0); visibility: visible; transition-delay: 0s; }
.sheet .grip { width: 48px; height: 5px; border-radius: 999px; background: hsl(var(--muted)); margin: 0 auto 20px; }
.sheet h2 { font-size: 18px; line-height: 1.3; margin-bottom: 6px; }
.sheet .lead { font-size: 14px; color: hsl(var(--muted-foreground)); margin: 0 0 20px; }
.sheet .btn { margin-top: 8px; }

/* Segmented control als Tabs */
.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: 16px;
  background: hsl(var(--muted));
  border-radius: var(--radius);
}
.seg button {
  flex: 1;
  height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: calc(var(--radius) - 3px);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  transition: background-color .15s, color .15s;
}
.seg button.is-active { background: hsl(var(--background)); color: hsl(var(--foreground)); box-shadow: var(--shadow); }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.two > * { min-width: 0; }
.two .btn { margin-top: 0; }
.sheet input[type="datetime-local"], .sheet input[type="date"] { min-width: 0; max-width: 100%; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid hsl(var(--border)); }
.card > .toggle-row:first-child { padding-top: 0; border-top: 0; }
.card > .toggle-row:last-child { padding-bottom: 0; }
.toggle-row .t { font-size: 14px; font-weight: 500; }
.toggle-row .s { font-size: 13px; color: hsl(var(--muted-foreground)); }
.toggle-row .btn { flex: none; }

.stack-top { margin-top: 16px; }

.hidden { display: none !important; }

/* Toast (Sonner-achtig) */
.toast {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 84px);
  z-index: 50;
  max-width: 360px;
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--popover));
  color: hsl(var(--foreground));
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(12px) scale(.98);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: none; }

/* ---------------------------------------------------------------
   Groter scherm
   --------------------------------------------------------------- */
@media (min-width: 768px) {
  :root { --side-w: 232px; }

  body { padding-bottom: 0; padding-left: var(--side-w); }

  .field input, .field select,
  .sheet input, .sheet select, .input, .btn { height: 40px; font-size: 14px; }
  .btn-sm { height: 36px; }

  .topbar { padding: 14px 32px; min-height: 64px; }
  .topbar h1 { font-size: 22px; }
  .view { padding: 24px 32px 48px; }
  main { max-width: 820px; margin: 0; }

  .nav {
    top: 0; bottom: 0; left: 0; right: auto;
    width: var(--side-w);
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 12px;
    border-top: 0;
    border-right: 1px solid hsl(var(--border));
    background: hsl(var(--muted) / .4);
  }
  .nav::before {
    content: 'Dashboard';
    display: block;
    padding: 6px 10px 18px;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -.01em;
    color: hsl(var(--foreground));
  }
  .nav button {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    height: 36px;
    margin: 0;
    padding: 0 10px;
    font-size: 14px;
    border-radius: calc(var(--radius) - 2px);
  }
  .nav button:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
  .nav button.is-active { background: hsl(var(--accent)); }
  .nav button.is-active svg { background: none; }
  .nav svg { width: 18px; height: 18px; padding: 0; border-radius: 0; }

  .fab { right: 32px; bottom: 32px; }
  .toast { left: calc(var(--side-w) + 16px); bottom: 32px; }

  .tiles { grid-template-columns: repeat(4, 1fr); }
  .project-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .project-list .project { margin: 0; }

  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%;
    width: min(520px, calc(100% - 32px));
    max-height: 85dvh;
    padding: 24px;
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 4px);
    opacity: 0;
    transform: translate(-50%, -48%) scale(.96);
    transition: transform .2s ease-out, opacity .2s ease-out, visibility 0s linear .2s;
  }
  .sheet.is-open { opacity: 1; transform: translate(-50%, -50%); }
  .sheet .grip { display: none; }
}
