@font-face{font-family:'Nunito';font-style:normal;font-weight:400 900;font-display:swap;src:url(/static/fonts/nunito-cyrillic-ext.woff2) format('woff2');unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}
@font-face{font-family:'Nunito';font-style:normal;font-weight:400 900;font-display:swap;src:url(/static/fonts/nunito-cyrillic.woff2) format('woff2');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:'Nunito';font-style:normal;font-weight:400 900;font-display:swap;src:url(/static/fonts/nunito-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'Nunito';font-style:normal;font-weight:400 900;font-display:swap;src:url(/static/fonts/nunito-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

:root {
  --sidebar-w: 256px;
  --column-w: 284px;
  --topbar-h: 56px;
  --on-accent: var(--dreams-ink);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--page-glow);
  color: var(--ink);
  font-family: var(--ff);
  font-size: var(--fs-base);
  line-height: 1.45;
}
a { color: var(--violet-2); text-decoration: none; }
a:hover { color: var(--violet); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: none; box-shadow: var(--ring); }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.icon {
  width: 1em; height: 1em; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Buttons and fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-1);
  background: var(--card); color: var(--ink-2);
  font-size: var(--fs-md); font-weight: 700; white-space: nowrap;
  transition: background-color var(--d1) var(--ease), border-color var(--d1) var(--ease);
}
.btn:hover { background: var(--hover-tint); color: var(--ink); }
.btn .icon { font-size: 15px; }
.btn.primary { border-color: transparent; background: var(--violet); color: var(--on-accent); }
.btn.primary:hover { background: var(--violet-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover-tint); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.wide { width: 100%; justify-content: flex-start; }
.btn.center { justify-content: center; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; flex: 0 0 auto;
  border: 1px solid transparent; border-radius: var(--r-1);
  background: transparent; color: var(--ico);
}
.icon-btn:hover { background: var(--hover-tint); color: var(--ink); }
.icon-btn .icon { font-size: 17px; }
.field, .area {
  width: 100%; min-height: 36px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: var(--r-1);
  background: var(--input-bg); color: var(--ink);
  font-size: var(--fs-md);
}
.area { min-height: 80px; resize: vertical; line-height: 1.5; }
.field:focus, .area:focus { outline: none; border-color: var(--chip-on-ring); box-shadow: var(--ring); }
.field::placeholder, .area::placeholder { color: var(--ink-4); }
.eyebrow {
  margin: 0 0 6px; color: var(--ink-4);
  font-size: var(--fs-cap); font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
}
.muted { color: var(--ink-3); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: grid; gap: 10px; }
.notice { padding: 10px 12px; border-radius: var(--r-1); font-size: var(--fs-md); }
.notice.bad { color: var(--bad); background: var(--bad-bg); }
.notice.warn { color: var(--warn); background: var(--warn-bg); }

.check {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; flex: 0 0 auto; margin: 0;
  display: inline-grid; place-items: center;
  border: 1.5px solid var(--line-strong); border-radius: 5px; background: var(--input-bg);
  cursor: pointer;
}
.check::after {
  content: ""; width: 9px; height: 5px; margin-top: -2px;
  border-left: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent);
  transform: rotate(-45deg); opacity: 0;
}
.check:checked { border-color: var(--ok); background: var(--ok); }
.check:checked::after { opacity: 1; }
.check:focus-visible { box-shadow: var(--ring); }

.choice { display: flex; flex-wrap: wrap; gap: 6px; }
.choice label {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-pill); cursor: pointer;
  font-size: var(--fs-md); font-weight: 700; color: var(--ink-2);
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice input:checked + span { color: var(--badge-ink); }
.choice label:has(input:checked) { border-color: var(--chip-on-ring); background: var(--chip-on-bg); }
.choice label:has(input:focus-visible) { box-shadow: var(--ring); }

/* Tones: labels, covers, avatars, board marks */
.tone-green { --tone: var(--s-green); --tone-g: var(--t-green); }
.tone-yellow { --tone: var(--s-yellow); --tone-g: var(--t-yellow); }
.tone-orange { --tone: var(--s-orange); --tone-g: var(--t-orange); }
.tone-red { --tone: var(--s-red); --tone-g: var(--t-red); }
.tone-purple { --tone: var(--s-purple); --tone-g: var(--t-purple); }
.tone-blue { --tone: var(--s-blue); --tone-g: var(--t-blue); }
.tone-sky { --tone: var(--s-sky); --tone-g: var(--t-sky); }
.tone-lime { --tone: var(--s-lime); --tone-g: var(--t-lime); }
.tone-pink { --tone: var(--s-pink); --tone-g: var(--t-pink); }
.tone-black { --tone: var(--s-obsidian); --tone-g: var(--t-obsidian); }
.tone-none { --tone: var(--ink-4); --tone-g: var(--none-bg); }
.tone-violet { --tone: var(--s-violet); --tone-g: var(--t-violet); }
.tone-amber { --tone: var(--s-amber); --tone-g: var(--t-amber); }
.tone-teal { --tone: var(--s-teal); --tone-g: var(--t-teal); }
.tone-rose { --tone: var(--s-rose); --tone-g: var(--t-rose); }
.tone-indigo { --tone: var(--s-indigo); --tone-g: var(--t-indigo); }
.tone-slate { --tone: var(--s-slate); --tone-g: var(--t-slate); }
.tone-brand { --tone: var(--s-violet); --tone-g: var(--g-brand); }

.avatar {
  width: 28px; height: 28px; display: inline-grid; place-items: center; flex: 0 0 auto;
  border-radius: var(--r-pill); background: var(--tone-g, var(--t-violet));
  color: var(--on-accent); font-size: 10px; font-weight: 800; letter-spacing: 0.02em;
}
.avatar.sm { width: 24px; height: 24px; font-size: 9px; }
.avatar.lg { width: 32px; height: 32px; font-size: 11px; }
.avatars { display: inline-flex; align-items: center; }
.avatars .avatar { box-shadow: 0 0 0 2px var(--card); }
.avatars .avatar + .avatar { margin-left: -6px; }
.avatar-more {
  height: 24px; min-width: 24px; padding: 0 6px; display: inline-grid; place-items: center;
  margin-left: 4px; border-radius: var(--r-pill); background: var(--none-bg);
  color: var(--ink-3); font-size: var(--fs-xs); font-weight: 800;
}

.label-chip {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 12px;
  border-radius: var(--r-1); font-size: var(--fs-md); font-weight: 800;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 16%, transparent);
}
.label-chip.empty { min-width: 44px; background: var(--tone-g); }

