:root {
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: #faf9f8;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --hover: #f3f2f1;
  --selected: #eff6fc;
  --border: #edebe9;
  --text: #323130;
  --text-2: #605e5c;
  --text-3: #8a8886;
  --accent: #2564cf;
  --accent-text: #2564cf;
  --danger: #a80000;
  --important: #2564cf;
  --shadow: 0 1.6px 3.6px rgba(0,0,0,.13), 0 .3px .9px rgba(0,0,0,.11);
  --shadow-lg: 0 6.4px 14.4px rgba(0,0,0,.13), 0 1.2px 3.6px rgba(0,0,0,.11);
  --radius: 4px;
  --list-bg: #faf9f8;
  --task-bg: #ffffff;
  --header-text: #2564cf;
  color-scheme: light;
}
:root.dark {
  --bg: #11100f;
  --sidebar: #1b1a19;
  --surface: #252423;
  --surface-2: #2b2a29;
  --hover: #323130;
  --selected: #2b3a4f;
  --border: #3b3a39;
  --text: #f3f2f1;
  --text-2: #c8c6c4;
  --text-3: #a19f9d;
  --accent: #6aa0ff;
  --accent-text: #8ab4ff;
  --danger: #f1707b;
  --task-bg: #252423;
  --shadow: 0 1.6px 3.6px rgba(0,0,0,.5);
  --shadow-lg: 0 6.4px 14.4px rgba(0,0,0,.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
svg { display: block; flex-shrink: 0; }
.hidden { display: none !important; }
.boot { height: 100vh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #2564cf 0%, #4a8bf5 100%); overflow: auto; height: 100vh; }
.auth-card { background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 36px 32px; width: 100%; max-width: 400px; }
.auth-card .logo { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 600; margin-bottom: 24px; }
.auth-card h2 { font-size: 20px; font-weight: 600; margin: 0 0 16px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.auth-switch { margin-top: 16px; font-size: 13px; color: var(--text-2); text-align: center; }
.link { color: var(--accent-text); cursor: pointer; }
.link:hover { text-decoration: underline; }
.error { color: var(--danger); font-size: 13px; margin: 8px 0; min-height: 1em; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-rows: 48px 1fr; height: 100vh; height: 100dvh; }
.topbar { background: var(--accent); color: #fff; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 4px; }
:root.dark .topbar { background: #1f3a68; }
.topbar .brand { font-weight: 600; font-size: 16px; padding: 0 8px; white-space: nowrap; }
.topbar .icon-btn { color: #fff; }
.topbar .icon-btn:hover { background: rgba(255,255,255,.15); }
.search { flex: 1; max-width: 400px; margin: 0 auto; position: relative; }
.search input { width: 100%; height: 32px; border-radius: var(--radius); border: 0; padding: 0 32px 0 34px; background: rgba(255,255,255,.95); color: #323130; outline: none; }
:root.dark .search input { background: #323130; color: #fff; }
.search .s-icon { position: absolute; left: 9px; top: 8px; color: var(--accent); }
.search .s-clear { position: absolute; right: 4px; top: 4px; color: #605e5c; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #8764b8; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }
.topbar .avatar { cursor: pointer; border: 2px solid rgba(255,255,255,.6); }

.body { display: grid; grid-template-columns: 290px 1fr auto; min-height: 0; }
.body.sidebar-collapsed { grid-template-columns: 0 1fr auto; }
.body.sidebar-collapsed .sidebar { visibility: hidden; }

.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: var(--radius); color: var(--text-2); flex-shrink: 0; }
.icon-btn:hover { background: var(--hover); }

/* ---------- Sidebar ---------- */
.sidebar { background: var(--sidebar); display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); overflow: hidden; }
.sidebar-top { padding: 8px 8px 0; }
.nav { flex: 1; overflow-y: auto; padding: 0 0 8px; }
.nav-item { display: flex; align-items: center; gap: 14px; height: 40px; padding: 0 16px 0 20px; cursor: pointer; position: relative; user-select: none; }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--selected); font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent); }
.nav-item .ico { width: 20px; display: grid; place-items: center; color: var(--text-2); font-size: 16px; }
.nav-item .ico.emoji { font-size: 16px; line-height: 1; }
.nav-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { font-size: 12px; color: var(--text-2); min-width: 18px; text-align: center; font-weight: 400; }
.nav-item .shared { color: var(--text-3); }
.nav-item.drop-target { background: var(--selected); outline: 2px dashed var(--accent); outline-offset: -2px; }
.nav-item.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.nav-item.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.nav-sep { height: 1px; background: var(--border); margin: 8px 16px; }
.nav-group > .nav-item .ico { color: var(--text-2); }
.nav-group .group-children { padding-left: 16px; }
.nav-group.collapsed .group-children { display: none; }
.nav-group .chev { transition: transform .15s; }
.nav-group.collapsed .chev { transform: rotate(-90deg); }
.group-empty { padding: 6px 20px 6px 54px; color: var(--text-3); font-size: 12px; }
.sidebar-bottom { display: flex; align-items: center; border-top: 1px solid var(--border); padding: 4px 4px 4px 8px; gap: 4px; }
.new-list { flex: 1; display: flex; align-items: center; gap: 14px; height: 40px; padding: 0 12px; color: var(--accent-text); border-radius: var(--radius); cursor: text; }
.new-list:hover { background: var(--hover); }
.new-list input { flex: 1; border: 0; outline: none; background: transparent; color: var(--text); min-width: 0; }
.new-list input::placeholder { color: var(--accent-text); }

/* ---------- Main ---------- */
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--list-bg); background-size: cover; background-position: center; }
.main-header { display: flex; align-items: flex-start; gap: 8px; padding: 28px 24px 8px; }
.main-header .titles { flex: 1; min-width: 0; }
.list-title { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 600; color: var(--header-text); min-height: 36px; }
.list-title .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: default; }
.list-title .t.editable { cursor: text; border-radius: 4px; padding: 0 4px; margin-left: -4px; }
.list-title .t.editable:hover { background: rgba(127,127,127,.12); }
.list-title input { font-size: 24px; font-weight: 600; color: var(--header-text); background: var(--surface); border: 1px solid var(--accent); border-radius: 4px; padding: 0 6px; outline: none; width: 100%; max-width: 420px; }
.list-title .emoji-btn { font-size: 24px; line-height: 1; cursor: pointer; border-radius: 4px; padding: 2px; }
.list-title .emoji-btn:hover { background: rgba(127,127,127,.12); }
.subtitle { color: var(--header-text); opacity: .85; font-size: 13px; margin-top: 2px; }
.header-actions { display: flex; gap: 2px; align-items: center; }
.header-actions .icon-btn, .header-actions .txt-btn { color: var(--header-text); }
.txt-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; height: 32px; border-radius: var(--radius); font-size: 13px; }
.txt-btn:hover, .header-actions .icon-btn:hover { background: rgba(127,127,127,.15); }
.has-bg .list-title, .has-bg .subtitle, .has-bg .header-actions .icon-btn, .has-bg .header-actions .txt-btn, .has-bg .section-head, .has-bg .sort-chip { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.35); }
.sort-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--header-text); margin: 0 24px 4px; padding: 2px 4px 2px 8px; border-radius: 12px; background: rgba(127,127,127,.12); align-self: flex-end; }
.sort-chip button { color: inherit; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; }
.sort-chip button:hover { background: rgba(127,127,127,.2); }

