:root {
  --bg: #ffffff; --fg: #202124; --muted: #5f6368; --line: #e0e0e0; --hover: #f1f3f4;
  --accent: #f6c343; --shadow: 0 1px 3px rgba(0,0,0,.15);
  --c-default: #ffffff; --c-red: #faafa8; --c-orange: #f39f76; --c-yellow: #fff8b8;
  --c-green: #e2f6d3; --c-teal: #b4ddd3; --c-blue: #d4e4ed; --c-purple: #d3bfdb;
  --c-pink: #f6e2dd; --c-gray: #efeff1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #202124; --fg: #e8eaed; --muted: #9aa0a6; --line: #5f6368; --hover: #303134;
    --shadow: 0 1px 3px rgba(0,0,0,.6);
    --c-default: #202124; --c-red: #77172e; --c-orange: #692b17; --c-yellow: #7c4a03;
    --c-green: #264d3b; --c-teal: #0c625d; --c-blue: #256377; --c-purple: #472e5b;
    --c-pink: #6c394f; --c-gray: #4b443a;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       background: var(--bg); color: var(--fg); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* topbar */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
          padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top));
          background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font-size: 20px; font-weight: 500; margin: 0; }
.space-badge { flex: none; padding: 7px 14px; border-radius: 20px; font-weight: 600;
               text-decoration: none; color: #202124; background: var(--space-color); }
.space-werk  { --space-color: #aecbfa; }
.space-prive { --space-color: #ccebc5; }
@media (prefers-color-scheme: dark) {
  .space-werk  { --space-color: #8ab4f8; }
  .space-prive { --space-color: #a8dab5; }
}
#search { flex: 1; min-width: 0; max-width: 640px; padding: 10px 14px; border-radius: 8px; border: 0;
          background: var(--hover); outline: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; font-size: 18px; flex: none; }
.icon-btn:hover { background: var(--hover); }
.icon-btn.small { width: 28px; height: 28px; font-size: 13px; color: var(--muted); }
.icon-btn.on { background: var(--accent); }
.text-btn { padding: 8px 14px; border-radius: 6px; font-weight: 500; }
.text-btn:hover { background: rgba(127,127,127,.15); }

/* layout */
.layout { display: flex; }
.sidebar { width: 240px; flex: none; padding: 8px 0; position: sticky; top: 57px;
           height: calc(100vh - 57px); overflow-y: auto; }
.nav-item { display: block; width: 100%; text-align: left; padding: 11px 24px;
            border-radius: 0 25px 25px 0; color: var(--fg); text-decoration: none; }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.sidebar hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
main { flex: 1; min-width: 0; padding: 20px 16px 80px; }

@media (max-width: 799px) {
  .brand { display: none; }
  .sidebar { position: fixed; left: 0; top: 57px; z-index: 6; background: var(--bg);
             box-shadow: var(--shadow); transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
}
@media (min-width: 800px) { #menuBtn { display: none; } }

/* composer */
.composer { max-width: 600px; margin: 0 auto 28px; display: flex; align-items: center;
            padding: 4px 6px 4px 16px; border-radius: 8px; box-shadow: var(--shadow);
            border: 1px solid var(--line); cursor: text; color: var(--muted); }
.composer span { flex: 1; padding: 8px 0; }
.trash-bar { text-align: center; color: var(--muted); margin-bottom: 24px; font-style: italic; }
.trash-bar button { color: #1a73e8; font-style: normal; margin-left: 8px; }

/* grid (masonry via kolommen) */
.section-title { font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
                 color: var(--muted); margin: 8px auto 8px; max-width: 1200px; }
.grid { columns: 240px; column-gap: 14px; max-width: 1200px; margin: 0 auto 24px; }
.card { position: relative; break-inside: avoid; margin: 0 0 14px; padding: 12px 16px;
        border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
        white-space: pre-wrap; word-wrap: break-word; transition: box-shadow .15s; }
.card:hover { box-shadow: var(--shadow); }
.card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 500; padding-right: 22px; }
.card p { margin: 0; }
.card-list { list-style: none; margin: 0; padding: 0; }
.card-list li { display: flex; gap: 8px; align-items: flex-start; }
.card-list li.done span { text-decoration: line-through; color: var(--muted); }
.card-list li.more { color: var(--muted); font-size: 13px; }
.card-list input { margin-top: 4px; }
.pin-mark { position: absolute; top: 10px; right: 10px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; white-space: normal; }
.chip { font-size: 12px; padding: 2px 10px; border-radius: 12px; background: rgba(127,127,127,.18); }
.empty { text-align: center; color: var(--muted); margin-top: 60px; }

/* kleuren */
.c-default { background: var(--c-default); } .c-red { background: var(--c-red); }
.c-orange { background: var(--c-orange); } .c-yellow { background: var(--c-yellow); }
.c-green { background: var(--c-green); } .c-teal { background: var(--c-teal); }
.c-blue { background: var(--c-blue); } .c-purple { background: var(--c-purple); }
.c-pink { background: var(--c-pink); } .c-gray { background: var(--c-gray); }
.card:not(.c-default), .editor:not(.c-default) { border-color: transparent; }

/* editor */
.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.5);
           display: flex; align-items: flex-start; justify-content: center; padding: 10vh 12px 12px; }
.editor { width: 100%; max-width: 600px; border-radius: 10px; padding: 14px 16px 6px;
          box-shadow: 0 8px 30px rgba(0,0,0,.35); max-height: 85vh; overflow-y: auto; }
.ed-title, .ed-body { width: 100%; border: 0; background: transparent; outline: none; }
.ed-title { font-size: 20px; font-weight: 500; margin-bottom: 8px; }
.ed-body { resize: none; min-height: 120px; }
.ed-item { display: flex; align-items: center; gap: 8px; }
.ed-item input:not([type=checkbox]) { flex: 1; border: 0; background: transparent; outline: none; padding: 6px 0; }
.ed-item.done input:not([type=checkbox]) { text-decoration: line-through; color: var(--muted); }
.add-item { color: var(--muted); padding-left: 0; }
.ed-labels { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ed-labels .chip { cursor: pointer; }
.ed-toolbar { display: flex; align-items: center; gap: 2px; margin-top: 6px; }
.ed-toolbar .icon-btn { width: 36px; height: 36px; font-size: 16px; }
.spacer { flex: 1; }
.ed-colors { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); }

/* login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { width: 300px; display: flex; flex-direction: column; gap: 12px; padding: 28px;
             border: 1px solid var(--line); border-radius: 12px; }
.login-box h1 { margin: 0 0 8px; font-weight: 500; text-align: center; }
.login-box input { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.login-box button { padding: 12px; border-radius: 8px; background: var(--accent); color: #202124; font-weight: 600; }
.error { color: #d93025; margin: 0; font-size: 14px; }

/* startscherm */
.choose-page { display: flex; flex-direction: column; align-items: center; justify-content: center;
               min-height: 100vh; gap: 28px; padding: 20px; }
.choose-page h1 { margin: 0; font-weight: 500; }
.spaces { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.space-tile { width: 170px; height: 170px; border-radius: 18px; display: flex; flex-direction: column;
              align-items: center; justify-content: center; gap: 6px; text-decoration: none;
              color: #202124; background: var(--space-color); box-shadow: var(--shadow);
              transition: transform .1s; }
.space-tile:active { transform: scale(.97); }
.space-icon { font-size: 44px; }
.space-name { font-size: 22px; font-weight: 600; }
.space-count { font-size: 13px; opacity: .75; }