/* Shell */
.app-shell {
  min-height: 100dvh;
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}
.sidebar {
  position: sticky; top: 0; height: 100dvh; z-index: var(--z-drawer);
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 12px 12px;
  border-right: 1px solid var(--line); background: var(--card);
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 2px 4px 12px;
  color: var(--ink); font-size: var(--fs-lg); font-weight: 800; letter-spacing: -0.02em;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 28px; height: 28px; flex: 0 0 auto; display: inline-grid; place-items: center;
  border-radius: 7px; background: var(--g-brand); color: var(--on-accent);
}
.brand-mark .icon { font-size: 16px; stroke-width: 2.2; }
.nav { display: grid; gap: 2px; }
.nav a {
  min-height: 36px; display: flex; align-items: center; gap: 10px; padding: 0 10px;
  border-radius: var(--r-1); color: var(--ink-2); font-size: var(--fs-md); font-weight: 700;
}
.nav a:hover { background: var(--hover-tint); color: var(--ink); }
.nav a.active { color: var(--badge-ink); background: var(--badge-bg); }
.nav .icon { font-size: 16px; color: var(--ico-soft); }
.nav a.active .icon { color: currentColor; }
.sidebar-rule { height: 1px; margin: 10px 4px; background: var(--line); flex: 0 0 auto; }
.sidebar-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px 6px; color: var(--ink-4);
  font-size: var(--fs-cap); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.space {
  min-height: 34px; display: flex; align-items: center; gap: 10px; padding: 0 8px;
  color: var(--ink-2); font-size: var(--fs-md); font-weight: 700;
}
.space-mark { width: 18px; height: 18px; flex: 0 0 auto; border-radius: 5px; background: var(--tone-g); }
.space-boards { display: grid; gap: 2px; margin: 0 0 6px 18px; }
.space-boards a {
  min-height: 32px; display: flex; align-items: center; padding: 0 10px;
  border: 1px solid transparent; border-radius: var(--r-1);
  color: var(--ink-2); font-size: var(--fs-md);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.space-boards a:hover { background: var(--hover-tint); color: var(--ink); }
.space-boards a.active {
  color: var(--badge-ink); background: var(--badge-bg); border-color: var(--chip-on-ring);
  font-weight: 700;
}
.profile {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 8px;
  border-radius: var(--r-2); background: var(--card-2);
}
.profile-copy { display: grid; min-width: 0; flex: 1; }
.profile-copy b { overflow: hidden; font-size: var(--fs-sm); text-overflow: ellipsis; white-space: nowrap; }
.profile-copy small { color: var(--ink-4); font-size: var(--fs-cap); }
.profile form { margin: 0; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: var(--z-sticky);
  min-height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px);
}
.topbar h1 { margin: 0; font-size: var(--fs-xl); font-weight: 800; letter-spacing: -0.02em;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px;
  border-radius: var(--r-pill); background: var(--none-bg); color: var(--ink-3);
  font-size: var(--fs-sm); font-weight: 700; white-space: nowrap;
}
.chip .icon { font-size: 13px; }
.chip.accent { background: var(--badge-bg); color: var(--badge-ink); }
.menu-toggle { display: none; }
.theme-toggle .theme-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .theme-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .theme-moon { display: block; }
}
.page { width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 24px 48px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: var(--fs-3xl); letter-spacing: -0.03em; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.page-head .spacer { flex: 1; }

/* Home: boards by workspace */
.ws { margin-bottom: 28px; }
.ws-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ws-head h2 { margin: 0; font-size: var(--fs-lg); font-weight: 800; }
.ws-head .space-mark { width: 22px; height: 22px; border-radius: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tile {
  position: relative; min-height: 112px; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 14px 14px; border: 1px solid var(--line); border-radius: var(--r-3);
  background: var(--card); color: var(--ink);
  box-shadow: 0 1px 0 var(--line);
  transition: transform var(--d1) var(--ease), box-shadow var(--d1) var(--ease);
  overflow: hidden;
}
.tile::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--tone-g); }
.tile:hover { color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow); }
.tile b { font-size: var(--fs-base); font-weight: 800; }
.tile small { color: var(--ink-4); font-size: var(--fs-sm); }
.tile-new {
  align-items: center; justify-content: center; border-style: dashed;
  background: transparent; box-shadow: none; color: var(--ink-4); font-weight: 700;
}
.tile-new::before { display: none; }
.tile-new .icon { font-size: 18px; }
.empty {
  display: grid; justify-items: center; gap: 10px; padding: 48px 24px; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: var(--r-4); background: var(--card);
}
.empty h2 { margin: 6px 0 0; font-size: var(--fs-xl); }
.empty p { max-width: 460px; margin: 0; color: var(--ink-3); }
.empty-mark {
  width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px;
  background: var(--g-brand); color: var(--on-accent);
}
.empty-mark .icon { font-size: 26px; stroke-width: 2.1; }