.task-scroll { flex: 1; overflow-y: auto; padding: 0 24px 24px; }
.add-task { background: var(--task-bg); border-radius: var(--radius); box-shadow: var(--shadow); margin: 4px 0 8px; }
.add-task .row { display: flex; align-items: center; gap: 12px; padding: 0 14px; height: 52px; }
.add-task .row .plus { color: var(--accent-text); }
.add-task input { flex: 1; border: 0; outline: none; background: transparent; font-size: 14px; }
.add-task input::placeholder { color: var(--accent-text); }
.add-task.focused input::placeholder { color: var(--text-3); }
.add-task .opts { display: none; align-items: center; gap: 2px; padding: 4px 10px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.add-task.focused .opts, .add-task.has-opts .opts { display: flex; }
.add-task .opts .chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 4px 8px; border-radius: 4px; color: var(--text-2); }
.add-task .opts .chip:hover { background: var(--hover); }
.add-task .opts .chip.set { color: var(--accent-text); }
.add-task .opts .spacer { flex: 1; }
.add-task .opts .btn { padding: 4px 10px; font-size: 12px; }

.task { display: flex; align-items: center; gap: 4px; background: var(--task-bg); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 8px; min-height: 52px; padding: 0 4px 0 6px; cursor: pointer; position: relative; user-select: none; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-3px); } }
.task:hover { background: var(--hover); }
:root.dark .task:hover { background: #2f2e2d; }
.task.selected { background: var(--selected); }
.task.dragging { opacity: .4; }
.task.drop-before { box-shadow: var(--shadow), inset 0 3px 0 var(--accent); }
.task.drop-after { box-shadow: var(--shadow), inset 0 -3px 0 var(--accent); }
.task .body-t { flex: 1; min-width: 0; padding: 8px 6px; }
.task .title { word-break: break-word; line-height: 1.35; }
.task.done .title { text-decoration: line-through; color: var(--text-2); }
.task .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; font-size: 12px; color: var(--text-2); margin-top: 2px; }
.task .meta > span { display: inline-flex; align-items: center; gap: 3px; }
.task .meta > span:not(:first-child)::before { content: "•"; margin: 0 6px; color: var(--text-3); }
.task .meta .overdue { color: var(--danger); }
.task .meta .today { color: var(--accent-text); }
.task .meta .cat-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cat-chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: 3px; font-size: 11px; line-height: 18px; }

