/* Base reset (the design was previewed inside a page skeleton that provided these) */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: 14px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:root { color-scheme: light; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }

/* Layout: fixed left rail (Calendar, Notifications, Spaces) + month-scoped main view; board cards carry exactly four facts: project, category, assignee, due date. */
:root {
  --bg: #eef1f5;
  --rail: #f8f9fb;
  --surface: #ffffff;
  --line: #d9dee7;
  --fg: #18202b;
  --muted: #5d6878;
  --accent: #2f5bea;
  --accent-soft: #e4ebfd;
  --on-accent: #ffffff;
  --brand-panel: #1f3fb5;
  --on-brand: #ffffff;
  --late: #c2352b;
  --late-soft: #fbe9e7;
  --today: #a8650a;
  --shadow: 0 1px 2px rgba(24,32,43,.06), 0 2px 6px rgba(24,32,43,.05);
  --pop-shadow: 0 10px 30px rgba(24,32,43,.15);
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Helvetica Neue", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151b; --rail: #161b23; --surface: #1d232d; --line: #2c3442;
    --fg: #e7ebf1; --muted: #9aa5b5; --accent: #7d9bff; --accent-soft: #232f4d; --on-accent: #0d1220;
    --brand-panel: #1a2a5c; --on-brand: #eef2ff;
    --late: #ff7a6e; --late-soft: #3a2020; --today: #f0b24a;
    --shadow: 0 1px 2px rgba(0,0,0,.35); --pop-shadow: 0 10px 30px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11151b; --rail: #161b23; --surface: #1d232d; --line: #2c3442;
  --fg: #e7ebf1; --muted: #9aa5b5; --accent: #7d9bff; --accent-soft: #232f4d; --on-accent: #0d1220;
  --brand-panel: #1a2a5c; --on-brand: #eef2ff;
  --late: #ff7a6e; --late-soft: #3a2020; --today: #f0b24a;
  --shadow: 0 1px 2px rgba(0,0,0,.35); --pop-shadow: 0 10px 30px rgba(0,0,0,.5);
  color-scheme: dark;
}
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px; box-sizing: border-box;
}
*, *::before, *::after { box-sizing: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  display: grid; grid-template-columns: 236px minmax(0, 1fr);
  height: 100%; min-height: 560px;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--surface);
}