/* Board */
.board-page { height: 100dvh; overflow: hidden; }
.board-page .main { height: 100dvh; }
.board-head .members { margin-left: 4px; }
.filter-count {
  min-width: 18px; height: 18px; padding: 0 5px; display: inline-grid; place-items: center;
  border-radius: var(--r-pill); background: var(--violet); color: var(--on-accent);
  font-size: var(--fs-xs); font-weight: 800;
}
.board-canvas {
  flex: 1; min-height: 0; display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px 20px; overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain;
}
.board-canvas.filtered { box-shadow: inset 0 3px 0 var(--chip-on-ring); }
.column {
  width: var(--column-w); flex: 0 0 var(--column-w); max-height: 100%;
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--r-3); background: var(--card-2);
}
.column.lifted, .card.lifted { box-shadow: 0 0 0 2px var(--violet), var(--shadow); }
.column.dragging, .card.dragging { opacity: 0.4; }
.column-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 8px 6px 14px;
  cursor: grab; border-radius: var(--r-3) var(--r-3) 0 0;
}
.column-head h2 {
  margin: 0; min-width: 0; font-size: var(--fs-md); font-weight: 800;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.column-head .count {
  min-width: 22px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center;
  border-radius: var(--r-pill); background: var(--none-bg); color: var(--ink-3);
  font-size: var(--fs-xs); font-weight: 800;
}
.column-head .icon-btn { margin-left: auto; width: 28px; height: 28px; }
.column-head .rename { flex: 1; min-height: 30px; padding: 3px 8px; font-weight: 800; }
.column-cards {
  flex: 1 1 auto; min-height: 12px; display: flex; flex-direction: column; gap: 8px;
  padding: 4px 8px 4px; overflow-y: auto; overscroll-behavior: contain;
}
.column-foot { padding: 4px 8px 8px; }
.add-card {
  width: 100%; min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 8px;
  border: 0; border-radius: var(--r-1); background: transparent; color: var(--ink-3);
  font-size: var(--fs-md); font-weight: 700;
}
.add-card:hover { background: var(--hover-tint); color: var(--ink); }
.composer { display: grid; gap: 8px; }
.composer .area { min-height: 64px; box-shadow: 0 1px 0 var(--line); }
.add-column {
  width: var(--column-w); flex: 0 0 var(--column-w);
  border: 1px dashed var(--line-strong); border-radius: var(--r-3); padding: 8px;
  background: color-mix(in srgb, var(--card) 50%, transparent);
}
.drop-line { height: 2px; margin: -5px 2px; border-radius: 2px; background: var(--violet); }
.drop-column { width: 3px; align-self: stretch; margin: 0 -7px; border-radius: 2px; background: var(--violet); }
.column-cards.drop-over { background: var(--hover-tint); border-radius: var(--r-1); }

.card {
  position: relative; display: grid; gap: 8px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-2);
  background: var(--card); color: var(--ink);
  box-shadow: 0 1px 0 var(--line);
  cursor: pointer; text-align: left;
}
.card:hover { border-color: var(--line-strong); }
.card:focus-visible { box-shadow: 0 0 0 2px var(--violet); }
.card.pending { opacity: 0.7; }
.card.locked .card-title::after { content: none; }
.card-cover { height: 32px; margin: -10px -12px 0; border-radius: var(--r-2) var(--r-2) 0 0; background: var(--tone-g); }
.card.full-cover { background: var(--tone-g); color: var(--on-accent); border-color: transparent; }
.card.full-cover .card-cover { display: none; }
.card.full-cover .badge { color: var(--on-accent); }
.card.full-cover .card-title { font-weight: 800; }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.label-bar { width: 36px; height: 6px; border-radius: var(--r-pill); background: var(--tone); }
.card-title { margin: 0; font-size: var(--fs-md); font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 0; }
.card-meta:empty { display: none; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3);
  font-size: var(--fs-sm); font-weight: 700;
}
.badge .icon { font-size: 13px; }
.badge.ref { padding: 1px 6px; border-radius: 6px; background: var(--none-bg); font-size: var(--fs-xs); }
.badge.lock { color: var(--warn); }
.due { padding: 2px 7px; border-radius: 6px; }
.due.overdue { background: var(--bad-bg); color: var(--bad); }
.due.soon { background: var(--warn-bg); color: var(--warn); }
.due.done { background: var(--ok-bg); color: var(--ok); }
.card-people { margin-left: auto; }
.board-empty {
  margin: auto; max-width: 420px; padding: 32px; text-align: center; color: var(--ink-3);
}