.check { width: 32px; height: 32px; display: grid; place-items: center; flex-shrink: 0; border-radius: 50%; }
.check .circle { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--text-2); display: grid; place-items: center; transition: background .15s; }
.check .circle svg { opacity: 0; color: var(--accent); }
.check:hover .circle svg { opacity: 1; }
.check.checked .circle { background: var(--accent); border-color: var(--accent); }
.check.checked .circle svg { opacity: 1; color: #fff; }
.check.pop .circle { animation: pop .3s ease; }
@keyframes pop { 50% { transform: scale(1.3); } }
.star { width: 32px; height: 32px; display: grid; place-items: center; color: var(--text-2); border-radius: 50%; flex-shrink: 0; }
.star:hover { color: var(--important); }
.star.on { color: var(--important); }

.section-head { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--text); padding: 12px 4px 8px; cursor: pointer; user-select: none; }
.section-head .chev { transition: transform .15s; }
.section-head.collapsed .chev { transform: rotate(-90deg); }
.section-head .cnt { font-weight: 400; color: inherit; opacity: .8; }
.has-bg .section-head { }

.empty { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty .big { font-size: 56px; margin-bottom: 12px; }
.empty h3 { margin: 0 0 6px; font-size: 16px; color: var(--text); font-weight: 600; }
.has-bg .empty, .has-bg .empty h3 { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.4); }

