/* HAL Planner · Notion-stijl: wit, lichtgrijze vlakken, rustige sans, kleur komt van de labels */

:root {
  --bg: #FFFFFF;
  --panel: #F7F7F5;
  --card: #FFFFFF;
  --card-2: #F7F7F5;
  --border: #E9E9E7;
  --border-strong: #D3D1CB;
  --text: #37352F;
  --text-2: #787774;
  --text-3: #9B9A97;
  --accent: #37352F;
  --accent-ink: #5F5E5B;
  --accent-soft: rgba(55, 53, 47, .06);
  --ring: #9DB7DA;
  --today: #EB5757;
  --today-soft: rgba(235, 87, 87, .12);
  --track: #E9E9E7;
  --fill: #6FAE8A;
  --hover: rgba(55, 53, 47, .06);
  --active: rgba(55, 53, 47, .09);
  --btn-bg: #2F2E2B;
  --btn-fg: #FFFFFF;
  --btn-hover: #46443F;
  --btn2-bg: #EFEFED;
  --btn2-hover: #E6E6E3;
  --danger: #D44C47;
  --callout: #FBF3DB;
  --callout-ink: #5C4A14;
  --shadow: none;
  --shadow-pop: 0 0 0 1px rgba(15, 15, 15, .05), 0 3px 6px rgba(15, 15, 15, .08), 0 9px 24px rgba(15, 15, 15, .16);
  --scrim: rgba(15, 15, 15, .4);
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --r: 10px;
  --kb: 0px;
}