/* Popovers and dialogs */
.pop {
  position: fixed; z-index: var(--z-pop); width: 304px; max-width: calc(100vw - 32px);
  max-height: min(70dvh, 560px); overflow-y: auto;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--r-3);
  background: var(--card); box-shadow: var(--shadow);
}
.pop-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.pop-head b { flex: 1; text-align: center; font-size: var(--fs-md); }
.pop-head .icon-btn { width: 28px; height: 28px; }
.pop-list { display: grid; gap: 2px; margin: 6px 0; }
.pop-item {
  min-height: 36px; display: flex; align-items: center; gap: 10px; padding: 4px 8px;
  border: 0; border-radius: var(--r-1); background: transparent; text-align: left;
  font-size: var(--fs-md); color: var(--ink-2);
}
.pop-item:hover { background: var(--hover-tint); color: var(--ink); }
.pop-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item .mark { color: var(--violet); }
.pop-item .label-chip { flex: 1; }
.pop-section { margin: 12px 0 4px; color: var(--ink-4); font-size: var(--fs-cap); font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; }
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.swatch {
  height: 32px; border: 2px solid transparent; border-radius: var(--r-1); background: var(--tone-g);
}
.swatch[aria-pressed="true"] { border-color: var(--ink); }
.dialog {
  width: min(520px, calc(100vw - 32px)); padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-4);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow);
}
.dialog::backdrop { background: var(--scrim); }
.dialog form { display: grid; gap: 14px; padding: 22px; }
.dialog h2 { margin: 0; font-size: var(--fs-xl); }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog label.field-label { display: grid; gap: 6px; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-3); }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-sheet); transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px;
  border-radius: var(--r-2); background: var(--ink); color: var(--card);
  font-size: var(--fs-md); font-weight: 700; box-shadow: var(--shadow);
}