/* ---------- Detail ---------- */
.detail { width: 360px; background: var(--surface-2); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
:root:not(.dark) .detail { background: #faf9f8; }
.detail-scroll { flex: 1; overflow-y: auto; padding: 16px 16px 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.card .d-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; cursor: pointer; color: var(--text-2); position: relative; }
.card .d-row:hover { background: var(--hover); }
.card .d-row.set { color: var(--accent-text); }
.card .d-row .lbl { flex: 1; min-width: 0; }
.card .d-row .lbl small { display: block; font-size: 12px; color: var(--text-2); }
.card .d-row .x { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 4px; color: var(--text-2); }
.card .d-row .x:hover { background: var(--surface-2); }
.card .d-row + .d-row { border-top: 1px solid var(--border); }
.d-title { display: flex; align-items: flex-start; gap: 4px; padding: 10px 4px 6px 4px; }
.d-title textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; font-size: 18px; font-weight: 600; padding: 4px; line-height: 1.35; border-radius: 4px; min-height: 32px; overflow: hidden; }
.d-title textarea:focus { background: var(--surface-2); }
.d-title.done textarea { text-decoration: line-through; color: var(--text-2); }
.step { display: flex; align-items: center; gap: 4px; padding: 0 4px 0 8px; min-height: 40px; position: relative; }
.step:hover { background: var(--hover); }
.step .check { width: 28px; height: 28px; }
.step .check .circle { width: 16px; height: 16px; }
.step input { flex: 1; border: 0; outline: none; background: transparent; padding: 6px 4px; }
.step.done input { text-decoration: line-through; color: var(--text-2); }
.step .more { opacity: 0; }
.step:hover .more { opacity: 1; }
.add-step { display: flex; align-items: center; gap: 12px; padding: 0 12px 0 14px; min-height: 40px; color: var(--accent-text); }
.add-step input { flex: 1; border: 0; outline: none; background: transparent; }
.add-step input::placeholder { color: var(--accent-text); }
.notes textarea { width: 100%; border: 0; outline: none; resize: none; background: transparent; padding: 12px; min-height: 110px; line-height: 1.45; }
.notes .updated { font-size: 11px; color: var(--text-3); padding: 0 12px 8px; }
.attachment { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); }
.attachment .fi { width: 36px; height: 36px; border-radius: 4px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 700; text-transform: uppercase; overflow: hidden; flex-shrink: 0; }
.attachment .fi img { width: 100%; height: 100%; object-fit: cover; }
.attachment .an { flex: 1; min-width: 0; }
.attachment .an a { color: var(--text); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment .an a:hover { text-decoration: underline; }
.attachment .an small { color: var(--text-2); font-size: 11px; }
.cats { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 10px 44px; }
.detail-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); padding: 0 8px; height: 52px; color: var(--text-2); font-size: 12px; background: var(--surface); }
.detail-footer .mid { flex: 1; text-align: center; }