/* Labelkleuren: Notion-palet, levendig maar zacht */
.c-default { --cb: #F1F1EF; --ct: #32302C; --cd: #91918E; }
.c-gray    { --cb: #E3E2E0; --ct: #32302C; --cd: #91918E; }
.c-brown   { --cb: #EEE0DA; --ct: #442A1E; --cd: #BB846C; }
.c-orange  { --cb: #FADEC9; --ct: #49290E; --cd: #D7813A; }
.c-yellow  { --cb: #FDECC8; --ct: #402C1B; --cd: #CB912F; }
.c-green   { --cb: #DBEDDB; --ct: #1C3829; --cd: #4F9768; }
.c-blue    { --cb: #D3E5EF; --ct: #183347; --cd: #4A8DB8; }
.c-purple  { --cb: #E8DEEE; --ct: #412454; --cd: #A782C3; }
.c-pink    { --cb: #F5E0E9; --ct: #4C2337; --cd: #CD749F; }
.c-red     { --cb: #FFE2DD; --ct: #5D1715; --cd: #E16F64; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919;
    --panel: #202020;
    --card: #262626;
    --card-2: #2C2C2C;
    --border: #333333;
    --border-strong: #474747;
    --text: #E6E6E4;
    --text-2: #9B9B9B;
    --text-3: #6F6F6F;
    --accent: #E6E6E4;
    --accent-ink: #B4B4B2;
    --accent-soft: rgba(255, 255, 255, .07);
    --ring: #4F6F9C;
    --today-soft: rgba(235, 87, 87, .2);
    --track: #373737;
    --fill: #4F9768;
    --hover: rgba(255, 255, 255, .055);
    --active: rgba(255, 255, 255, .09);
    --btn-bg: #E6E6E4;
    --btn-fg: #191919;
    --btn-hover: #FFFFFF;
    --btn2-bg: #2F2F2F;
    --btn2-hover: #3A3A3A;
    --danger: #E5706B;
    --callout: #3A3222;
    --callout-ink: #E9D9A8;
    --shadow-pop: 0 0 0 1px rgba(255, 255, 255, .07), 0 3px 6px rgba(0, 0, 0, .3), 0 9px 24px rgba(0, 0, 0, .5);
    --scrim: rgba(0, 0, 0, .6);
  }
  .c-default { --cb: #373737; --ct: #D4D4D4; --cd: #9B9B9B; }
  .c-gray    { --cb: #5A5A5A; --ct: #EDEDED; --cd: #BDBDBD; }
  .c-brown   { --cb: #603B2C; --ct: #F2DDD2; --cd: #D1A088; }
  .c-orange  { --cb: #854C1D; --ct: #FBE3CF; --cd: #F0A968; }
  .c-yellow  { --cb: #89632A; --ct: #FCEFCF; --cd: #EDC16A; }
  .c-green   { --cb: #2B593F; --ct: #D9F0DF; --cd: #7BC598; }
  .c-blue    { --cb: #28456C; --ct: #D6E7F7; --cd: #7FB2E0; }
  .c-purple  { --cb: #492F64; --ct: #EADDF5; --cd: #C3A1DE; }
  .c-pink    { --cb: #69314C; --ct: #F8DDE9; --cd: #E59ABD; }
  .c-red     { --cb: #6E3630; --ct: #FCDDD8; --cd: #F0938A; }
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--sans); font-weight: 700; margin: 0; letter-spacing: -.02em; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; border-radius: 6px; }
.emo { margin-right: .5em; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif; letter-spacing: 0; }
.ti { flex: none; color: var(--text-3); }
::selection { background: var(--accent-soft); }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
#app { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
#main { min-width: 0; padding: 0 40px 96px; }
#view { max-width: 1180px; margin: 0 auto; }

/* ---------- Sidebar ---------- */
#sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: 22px 14px 16px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand-logo { width: 34px; height: 34px; flex: none; display: block; }
.brand-logo { border-radius: 23%; background: #FFFFFF; box-shadow: 0 0 0 1px var(--border); }
.brand + .sync-status { margin: -14px 0 16px 54px; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.brand-sub { display: block; font-family: var(--sans); font-size: 12px; color: var(--text-2); letter-spacing: 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; min-height: 38px; border-radius: 10px;
  color: var(--text); border: 1px solid transparent;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--active); font-weight: 500; }
.nav-item .ico { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; flex: none; }
.nav-item .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item.add { color: var(--text-2); }
.nav-item.add:hover { color: var(--text); }
.nav-section { padding: 22px 10px 6px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.nav-section[data-sort] { cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.nav-row { position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.nav-row .nav-item { padding-right: 34px; }
.nav-pin { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--text-3); opacity: 0; }
.nav-row:hover .nav-pin, .nav-pin:focus-visible { opacity: 1; }
.nav-row.pinned .nav-pin { opacity: 1; color: var(--text); }
.nav-row.pinned .nav-pin svg { fill: currentColor; }
.nav-pin:hover { background: var(--active); color: var(--text); }
@media (hover: none) { .nav-pin { opacity: .45; } }
.tab[data-sort] { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.nav-projects { display: flex; flex-direction: column; gap: 2px; }
.sidebar-spacer { flex: 1; min-height: 24px; }
.data-box { border-top: 1px solid var(--border); padding: 12px 6px 0; }
.data-box .nav-section { padding: 0 4px 8px; }
.data-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Sync (v14) ---------- */
.sync-status { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 2px 8px; border-radius: 999px; font-size: 12px; color: var(--text-2); }
.sync-status:hover { background: var(--hover); color: var(--text); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.sync-status.s-ok .sync-dot { background: #4F9768; }
.sync-status.s-busy .sync-dot { background: #CB912F; animation: sync-pulse 1s ease-in-out infinite alternate; }
.sync-status.s-off .sync-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-3); }
.sync-status.s-err { color: var(--danger); }
.sync-status.s-err .sync-dot { background: var(--danger); }
@keyframes sync-pulse { from { opacity: 1; } to { opacity: .35; } }
.app-version { margin-top: 10px; padding: 0 4px; font-size: 11.5px; color: var(--text-3); }
.sync-account { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.sync-mail { flex: 1; min-width: 0; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#login-layer { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); background: var(--panel); overflow-y: auto; }
.login-card { width: min(380px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-pop); padding: 28px 24px 24px; display: flex; flex-direction: column; }
.login-logo { width: 64px; height: 64px; border-radius: 23%; background: #FFFFFF; box-shadow: 0 0 0 1px var(--border); align-self: center; margin-bottom: 14px; }
.login-card h1 { font-size: 20px; font-weight: 600; text-align: center; letter-spacing: -.01em; margin: 0; }
.login-sub { margin: 6px 0 20px; text-align: center; color: var(--text-2); font-size: 13.5px; }
.login-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.login-field input { font: inherit; font-size: 16px; font-weight: 400; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px; width: 100%; }
.login-field input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgba(157, 183, 218, .35); }
.login-remember { display: flex; align-items: center; gap: 8px; margin: 2px 0 10px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.login-remember input { width: 17px; height: 17px; accent-color: var(--btn-bg); margin: 0; }
#update-bar { position: fixed; z-index: 92; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 10px; background: var(--btn-bg); color: var(--btn-fg); font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-pop); animation: toast-in .2s ease-out; }
#update-bar .update-btn { background: var(--btn-fg); color: var(--btn-bg); }
.login-err { min-height: 18px; margin: 0 0 10px; color: var(--danger); font-size: 13px; }
.login-btn { width: 100%; min-height: 42px; }
body.logged-out #app, body.logged-out #panel { visibility: hidden; }

/* ---------- Knoppen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 0 12px; border-radius: 6px;
  font-weight: 500; font-size: 13.5px; white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { background: var(--btn-hover); }
.btn-secondary { background: var(--btn2-bg); color: var(--text); }
.btn-secondary:hover { background: var(--btn2-hover); }
.btn-small { min-height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-danger-ghost { color: var(--danger); padding: 0 12px; margin-left: -12px; }
.btn-danger-ghost:hover { background: var(--accent-soft); }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; color: var(--text-2); font-size: 20px; line-height: 1; flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.link-btn { color: var(--accent-ink); font-weight: 500; padding: 8px 0; min-height: 36px; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Topbar + tabs ---------- */
#topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  margin: 0 -40px 8px; padding: 0 40px;
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; }
.topbar-row { display: flex; align-items: center; gap: 12px; padding: 18px 0 10px; }
.topbar-row h1 { font-size: 20px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hamburger { display: none; margin-left: -8px; }
.hamburger svg { width: 20px; height: 20px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -6px; padding: 0 6px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; padding: 6px 10px; margin-bottom: 8px; white-space: nowrap;
  color: var(--text-2); font-weight: 500; font-size: 14px; border-radius: 6px;
}
.tab .emo { margin-right: 6px; font-size: 15px; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active { background: var(--active); color: var(--text); font-weight: 600; }

/* ---------- Weergavekop ---------- */
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 0 18px; }
.view-head h2 { font-size: 30px; line-height: 1.2; }
.view-head h2::first-letter { text-transform: uppercase; }
.view-sub { color: var(--text-2); margin-top: 4px; max-width: 64ch; }
.view-sub .rel { color: var(--today); font-weight: 600; }
.nav-group { display: inline-flex; align-items: center; background: var(--btn2-bg); border-radius: 8px; padding: 3px; gap: 2px; flex: none; }
.nav-group button { min-height: 28px; min-width: 32px; padding: 0 10px; border-radius: 5px; font-weight: 500; font-size: 13.5px; text-align: center; }
.nav-group button:hover { background: var(--btn2-hover); }
.nav-group .arrow { font-size: 18px; line-height: 1; padding: 0 10px; }

/* ---------- Kaarten en groepen ---------- */
.card { background: var(--panel); border-radius: var(--r); }
.card.cal { background: var(--card); border: 1px solid var(--border); }
.group { margin-bottom: 18px; overflow: hidden; padding-bottom: 6px; }
.group.no-head { padding-top: 8px; }
.group.is-closed { padding-bottom: 0; }
.group.is-today { box-shadow: inset 0 0 0 1.5px var(--today-soft); }
.group-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px; flex-wrap: wrap; min-height: 50px; }
.group-head h3 { font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.group-head h3::first-letter { text-transform: uppercase; }
.group-head .meta { color: var(--text-2); font-size: 13px; }
.group-head .today-tag { color: var(--today); font-weight: 600; font-size: 12px; background: var(--today-soft); border-radius: 4px; padding: 1px 7px; align-self: center; }
.group-intro { padding: 0 18px 12px; color: var(--text-2); max-width: 72ch; }
.group-empty { padding: 4px 18px 10px; color: var(--text-3); font-size: 13.5px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 8px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; }
.grid tbody tr:last-child td { border-bottom: 0; }
table.grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.grid th, .grid td { padding: 0; border-bottom: 1px solid var(--border); vertical-align: middle; height: 42px; }
.grid th { height: 34px; background: transparent; font-weight: 500; font-size: 12.5px; color: var(--text-2); text-align: left; }
.grid tbody tr:hover td { background: var(--hover); }
.th-btn { display: flex; align-items: center; gap: 6px; width: 100%; height: 34px; padding: 0 10px; overflow: hidden; white-space: nowrap; color: inherit; font-weight: 500; }
.th-btn span { overflow: hidden; text-overflow: ellipsis; }
.th-btn:hover { color: var(--text); background: var(--hover); }
.th-btn.th-title { padding-left: 2px; }
.th-plus { display: flex; align-items: center; justify-content: center; width: 100%; height: 34px; color: var(--text-2); font-size: 17px; }
.th-plus:hover { color: var(--text); background: var(--hover); }
.grid th { position: relative; }
.col-resize { position: absolute; top: 0; right: -5px; width: 10px; height: 100%; cursor: col-resize; z-index: 2; touch-action: none; }
.col-resize::after { content: ''; position: absolute; left: 4px; top: 5px; bottom: 5px; width: 2px; border-radius: 2px; background: #2383E2; opacity: 0; transition: opacity .12s; }
.col-resize:hover::after, .col-resize.on::after { opacity: 1; }
body.col-resizing, body.col-resizing * { cursor: col-resize !important; user-select: none !important; -webkit-user-select: none !important; }
@media (hover: none) { .col-resize { width: 20px; right: -10px; } .col-resize::after { left: 9px; opacity: .25; } }
.col-check { width: 44px; }
.col-plus { width: 44px; }
td.td-check { text-align: center; }
.cell { display: flex; align-items: center; width: 100%; min-height: 42px; padding: 4px 10px; overflow: hidden; }
.cell:hover { background: var(--hover); }
.cell .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .ph { color: var(--text-3); opacity: 0; transition: opacity .12s; font-size: 13px; }
.cell:hover .ph, .cell:focus-visible .ph, .prow .cell .ph { opacity: 1; }
.cell.static { cursor: pointer; color: var(--text-2); }
.cell.plain { color: var(--text-2); cursor: default; }
.cell.plain:hover { background: none; }
.th-txt { display: block; padding: 0 10px; }
.progress.plain { border-top: 0; padding-top: 8px; }
.t-title { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px; padding: 6px 10px 6px 2px; font-weight: 500; }
.t-title .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-title:hover .txt { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.t-title .nameless { color: var(--text-3); font-weight: 400; }
.t-title .rep { color: var(--text-3); font-size: 13px; flex: none; }
tr.is-done .t-title .txt { text-decoration: line-through; color: var(--text-2); font-weight: 400; }

/* Checkbox */
.check { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; flex: none; }
.check::before {
  content: ''; width: 18px; height: 18px; border-radius: 6px;
  border: 1.5px solid var(--border-strong); background: var(--card);
  transition: border-color .12s, background .12s;
}
.check:hover::before { border-color: var(--accent); background: var(--accent-soft); }
.check[aria-checked="true"]::before {
  border-color: var(--fill); background: var(--fill) center / 12px 12px no-repeat
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.3l2.3 2.3 4.7-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.series-ico { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; color: var(--accent-ink); font-size: 17px; }
.series-ico:hover { background: var(--hover); }
.mini-check { display: inline-flex; align-items: center; gap: 8px; }
.mini-check::before {
  content: ''; width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--border-strong); background: var(--card); flex: none;
}
.mini-check.on::before {
  border-color: var(--text); background: var(--text) center / 10px 10px no-repeat
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.3l2.3 2.3 4.7-5' fill='none' stroke='%23F0EEE6' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  .mini-check.on::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.3l2.3 2.3 4.7-5' fill='none' stroke='%231F1E1D' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
}

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  background: var(--cb); color: var(--ct);
  border-radius: 4px; padding: 1px 7px; font-size: 13px; font-weight: 400; line-height: 20px;
  white-space: nowrap; overflow: hidden;
}
.chip > span { overflow: hidden; text-overflow: ellipsis; }
.chip.dot { border-radius: 999px; padding: 1px 9px 1px 7px; }
.chip.dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--cd); flex: none; }
.proj-ref { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; overflow: hidden; }
.proj-ref span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Inline toevoegen */
.add-row { display: flex; align-items: center; gap: 8px; width: calc(100% - 16px); margin: 4px 8px 0; border-radius: 6px; min-height: 38px; padding: 0 10px; color: var(--text-3); }
button.add-row:hover { background: var(--hover); color: var(--text); }
.add-row .plus { width: 22px; text-align: center; font-size: 17px; flex: none; color: var(--text-3); }
.add-row.open .plus { color: var(--accent); }
.add-input { flex: 1; min-width: 0; height: 38px; border: 0; outline: 0; background: transparent; font-weight: 500; font-size: 16px; }
.add-input::placeholder { color: var(--text-3); font-weight: 400; }
@media (min-width: 841px) { .add-input { font-size: 14.5px; } }

/* Voortgang */
.progress { display: flex; align-items: center; gap: 12px; padding: 8px 18px 8px; }
.progress .track { flex: 1; height: 4px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress .fill { height: 100%; border-radius: 999px; background: var(--fill); transition: width .35s ease; }
.progress .num { color: var(--text-2); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Pauzestrook */
.pause { margin: 0 0 18px; padding: 8px 14px; border-radius: 8px; color: var(--text-2); font-size: 13.5px; text-align: center; border: 1px dashed var(--border-strong); }
.pause.is-active { background: var(--callout); color: var(--callout-ink); border-style: solid; border-color: transparent; }
.pause.is-active b { color: inherit; }
.pause b { font-weight: 600; color: var(--text); }

/* ---------- Slepen ---------- */
td.td-check { position: relative; }
.grip { position: absolute; left: 0; top: 50%; width: 12px; height: 22px; margin-top: -11px; border-radius: 3px; cursor: grab; opacity: 0; touch-action: none; z-index: 1;
  background: radial-gradient(circle, var(--text-3) 1.1px, transparent 1.4px) 1px 2px / 5px 6px; }
tr:hover .grip { opacity: 1; }
@media (hover: none) { .grip { opacity: .7; } }
.grid .t-title, .cal-card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
body.dragging, body.dragging * { cursor: grabbing !important; -webkit-user-select: none !important; user-select: none !important; }
.drag-src { opacity: .35; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 120; pointer-events: none; max-width: 280px; padding: 6px 12px; border-radius: 8px; background: var(--card); color: var(--text); font-weight: 500; font-size: 13.5px; box-shadow: var(--shadow-pop); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#drop-line { position: fixed; z-index: 119; height: 2px; border-radius: 2px; background: #2383E2; pointer-events: none; display: none; }
#drop-line.v { width: 2px; }
#drop-line.v::before { left: -3px; top: -4px; }
#drop-line::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; border: 2px solid #2383E2; background: var(--card); box-sizing: border-box; }
tr.drop-onto td { background: rgba(35, 131, 226, .12) !important; }
.group.drop-target, .cal-cell.drop-target { box-shadow: inset 0 0 0 2px rgba(35, 131, 226, .55); }

/* ---------- Subtaken ---------- */
.t-cell { display: flex; align-items: center; min-width: 0; position: relative; }
.t-cell .t-title { flex: 1; min-width: 0; width: auto; }
tr.is-sub .t-cell { padding-left: 16px; } /* subtaak: haakje + afvinkvakje staan ingesprongen in de titelcel */
tr.is-sub .t-cell > .check, tr.is-sub .t-cell > .series-ico { margin-right: 2px; }
tr.is-sub .t-cell::before { content: ''; position: absolute; left: 3px; top: 0; height: 50%; width: 12px; border-left: 1.5px solid var(--border-strong); border-bottom: 1.5px solid var(--border-strong); border-bottom-left-radius: 6px; }
tr.is-sub .t-title { font-weight: 400; }
.sub-chev { width: 22px; height: 22px; margin: 0 2px 0 -4px; }
.sub-count { flex: none; font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--hover); border-radius: 4px; padding: 0 6px; line-height: 18px; font-variant-numeric: tabular-nums; }
.sub-add-btn { flex: none; width: 24px; height: 24px; margin-right: 4px; border-radius: 5px; color: var(--text-3); font-size: 16px; line-height: 1; text-align: center; opacity: 0; }
tr:hover .sub-add-btn, .sub-add-btn:focus-visible { opacity: 1; }
.sub-add-btn:hover { background: var(--hover); color: var(--text); }
@media (hover: none) { .sub-add-btn { opacity: 1; } }
.crumb { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--text-3); padding: 2px 6px; margin-right: 2px; border-radius: 4px; }
.crumb:hover { background: var(--hover); color: var(--text); }
tr.sub-add td { height: auto; }
.add-row.sub { width: auto; max-width: min(420px, 62vw); margin: 0 0 0 22px; min-height: 40px; }
#panel-subs-add .add-row.sub { max-width: none; }
.add-row.sub .add-input { height: 40px; }
.parent-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -6px 2px; }
.parent-line .crumb { max-width: 75%; font-size: 13px; }
#panel-subs { margin: 6px 0 0; }
#panel-subs .panel-section { margin-top: 12px; }
.psub { display: flex; align-items: center; margin: 0 -8px; border-radius: 6px; }
.psub:hover { background: var(--hover); }
.psub .t-title { font-weight: 400; padding-left: 0; min-height: 38px; }
.psub.is-done .t-title .txt { text-decoration: line-through; color: var(--text-2); }
#panel-subs-add .add-row.sub { margin: 0 -8px; width: calc(100% + 16px); padding: 0 10px; }

/* ---------- Blokkop: inklappen, tijden, live timer ---------- */
.chev { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin-left: -4px; border-radius: 5px; color: var(--text-3); flex: none; transition: transform .15s ease; }
.chev:hover { background: var(--hover); color: var(--text); }
.chev.closed { transform: rotate(-90deg); }
.head-space { flex: 1; }
.head-count { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.head-btn { font-size: 12.5px; color: var(--text-2); padding: 0 8px; min-height: 26px; border-radius: 5px; }
.head-btn:hover { background: var(--hover); color: var(--text); }
.time-btn { font-size: 13px; color: var(--text-2); padding: 0 7px; min-height: 26px; border-radius: 5px; font-variant-numeric: tabular-nums; border: 1px solid transparent; }
.time-btn:hover { background: var(--hover); color: var(--text); }
.time-btn.custom { border-color: var(--border-strong); color: var(--text); }
.live { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.live.on { color: var(--callout-ink); background: var(--callout); border-radius: 4px; padding: 1px 7px; font-weight: 600; }
.live.on.paused { color: var(--text-2); background: var(--active); }
.blk-btn { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--text-3); flex: none; margin-left: -4px; }
.blk-btn:hover { background: var(--hover); color: var(--text); }
.blk-btn.blk-pause[aria-pressed="true"] { color: var(--text); background: var(--active); }
.group:not(.is-active) .blk-btn.blk-pause { display: none; } /* pauzeren kan alleen bij het lopende blok */
.pause .live { margin-left: 8px; }
.pause .live.on { background: transparent; padding: 0; }
.timebar { height: 2px; margin: 0 14px 10px; border-radius: 2px; background: var(--track); overflow: hidden; display: none; }
.group.is-active .timebar { display: block; }
.timebar div { height: 100%; width: 0; background: var(--text-2); border-radius: 2px; transition: width 1s linear; }
.group.is-active { box-shadow: inset 0 0 0 1.5px var(--border-strong); }
input[type="time"].input { font-variant-numeric: tabular-nums; font-size: 18px; height: 44px; }

/* ---------- Melding einde blok / pauze ---------- */
#alert-bar {
  position: fixed; z-index: 95; left: 50%; top: 14px; transform: translate(-50%, -140%);
  display: flex; align-items: center; gap: 10px; width: min(560px, calc(100vw - 24px));
  background: var(--callout); color: var(--callout-ink); border-radius: 10px; padding: 12px 8px 12px 16px;
  font-weight: 600; box-shadow: var(--shadow-pop); transition: transform .3s cubic-bezier(.2, .8, .2, 1); visibility: hidden;
}
#alert-bar.open { transform: translate(-50%, 0); visibility: visible; }
#alert-bar span { flex: 1; }
#alert-bar .icon-btn { color: inherit; }

/* ---------- Kalender ---------- */
.cal { overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head { background: var(--card-2); border-bottom: 1px solid var(--border); }
.cal-head div { padding: 8px 10px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.cal-grid { gap: 1px; background: var(--border); }
.cal-cell { background: var(--card); min-height: 118px; padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal-cell:hover { background: var(--card-2); }
.cal-cell.other { background: var(--card-2); }
.cal-cell.other .cal-num, .cal-cell.other .cal-card { opacity: .55; }
.cal-num { display: inline-flex; align-items: center; justify-content: center; align-self: flex-start; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 1px; }
.cal-cell.today .cal-num { background: var(--today); color: #fff; font-weight: 600; }
.cal-card { display: flex; align-items: center; gap: 5px; width: 100%; padding: 2px 8px; border-radius: 4px; background: var(--cb); color: var(--ct); font-size: 12px; font-weight: 500; line-height: 18px; overflow: hidden; }
.cal-card::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--cd); flex: none; }
.cal-card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-card:hover { filter: brightness(.97); }
.cal-card.done { opacity: .6; }
.cal-card.done span { text-decoration: line-through; }
.cal-more { font-size: 12px; color: var(--text-2); padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: clip; }

/* ---------- Projectpagina ---------- */
.project-head { display: flex; align-items: center; gap: 16px; padding: 26px 0 18px; }
.project-emoji { font-size: 46px; line-height: 1; width: 72px; height: 72px; border-radius: 18px; display: flex; align-items: center; justify-content: center; flex: none; }
.project-emoji:hover { background: var(--hover); }
.project-name { flex: 1; min-width: 0; font-family: var(--sans); font-size: 32px; font-weight: 700; letter-spacing: -.02em; background: transparent; border: 0; outline: 0; padding: 4px 8px; margin-left: -8px; border-radius: 10px; }
.project-name:hover { background: var(--hover); }
.project-name:focus { background: var(--card); box-shadow: 0 0 0 2px var(--ring); }
.block { margin-bottom: 16px; }
.block-label { display: block; padding: 14px 18px 0; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.notes { display: block; width: 100%; min-height: 96px; border: 0; outline: 0; resize: none; background: transparent; padding: 8px 18px 14px; line-height: 1.6; font-size: 16px; }
@media (min-width: 841px) { .notes { font-size: 14.5px; } }
.notes::placeholder { color: var(--text-3); }
.saved-note { padding: 0 18px 12px; font-size: 12px; color: var(--text-3); }
.danger-zone { padding: 12px 0 0; }

/* ---------- Kennisbank ---------- */
.kb-search { padding: 8px 8px 0; }
.kb-filters { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 8px 0; }
.kb-filter { padding: 3px 10px; border-radius: 6px; font-size: 13px; color: var(--text-2); }
.kb-filter:hover { background: var(--hover); color: var(--text); }
.kb-filter.on { background: var(--active); color: var(--text); font-weight: 600; }
.kb-list { margin: 10px 8px 2px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.kb-list .group-empty { padding: 14px; }
.kb-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.kb-row:last-child { border-bottom: 0; }
.kb-row:hover { background: var(--hover); }
.kb-ico { font-size: 20px; width: 26px; text-align: center; flex: none; }
.kb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.kb-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-snip { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-meta { flex: none; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }

.doc-page { max-width: 860px; }
.doc-meta-row { display: flex; align-items: center; gap: 8px; min-height: 36px; flex-wrap: wrap; }
.meta-label { width: 118px; flex: none; font-size: 13.5px; color: var(--text-2); }
.meta-cell { width: auto; min-width: 120px; min-height: 32px; border-radius: 6px; }
.link-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; flex: 1; min-width: 0; }
.link-chip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; padding: 2px 8px; border-radius: 4px; background: var(--hover); }
.link-chip:hover { background: var(--active); }
.doc-actions { margin: 4px 0 10px; }
.doc-actions .meta-label { width: auto; font-size: 12.5px; color: var(--text-3); }
.doc-toolbar { position: sticky; top: 74px; z-index: 15; display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 6px 8px; margin: 0 -8px 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.tb-group { display: inline-flex; gap: 2px; }
.tb-group.table-tools { display: none; }
.doc-toolbar.in-table .table-tools { display: inline-flex; }
.tb-btn { min-width: 30px; min-height: 30px; padding: 0 8px; border-radius: 5px; font-size: 13px; color: var(--text-2); text-align: center; white-space: nowrap; }
.tb-btn:hover { background: var(--hover); color: var(--text); }
.tb-btn[aria-disabled="true"], .tb-btn[aria-disabled="true"]:hover { opacity: .35; cursor: default; background: none; color: var(--text-2); }
#tb-size { min-width: 62px; font-variant-numeric: tabular-nums; }
.size-row { display: flex; align-items: center; gap: 8px; }
.size-row .input { flex: 1; min-width: 0; }
.seg.sizes { grid-template-columns: repeat(3, 1fr); }

.doc-body { font-size: 15.5px; line-height: 1.65; color: var(--text); outline: 0; overflow-wrap: anywhere; }
#doc-editor { min-height: 46vh; padding: 8px 2px 60px; }
#doc-editor:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.doc-body > :first-child { margin-top: 0; }
.doc-body p { margin: 0 0 .55em; }
.doc-body h1 { font-size: 1.7em; margin: 1.1em 0 .35em; line-height: 1.25; }
.doc-body h2 { font-size: 1.35em; margin: 1.1em 0 .3em; line-height: 1.3; }
.doc-body h3 { font-size: 1.12em; margin: 1em 0 .25em; }
.doc-body ul, .doc-body ol { margin: 0 0 .6em; padding-left: 1.5em; }
.doc-body li { margin: .15em 0; }
.doc-body ul.todo { list-style: none; padding-left: 1.75em; }
.doc-body ul.todo > li { position: relative; }
.doc-body ul.todo > li::before { content: ''; position: absolute; left: -1.7em; top: .28em; width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border-strong); background: var(--card); box-sizing: border-box; cursor: pointer; }
.doc-body ul.todo > li[data-done="1"] { color: var(--text-2); text-decoration: line-through; }
.doc-body ul.todo > li[data-done="1"]::before { border-color: var(--fill); background: var(--fill) center / 11px 11px no-repeat
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.3l2.3 2.3 4.7-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.doc-body blockquote { margin: 0 0 .7em; padding: 2px 0 2px 14px; border-left: 3px solid var(--text); }
.doc-body .callout { margin: 0 0 .8em; padding: 12px 14px 12px 42px; border-radius: 6px; background: var(--callout); color: var(--callout-ink); position: relative; }
.doc-body .callout::before { content: '💡'; position: absolute; left: 14px; top: 11px; }
.doc-body .callout > :last-child { margin-bottom: 0; }
.doc-body hr { border: 0; border-top: 1px solid var(--border-strong); margin: 1.2em 0; }
.doc-body a { color: inherit; text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 3px; }
.doc-body table { width: 100%; border-collapse: collapse; margin: .4em 0 .9em; table-layout: fixed; font-size: .94em; }
.doc-body th, .doc-body td { border: 1px solid var(--border-strong); padding: 6px 9px; vertical-align: top; text-align: left; min-width: 40px; }
.doc-body th { background: var(--panel); font-weight: 600; }
.doc-empty { color: var(--text-3); }

.doc-cards { display: flex; flex-direction: column; gap: 6px; }
.doc-block .doc-cards { padding: 8px 8px 0; }
.doc-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.doc-card summary { display: flex; align-items: center; gap: 6px; padding: 9px 12px; cursor: pointer; list-style: none; font-weight: 500; }
.doc-card summary::-webkit-details-marker { display: none; }
.doc-card summary::before { content: '›'; width: 14px; color: var(--text-3); font-size: 16px; line-height: 1; transition: transform .15s; flex: none; text-align: center; }
.doc-card[open] summary::before { transform: rotate(90deg); }
.doc-card summary:hover { background: var(--hover); }
.doc-card summary .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-card .doc-body.read { padding: 6px 14px 4px; font-size: 14.5px; border-top: 1px solid var(--border); overflow-x: auto; }
.doc-card-actions { display: flex; gap: 4px; padding: 4px 8px 8px; }
.panel-doc-add .add-row.sub { margin: 4px -8px 0; width: calc(100% + 16px); max-width: none; padding: 0 10px; }

@media print {
  #sidebar, #topbar, #doc-meta, .doc-toolbar, .danger-zone, #panel, #panel-scrim, #pop-layer, #toast-layer, #alert-bar, #update-bar, #drawer-scrim { display: none !important; }
  #app { display: block; } #main { padding: 0; } body { background: #fff; color: #000; }
  .doc-page { max-width: none; } .project-emoji { width: auto; height: auto; font-size: 30px; }
  #doc-editor { min-height: 0; padding: 0; }
}

/* ---------- Detailpaneel ---------- */
#panel-scrim, #drawer-scrim { position: fixed; inset: 0; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
#panel-scrim { z-index: 40; }
#panel-scrim.open { opacity: 1; pointer-events: auto; }
#panel {
  position: fixed; top: 0; right: 0; z-index: 41;
  width: min(460px, 100vw); height: 100vh; height: 100dvh;
  background: var(--card); border-left: 1px solid var(--border); box-shadow: var(--shadow-pop);
  transform: translateX(104%); transition: transform .26s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .26s;
  display: flex; flex-direction: column; visibility: hidden;
}
#panel.open { transform: none; visibility: visible; transition: transform .26s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 4px 24px; }
.panel-kicker { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.panel-kicker .rep { color: var(--accent-ink); }
.panel-body { flex: 1; overflow-y: auto; padding: 4px 24px calc(28px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.panel-title { display: block; width: calc(100% + 16px); margin: 0 -8px 6px; padding: 6px 8px; border: 0; outline: 0; resize: none; overflow: hidden; background: transparent; border-radius: 10px; font-family: var(--sans); font-size: 26px; font-weight: 700; line-height: 1.25; letter-spacing: -.02em; }
.panel-title:hover { background: var(--hover); }
.panel-title:focus { background: var(--card-2); box-shadow: 0 0 0 2px var(--ring); }
.panel-title::placeholder { color: var(--text-3); }
.hint { margin: 6px 0 10px; padding: 10px 12px; border-radius: 6px; background: var(--callout); color: var(--callout-ink); font-size: 13.5px; font-weight: 500; }
.prows { margin: 8px -8px 4px; }
.prow { display: grid; grid-template-columns: 132px minmax(0, 1fr); align-items: center; min-height: 42px; }
.prow-name { display: flex; align-items: center; gap: 6px; padding: 0 8px; min-height: 38px; border-radius: 8px; color: var(--text-2); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-name:hover { background: var(--hover); color: var(--text); }
.prow .cell { border-radius: 8px; min-height: 38px; padding: 4px 8px; }
.panel-section { display: block; margin: 18px 0 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.panel-notes { display: block; width: 100%; min-height: 140px; resize: none; border: 1px solid var(--border); border-radius: 8px; background: var(--card-2); padding: 12px 14px; outline: 0; line-height: 1.6; font-size: 16px; }
@media (min-width: 841px) { .panel-notes { font-size: 14.5px; } }
.pop-notes { min-height: 120px; max-height: 46vh; resize: vertical; font-size: 15px; padding: 10px 12px; }
.panel-notes:focus { border-color: var(--ring); box-shadow: 0 0 0 2px var(--ring); }
.panel-notes::placeholder { color: var(--text-3); }
.panel-foot { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-foot .small { font-size: 12px; color: var(--text-3); }

/* ---------- Popovers ---------- */
#pop-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.pop-scrim { display: none; }
.pop {
  position: fixed; pointer-events: auto; width: 272px; max-width: calc(100vw - 16px); max-height: min(420px, calc(100vh - 16px));
  display: flex; flex-direction: column;
  background: var(--card); border: 0; border-radius: 8px; box-shadow: var(--shadow-pop);
  overflow: hidden; animation: pop-in .12s ease-out;
}
.pop.wide { width: 312px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.pop-title { padding: 12px 14px 4px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.pop-pad { padding: 8px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.pop-text { color: var(--text-2); font-size: 13.5px; }
.pop-note { padding: 8px 14px 12px; color: var(--text-3); font-size: 12.5px; border-top: 1px solid var(--border); }
.pop-search { padding: 10px 10px 6px; }
.input {
  display: block; width: 100%; height: 40px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--card); outline: 0; font-size: 16px;
}
@media (min-width: 841px) { .input { height: 36px; font-size: 14px; } }
.input:focus { border-color: var(--ring); box-shadow: 0 0 0 2px var(--ring); }
.input::placeholder { color: var(--text-3); }
input[type="date"].input { font-variant-numeric: tabular-nums; cursor: pointer; }
.pop-list { overflow-y: auto; padding: 4px 6px 8px; display: flex; flex-direction: column; gap: 1px; }
.opt { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 5px 8px; border-radius: 8px; }
.opt:hover, .opt.hi { background: var(--hover); }
.opt.sel::after { content: '✓'; margin-left: auto; color: var(--accent-ink); font-weight: 600; }
.opt.muted { color: var(--text-2); }
.opt.create { color: var(--text); }
.opt.create .mk { color: var(--text-2); flex: none; }
.opt-empty { padding: 8px 10px; color: var(--text-3); font-size: 13px; }
.pop-sep { height: 1px; background: var(--border); margin: 4px 8px; flex: none; }
.pop-actions { display: flex; gap: 8px; }
.pop-actions .btn { flex: 1; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg button { min-height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); font-size: 13.5px; font-weight: 500; text-align: center; color: var(--text-2); }
.seg button:hover { background: var(--hover); color: var(--text); }
.seg button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); color: var(--text); background: var(--accent-soft); }
.emoji-row { display: flex; gap: 8px; align-items: center; }
.emoji-cur { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none; background: var(--card-2); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-grid button { aspect-ratio: 1; border-radius: 8px; font-size: 19px; text-align: center; display: flex; align-items: center; justify-content: center; }
.emoji-grid button:hover { background: var(--hover); }
.emoji-grid button.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* ---------- Modal + toast ---------- */
#modal-layer { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 20px; background: var(--scrim); }
#modal-layer.open { display: flex; animation: fade-in .15s ease-out; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(420px, 100%); background: var(--card); border: 0; border-radius: 10px; box-shadow: var(--shadow-pop); padding: 22px 22px 18px; }
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal p { margin: 0 0 18px; color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
#toast-layer { position: fixed; left: 0; right: 0; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--btn-bg); color: var(--btn-fg); border-radius: 8px; padding: 9px 18px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-pop); animation: toast-in .2s ease-out; max-width: 100%; text-align: center; }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 840px) {
  #app { display: block; }
  #sidebar {
    position: fixed; z-index: 51; left: 0; top: 0; width: min(300px, 86vw);
    transform: translateX(-104%); transition: transform .26s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .26s;
    box-shadow: var(--shadow-pop); visibility: hidden;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  #sidebar.open { transform: none; visibility: visible; transition: transform .26s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
  #drawer-scrim { z-index: 50; }
  #drawer-scrim.open { opacity: 1; pointer-events: auto; }
  .nav-item { min-height: 44px; }
  .nav-pin { width: 40px; height: 40px; right: 2px; }
  .nav-row .nav-item { padding-right: 44px; }
  .hamburger { display: inline-flex; }
  #main { padding: 0 16px 96px; }
  #topbar { margin: 0 -16px 4px; padding: 0 16px; }
  .topbar-row { padding: 10px 0 4px; }
  .topbar-row h1 { font-size: 22px; }
  .tab { padding: 8px 10px; }
  .view-head { padding: 16px 0 14px; align-items: flex-start; }
  .view-head h2 { font-size: 25px; }
  .nav-group button { min-height: 38px; min-width: 42px; }
  .group-head { padding: 12px 12px 10px; }
  .chev, .time-btn, .head-btn { min-height: 34px; }
  .blk-btn { width: 36px; height: 36px; margin-left: 0; }
  .chev { width: 34px; }
  .head-space { display: none; }
  .head-count { margin-left: auto; }
  .group-intro, .group-empty { padding-left: 14px; padding-right: 14px; }
  .add-row { min-height: 46px; }
  .add-input { height: 46px; }
  .progress { padding: 8px 14px; }
  .grid td { height: 46px; }
  .grid th, .th-btn, .th-plus { height: 40px; }
  .cell, .t-title { min-height: 46px; }
  .project-head { gap: 10px; padding: 18px 0 14px; }
  .doc-toolbar { top: 66px; margin: 0 0 8px; }
  .tb-btn { min-height: 36px; }
  .meta-label { width: 100%; }
  .kb-meta { display: none; }
  .project-emoji { font-size: 38px; width: 60px; height: 60px; }
  .project-name { font-size: 25px; }
  .block-label, .notes, .saved-note { padding-left: 14px; padding-right: 14px; }
  .cal-cell { min-height: 92px; padding: 3px; gap: 2px; }
  .cal-head div { padding: 6px 2px; text-align: center; font-size: 11.5px; }
  .cal-num { min-width: 22px; height: 22px; font-size: 12px; align-self: center; }
  .cal-card { padding: 1px 4px; font-size: 10.5px; line-height: 15px; border-radius: 5px; }
  .cal-card::before { display: none; }
  .cal-more { font-size: 10.5px; padding: 0 2px; text-align: center; }
  .prow { min-height: 46px; }
  .prow .cell, .prow-name { min-height: 44px; }
  .panel-body { padding-left: 18px; padding-right: 18px; }
  .panel-head { padding-left: 18px; }
}
@media (max-width: 560px) {
  .btn-primary.new-task { padding: 0 14px; }
  .pop-scrim { display: block; position: fixed; inset: 0; background: var(--scrim); pointer-events: auto; animation: fade-in .15s ease-out; }
  .pop, .pop.wide {
    left: 0 !important; right: 0; top: auto !important; bottom: var(--kb);
    width: 100%; max-width: 100%; max-height: min(72vh, calc(100dvh - var(--kb) - 24px));
    border-radius: 18px 18px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-in .2s cubic-bezier(.2, .8, .2, 1);
  }
  .opt { min-height: 44px; }
  .emoji-grid button { font-size: 22px; }
  @keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