/* Calendar */
.cal { display: grid; gap: 6px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; }
.cal-head b { font-size: var(--fs-md); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-grid span { text-align: center; color: var(--ink-4); font-size: var(--fs-xs); font-weight: 800; padding: 4px 0; }
.cal-day {
  height: 34px; border: 0; border-radius: var(--r-1); background: transparent;
  font-size: var(--fs-md); color: var(--ink-2);
}
.cal-day:hover { background: var(--hover-tint); }
.cal-day.other { color: var(--ink-4); }
.cal-day.today { font-weight: 800; color: var(--violet-2); }
.cal-day.in-range { background: var(--chip-on-bg); border-radius: 0; }
.cal-day.picked { background: var(--violet); color: var(--on-accent); }
.date-row { display: grid; grid-template-columns: 22px 1fr 84px; align-items: center; gap: 8px; }

/* Card detail */
.card-dialog {
  width: min(900px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0;
  border: 0; border-radius: var(--r-5); background: var(--card); color: var(--ink);
  box-shadow: var(--shadow); overflow: hidden;
}
.card-dialog::backdrop { background: var(--scrim); }
.card-dialog-body { max-height: calc(100dvh - 48px); overflow-y: auto; }
.card-loading { padding: 48px; text-align: center; color: var(--ink-3); }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 220px; }
.detail-page { max-width: 960px; margin: 24px auto; border: 1px solid var(--line);
  border-radius: var(--r-5); background: var(--card); box-shadow: var(--shadow); overflow: hidden; }
.detail-cover { height: 72px; background: var(--tone-g); grid-column: 1 / -1; }
.detail-main { min-width: 0; display: grid; align-content: start; gap: 22px; padding: 24px 28px 28px; }
.detail-side {
  display: grid; align-content: start; gap: 6px; padding: 24px 16px;
  border-left: 1px solid var(--line); background: var(--card-2);
}
.detail-head { display: grid; gap: 8px; }
.detail-crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-right: 36px; }
.detail-crumbs small { color: var(--ink-4); font-size: var(--fs-sm); }
.detail-close { position: absolute; top: 14px; right: 14px; }
.title-input {
  width: 100%; margin: 0; padding: 4px 6px; margin-left: -6px;
  border: 1px solid transparent; border-radius: var(--r-1); background: transparent;
  font-size: var(--fs-2xl); font-weight: 800; line-height: 1.25; letter-spacing: -0.02em;
  resize: none; overflow: hidden;
}
.title-input:hover:not([readonly]) { background: var(--hover-tint); }
.title-input:focus { outline: none; border-color: var(--chip-on-ring); background: var(--input-bg); }
.detail-meta { display: flex; flex-wrap: wrap; gap: 20px; }
.detail-meta .row { gap: 6px; }
.round-add {
  width: 28px; height: 28px; display: inline-grid; place-items: center;
  border: 1px dashed var(--line-strong); border-radius: var(--r-pill);
  background: transparent; color: var(--ink-3);
}
.due-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 12px;
  border: 0; border-radius: var(--r-1); background: var(--none-bg); color: var(--ink-2);
  font-size: var(--fs-md); font-weight: 800;
}
.due-chip.overdue { background: var(--bad-bg); color: var(--bad); }
.due-chip.soon { background: var(--warn-bg); color: var(--warn); }
.due-chip.done { background: var(--ok-bg); color: var(--ok); }
.section { display: grid; gap: 10px; }
.section-head { display: flex; align-items: center; gap: 10px; }
.section-head h3 { margin: 0; font-size: var(--fs-base); font-weight: 800; }
.section-head .icon { font-size: 17px; color: var(--ico); }
.section-head .spacer { flex: 1; }
.prose { color: var(--ink-2); font-size: var(--fs-md); line-height: 1.6; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { color: var(--ink); line-height: 1.3; margin: 16px 0 8px; }
.prose h1 { font-size: var(--fs-xl); } .prose h2 { font-size: var(--fs-lg); } .prose h3 { font-size: var(--fs-base); }
.prose p { margin: 0 0 10px; }
.prose ul, .prose ol { margin: 0 0 10px; padding-left: 22px; }
.prose li > p { margin: 0; }
.prose blockquote { margin: 0 0 10px; padding: 2px 0 2px 12px; border-left: 3px solid var(--line-strong); color: var(--ink-3); }
.prose code { padding: 1px 5px; border-radius: 5px; background: var(--none-bg); font-family: var(--ff-mono); font-size: 0.92em; }
.prose pre { margin: 0 0 10px; padding: 12px; border-radius: var(--r-1); background: var(--none-bg); overflow-x: auto; }
.prose pre code { padding: 0; background: none; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.prose-empty {
  width: 100%; min-height: 64px; padding: 10px 12px; border: 0; border-radius: var(--r-1);
  background: var(--none-bg); color: var(--ink-3); text-align: left; font-size: var(--fs-md);
}
.progress { display: flex; align-items: center; gap: 10px; }
.progress small { width: 34px; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 800; }
.progress-bar { flex: 1; height: 8px; border-radius: var(--r-pill); background: var(--none-bg); overflow: hidden; }
.progress-bar span { display: block; height: 100%; border-radius: inherit; background: var(--violet); }
.progress-bar.full span { background: var(--ok); }
.check-item { display: flex; align-items: flex-start; gap: 10px; min-height: 32px; padding: 4px 6px; border-radius: var(--r-1); }
.check-item:hover { background: var(--hover-tint); }
.check-item .check { margin-top: 2px; }
.check-item .text { flex: 1; min-width: 0; font-size: var(--fs-md); overflow-wrap: anywhere; cursor: text; }
.check-item.done .text { color: var(--ink-4); text-decoration: line-through; }
.check-item .icon-btn { width: 26px; height: 26px; opacity: 0; }
.check-item:hover .icon-btn, .check-item:focus-within .icon-btn { opacity: 1; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.file {
  display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-2); background: var(--card);
}
.file-mark {
  width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: var(--r-1); background: var(--badge-bg); color: var(--badge-ink);
}
.file-copy { min-width: 0; flex: 1; display: grid; }
.file-copy a, .file-copy b { overflow: hidden; color: var(--ink); font-size: var(--fs-md); font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.file-copy small { color: var(--ink-4); font-size: var(--fs-xs); }
.comment { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
.comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.comment-head b { font-size: var(--fs-md); }
.comment-head small { color: var(--ink-4); font-size: var(--fs-xs); }
.comment-actions { display: flex; gap: 10px; margin-top: 4px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--ink-3); font-size: var(--fs-sm); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--ink); }
.side-title { margin: 8px 4px 4px; color: var(--ink-4); font-size: var(--fs-cap); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.side-rule { height: 1px; margin: 10px 0; background: var(--line); }
.archived-note { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-1); background: var(--warn-bg); color: var(--warn); font-weight: 700; }

/* Settings and archive */
.panel { margin-bottom: 18px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-4); background: var(--card); }
.panel h2 { margin: 0 0 14px; font-size: var(--fs-lg); }
.list-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .field { max-width: 360px; }

/* Login keeps its own centered layout */
.login-shell { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(420px, 100%); padding: 38px; text-align: center;
  border: 1px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: var(--shadow);
}
.login-card .brand-mark { width: 64px; height: 64px; margin: 0 auto 22px; border-radius: 15px; }
.login-card .brand-mark .icon { font-size: 34px; }
.login-card h1 { margin: 0; font-size: 34px; letter-spacing: -0.04em; }
.login-card .lead { margin: 12px 0 26px; color: var(--ink-3); line-height: 1.55; }
.login-card .notice { margin: 0 0 16px; }
.login-card .btn { width: 100%; min-height: 44px; }
.login-note { margin: 18px 0 0; color: var(--ink-4); font-size: var(--fs-sm); }
.login-theme { position: fixed; top: 20px; right: 20px; }

/* Wide screens: the board does not stretch, extra space stays empty */
@media (min-width: 1920px) {
  :root { --column-w: 296px; }
  .page { max-width: 1440px; }
}

/* Laptop: the sidebar folds into a strip of icons and slides out over the page on demand */
.rail-toggle { display: none; }
@media (max-width: 1439px) and (min-width: 1025px) {
  :root { --sidebar-w: 68px; }
  .rail-toggle { display: inline-grid; margin: 0 auto 6px; }
  .main { grid-column: 2; }
  .rail-close-icon { display: none; }
  body:not(.rail-open) .sidebar { padding: 14px 10px 12px; align-items: center; }
  body:not(.rail-open) :is(.brand span:not(.brand-mark), .nav a span, .sidebar-title, .space-name,
    .space-boards, .profile-copy, .sidebar .theme-toggle) { display: none; }
  body:not(.rail-open) .nav a { justify-content: center; padding: 0; width: 44px; }
  body:not(.rail-open) .space { justify-content: center; padding: 0; cursor: pointer; border-radius: var(--r-1); min-height: 40px; width: 44px; }
  body:not(.rail-open) .space:hover { background: var(--hover-tint); }
  body:not(.rail-open) .space-mark { width: 24px; height: 24px; }
  body:not(.rail-open) .profile { padding: 4px; background: transparent; flex-direction: column; }
  body.rail-open .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; box-shadow: var(--shadow);
    animation: rail-in var(--d2) var(--ease);
  }
  body.rail-open .rail-toggle { position: absolute; top: 12px; right: 10px; margin: 0; }
  body.rail-open .rail-open-icon { display: none; }
  body.rail-open .rail-close-icon { display: block; }
  body.rail-open .brand { padding-right: 44px; }
  body.rail-open::after {
    content: ""; position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1); background: var(--scrim);
  }
}
@keyframes rail-in { from { transform: translateX(-40px); opacity: 0.6; } }