/* ---------- Menus, dialogen ---------- */
.menu { position: fixed; z-index: 1000; background: var(--surface); box-shadow: var(--shadow-lg); border-radius: var(--radius); padding: 4px 0; min-width: 220px; max-width: 320px; max-height: 80vh; overflow-y: auto; border: 1px solid var(--border); animation: fadeIn .1s ease; }
.menu .mi { display: flex; align-items: center; gap: 12px; padding: 0 14px; height: 36px; cursor: pointer; white-space: nowrap; width: 100%; text-align: left; }
.menu .mi:hover, .menu .mi.focus { background: var(--hover); }
.menu .mi .ico { width: 18px; color: var(--text-2); display: grid; place-items: center; }
.menu .mi .ext { margin-left: auto; color: var(--text-3); font-size: 12px; padding-left: 16px; }
.menu .mi.danger { color: var(--danger); }
.menu .mi.danger .ico { color: var(--danger); }
.menu .mi.checked .ext { color: var(--accent-text); }
.menu .ms { height: 1px; background: var(--border); margin: 4px 0; }
.menu .mh { padding: 8px 14px 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.menu .picker { padding: 8px 14px; display: flex; flex-direction: column; gap: 8px; }
.menu .picker .btn { padding: 6px 12px; }

.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 900; display: grid; place-items: center; padding: 16px; animation: fadeIn .15s; }
.modal { background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; max-height: 90vh; display: flex; flex-direction: column; }
.modal.wide { max-width: 560px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; font-size: 18px; font-weight: 600; }
.modal-b { padding: 8px 20px 16px; overflow-y: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; }
.modal p { margin: 0 0 12px; color: var(--text-2); line-height: 1.45; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: 0; }
.setting-h { font-weight: 600; margin: 18px 0 4px; font-size: 13px; color: var(--accent-text); text-transform: uppercase; letter-spacing: .03em; }
.toggle { position: relative; width: 40px; height: 20px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; border: 1px solid var(--text-2); border-radius: 10px; cursor: pointer; transition: .15s; }
.toggle span::after { content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--text-2); top: 3px; left: 4px; transition: .15s; }
.toggle input:checked + span { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + span::after { background: #fff; left: 22px; }
.seg { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg button { padding: 6px 12px; font-size: 13px; }
.seg button.on { background: var(--accent); color: #fff; }

.themes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 8px 14px; }
.theme-sw { width: 34px; height: 34px; border-radius: 4px; cursor: pointer; border: 2px solid transparent; background-size: cover; background-position: center; }
.theme-sw.on { border-color: var(--text); box-shadow: inset 0 0 0 2px var(--surface); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; width: 300px; }
.emoji-grid button { font-size: 20px; height: 34px; border-radius: 4px; }
.emoji-grid button:hover { background: var(--hover); }

.member { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.member .mn { flex: 1; min-width: 0; }
.member .mn small { display: block; color: var(--text-2); font-size: 12px; }
.share-link { display: flex; gap: 6px; margin: 8px 0 12px; }
.share-link input { flex: 1; }

.suggest { position: absolute; right: 0; top: 0; bottom: 0; width: 360px; background: var(--surface-2); border-left: 1px solid var(--border); z-index: 20; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.suggest .sh { display: flex; align-items: center; justify-content: space-between; padding: 16px; font-size: 18px; font-weight: 600; }
.suggest .sb { flex: 1; overflow-y: auto; padding: 0 16px 16px; }
.suggest .sg-h { font-weight: 600; margin: 12px 0 8px; font-size: 13px; }
.suggest .task { cursor: default; }
.suggest .add-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: var(--accent-text); }
.suggest .add-btn:hover { background: var(--hover); }

#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #323130; color: #fff; padding: 10px 14px; border-radius: 6px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 16px; pointer-events: auto; animation: fadeIn .15s; max-width: 92vw; }
.toast button { color: #8ab4ff; font-weight: 600; }

.date-input { width: 100%; }

/* ---------- Mobiel ---------- */
.mobile-only { display: none !important; }
@media (max-width: 1100px) {
  .detail { position: fixed; right: 0; top: 48px; bottom: 0; z-index: 50; box-shadow: var(--shadow-lg); }
}
@media (max-width: 760px) {
  .mobile-only { display: inline-grid !important; }
  .desktop-only { display: none !important; }
  .body { grid-template-columns: 1fr !important; }
  .sidebar { visibility: visible !important; border-right: 0; }
  .body .main { display: none; }
  .body.view-list .sidebar, .body.view-detail .sidebar { display: none; }
  .body.view-list .main, .body.view-detail .main { display: flex; }
  .detail { width: 100%; top: 0; z-index: 60; border-left: 0; }
  .main-header { padding: 16px 12px 8px 4px; }
  .task-scroll { padding: 0 12px 90px; }
  .list-title, .list-title input { font-size: 22px; }
  .suggest { width: 100%; }
  .topbar .brand { display: none; }
  .add-task.mobile-fixed { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; margin: 0; box-shadow: var(--shadow-lg); }
  .nav-item { height: 46px; }
}

/* ---------- Print ---------- */
@media print {
  body { overflow: visible; background: #fff; }
  .topbar, .sidebar, .detail, .add-task, .header-actions, .star, .sort-chip, #toasts, .suggest { display: none !important; }
  .app, .body { display: block; height: auto; }
  .main { background: #fff !important; }
  .task-scroll { overflow: visible; }
  .task { box-shadow: none; border-bottom: 1px solid #ddd; border-radius: 0; break-inside: avoid; }
  .has-bg .list-title, .has-bg .section-head { color: #000; text-shadow: none; }
}

/* =========================================================
   Aanvullingen: account, delen, 2FA, instellingen
   ========================================================= */
.logo-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.notice { background: var(--selected); color: var(--text); border-left: 3px solid var(--accent); padding: 10px 12px; border-radius: 4px; font-size: 13px; margin-bottom: 14px; line-height: 1.45; }
.muted, .hint { color: var(--text-2); font-size: 13px; line-height: 1.45; }
.hint { margin: 6px 0 10px; }
.code-input { font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.acct-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.acct-card small, .acct-big small, .setting small { display: block; color: var(--text-2); font-size: 12px; font-weight: 400; margin-top: 2px; }
.acct-big { display: flex; align-items: center; gap: 14px; margin: 8px 0 16px; }
.acct-big .avatar { width: 56px; height: 56px; font-size: 20px; }
.inline { display: flex; gap: 8px; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.danger-text { color: var(--danger); }
.btn-row, .share-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -4px 0 8px; overflow-x: auto; }
.tabs button { padding: 10px 12px; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }
kbd { font-family: inherit; font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 2px 8px; }
.sec-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px solid var(--border); border-radius: 8px; margin: 8px 0 14px; }
.sec-card .sec-ico { color: var(--text-3); }
.sec-card.on .sec-ico { color: #107c10; }
.tf-steps { padding-left: 20px; margin: 0; line-height: 1.5; }
.tf-steps li { margin-bottom: 14px; }
.qr { background: #fff; display: inline-block; padding: 6px; border-radius: 8px; border: 1px solid var(--border); margin: 10px 0 6px; }
.secret { display: inline-block; margin-top: 4px; font-size: 15px; letter-spacing: .08em; background: var(--surface-2); padding: 4px 8px; border-radius: 4px; user-select: all; }
.backup-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.backup-codes code { background: var(--surface-2); padding: 8px; border-radius: 4px; text-align: center; font-size: 15px; letter-spacing: .06em; }
.share-hero { display: flex; align-items: center; gap: 12px; padding: 4px 0 4px; color: var(--accent-text); }
.share-hero .se { font-size: 28px; }
.share-hero b { color: var(--text); display: block; font-size: 16px; }
.share-hero small { color: var(--text-2); }
.invite-form { display: flex; gap: 8px; }
.invite-form .input { flex: 1; }
.member .role { font-size: 12px; color: var(--text-2); }
.member.pending .mn { color: var(--text-2); }
.join-card { text-align: center; }
.join-card .big { font-size: 48px; margin-bottom: 8px; }
.repeat-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.weekdays { display: flex; gap: 6px; flex-wrap: wrap; }
.weekdays .wd { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); font-size: 12px; text-transform: capitalize; }
.weekdays .wd.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cat-chip button { display: inline-grid; place-items: center; color: inherit; opacity: .7; }
.cat-chip button:hover { opacity: 1; }
.cats .cat-chip { font-size: 12px; line-height: 22px; padding: 0 8px; }

/* Zijbalk/hoofd extra's */
.title-ico { display: grid; place-items: center; }
.member-stack { display: inline-flex; vertical-align: middle; margin-right: 6px; }
.member-stack .avatar { border: 2px solid var(--list-bg); margin-left: -6px; }
.member-stack .avatar:first-child { margin-left: 0; }
.subtitle { display: flex; align-items: center; }
.assignee { margin-right: 2px; }
.all-done { display: flex; align-items: center; gap: 8px; color: var(--header-text); padding: 10px 4px; font-weight: 600; }
.circle-ph { display: none; }
.nav-head { display: none; }
.d-row.overdue { color: var(--danger) !important; }
.d-back { margin: -6px 0 6px -6px; }
.detail.file-over { outline: 2px dashed var(--accent); outline-offset: -6px; }
.suggest .task .add-btn + .star { display: none; }

/* =========================================================
   Animaties (zoals Microsoft To Do)
   ========================================================= */
.check .circle svg { transform: scale(.6); transition: opacity .15s, transform .15s; }
.check:hover .circle svg, .check.checked .circle svg { transform: scale(1); }
.check.pop .circle { animation: checkPop .35s cubic-bezier(.2,.9,.3,1.4); }
@keyframes checkPop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.check.pop.checked .circle::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 0 0 var(--accent); animation: ring .5s ease-out; }
.check .circle { position: relative; }
@keyframes ring { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } to { box-shadow: 0 0 0 10px transparent; } }
.task .title { transition: color .2s; }
.task.leaving { animation: taskLeave .28s ease-in forwards; pointer-events: none; }
@keyframes taskLeave { to { opacity: 0; transform: translateX(16px); max-height: 0; min-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; } }
.task.entering { animation: taskEnter .3s cubic-bezier(.1,.9,.2,1); }
@keyframes taskEnter { from { opacity: 0; transform: translateY(-12px) scale(.98); } }
.star.pop svg { animation: starPop .4s cubic-bezier(.2,.9,.3,1.5); }
@keyframes starPop { 0% { transform: scale(1) rotate(0); } 45% { transform: scale(1.45) rotate(-12deg); } 100% { transform: scale(1) rotate(0); } }
.detail.opening { animation: paneIn .26s cubic-bezier(.1,.9,.2,1); }
.detail.closing { animation: paneOut .18s ease-in forwards; }
@keyframes paneIn { from { transform: translateX(40px); opacity: 0; } }
@keyframes paneOut { to { transform: translateX(40px); opacity: 0; } }
.suggest { animation: paneIn .26s cubic-bezier(.1,.9,.2,1); }
.menu { transform-origin: top left; animation: menuIn .14s cubic-bezier(.1,.9,.2,1); }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.modal-back .modal { animation: modalIn .22s cubic-bezier(.1,.9,.2,1); }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.modal-back.out { animation: fadeOut .15s forwards; }
@keyframes fadeOut { to { opacity: 0; } }
.toast { animation: toastIn .25s cubic-bezier(.1,.9,.2,1); }
.toast.out { animation: toastOut .2s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
.section-head .chev { transition: transform .2s ease; }
.section-body { animation: fadeIn .2s ease; }
.nav-item { transition: background .1s; }
.nav-item.active::before { animation: barIn .2s ease; }
@keyframes barIn { from { transform: scaleY(0); } }
.main { transition: background .3s ease; }
.body { transition: grid-template-columns .2s ease; }
.list-title .t { animation: fadeIn .2s ease; }
.task:active { transform: scale(.995); }
.add-task .opts { animation: fadeIn .15s ease; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

@media (max-width: 760px) {
  .nav-head { display: flex; padding: 16px 20px 8px; }
  .acct-mini { display: flex; align-items: center; gap: 10px; }
  .body.view-detail .detail { animation: sheetIn .28s cubic-bezier(.1,.9,.2,1); }
  @keyframes sheetIn { from { transform: translateX(100%); } }
  .backup-codes { grid-template-columns: 1fr; }
  .modal { max-height: 92vh; }
}

/* Correcties na test */
#detail-slot { display: contents; }
.new-list { min-width: 0; }
.new-list input { width: 100%; }
.sidebar-bottom { min-width: 0; }
.list-title .icon-btn, .main-header .back-btn { color: var(--header-text); }
.has-bg .list-title .icon-btn, .has-bg .back-btn { color: #fff; }
.list-title .icon-btn:hover { background: rgba(127,127,127,.15); }
.qr { display: block; width: fit-content; }
@media (max-width: 760px) { .main-header { align-items: center; } .list-title { gap: 6px; } }

/* =========================================================
   Telefoon: aanraakvriendelijk + animaties
   ========================================================= */
#task-area, .section-body { position: relative; }
.swipe-bg { position: absolute; left: 0; right: 0; border-radius: var(--radius); display: flex; align-items: center; padding: 0 20px; color: #fff; font-weight: 600; font-size: 13px; transition: background .15s, opacity .25s; z-index: 0; }
.swipe-bg span { display: flex; align-items: center; gap: 8px; }
.swipe-bg.right { background: #8aa6d6; justify-content: flex-start; }
.swipe-bg.right.armed { background: #2564cf; }
.swipe-bg.left { background: #d9a0a0; justify-content: flex-end; }
.swipe-bg.left.armed { background: #c50f1f; }
.swipe-bg.armed span svg { animation: starPop .3s ease; }
.task { position: relative; z-index: 1; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
.task.swiping { box-shadow: var(--shadow-lg); }
.task.pressed { transform: scale(.97); transition: transform .15s; }
button, .nav-item { -webkit-tap-highlight-color: transparent; }

@media (max-width: 760px) {
  html, body { overscroll-behavior: none; }
  .topbar { padding-top: env(safe-area-inset-top); height: auto; min-height: 48px; }
  .app { grid-template-rows: auto 1fr; }
  .input, .add-task input, .search input, .new-list input, .step input, .add-step input, .d-title textarea, .notes textarea, .list-title input { font-size: 16px; } /* geen inzoomen op iOS */
  .task { min-height: 56px; }
  .check { width: 40px; height: 40px; }
  .star { width: 40px; height: 40px; }
  .nav-item:active, .task:active { background: var(--hover); }

  /* Schermovergangen */
  .body.nav-fwd .main { animation: pushIn .32s cubic-bezier(.1,.9,.2,1); }
  .body.nav-back .sidebar { animation: popIn .32s cubic-bezier(.1,.9,.2,1); }
  @keyframes pushIn { from { transform: translateX(40%); opacity: 0; } }
  @keyframes popIn { from { transform: translateX(-25%); opacity: .3; } }
  .detail { animation: sheetIn .3s cubic-bezier(.1,.9,.2,1); padding-bottom: env(safe-area-inset-bottom); }
  .detail.closing { animation: sheetOut .2s ease-in forwards; }
  @keyframes sheetOut { to { transform: translateX(100%); } }

  /* Invoerbalk onderin, zoals de To Do-app */
  .add-task.mobile-fixed { bottom: calc(12px + env(safe-area-inset-bottom)); border-radius: 10px; animation: barUp .35s cubic-bezier(.1,.9,.2,1); }
  .add-task.mobile-fixed .opts { border-radius: 0 0 10px 10px; }
  .add-task.mobile-fixed.focused { box-shadow: 0 -4px 24px rgba(0,0,0,.2); }
  @keyframes barUp { from { transform: translateY(120%); } }
  .task-scroll { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  #toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* Menu's als bottom-sheet */
  .menu { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-width: none; min-width: 0; max-height: 75vh; border-radius: 14px 14px 0 0; border: 0;
    padding: 8px 0 calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); animation: sheetUp .28s cubic-bezier(.1,.9,.2,1); }
  .menu::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 8px; }
  .menu .mi { height: 48px; font-size: 15px; }
  .menu .themes { grid-template-columns: repeat(6, 1fr); }
  .menu .theme-sw { width: 100%; height: 44px; }
  .emoji-grid { width: 100%; }
  @keyframes sheetUp { from { transform: translateY(100%); } }

  /* Dialogen als bottom-sheet */
  .modal-back { place-items: end center; padding: 0; }
  .modal-back .modal { max-width: none; border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: sheetUp .3s cubic-bezier(.1,.9,.2,1); }
  .modal-f .btn { flex: 1; padding: 12px; }
  .invite-form { flex-direction: column; }
}
@media (hover: none) { .nav-item:not(.active):hover { background: inherit; } .task:not(.selected):hover { background: var(--task-bg); } .step .more { opacity: 1; } }

/* =========================================================
   Web-app (PWA)
   ========================================================= */
.pwa-banner { display: flex; align-items: center; gap: 10px; margin: 8px; padding: 10px 6px 10px 12px; border-radius: 8px; background: var(--selected); animation: fadeIn .3s ease; }
.pwa-banner .pb-ico { color: var(--accent-text); }
.pwa-banner div { flex: 1; min-width: 0; font-size: 13px; }
.pwa-banner small { display: block; color: var(--text-2); font-size: 12px; }
.pwa-banner .icon-btn { width: 24px; height: 24px; }
.hint.warn { color: #a4262c; }
.ios-share { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid currentColor; border-radius: 4px; vertical-align: middle; }
/* Geïnstalleerde app: rekening houden met notch/statusbalk, geen tekstselectie op knoppen */
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); height: auto; min-height: calc(48px + env(safe-area-inset-top)); }
  .app { grid-template-rows: auto 1fr; }
  .sidebar-bottom { padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  .nav-item, .btn, .icon-btn, .txt-btn, .section-head, .task .meta { -webkit-user-select: none; user-select: none; }
  body { -webkit-touch-callout: none; }
  .search input { -webkit-user-select: text; user-select: text; }
}
.sec-card > div, .setting > span:first-child { flex: 1; min-width: 0; }
.modal-b { overflow-x: hidden; }
.setting small, .sec-card small { overflow-wrap: anywhere; }