/* Sidebar */
.rail { background: var(--rail); border-right: 1px solid var(--line); padding: 18px 12px 12px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--fg); color: var(--surface); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .02em; flex: none; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 16px; line-height: 1.15; text-wrap: balance; }
.nav-top { display: flex; flex-direction: column; gap: 2px; }
.nav-btn, .space-btn { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; padding: 7px 8px; border-radius: 7px; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.nav-btn svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.nav-btn .count { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--late); color: #fff; font-size: 11px; display: grid; place-items: center; }
.space-btn .sw { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.space-btn .count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 500; }
.nav-btn:hover, .space-btn:hover { background: var(--accent-soft); }
.nav-btn[aria-current="true"], .cat-btn[aria-current="true"], .space-btn[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.nav-btn[aria-current="true"] svg { color: var(--accent); }
.spaces { display: flex; flex-direction: column; gap: 8px; }
.space { display: flex; flex-direction: column; gap: 2px; }
.cats { display: flex; flex-direction: column; gap: 1px; padding-left: 17px; }
.cat-btn { background: none; border: 0; text-align: left; padding: 5px 8px; border-radius: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.cat-btn:hover { color: var(--fg); background: var(--accent-soft); }
.space:not(.open) .cats { display: none; }
body.is-member .admin-only { display: none !important; }
body.is-member .me { margin-top: auto; }
.ctx-menu { position: fixed; z-index: 70; min-width: 160px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--pop-shadow); padding: 4px; }
.ctx-menu button { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font-size: 13.5px; font-weight: 500; text-align: left; }
.ctx-menu button:hover, .ctx-menu button:focus-visible { background: var(--accent-soft); color: var(--accent); }
.ctx-menu svg { width: 15px; height: 15px; }
.danger-zone { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }
.danger-zone b { display: block; font-size: 13.5px; }
.danger-zone small { font-size: 12px; color: var(--muted); }
.danger-zone .danger-outline { margin-top: 0; padding: 0 14px; }
.trash-nav { margin-top: auto; flex: none; }
.trash-nav + .me { margin-top: 4px; }
.trash-count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 500; }
.trash-ic { width: 32px; height: 32px; border-radius: 8px; background: var(--bg); color: var(--muted); display: grid; place-items: center; flex: none; }
.trash-ic svg { width: 16px; height: 16px; }
.soon { color: var(--late); font-weight: 600; }
.m-actions .danger-outline { margin-top: 0; height: 34px; padding: 0 12px; }
.rail-item { position: relative; display: flex; align-items: center; min-width: 0; }
.rail-item > .space-btn, .rail-item > .cat-btn { flex: 1; min-width: 0; }
.rail-item:hover .space-btn .count, .rail-item:focus-within .space-btn .count { visibility: hidden; }
.del-btn { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border: 0; background: none; border-radius: 6px; color: var(--muted); padding: 0; opacity: 0; }
.rail-item > .del-btn { position: absolute; right: 2px; }
.del-btn svg { width: 15px; height: 15px; }
.rail-item:hover .del-btn, .rail-item:focus-within .del-btn, .del-btn.show, .del-btn:focus-visible { opacity: 1; }
.del-btn:hover { color: var(--late); background: var(--late-soft); }
@media (hover: none) { .del-btn { opacity: 1; } }
.del-spacer { width: 26px; flex: none; }
.comment { position: relative; }
.comment .del-btn { margin-left: auto; }
.danger { background: var(--late); color: #fff; border: 0; border-radius: 8px; height: 38px; padding: 0 16px; font-weight: 600; font-size: 13.5px; }
.danger-outline { margin-top: auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; border: 1px solid var(--line); background: none; color: var(--late); border-radius: 8px; font-weight: 600; font-size: 13px; }
.danger-outline svg { width: 15px; height: 15px; }
.danger-outline:hover { background: var(--late-soft); border-color: var(--late); }
.link-btn.danger-link { color: var(--late); margin-left: 0; }
.role-tabs { align-self: flex-start; }
.confirm-text { margin: -4px 0 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.rail-row { display: flex; align-items: center; justify-content: space-between; }
.add-btn { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-size: 15px; line-height: 1; display: grid; place-items: center; padding: 0; }
.add-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.cat-add { background: none; border: 0; text-align: left; padding: 5px 8px; border-radius: 6px; font-size: 12.5px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.cat-add:hover { background: var(--accent-soft); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; padding: 0; }
.swatches button[aria-pressed="true"] { border-color: var(--fg); box-shadow: inset 0 0 0 2px var(--surface); }
.rail-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 8px; }
.me { margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 10px 6px 0; border-top: 1px solid var(--line); }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-text b { font-size: 13px; }
.me-text small { font-size: 11.5px; color: var(--muted); }
.me-btn { display: flex; align-items: center; gap: 9px; background: none; border: 0; padding: 4px; margin: -4px; border-radius: 8px; text-align: left; min-width: 0; }
.me-btn:hover { background: var(--accent-soft); }
.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.av.xl { width: 72px; height: 72px; font-size: 24px; }
.photo-row { display: flex; align-items: center; gap: 16px; }
.photo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.upload { display: inline-flex; align-items: center; cursor: pointer; color: var(--fg); }
.photo-actions .link-btn { margin: 0; padding: 4px 0; font-size: 12.5px; }
.field input[readonly] { color: var(--muted); cursor: not-allowed; border-style: dashed; }
.locked { display: flex; align-items: center; gap: 6px; font-weight: 400; font-size: 12px; color: var(--muted); }
.locked svg { width: 13px; height: 13px; flex: none; }
.me-text b, .me-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signout { white-space: nowrap; flex: none; margin-left: auto; background: none; border: 0; font-size: 12px; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.signout:hover { color: var(--fg); background: var(--accent-soft); }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.crumb { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.crumb small { color: var(--muted); font-size: 12px; }
.crumb h1 { margin: 0; font-family: var(--display); font-size: 21px; font-weight: 700; text-wrap: balance; }
.top-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.month { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; position: relative; }
.month button { background: none; border: 0; width: 30px; height: 30px; border-radius: 6px; font-size: 16px; color: var(--muted); }
.month button:hover { background: var(--accent-soft); color: var(--fg); }
.month .month-label { width: auto; min-width: 150px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 10px; font-weight: 600; font-size: 13.5px; color: var(--fg); }
.month .month-label svg { width: 15px; height: 15px; color: var(--accent); }
.month .month-label[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.picker { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: min(272px, calc(100vw - 40px)); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--pop-shadow); z-index: 20; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.picker-year { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.month .picker-year button { width: 32px; height: 32px; }
.picker-year select { flex: 1; height: 32px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); text-align: center; font-weight: 600; font-family: var(--mono); padding: 0 6px; }
.picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.month .picker-grid button { width: auto; height: 36px; font-size: 13px; color: var(--fg); position: relative; }
.month .picker-grid button.now::after { content: ""; position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.month .picker-grid button[aria-current="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.month .picker-grid button[aria-current="true"]::after { background: var(--on-accent); }
.month .picker-today { width: auto; height: 32px; font-size: 12.5px; color: var(--accent); font-weight: 600; border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; padding-top: 2px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--late); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.primary { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 8px; padding: 0 14px; height: 38px; font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.primary svg { width: 16px; height: 16px; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 8px; height: 38px; padding: 0 14px; font-weight: 600; font-size: 13.5px; }
.ghost:hover { background: var(--accent-soft); }
.hint { margin: 0; padding: 10px 18px 0; background: var(--bg); font-size: 12.5px; color: var(--muted); }
.view { flex: 1; min-height: 0; background: var(--bg); }

/* Board */
/* Columns share the width (min 186px) so all 7 fit on a ~1600px+ screen; smaller screens scroll sideways. */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(186px, 1fr); gap: 8px; padding: 14px 14px; overflow-x: auto; overflow-y: hidden; align-items: start; }
.col { display: flex; flex-direction: column; gap: 9px; max-height: 100%; min-height: 120px; border-radius: 10px; padding: 6px; transition: background .15s; min-width: 0; }
.col.drop { background: var(--accent-soft); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; }
.col-head .n { font-family: var(--mono); color: var(--muted); font-weight: 500; }
.col-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 60px; }
.empty { border: 1px dashed var(--line); border-radius: 8px; padding: 14px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* Card: project, category, assignee, due. Nothing else. */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); padding: 14px 12px 12px; display: flex; flex-direction: column; gap: 10px; cursor: grab; min-width: 0; min-height: 118px; }
.card:hover { border-color: var(--accent); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: .45; }
.card-title { margin: 0; font-weight: 600; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.card-cat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.card-cat i { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-top: 10px; margin-top: auto; border-top: 1px solid var(--line); }
.card-foot .due { font-size: 11px; }
.who { display: flex; align-items: center; gap: 7px; min-width: 0; }
.av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 600; color: #fff; flex: none; }
.av.lg { width: 32px; height: 32px; font-size: 12px; }
.who-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.due.late { color: var(--late); }
.due.today { color: var(--today); }

/* Calendar */
.calendar { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; padding: 16px 18px; overflow-y: auto; align-items: start; height: 100%; }
.cal-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(92px, 1fr)); min-width: 660px; }
.cal-wd { padding: 8px 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); border-bottom: 1px solid var(--line); }
.day { min-height: 104px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.day:nth-child(7n) { border-right: 0; }
.day.other { background: var(--bg); }
.day.other .dnum { color: var(--muted); opacity: .6; }
.dnum { font-family: var(--mono); font-size: 12px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.day.is-today .dnum { background: var(--accent); color: var(--on-accent); }
.chip { display: flex; align-items: center; gap: 5px; width: 100%; background: var(--bg); border: 0; border-radius: 5px; padding: 3px 6px; font-size: 11.5px; text-align: left; min-width: 0; }
.chip:hover { background: var(--accent-soft); }
.chip i { width: 6px; height: 6px; border-radius: 2px; flex: none; }
.chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.done span { text-decoration: line-through; color: var(--muted); }
.more { font-size: 11px; color: var(--muted); padding-left: 6px; background: none; border: 0; text-align: left; }
.agenda { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.agenda-head small { display: block; color: var(--muted); font-size: 12px; }
.agenda-head b { font-family: var(--display); font-size: 18px; }
.agenda h3 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.agenda h3.late { color: var(--late); }
.agenda h3.today { color: var(--today); }
.agenda ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ag-item { width: 100%; text-align: left; background: var(--bg); border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.ag-item:hover { border-color: var(--accent); }
.ag-item b { font-size: 13px; font-weight: 600; }
.ag-item small { font-size: 11.5px; color: var(--muted); }
.ag-none { font-size: 12.5px; color: var(--muted); }

/* Notifications page */
.notif-page { padding: 16px 18px; overflow-y: auto; height: 100%; }
.notif-card { max-width: 720px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.notif-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 8px; }
.tabs button { background: none; border: 0; padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.link-btn { margin-left: auto; background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 13px; padding: 6px; }
.n-group { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 6px 4px 0; }
.n-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.n-item { width: 100%; display: flex; align-items: flex-start; gap: 10px; text-align: left; background: none; border: 0; padding: 10px 8px; border-radius: 8px; }
.n-item:hover { background: var(--accent-soft); }
.n-item .n-text { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.4; }
.n-item .n-text small { display: block; font-size: 12px; color: var(--muted); }
.n-item .unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }
.n-item.read .unread-dot { visibility: hidden; }
.n-item.read .n-text { color: var(--muted); }

/* Bell popover */
.bell-wrap { position: relative; }
.pop { position: absolute; top: 46px; right: 0; width: min(320px, calc(100vw - 40px)); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--pop-shadow); z-index: 20; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.pop h2 { margin: 4px 8px; font-size: 13px; }
.pop .n-item { padding: 8px; }
.pop .see-all { margin: 0; border-top: 1px solid var(--line); border-radius: 0; padding-top: 8px; text-align: center; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; background: var(--fg); color: var(--surface); padding: 11px 16px; border-radius: 9px; font-size: 13px; max-width: calc(100vw - 32px); transition: opacity .2s, transform .2s; z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Dialogs */
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--fg); }
dialog::backdrop { background: rgba(10,14,20,.45); }
.dlg { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.dlg h2 { margin: 0; font-family: var(--display); font-size: 19px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field input, .field select { height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--bg); font-weight: 400; font-size: 14px; color: var(--fg); }
.field textarea { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: var(--bg); font-weight: 400; font-size: 14px; line-height: 1.45; color: var(--fg); resize: vertical; min-height: 92px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Task details */
dialog.detail { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.d-wrap { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.d-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.d-head small { color: var(--muted); font-size: 12.5px; }
.d-close { margin-left: auto; width: 32px; height: 32px; border: 0; background: none; border-radius: 7px; font-size: 20px; color: var(--muted); }
.d-close:hover { background: var(--accent-soft); color: var(--fg); }
.d-close + .d-close { margin-left: 0; }
.d-full { display: grid; place-items: center; }
.d-full svg { width: 16px; height: 16px; }
.d-full .ic-shrink, dialog.detail.full .d-full .ic-expand { display: none; }
dialog.detail.full .d-full .ic-shrink { display: block; }
dialog.detail.full { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; border: 0; border-radius: 0;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
dialog.detail.full .d-wrap { height: 100%; max-height: none; }
dialog.detail.full .d-body { flex: 1; grid-template-columns: minmax(0, 1fr) 320px; }
.d-view { display: flex; flex-direction: column; gap: 22px; }
.d-title-row { display: flex; align-items: flex-start; gap: 12px; }
.d-title-row h2 { flex: 1; }
.edit-btn { height: 32px; padding: 0 12px; font-size: 13px; flex: none; }
.d-desc { cursor: text; border-radius: 6px; }
.d-desc:hover { background: var(--bg); box-shadow: 0 0 0 6px var(--bg); }
.d-editform { display: flex; flex-direction: column; gap: 14px; }
.d-editform textarea { min-height: 160px; }
.d-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; min-height: 0; overflow-y: auto; }
.d-main { padding: 20px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.d-main h2 { margin: 0; font-family: var(--display); font-size: 24px; text-wrap: balance; overflow-wrap: anywhere; }
.d-sec h3 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.d-desc { margin: 0; font-size: 14px; line-height: 1.6; white-space: pre-wrap; max-width: 62ch; }
.d-desc.empty-text { color: var(--muted); }
.comments { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.comment { display: flex; gap: 10px; }
.comment-body { min-width: 0; }
.comment-body b { font-size: 13px; }
.comment-body small { color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.comment-body p { margin: 3px 0 0; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.c-form { display: flex; gap: 8px; }
.c-form input { flex: 1; min-width: 0; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--bg); }
.d-side { border-left: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 18px; background: var(--rail); }
.d-side .field select { background: var(--surface); }
.assignee-box { display: flex; flex-direction: column; gap: 10px; }
.assignee-now { display: flex; align-items: center; gap: 10px; }
.assignee-now b { font-size: 14px; color: var(--fg); }
.notify-btn { width: 100%; height: 42px; font-size: 14px; }
.kv { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kv span { font-weight: 500; font-size: 14px; color: var(--fg); display: flex; align-items: center; gap: 6px; }
.kv span i { width: 8px; height: 8px; border-radius: 2px; }
.kv .late-tag { color: var(--late); font-size: 12px; font-family: var(--mono); }

/* Login */
.login { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--surface);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.login-art { background: var(--brand-panel); color: var(--on-brand); display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  padding: 36px max(36px, env(safe-area-inset-left, 0px)); }
.login-art .brand-mark { background: var(--on-brand); color: var(--brand-panel); }
.login-art h2 { margin: 0; font-family: var(--display); font-size: clamp(30px, 4vw, 44px); line-height: 1.08; max-width: 14ch; text-wrap: balance; }
.login-art p { margin: 12px 0 0; max-width: 40ch; line-height: 1.55; opacity: .85; }
.login-art small { opacity: .7; }
.login-form-wrap { display: grid; place-items: center; padding: 36px max(24px, env(safe-area-inset-right, 0px)) 36px 24px; }
.login-form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login-form h2 { margin: 0; font-family: var(--display); font-size: 26px; }
.login-form > p { margin: -8px 0 4px; color: var(--muted); font-size: 13.5px; }
.login-form .primary { height: 42px; }
.login-note { font-size: 12.5px; color: var(--muted); text-align: center; }
.demo-note { font-size: 12.5px; line-height: 1.5; background: var(--accent-soft); color: var(--fg); border-radius: 8px; padding: 10px 12px; }
.login-error { margin: 0; font-size: 12.5px; color: var(--late); }
.text-link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; font-size: inherit; }
.text-link:hover { text-decoration: underline; }

/* Members */
.m-title { margin: 6px 4px 0; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.pill { font-family: var(--mono); font-size: 11px; font-weight: 500; background: var(--accent-soft); color: var(--accent); border-radius: 9px; padding: 1px 7px; }
.m-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.m-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 6px; border-top: 1px solid var(--line); }
.m-row:first-child { border-top: 0; }
.m-info { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.m-info b { font-size: 14px; }
.m-info small { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.m-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m-actions select { height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--bg); }
.m-actions .primary, .m-actions .ghost { height: 34px; }
.role { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; background: var(--bg); color: var(--muted); }
.role.admin { background: var(--accent-soft); color: var(--accent); }
.pending-box { border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; background: var(--rail); }

@media (max-width: 900px) {
  .calendar { grid-template-columns: 1fr; }
  .d-body { grid-template-columns: 1fr; }
  .d-side { border-left: 0; border-top: 1px solid var(--line); order: -1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Additions for the live app */
.pw-box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.pw-box summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); }
.pw-box[open] { display: flex; flex-direction: column; gap: 12px; }
.code-box { font-family: var(--mono); font-size: 22px; letter-spacing: .12em; background: var(--bg); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 14px; text-align: center; color: var(--fg); margin: 8px 0; user-select: all; }
.loading { display: grid; place-items: center; min-height: 60vh; color: var(--muted); font-size: 13px; }
.m-actions .role-select { height: 34px; }
.n-item .n-text small.ago { display: inline; }
.offline { position: fixed; left: 50%; top: 10px; transform: translateX(-50%); background: var(--late); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 12.5px; z-index: 80; }

/* Sign-in: faded photo behind, black shade on top, one tall panel holding the name and the forms */
.login {
  grid-template-columns: 1fr; grid-template-rows: 1fr; place-items: center; overflow-y: auto;
  background: #000;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  /* the sign-in screen is always dark, whatever the device theme */
  --fg: #f2f4f8; --muted: rgba(242, 244, 248, .72); --bg: rgba(255, 255, 255, .08); --line: rgba(255, 255, 255, .2);
  --surface: transparent; --accent: #8fa8ff; --on-accent: #0b0e14; --late: #ff8f84; --accent-soft: rgba(143, 168, 255, .16);
  color: var(--fg); color-scheme: dark;
}
.login-bg { position: fixed; inset: 0; background: url("/login-bg.webp") center / cover no-repeat; opacity: .5; }
.login-shade { position: fixed; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .7) 0%, rgba(0, 0, 0, .15) 30%, rgba(0, 0, 0, .1) 65%, rgba(0, 0, 0, .45) 100%); }
.login-card {
  position: relative; width: min(420px, 100%); min-height: min(640px, calc(100vh - 48px));
  display: flex; flex-direction: column; justify-content: center; gap: 28px;
  padding: 40px 32px; border-radius: 20px;
  background: rgba(12, 15, 22, .55); border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.login-title { margin: 0; text-align: center; font-family: var(--display); font-weight: 700; font-size: clamp(26px, 4vw, 32px); line-height: 1.12; letter-spacing: -.01em; text-wrap: balance; color: #fff; }
.login-card .login-form-wrap { display: block; padding: 0; }
.login-card .login-form { width: 100%; }
.login-card .field input { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); color: #fff; }
.login-card .field input::placeholder { color: rgba(255, 255, 255, .45); }
.login-card .field input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(143, 168, 255, .25); }
.login-card .ghost { color: #fff; }
@media (max-width: 780px) {
  .login { grid-template-rows: 1fr; }
  .login-card { padding: 32px 22px; min-height: auto; }
}

/* Sign-in panel sits on the right so the people in the middle of the photo stay visible (phones keep it centered) */
@media (min-width: 781px) {
  .login { place-items: center end; padding-right: max(6vw, 24px, env(safe-area-inset-right, 0px)); }
}

/* ================= Phone layout (≤ 780px wide) ================= */
.menu-btn, .col-tabs, .cat-filter, .rail-shade, .sheet-handle { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mv-list { display: flex; flex-direction: column; gap: 6px; }
.mv-list button { display: flex; align-items: center; gap: 12px; height: 50px; padding: 0 14px; border-radius: 12px; border: 1px solid transparent; background: var(--rail); color: var(--fg); font-size: 16px; text-align: left; }
.mv-list button i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.mv-list button span { flex: 1; }
.mv-list button small { font-size: 12.5px; color: var(--muted); }
.mv-list button[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
#moveDlg h2 { font-size: 20px; line-height: 1.25; }

@media (max-width: 780px) {
  body { padding: 0; }
  .app { display: block; height: 100dvh; min-height: 0; border: 0; border-radius: 0; }
  .main { height: 100dvh; }

  /* sidebar becomes a slide-out menu */
  .rail {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 45; width: min(318px, 86vw);
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: 20px 0 50px rgba(0,0,0,.35);
    padding: calc(16px + env(safe-area-inset-top, 0px)) 12px calc(14px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  }
  body.menu-open .rail { transform: none; }
  .rail-shade { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(5,7,10,.55); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.menu-open .rail-shade { opacity: 1; pointer-events: auto; }
  .nav-btn, .space-btn { min-height: 44px; font-size: 15px; }
  .cat-btn { min-height: 38px; font-size: 14px; }
  .cat-add { min-height: 38px; }
  .del-btn { opacity: 1; width: 34px; height: 34px; }
  .rail-item:hover .space-btn .count { visibility: visible; }
  .rail-item > .del-btn { position: static; }

  /* header: menu, title, bell on top; month + category below */
  .topbar { position: sticky; top: 0; z-index: 30; background: var(--rail); gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 10px max(12px, env(safe-area-inset-left, 0px)); flex-wrap: wrap; }
  .menu-btn { display: grid; flex: none; width: 44px; height: 44px; }
  .crumb { flex: 1; min-width: 0; flex-basis: auto; }
  .crumb h1 { font-size: 19px; }
  .top-actions { display: contents; }
  .bell-wrap { order: 1; }
  .icon-btn { width: 44px; height: 44px; }
  .month { order: 2; flex: none; }
  .month button { width: 40px; height: 40px; }
  .month .month-label { min-width: 0; padding: 0 6px; }
  .month .month-label svg { display: none; }
  .cat-filter { display: block; order: 3; flex: 1; min-width: 0; }
  .cat-filter select { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--fg); padding: 0 10px; font-size: 15px; }
  #todayBtn { display: none; }
  .pop { display: none !important; }
  .picker { left: 0; transform: none; position: fixed; top: calc(118px + env(safe-area-inset-top, 0px)); left: 12px; }

  /* board: one column at a time, chosen by tabs or by swiping */
  .col-tabs:not([hidden]) { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px 6px; background: var(--bg); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .col-tabs::-webkit-scrollbar { display: none; }
  .col-tabs button { flex: none; display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-size: 14px; white-space: nowrap; }
  .col-tabs button i { width: 8px; height: 8px; border-radius: 50%; }
  .col-tabs button b { font-family: var(--mono); font-size: 12px; font-weight: 500; opacity: .75; }
  .col-tabs button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
  .view { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .board { display: block; overflow: visible; padding: 4px 12px 110px; }
  .board .col { padding: 0; min-height: 60vh; }
  .board .col:not(.active) { display: none; }
  .board .col-head { display: none; }
  .col-list { overflow: visible; gap: 10px; }
  .card { padding: 16px 14px 14px; gap: 10px; min-height: 0; border-radius: 14px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .card-title { font-size: 16px; }
  .card-cat { font-size: 13px; }
  .card-foot .av { width: 28px; height: 28px; font-size: 11px; }
  .who-name { font-size: 14px; }
  .card-foot .due { font-size: 12.5px; }
  .empty { padding: 28px 14px; }

  /* big round "New task" button */
  #newBtn { position: fixed; z-index: 35; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(22px + env(safe-area-inset-bottom, 0px)); height: 56px; padding: 0 22px; border-radius: 28px; font-size: 16px; box-shadow: 0 10px 28px rgba(0,0,0,.4); }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

  /* calendar: small month grid with dots, tap a day to see it */
  .calendar { display: flex; flex-direction: column; gap: 12px; padding: 10px 10px 30px; height: auto; }
  .cal-scroll { overflow: visible; }
  .cal { min-width: 0; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .cal-wd { padding: 6px 0; text-align: center; font-size: 10.5px; }
  .day { min-height: 54px; padding: 4px 2px; flex-direction: row; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 3px; border-right: 0; cursor: pointer; }
  .day .dnum { flex-basis: 100%; margin: 0 auto; width: 28px; height: 28px; }
  .day .chip { width: 6px; height: 6px; padding: 0; border-radius: 50%; background: none; }
  .day .chip i { width: 6px; height: 6px; border-radius: 50%; }
  .day .chip span, .day .more { display: none; }
  .day.picked { background: var(--accent-soft); border-radius: 10px; }
  .agenda { border-radius: 14px; }

  /* dialogs: task details, profile full screen; new task and move as bottom sheets */
  dialog.detail, dialog#profile { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }
  dialog.detail .d-wrap { height: 100%; max-height: none; }
  dialog.detail .d-body { flex: 1; }
  #dFull { display: none; }
  .d-head { padding: 10px 12px; }
  .d-close { width: 44px; height: 44px; font-size: 24px; }
  .d-main { padding: 16px; }
  .d-main h2 { font-size: 22px; }
  .d-side { padding: 16px; gap: 14px; }
  .c-form input { height: 48px; border-radius: 24px; font-size: 16px; }
  dialog#profile .dlg { min-height: 100%; box-sizing: border-box; padding: 18px 16px 24px; }
  dialog#profile .dlg-actions { margin-top: auto; }
  dialog#profile .photo-row { flex-direction: column; }
  dialog#dlg, dialog.sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 22px 22px 0 0; border-bottom: 0; max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .sheet-handle { display: block; align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
  dialog#dlg .dlg::before { content: ""; align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
  .field input, .field select, .field textarea { font-size: 16px; } /* 16px stops phones zooming in */
  .field input, .field select { height: 46px; }
  .dlg-actions .primary, .dlg-actions .ghost, .dlg-actions .danger { height: 48px; flex: 1; }
  .row2 { grid-template-columns: 1fr; }

  /* lists */
  .notif-page { padding: 10px 10px 40px; }
  .notif-card { padding: 10px; }
  .n-item { padding: 12px 8px; }
  .m-actions { width: 100%; }
}

/* Montage Motion logo */
.brand-logo { width: 34px; height: 34px; object-fit: contain; flex: none; }
.login-logo { display: block; width: 76px; height: 76px; object-fit: contain; margin: 0 auto -10px; filter: drop-shadow(0 6px 18px rgba(0,0,0,.35)); }

/* Phone: task details in the design's order — name, status/assignee/notify, details, comments, delete last */
@media (max-width: 780px) {
  dialog.detail .d-body { display: flex; flex-direction: column; gap: 16px; padding: 16px 16px 28px; overflow-y: auto; }
  dialog.detail .d-main, dialog.detail .d-view, dialog.detail .d-side { display: contents; }
  dialog.detail .d-title-row { order: 1; }
  dialog.detail .d-side > * { order: 2; }
  dialog.detail #dView > .d-sec, dialog.detail #dEditForm { order: 3; }
  dialog.detail .d-main > .d-sec { order: 4; }
  dialog.detail #dDelete { order: 5; margin-top: 8px; height: 46px; }
}

/* ================= Computers & laptops: fit the 7 columns ================= */
@media (min-width: 781px) {
  .main { position: relative; }
  /* ☰ collapses the sidebar so the board gets the whole width */
  .menu-btn { display: grid; flex: none; }
  body.rail-collapsed .app { grid-template-columns: minmax(0, 1fr); }
  body.rail-collapsed .rail { display: none; }
  /* more compact columns before anything needs scrolling */
  .board { grid-auto-columns: minmax(150px, 1fr); }
  /* a scrollbar that is always visible when the columns don't fit */
  .board { scrollbar-width: auto; scrollbar-color: var(--muted) var(--bg); padding-bottom: 6px; }
  .board::-webkit-scrollbar { height: 12px; }
  .board::-webkit-scrollbar-track { background: var(--bg); }
  .board::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid var(--bg); }
  .board::-webkit-scrollbar-thumb:hover { background: var(--muted); }
  .board-arrow { position: absolute; top: 50%; z-index: 15; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--fg); display: grid; place-items: center; box-shadow: var(--pop-shadow); }
  .board-arrow svg { width: 20px; height: 20px; }
  .board-arrow:hover { border-color: var(--accent); color: var(--accent); }
  .board-arrow.left { left: 8px; }
  .board-arrow.right { right: 8px; }
}
@media (min-width: 781px) and (max-width: 1500px) {
  .board { grid-auto-columns: minmax(136px, 1fr); gap: 6px; padding-inline: 10px; }
  .card { padding: 10px 10px 10px; }
  .card-title { font-size: 13px; }
  .card-foot { flex-wrap: wrap; row-gap: 4px; }
}
@media (max-width: 780px) { .board-arrow { display: none !important; } }


/* Phone header: short month, and a category box that's always big enough to read */
@media (max-width: 780px) {
  .month { flex: none; }
  .month .month-label { font-size: 15px; padding: 0 4px; }
  .cat-filter { flex: 1 1 150px; min-width: 150px; }
  .cat-filter select { height: 42px; font-size: 15px; text-overflow: ellipsis; }
}

/* Day/Month/Year date boxes: our text underneath, the real (invisible) date box on top */
.date-wrap { position: relative; display: inline-flex; min-width: 170px; }
.field .date-wrap { display: flex; }
.date-text { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font-weight: 400; font-size: 14px; font-variant-numeric: tabular-nums; }
.date-text svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.date-wrap input[type="date"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; margin: 0; }
.date-wrap:focus-within .date-text { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.d-side .date-text { background: var(--surface); height: 36px; }
@media (max-width: 780px) { .date-text { height: 46px; font-size: 16px; } }