/* Tablet and phone: the sidebar becomes a drawer */
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100dvh;
    transform: translateX(-102%); transition: transform var(--d2) var(--ease);
    box-shadow: var(--shadow);
  }
  body.drawer-open .sidebar { transform: none; }
  body.drawer-open::after {
    content: ""; position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1); background: var(--scrim);
  }
  .menu-toggle { display: inline-grid; }
}

@media (max-width: 720px) {
  :root { --column-w: calc(100vw - 48px); --topbar-h: 52px; }
  .topbar { padding: 8px 16px; gap: 8px; }
  .topbar h1 { font-size: var(--fs-lg); }
  .topbar .hide-phone { display: none; }
  .board-canvas { padding: 12px 16px 16px; gap: 12px; scroll-snap-type: x mandatory; scroll-padding: 0 16px; }
  .column, .add-column { scroll-snap-align: start; }
  .page { padding: 20px 16px 40px; }
  .page-head h1 { font-size: var(--fs-2xl); }
  .icon-btn, .btn { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .card-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .card-dialog-body { max-height: 100dvh; }
  .detail { grid-template-columns: minmax(0, 1fr); }
  .detail-side { border-left: 0; border-top: 1px solid var(--line); grid-template-columns: 1fr 1fr; }
  .detail-side .side-title, .detail-side .side-rule { grid-column: 1 / -1; }
  .detail-main { padding: 20px 16px; }
  .detail-page { margin: 0; border-radius: 0; border: 0; }
  .title-input { font-size: var(--fs-xl); }
  .list-row { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }

.detail { position: relative; }
.progress-bar .w-0 { width: 0%; }
.progress-bar .w-5 { width: 5%; }
.progress-bar .w-10 { width: 10%; }
.progress-bar .w-15 { width: 15%; }
.progress-bar .w-20 { width: 20%; }
.progress-bar .w-25 { width: 25%; }
.progress-bar .w-30 { width: 30%; }
.progress-bar .w-35 { width: 35%; }
.progress-bar .w-40 { width: 40%; }
.progress-bar .w-45 { width: 45%; }
.progress-bar .w-50 { width: 50%; }
.progress-bar .w-55 { width: 55%; }
.progress-bar .w-60 { width: 60%; }
.progress-bar .w-65 { width: 65%; }
.progress-bar .w-70 { width: 70%; }
.progress-bar .w-75 { width: 75%; }
.progress-bar .w-80 { width: 80%; }
.progress-bar .w-85 { width: 85%; }
.progress-bar .w-90 { width: 90%; }
.progress-bar .w-95 { width: 95%; }
.progress-bar .w-100 { width: 100%; }
.field-label { display: grid; gap: 6px; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-3); }
label.swatch { cursor: pointer; }
label.swatch:has(input:checked) { border-color: var(--ink); }
label.swatch:has(input:focus-visible) { box-shadow: var(--ring); }
.pop-item[aria-pressed="true"] { background: var(--chip-on-bg); }
.btn[aria-pressed="true"] { border-color: var(--chip-on-ring); background: var(--chip-on-bg); color: var(--badge-ink); }
.row .grow { flex: 1; min-width: 0; }
.list-row > .label-chip { flex: 0 0 auto; height: 28px; }
.label-chip.empty { min-height: 28px; }

/* Card editor: Tiptap 3, the same menus as the wiki editor, tokens only */
.editor-host { min-width: 0; }
.ed {
  position: relative; border: 1px solid var(--line); border-radius: var(--r-1);
  background: var(--input-bg); color: var(--ink);
}
.ed.focused { border-color: var(--chip-on-ring); box-shadow: var(--ring); }
.ed-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px;
  border-bottom: 1px solid var(--line);
}
.ed-tool {
  width: 32px; height: 32px; display: inline-grid; place-items: center;
  border: 0; border-radius: var(--r-1); background: transparent; color: var(--ico);
}
.ed-tool:hover { background: var(--hover-tint); color: var(--ink); }
.ed-tool[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--badge-ink); }
.ed-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--line); }
.ed .i, .ed-menu .i {
  width: 1em; height: 1em; flex: 0 0 auto; font-size: 16px;
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.ed-text {
  min-height: 120px; max-height: 60vh; overflow-y: auto; padding: 10px 12px; outline: none;
  position: relative; white-space: pre-wrap; white-space: break-spaces; word-wrap: break-word;
  font-variant-ligatures: none;
}
[data-comment-editor] .ed-text, [data-edit-editor] .ed-text { min-height: 72px; }
.ed-text pre { white-space: pre-wrap; }
.ed-text p.is-editor-empty:first-child::before {
  content: attr(data-placeholder); float: left; height: 0; pointer-events: none; color: var(--ink-4);
}
.ed-text .ProseMirror-selectednode { outline: 2px solid var(--chip-on-ring); }
.ed-text .ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; }
.ed-text.ProseMirror-hideselection *::selection { background: transparent; }
.ed-text a { color: var(--violet-2); text-decoration: underline; }
.ed-text ul[data-type="taskList"] { list-style: none; padding-left: 0; }
.ed-text ul[data-type="taskList"] li { display: flex; align-items: flex-start; gap: 8px; }
.ed-text ul[data-type="taskList"] li > label { flex: 0 0 auto; margin-top: 3px; }
.ed-text ul[data-type="taskList"] li > div { flex: 1; min-width: 0; }
.ed-text ul[data-type="taskList"] input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0;
  display: inline-grid; place-items: center; cursor: pointer;
  border: 1.5px solid var(--line-strong); border-radius: 5px; background: var(--input-bg);
}
.ed-text ul[data-type="taskList"] input[type="checkbox"]::after {
  content: ""; width: 9px; height: 5px; margin-top: -2px; opacity: 0; transform: rotate(-45deg);
  border-left: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent);
}
.ed-text ul[data-type="taskList"] input[type="checkbox"]:checked { border-color: var(--ok); background: var(--ok); }
.ed-text ul[data-type="taskList"] input[type="checkbox"]:checked::after { opacity: 1; }
.ed-menu, .ed-link {
  position: fixed; left: 0; top: 0; z-index: var(--z-sheet); display: none;
  border: 1px solid var(--line); border-radius: var(--r-2); background: var(--card);
  box-shadow: var(--shadow); color: var(--ink);
}
.ed-menu.on { display: grid; gap: 1px; width: 260px; max-height: min(420px, 70vh); overflow-y: auto; padding: 6px; }
.ed-link.on { display: flex; align-items: center; gap: 6px; width: min(380px, calc(100vw - 32px)); padding: 8px; }
.ed-menu .mi-t {
  padding: 8px 8px 4px; color: var(--ink-4);
  font-size: var(--fs-cap); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.ed-menu .mi {
  min-height: 34px; display: flex; align-items: center; gap: 10px; padding: 0 8px;
  border: 0; border-radius: var(--r-1); background: transparent; color: var(--ink-2);
  font-size: var(--fs-md); text-align: left;
}
.ed-menu .mi .i { color: var(--ico-soft); }
.ed-menu .mi.on { background: var(--hover-tint); color: var(--ink); }
.ed-menu .mi-l { flex: 1; min-width: 0; }
.ed-menu .k { color: var(--ink-4); font-family: var(--ff-mono); font-size: var(--fs-xs); }
.ed-menu .menu-empty { padding: 10px; color: var(--ink-3); font-size: var(--fs-md); }
.comment-start {
  width: 100%; min-height: 40px; padding: 0 12px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-1); background: var(--input-bg);
  color: var(--ink-4); font-size: var(--fs-md); cursor: text;
}
.comment-start:hover { border-color: var(--line-strong); }

/* Check items written inside a description or a comment */
.prose ul.tasks { list-style: none; padding-left: 0; }
.prose li.task { display: flex; align-items: flex-start; gap: 8px; }
.prose li.task > div { flex: 1; min-width: 0; }
.task-tick { display: inline-grid; margin-top: 3px; color: var(--ink-4); }
.task-tick .icon { font-size: 16px; }
.prose li.task.done .task-tick { color: var(--ok); }
.prose li.task.done > div { color: var(--ink-3); }

/* Cover image: a field of the card, served by the same rights-checking handler as any file */
.card-cover.image {
  height: auto; overflow: hidden; background: var(--none-bg);
  display: flex; justify-content: center;
}
.card-cover.image img { display: block; width: 100%; max-height: 160px; object-fit: cover; }
.card.full-image .card-cover.image img { max-height: 280px; }
.card.full-image .card-title { font-weight: 800; }
.detail-cover.image { height: auto; display: flex; justify-content: center; background: var(--none-bg); }
.detail-cover.image img { display: block; max-width: 100%; max-height: 240px; object-fit: contain; }
.cover-picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cover-pick {
  aspect-ratio: 4 / 3; padding: 0; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; border-radius: var(--r-1); background: var(--none-bg);
}
.cover-pick img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-pick[aria-pressed="true"] { border-color: var(--violet); }
.icon-btn[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--badge-ink); }
.files { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* Finger drag: a long press lifts, the ghost follows the finger */
.card, .column-head { -webkit-touch-callout: none; }
@media (pointer: coarse) {
  .card, .column-head { -webkit-user-select: none; user-select: none; }
}
.board-canvas.touch-dragging { scroll-snap-type: none; }
.touch-ghost {
  position: fixed; left: 0; top: 0; z-index: var(--z-sheet); margin: 0;
  pointer-events: none; opacity: 0.95; box-shadow: var(--shadow);
}
