/* =========================================================
   TaskFlow — app styles
   ========================================================= */
:root {
  --bg: #F4F5F8;
  --surface: #FFFFFF;
  --ink: #171A23;
  --ink-2: #545B6B;
  --ink-3: #8A90A0;
  --line: #E2E5EB;
  --line-2: #EEF0F4;
  --side: #1B1E2B;
  --side-2: #262A3B;
  --side-ink: #C3C7D6;
  --side-mute: #7E8399;
  --accent: #5B4BDB;
  --accent-2: #4A3BC4;
  --accent-soft: #EEECFC;
  --ok: #1F9D55;  --ok-soft: #E7F6EE;
  --bad: #C8352B; --bad-soft: #FCECEA;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --side-w: 260px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 15px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--r-sm); z-index: 100; }
.skip:focus { top: 12px; }
.muted { color: var(--ink-2); margin: 0; }

/* ---------- Buttons & fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: var(--r-sm); border: 1px solid transparent; font-weight: 600; font-size: .92rem; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-block { width: 100%; min-height: 46px; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: var(--r-sm); background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: rgba(127,127,160,.16); }

.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; margin: 0; border: 0; padding: 0; min-width: 0; }
.field > span, .field legend { font-size: .85rem; font-weight: 600; color: var(--ink); padding: 0; }
.field input, .field select, .field textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .hint { color: var(--ink-3); font-size: .8rem; }
.field .err { color: var(--bad); font-size: .8rem; font-weight: 500; }
.field.has-error input { border-color: var(--bad); }

.alert { padding: 11px 14px; border-radius: var(--r-sm); font-size: .9rem; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: var(--ok-soft); color: #13643A; border-color: #BFE5CF; }
.alert-error { background: var(--bad-soft); color: #8E2119; border-color: #F2C6C1; }

/* ---------- Auth (guest) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(360px, 460px); }
.auth-brand { background: var(--side); color: var(--side-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: conic-gradient(from 210deg, var(--accent) 0 40%, #8A7DF0 40% 70%, #fff 70% 100%); }
.auth-pitch { font-size: clamp(1.6rem, 2.6vw, 2.3rem); line-height: 1.2; color: #fff; max-width: 15em; margin: 0; font-weight: 500; letter-spacing: -.01em; }
.auth-board { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 560px; }
.auth-board li { background: var(--side-2); border-radius: var(--r); padding: 12px; display: grid; gap: 8px; align-content: start; min-height: 150px; border-top: 3px solid var(--c, #888); }
.auth-board span { font-size: .8rem; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 6px; }
.auth-board span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.auth-board li:nth-child(1) { border-top-color: #8A8F98; }
.auth-board li:nth-child(2) { border-top-color: #2F6FEB; }
.auth-board li:nth-child(3) { border-top-color: #1F9D55; }
.auth-board i { display: block; height: 34px; border-radius: var(--r-sm); background: rgba(255,255,255,.08); }
.auth-board i.s { width: 65%; height: 22px; }
.auth-panel { background: var(--surface); padding: 48px clamp(24px, 5vw, 56px); display: flex; flex-direction: column; justify-content: center; }
.auth-panel h1 { font-size: 1.7rem; letter-spacing: -.01em; }
.auth-panel .lead { color: var(--ink-2); margin: 8px 0 28px; }
.switch { margin: 22px 0 0; color: var(--ink-2); font-size: .92rem; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 14px 12px 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.side a { color: inherit; text-decoration: none; }

.ws-switch { position: relative; }
.ws-switch summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); cursor: pointer; color: #fff; font-weight: 600; }
.ws-switch summary::-webkit-details-marker { display: none; }
.ws-switch summary:hover { background: var(--side-2); }
.ws-logo { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: #fff; flex: none; }
.ws-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); color: var(--ink); border-radius: var(--r); box-shadow: 0 12px 32px -8px rgba(10,12,24,.35); padding: 6px; z-index: 20; display: grid; }
.ws-menu form { margin: 0; }
.ws-menu button, .ws-menu a { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: var(--r-sm); cursor: pointer; color: var(--ink); text-decoration: none; font-size: .9rem; }
.ws-menu button:hover, .ws-menu a:hover { background: var(--bg); }
.ws-menu .is-current { font-weight: 600; color: var(--accent); }
.ws-menu a { border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 10px; color: var(--accent); }

.side-nav { display: grid; gap: 2px; margin: 8px 0 10px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); font-weight: 500; }
.side-nav a:hover { background: var(--side-2); }
.side-nav a[aria-current="page"] { background: var(--side-2); color: #fff; }

.side-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px 6px 10px; color: var(--side-mute); font-size: .8rem; font-weight: 600; }
.tree-empty { color: var(--side-mute); font-size: .85rem; padding: 4px 10px; margin: 0; }
.space summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 7px 4px 7px 10px; border-radius: var(--r-sm); cursor: pointer; color: #fff; font-weight: 500; }
.space summary::-webkit-details-marker { display: none; }
.space summary:hover { background: var(--side-2); }
.space .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.space-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.space .add-list { opacity: 0; transition: opacity .15s; }
.space summary:hover .add-list, .space .add-list:focus-visible { opacity: 1; }
.space ul { list-style: none; margin: 2px 0 6px; padding: 0 0 0 20px; border-left: 1px solid var(--side-2); margin-left: 15px; }
.space li a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: var(--r-sm); font-size: .9rem; }
.space li a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.space li a em { font-style: normal; font-size: .75rem; color: var(--side-mute); }
.space li a:hover { background: var(--side-2); }
.space li a[aria-current="page"] { background: var(--accent); color: #fff; }
.space li a[aria-current="page"] em { color: rgba(255,255,255,.8); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: rgba(244,245,248,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.menu-btn { display: none; }
.top-title { flex: 1; min-width: 0; font-weight: 600; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 500; }
.crumb i { width: 9px; height: 9px; border-radius: 3px; }
.crumb-sep { color: var(--ink-3); }

.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; border-radius: 50%; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: .78rem; font-weight: 700; }
.user-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 32px -10px rgba(10,12,24,.25); padding: 14px; display: grid; gap: 2px; z-index: 30; }
.user-pop small { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.user-pop form { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line-2); }
.user-pop button { width: 100%; text-align: left; border: 0; background: none; padding: 6px 0; cursor: pointer; color: var(--bad); font-weight: 500; }

.content { padding: 28px 24px 60px; max-width: 1400px; width: 100%; }

/* ---------- Home ---------- */
.home-head { margin-bottom: 24px; }
.home-head h1 { font-size: 1.7rem; letter-spacing: -.01em; margin-bottom: 4px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.panel-head h2 { font-size: 1.1rem; }
.group-title { display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin: 18px 0 6px; }
.group-title span { color: var(--ink-3); font-weight: 500; }
.group-title.is-late { color: var(--bad); }
.task-rows { list-style: none; margin: 0; padding: 0; }
.task-rows li { display: grid; grid-template-columns: 12px 1fr auto auto auto; align-items: center; gap: 12px; padding: 10px 6px; border-top: 1px solid var(--line-2); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.task-title { color: var(--ink); text-decoration: none; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-title:hover { color: var(--accent); }
.task-list { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: .82rem; }
.task-list i { width: 8px; height: 8px; border-radius: 2px; }
.prio { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.prio.p1 { background: var(--bad-soft); color: var(--bad); }
.prio.p2 { background: #FDF1E1; color: #A55A00; }
.prio.p3 { background: #E9F0FE; color: #1F57C3; }
.prio.p4 { background: var(--line-2); color: var(--ink-2); }
.due { font-size: .82rem; color: var(--ink-2); min-width: 70px; text-align: right; }
.due.is-late { color: var(--bad); font-weight: 600; }

.empty { text-align: center; padding: 44px 20px; }
.empty h3 { font-size: 1.05rem; margin-bottom: 6px; }
.empty p { color: var(--ink-2); margin: 0 0 18px; }

/* ---------- List page ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.list-head h1 { font-size: 1.5rem; letter-spacing: -.01em; }
.view-tabs { display: inline-flex; padding: 3px; border-radius: var(--r-sm); background: var(--line-2); border: 1px solid var(--line); }
.view-tabs a { padding: 6px 14px; border-radius: 5px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .88rem; }
.view-tabs a[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(10,12,24,.12); }
.notice { background: var(--accent-soft); color: #3A2FA0; border-radius: var(--r); padding: 12px 16px; margin-bottom: 18px; font-size: .92rem; }

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--line-2); border-radius: var(--r); border-top: 3px solid var(--c); min-height: 320px; display: flex; flex-direction: column; }
.col header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; }
.col-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; }
.col-name::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.col-count { font-size: .8rem; color: var(--ink-3); font-weight: 600; }
.col-body { padding: 4px 10px 12px; flex: 1; }
.col-empty { color: var(--ink-3); font-size: .85rem; margin: 6px 4px; }

/* ---------- Dialog ---------- */
.dlg { border: 0; border-radius: var(--r-lg); padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 24px 60px -12px rgba(10,12,24,.4); }
.dlg::backdrop { background: rgba(15,17,28,.5); }
.dlg form { padding: 24px; display: grid; gap: 16px; }
.dlg h2 { font-size: 1.2rem; }
.dlg-help { color: var(--ink-2); margin: -8px 0 0; font-size: .9rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.colors legend { width: 100%; margin-bottom: 6px; }
.colors label { cursor: pointer; position: relative; }
.colors input { position: absolute; opacity: 0; }
.colors label > span:first-of-type { display: block; width: 28px; height: 28px; border-radius: 7px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.4); }
.colors input:checked + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.colors input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 24px; gap: 20px; }
  .auth-board { display: none; }
  .auth-pitch { font-size: 1.35rem; }

  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(var(--side-w), 84vw); z-index: 50; transform: translateX(-100%); transition: transform .25s ease; }
  .side.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(15,17,28,.45); }
  .menu-btn { display: inline-grid; }
  .top { padding: 0 14px; }
  .content { padding: 20px 14px 48px; }
  .space .add-list { opacity: 1; }
}
@media (max-width: 600px) {
  .task-rows li { grid-template-columns: 12px 1fr auto; row-gap: 4px; }
  .task-rows .task-list { grid-column: 2; grid-row: 2; }
  .task-rows .prio { grid-column: 3; grid-row: 2; justify-self: end; }
  .task-rows .due { grid-column: 3; grid-row: 1; }
  .board { grid-auto-columns: 82%; scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* =========================================================
   Step 2 — tasks, cards, detail panel, trash
   ========================================================= */
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: .85rem; }
.btn-danger-ghost { background: transparent; border: 1px solid #F2C6C1; color: var(--bad); }
.btn-danger-ghost:hover { background: var(--bad-soft); }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink-3); font-size: .8rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--bad); }
.small { font-size: .8rem; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--ink-2); white-space: nowrap; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.list-tools { display: flex; align-items: center; gap: 10px; }
.quick-add { display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; margin-bottom: 18px; }
.quick-add input[name="title"] { flex: 1; min-width: 0; border: 0; padding: 8px 10px; font-size: .95rem; background: transparent; }
.quick-add input[name="title"]:focus { outline: none; }
.quick-add:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.quick-add select, .select-sm { min-height: 34px; padding: 4px 28px 4px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-size: .88rem; }

/* cards */
.col { position: relative; }
.add-task, .inline-add, .tag-add, .quick-add { position: relative; }
.col-body { display: grid; align-content: start; gap: 8px; }
.card { display: grid; gap: 8px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); text-decoration: none; color: var(--ink); box-shadow: 0 1px 1px rgba(23,26,35,.04); }
.card:hover { border-color: #C9CDD8; }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.card-title { font-weight: 500; font-size: .92rem; line-height: 1.35; overflow-wrap: anywhere; }
.card.is-done .card-title { color: var(--ink-3); text-decoration: line-through; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .78rem; }
.card-meta .due { min-width: 0; text-align: left; font-size: .78rem; }
.meta-pill { color: var(--ink-2); background: var(--line-2); padding: 1px 7px; border-radius: 99px; }
.avatars { display: inline-flex; margin-left: auto; }
.avatar-xs { width: 22px; height: 22px; font-size: .6rem; border: 2px solid var(--surface); margin-left: -6px; }
.avatars .avatar-xs:first-child { margin-left: 0; }
.avatar-more { background: var(--ink-3); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 99px;
  background: color-mix(in srgb, var(--c) 13%, var(--surface)); color: color-mix(in srgb, var(--c) 78%, var(--ink)); }

.add-task input { width: 100%; min-height: 36px; padding: 6px 10px; border: 1px dashed transparent; border-radius: var(--r-sm); background: transparent; font-size: .88rem; color: var(--ink-2); }
.add-task input:hover { background: rgba(255,255,255,.6); }
.add-task input:focus { outline: none; background: var(--surface); border: 1px solid var(--accent); color: var(--ink); }

.list-view .rows { display: grid; gap: 6px; margin-bottom: 6px; }
.list-view .card { grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; }
.list-view .card-tags { grid-column: 1; }
.list-view .card-meta { grid-column: 2; grid-row: 1 / span 2; justify-content: flex-end; }

/* drawer */
.drawer-scrim { position: fixed; inset: 0; background: rgba(15,17,28,.35); z-index: 60; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); overflow: hidden; background: var(--surface); z-index: 61; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(15,17,28,.18); animation: drawer-in .2s ease-out; }
@keyframes drawer-in { from { transform: translateX(32px); } to { transform: none; } }
.drawer-top { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.status-form { min-width: 0; }
.status-form select { max-width: 100%; min-height: 34px; padding: 4px 30px 4px 12px; border-radius: 99px; font-weight: 600; font-size: .85rem; border: 1px solid transparent;
  background-color: color-mix(in srgb, var(--c) 15%, var(--surface)); color: color-mix(in srgb, var(--c) 75%, var(--ink)); }
.parent-link { font-size: .85rem; color: var(--ink-2); text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parent-link:hover { color: var(--accent); }
.drawer-close { margin-left: auto; color: var(--ink-2); }
.drawer-body { min-width: 0; flex: 1; overflow-y: auto; padding: 18px 22px 28px; }
.drawer-foot { padding: 12px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }

.title-form textarea { width: calc(100% + 16px); border: 1px solid transparent; border-radius: var(--r-sm); padding: 6px 8px; margin: 0 -8px 14px; font: 600 1.35rem/1.3 var(--font); resize: none; field-sizing: content; background: transparent; color: var(--ink); }
.title-form textarea:hover:not(:disabled) { border-color: var(--line); }
.title-form textarea:focus { outline: none; border-color: var(--accent); }

.props { display: grid; grid-template-columns: 96px 1fr; gap: 10px 14px; margin: 0 0 22px; align-items: center; }
.props dt { font-size: .82rem; color: var(--ink-2); font-weight: 500; }
.props dd { margin: 0; min-width: 0; }
.props form { margin: 0; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 3px; border: 1px solid var(--line); border-radius: 99px; font-size: .84rem; }
.chip .avatar-xs { margin: 0; border: 0; }
.chip button, .tag-chip button { border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 1rem; line-height: 1; padding: 0 4px; }
.chip button:hover, .tag-chip button:hover { color: var(--bad); }
.tag-chip { padding: 2px 4px 2px 9px; font-size: .78rem; margin: 0; }
.tag-chip button { color: inherit; opacity: .6; }
.tag-add input { width: 110px; min-height: 30px; padding: 3px 9px; border: 1px dashed var(--line); border-radius: 99px; font-size: .8rem; }
.tag-add input:focus { outline: none; border-style: solid; border-color: var(--accent); }
.dates { display: flex; flex-wrap: wrap; gap: 8px; }
.dates label { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--ink-3); }
.dates input { min-height: 32px; padding: 3px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: .85rem; }

.d-section { border-top: 1px solid var(--line-2); padding-top: 16px; margin-top: 18px; }
.d-section h3 { font-size: .92rem; margin-bottom: 10px; display: flex; gap: 8px; align-items: baseline; }
.desc-form textarea { width: 100%; min-height: 110px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); resize: vertical; line-height: 1.55; }
.desc-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.desc-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.progress { height: 4px; border-radius: 99px; background: var(--line-2); margin: -2px 0 10px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ok); border-radius: inherit; }

.sublist, .items { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 2px; }
.sublist li, .items li { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: var(--r-sm); }
.sublist li:hover, .items li:hover { background: var(--line-2); }
.sublist form, .items form { margin: 0; display: contents; }
.sublist a { flex: 1; min-width: 0; color: var(--ink); text-decoration: none; font-size: .9rem; }
.sublist a:hover { color: var(--accent); }
.items span { flex: 1; font-size: .9rem; overflow-wrap: anywhere; }
.is-done > a, .is-done > span { color: var(--ink-3); text-decoration: line-through; }
.tick { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1.5px solid var(--ink-3); background: var(--surface); cursor: pointer; padding: 0; display: grid; place-items: center; }
.tick-sq { border-radius: 4px; }
.tick[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); }
.tick[aria-pressed="true"]::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.tick:disabled { cursor: default; }
.x-btn { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 1.05rem; opacity: 0; padding: 0 4px; }
.items li:hover .x-btn, .x-btn:focus-visible { opacity: 1; }
.x-btn:hover { color: var(--bad); }
.inline-add input { width: 100%; min-height: 34px; padding: 5px 8px; border: 1px solid transparent; border-radius: var(--r-sm); font-size: .88rem; color: var(--ink-2); background: transparent; }
.inline-add input:hover { background: var(--line-2); }
.inline-add input:focus { outline: none; background: var(--surface); border-color: var(--accent); color: var(--ink); }
.checklist { margin-bottom: 14px; }
.checklist-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; font-size: .9rem; }
.checklist-head form { margin-left: auto; }

.activity { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; font-size: .84rem; color: var(--ink-2); }
.activity li { padding-left: 14px; position: relative; }
.activity li::before { content: ""; position: absolute; left: 0; top: .55em; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.activity strong { color: var(--ink); font-weight: 600; }
.activity em { font-style: normal; color: var(--ink); }
.activity time { color: var(--ink-3); margin-left: 4px; white-space: nowrap; }

/* trash */
.trash-list { list-style: none; margin: 0; padding: 0; }
.trash-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 4px; border-top: 1px solid var(--line-2); }
.trash-list li:first-child { border-top: 0; }
.trash-list .t-title { flex: 1; min-width: 200px; font-weight: 500; }
.trash-list .t-title small { display: block; font-weight: 400; color: var(--ink-3); }
.trash-list form { margin: 0; }

@media (max-width: 600px) {
  .quick-add { flex-wrap: wrap; }
  .quick-add input[name="title"] { flex: 1 1 100%; }
  .quick-add .btn { margin-left: auto; }
  .drawer-body { padding: 14px 16px 24px; }
  .props { grid-template-columns: 1fr; gap: 4px; }
  .props dd { margin-bottom: 10px; }
  .list-view .card { grid-template-columns: 1fr; }
  .list-view .card-meta { grid-column: 1; grid-row: auto; justify-content: flex-start; }
  .x-btn { opacity: 1; }
}

/* =========================================================
   Step 3 — space settings, folders
   ========================================================= */
.settings { display: grid; gap: 20px; max-width: 900px; }
.panel, .s-row, .inline-form { position: relative; }
.settings .panel-head { margin-bottom: 14px; }
.space-form { display: grid; gap: 16px; max-width: 480px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.danger-zone strong { display: block; margin-bottom: 2px; }
.danger-zone form { margin: 0; }

.s-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.s-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 8px; border-radius: var(--r-sm); }
.s-row:hover { background: var(--line-2); }
.s-row form { margin: 0; }
.s-name { flex: 1; min-width: 160px; }
.s-name input { width: 100%; min-height: 34px; padding: 4px 8px; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; font-weight: 500; }
.s-name input:hover { border-color: var(--line); background: var(--surface); }
.s-name input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.s-open { font-size: .82rem; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.s-open:hover { color: var(--accent); }
.updown { display: inline-flex; gap: 0; }
.updown .icon-btn { width: 26px; height: 26px; font-size: .9rem; color: var(--ink-2); }
.updown .icon-btn:disabled { opacity: .25; cursor: default; }
.s-folder { border: 1px solid var(--line); border-radius: var(--r); padding: 6px; margin-bottom: 12px; }
.s-folder-head { color: var(--ink-2); }
.s-folder .s-list { padding-left: 26px; }
.s-empty { color: var(--ink-3); font-size: .85rem; padding: 6px 8px; }
.s-add { display: grid; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input[name="name"] { flex: 1; min-width: 180px; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.inline-form input[name="name"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.s-help { margin: -6px 0 12px; }
.s-status-form { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 260px; flex-wrap: wrap; }
.s-status-form input[name="name"] { flex: 1; min-width: 140px; min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.swatch { width: 34px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.s-count { min-width: 56px; }
.s-delete { display: inline-flex; gap: 6px; align-items: center; }

/* sidebar folders */
.space .folder details > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer; color: var(--side-ink); font-size: .9rem; }
.space .folder details > summary::-webkit-details-marker { display: none; }
.space .folder details > summary:hover { background: var(--side-2); }
.space .folder ul { padding-left: 14px; margin: 0; border-left: 1px solid var(--side-2); }
.tree-note { color: var(--side-mute); font-size: .8rem; padding: 4px 10px; }
.space-settings-link { color: var(--side-mute) !important; font-size: .82rem; }
.trash-block { margin-bottom: 20px; }
.trash-list .status-dot { vertical-align: 1px; }

@media (max-width: 600px) {
  .s-row { padding: 8px 4px; }
  .s-status-form { min-width: 100%; }
  .list-tools { flex-wrap: wrap; justify-content: flex-end; }
}
.space li a.space-settings-link[aria-current="page"] { color: #fff !important; }
.settings .panel-head { flex-wrap: wrap; gap: 4px 12px; }

/* =========================================================
   Step 4 — drag and drop, filters, search
   ========================================================= */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -6px 0 16px; }
.filters input[type="search"] { min-height: 34px; width: 220px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-size: .88rem; }
.filters input[type="search"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filters select { min-height: 34px; padding: 4px 26px 4px 10px; border: 1px solid var(--line); border-radius: 99px; background-color: var(--surface); font-size: .84rem; color: var(--ink-2); }
.filters select.is-set { border-color: var(--accent); color: var(--accent); background-color: var(--accent-soft); font-weight: 600; }
.f-count { font-size: .84rem; color: var(--ink-2); margin-left: 4px; }
.drag-note { margin: -8px 0 14px; }

.col-cards { display: grid; align-content: start; gap: 8px; min-height: 12px; }
.board .col-cards.is-empty { min-height: 56px; border: 1px dashed transparent; border-radius: var(--r-sm); }
.list-view .col-cards { min-height: 8px; }
.list-view .col-cards.is-empty::after { content: attr(data-empty); color: var(--ink-3); font-size: .85rem; padding: 4px; }
[data-sortable] .card { cursor: grab; touch-action: manipulation; }
[data-sortable] .card:active { cursor: grabbing; }
.card-ghost { opacity: .35; background: var(--accent-soft); border-style: dashed; border-color: var(--accent); }
.card-chosen { box-shadow: 0 10px 24px -8px rgba(23,26,35,.35); }
.card.is-saving { opacity: .6; }
.sortable-drag { transform: rotate(1.5deg); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 99px; font-size: .88rem; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast-bad { background: var(--bad); }

.top-search { position: relative; display: flex; align-items: center; margin-right: 8px; }
.top-search svg { position: absolute; left: 10px; color: var(--ink-3); pointer-events: none; }
.top-search input { width: 240px; min-height: 34px; padding: 4px 30px 4px 32px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-size: .88rem; }
.top-search input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.top-search kbd { position: absolute; right: 8px; font: 600 .72rem var(--font); color: var(--ink-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; background: var(--surface); }
.top-search input:focus + kbd { display: none; }
.search-big { display: flex; gap: 8px; margin-top: 14px; max-width: 640px; }
.search-big input { flex: 1; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 1rem; }
.search-big input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-rows .task-title small { font-weight: 400; }
.search-rows li.is-done .task-title { color: var(--ink-3); text-decoration: line-through; }
mark { background: #FFF1B8; color: inherit; border-radius: 2px; padding: 0 1px; }

@media (max-width: 900px) {
  .top-search input { width: 160px; }
  .top-search kbd { display: none; }
}
@media (max-width: 600px) {
  .top-search { margin-right: 0; }
  .top-search input { width: 38px; padding-right: 6px; color: transparent; }
  .top-search input::placeholder { color: transparent; }
  .top-search input:focus { width: 52vw; color: var(--ink); position: relative; z-index: 2; }
  .filters input[type="search"] { width: 100%; }
  .filters select { flex: 1 1 calc(50% - 8px); }
}

/* =========================================================
   Step 5 — comments, mentions, files
   ========================================================= */
.meta-icon { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-3); }

.files { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.file { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.file form { margin: 0; }
.file-thumb { width: 44px; height: 44px; flex: none; border-radius: 6px; overflow: hidden; background: var(--line-2); display: grid; place-items: center; text-decoration: none; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-ext { font-size: .62rem; font-weight: 700; color: var(--ink-2); letter-spacing: .02em; }
.file-info { flex: 1; min-width: 0; display: grid; }
.file-name { color: var(--ink); text-decoration: none; font-size: .88rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name:hover { color: var(--accent); }
.x-show { opacity: 1; }
.dropzone { position: relative; display: block; border: 1.5px dashed var(--line); border-radius: var(--r-sm); padding: 12px 14px; color: var(--ink-2); font-size: .84rem; cursor: pointer; background: var(--surface); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone strong { color: var(--accent); }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.timeline { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.tl-activity { font-size: .8rem; color: var(--ink-3); padding-left: 40px; position: relative; }
.tl-activity::before { content: ""; position: absolute; left: 13px; top: .55em; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.tl-activity strong, .tl-activity em { color: var(--ink-2); font-style: normal; font-weight: 600; }
.tl-activity time { margin-left: 4px; }
.tl-comment { display: flex; gap: 10px; align-items: flex-start; scroll-margin-top: 80px; }
.tl-comment:target .bubble { box-shadow: 0 0 0 2px var(--accent-soft); border-color: var(--accent); }
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; flex: none; }
.bubble { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 9px 12px; }
.bubble-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; font-size: .84rem; margin-bottom: 3px; }
.bubble-head time { color: var(--ink-3); font-size: .78rem; }
.bubble-actions { margin-left: auto; display: inline-flex; gap: 10px; }
.bubble-actions form { margin: 0; }
.bubble-body { font-size: .92rem; line-height: 1.55; overflow-wrap: anywhere; }
.bubble-body a { word-break: break-all; }
.mention { color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.edit-comment textarea, .composer textarea { width: 100%; min-height: 70px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); resize: vertical; line-height: 1.5; font-size: .92rem; }
.edit-comment textarea:focus, .composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; display: grid; gap: 8px; }
.composer textarea { background: var(--surface); }
.composer-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.composer.is-busy, .upload.is-busy { opacity: .6; pointer-events: none; }
.attach-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; margin-right: auto; padding: 5px 10px; border-radius: var(--r-sm); color: var(--ink-2); font-size: .84rem; cursor: pointer; max-width: 55%; }
.attach-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-btn:hover { background: var(--line-2); color: var(--ink); }
.attach-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.attach-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.c-files { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.c-img img { display: block; max-width: 220px; max-height: 160px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.c-file { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: .84rem; color: var(--ink); text-decoration: none; max-width: 100%; }
.c-file .file-ext { background: var(--line-2); padding: 3px 5px; border-radius: 4px; }
.c-file:hover { border-color: var(--accent); }
.mention-wrap { position: relative; }
.mention-menu { position: absolute; left: 8px; bottom: calc(100% + 4px); z-index: 5; list-style: none; margin: 0; padding: 4px; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: 0 10px 30px -10px rgba(23,26,35,.3); }
.mention-menu li { padding: 6px 10px; border-radius: 5px; cursor: pointer; font-size: .88rem; }
.mention-menu li.is-active, .mention-menu li:hover { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 600px) {
  .kbd-hint { display: none; }
  .c-img img { max-width: 100%; }
}

/* =========================================================
   Step 6 — notifications, members, invites
   ========================================================= */
.nav-count { margin-left: auto; font-style: normal; font-size: .72rem; font-weight: 700; background: var(--accent); color: #fff; padding: 1px 7px; border-radius: 99px; }
.bell { position: relative; }
.bell summary { list-style: none; cursor: pointer; position: relative; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); }
.bell summary::-webkit-details-marker { display: none; }
.bell summary:hover, .bell[open] summary { background: var(--line-2); color: var(--ink); }
.bell-badge { position: absolute; top: 2px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: .66rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.bell-pop { position: absolute; right: -40px; top: calc(100% + 8px); width: min(380px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 18px 40px -12px rgba(23,26,35,.3); z-index: 40; overflow: hidden; }
.bell-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.bell-head form { margin: 0; }
.bell-empty { margin: 0; padding: 22px 16px; color: var(--ink-2); font-size: .88rem; text-align: center; }
.bell-all { display: block; text-align: center; padding: 10px; font-size: .86rem; font-weight: 600; text-decoration: none; border-top: 1px solid var(--line-2); }
.bell-all:hover { background: var(--line-2); }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li + li { border-top: 1px solid var(--line-2); }
.notif-list a { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: baseline; padding: 12px 8px; color: var(--ink-2); text-decoration: none; font-size: .9rem; border-radius: var(--r-sm); }
.notif-list a:hover { background: var(--line-2); }
.notif-mini { max-height: 360px; overflow-y: auto; }
.notif-mini a { padding: 10px 14px; border-radius: 0; font-size: .86rem; }
.notif-list .is-unread a { color: var(--ink); background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.notif-list .is-unread a:hover { background: var(--accent-soft); }
.notif-list strong { color: var(--ink); }
.notif-list em { font-style: normal; color: var(--ink); font-weight: 500; }
.notif-list time { color: var(--ink-3); font-size: .78rem; white-space: nowrap; }
.n-icon { width: 8px; height: 8px; border-radius: 50%; background: var(--line); align-self: center; }
.is-unread .n-icon { background: var(--accent); }
.is-unread .n-overdue, .is-unread .n-due_today { background: var(--bad); }
.n-tools { display: inline-flex; gap: 12px; align-items: center; }
.n-tools form { margin: 0; }

.people { list-style: none; margin: 0; padding: 0; }
.person-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.person-row:first-child { border-top: 0; }
.person-row form { margin: 0; }
.p-main { flex: 1; min-width: 180px; display: grid; }
.p-main small { overflow-wrap: anywhere; }
.avatar-pending { background: var(--line-2); color: var(--ink-2); }
.role-badge { font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); }
.role-owner { background: #FDF1E1; color: #A55A00; }
.role-admin { background: var(--accent-soft); color: var(--accent); }
.late { color: var(--bad); font-weight: 600; }
.invite-form input[type="email"] { flex: 1; min-width: 220px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.invite-form input[type="email"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.invite-form .select-sm { min-height: 40px; }
.role-help { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; font-size: .84rem; color: var(--ink-2); }
.role-help strong { color: var(--ink); }
.invite-link { margin-top: 16px; padding: 14px; border-radius: var(--r); background: var(--ok-soft); border: 1px solid #BFE5CF; }
.invite-link p { margin: 0 0 10px; font-size: .88rem; color: #13643A; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; min-height: 36px; padding: 6px 10px; border: 1px solid #BFE5CF; border-radius: var(--r-sm); background: var(--surface); font-size: .84rem; }

@media (max-width: 600px) {
  .bell-pop { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; }
  .notif-list a { grid-template-columns: 8px 1fr; }
  .notif-list time { grid-column: 2; }
  .copy-row { flex-wrap: wrap; }
}

/* =========================================================
   Step 7 — profile photos, password reset
   ========================================================= */
.avatar-img { object-fit: cover; padding: 0; background: var(--line-2); }
.avatar-xs.avatar-img { border: 2px solid var(--surface); }
.avatar-xl { width: 96px; height: 96px; font-size: 2rem; }
.photo-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.photo-actions { display: grid; gap: 10px; justify-items: start; max-width: 420px; }
.photo-actions form { margin: 0; display: inline-block; }
.photo-actions > form + form { margin-left: 8px; }
.photo-actions .photo-form, .photo-actions form + form { display: inline-flex; }
.btn-file { position: relative; overflow: hidden; cursor: pointer; }
.btn-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.btn-file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-file.is-busy { opacity: .6; pointer-events: none; }
.user-pop-link { display: block; margin-top: 10px; padding: 6px 0; font-weight: 600; text-decoration: none; }
.label-row { display: flex !important; justify-content: space-between; align-items: baseline; }
.label-row a { font-weight: 500; font-size: .82rem; }

/* mention chip with photo / initials */
.mention { display: inline-flex; align-items: center; gap: 3px; padding: 0 5px 0 2px; vertical-align: baseline; }
.avatar-mention { width: 16px; height: 16px; font-size: .5rem; margin: 0; border: 0; display: inline-grid; vertical-align: -3px; }
.mention-menu li { display: flex; align-items: center; gap: 8px; }
.mention-menu .avatar-xs { margin: 0; border: 0; }
.chip .avatar-img { border: 0; }

/* =========================================================
   Step 8 — calendar
   ========================================================= */
.cal-wrap { display: grid; gap: 16px; }
.cal-wrap.has-side { grid-template-columns: minmax(0, 1fr) 240px; align-items: start; }
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cal-head h2 { font-size: 1.1rem; }
.cal-nav { display: inline-flex; gap: 4px; }
.cal-nav .btn { min-width: 36px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd { padding: 8px 10px; font-size: .76rem; font-weight: 600; color: var(--ink-3); border-bottom: 1px solid var(--line); background: var(--bg); }
.cal-day { min-height: 118px; padding: 6px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.is-weekend { background: #FAFBFC; }
.cal-day.is-other { background: var(--bg); }
.cal-day.is-other .cal-dnum { color: var(--ink-3); }
.cal-dhead { display: flex; align-items: center; justify-content: space-between; }
.cal-dnum { font-size: .8rem; font-weight: 600; color: var(--ink-2); padding: 2px 6px; border-radius: 99px; }
.cal-day.is-today .cal-dnum { background: var(--accent); color: #fff; }
.cal-add { opacity: 0; border: 0; background: none; color: var(--ink-3); width: 22px; height: 22px; border-radius: 6px; cursor: pointer; font-size: 1rem; line-height: 1; }
.cal-day:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-add:hover { background: var(--accent-soft); color: var(--accent); }
.cal-items { display: grid; gap: 3px; align-content: start; min-height: 20px; }
.cal-day.is-over, [data-unscheduled] .cal-items.is-over { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -3px; }
.cal-task { display: flex; align-items: center; gap: 5px; padding: 3px 6px; border-radius: 5px; background: var(--line-2); color: var(--ink); text-decoration: none; font-size: .78rem; line-height: 1.3; min-width: 0; }
.cal-task:hover { background: var(--accent-soft); }
.cal-task i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.cal-task span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.cal-task small { color: var(--ink-3); font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.cal-task.is-done span { text-decoration: line-through; color: var(--ink-3); }
.cal-task.is-late { background: var(--bad-soft); }
.cal-task.is-late span { color: #8E2119; }
.cal-task.is-dragging { opacity: .4; }
.cal-task.is-saving { opacity: .6; }
.cal [data-drag] .cal-task, .cal[data-drag] .cal-task, .cal-wrap [data-unscheduled] .cal-task { cursor: grab; }
.prio-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.prio-dot.p1 { background: var(--bad); }
.prio-dot.p2 { background: #D97706; }
.cal-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; position: sticky; top: 72px; max-height: calc(100vh - 96px); overflow-y: auto; }
.cal-side h3 { font-size: .92rem; margin-bottom: 4px; }
.cal-side .cal-items { gap: 5px; padding: 4px; border-radius: var(--r-sm); min-height: 60px; }
.cal-side .cal-task { padding: 6px 8px; font-size: .82rem; background: var(--bg); border: 1px solid var(--line); }
.cal-agenda { display: none; list-style: none; margin: 0; padding: 0; }
.cal-agenda li { padding: 10px 14px; border-top: 1px solid var(--line-2); display: grid; gap: 5px; }
.cal-agenda li:first-child { border-top: 0; }
.cal-agenda h3 { font-size: .84rem; color: var(--ink-2); }
.cal-agenda li.is-today h3 { color: var(--accent); }
.cal-agenda .cal-task { padding: 8px 10px; font-size: .9rem; }
.cal-none { color: var(--ink-3); font-size: .9rem; padding: 24px 14px !important; text-align: center; }
.due-pill { border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 4px 10px; font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap; }

@media (max-width: 1100px) {
  .cal-wrap.has-side { grid-template-columns: 1fr; }
  .cal-side { position: static; max-height: none; }
  .cal-side .cal-items { display: flex; flex-wrap: wrap; }
}
@media (max-width: 700px) {
  .cal-grid { display: none; }
  .cal-agenda { display: block; }
  .cal-head { flex-wrap: wrap; }
}

/* =========================================================
   Step 9 — time tracking
   ========================================================= */
.rec { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-right: 6px; animation: rec 1.4s ease-in-out infinite; vertical-align: 1px; }
@keyframes rec { 50% { opacity: .35; } }
.btn-stop { background: var(--bad-soft); color: var(--bad); border-color: #F2C6C1; }
.btn-stop:hover { background: #F9DAD6; }
.top-timer { display: flex; align-items: center; gap: 8px; padding: 3px 4px 3px 12px; border: 1px solid #F2C6C1; background: var(--bad-soft); border-radius: 99px; margin-right: 6px; max-width: 360px; }
.top-timer a { color: var(--ink); text-decoration: none; font-size: .84rem; font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-timer a:hover { color: var(--bad); }
.top-timer time { font: 600 .86rem/1 var(--font); font-variant-numeric: tabular-nums; color: var(--bad); }
.top-timer form { margin: 0; }
.top-timer .rec { margin: 0; }
.top-timer .btn-stop { min-height: 28px; padding: 3px 12px; background: var(--surface); border-radius: 99px; }

.time-prop { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.time-prop form { margin: 0; }
.time-prop strong { font-variant-numeric: tabular-nums; min-width: 52px; }
.time-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.time-add input { min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: .86rem; }
.time-add input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.time-add input[name="duration"] { width: 92px; }
.time-note { flex: 1; min-width: 160px; }
.time-note input { width: 100%; }
.time-hint { margin: 6px 0 10px; }
.time-hint code { background: var(--line-2); padding: 0 4px; border-radius: 4px; font-size: .78rem; }
.time-list { list-style: none; margin: 0; padding: 0; }
.time-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 4px; border-top: 1px solid var(--line-2); font-size: .88rem; }
.time-list li:first-child { border-top: 0; }
.time-list li.is-running { background: var(--bad-soft); border-radius: var(--r-sm); }
.time-list .avatar-xs { margin: 0; }
.time-list form { margin: 0 0 0 auto; }
.t-dur { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 62px; }
.t-task { color: var(--ink); text-decoration: none; font-weight: 500; }
.t-task:hover { color: var(--accent); }
.t-note { flex-basis: 100%; padding-left: 30px; color: var(--ink-2); font-size: .84rem; }
.meta-icon.is-running { color: var(--bad); font-weight: 600; }
.meta-icon .rec { margin-right: 2px; width: 6px; height: 6px; }

.ts-wrap { overflow-x: auto; padding: 0; }
.ts { width: 100%; border-collapse: collapse; min-width: 760px; font-size: .88rem; }
.ts th, .ts td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); text-align: right; font-variant-numeric: tabular-nums; }
.ts thead th { font-size: .78rem; font-weight: 600; color: var(--ink-2); background: var(--bg); }
.ts thead th small { display: block; font-weight: 400; color: var(--ink-3); }
.ts thead th.is-today { color: var(--accent); }
.ts .ts-task { text-align: left; min-width: 220px; }
.ts tbody .ts-task a { color: var(--ink); text-decoration: none; font-weight: 500; }
.ts tbody .ts-task a:hover { color: var(--accent); }
.ts .ts-task small { display: flex; align-items: center; gap: 5px; font-weight: 400; color: var(--ink-3); font-size: .76rem; }
.ts .ts-task small i { width: 7px; height: 7px; border-radius: 2px; }
.ts .is-zero { color: var(--ink-3); }
.ts .ts-total { font-weight: 700; background: var(--bg); }
.ts tfoot th, .ts tfoot td { font-weight: 700; border-bottom: 0; background: var(--bg); }

@media (max-width: 900px) { .top-timer a { display: none; } }
@media (max-width: 600px) { .top-timer { padding-left: 8px; margin-right: 2px; } .top-timer time { font-size: .8rem; } }

/* =========================================================
   Step 10 — live updates
   ========================================================= */
.live-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 14px; margin-bottom: 14px; border-radius: var(--r-sm); background: var(--accent-soft); border: 1px solid #D5D0F6; color: var(--ink); font-size: .88rem; }
.live-bar a { font-weight: 700; white-space: nowrap; }
.drawer-body > .live-bar { margin: -4px 0 14px; }
.card.is-live { animation: live-flash 1.6s ease-out; }
@keyframes live-flash { 0% { box-shadow: 0 0 0 3px var(--accent); background: var(--accent-soft); } 100% { box-shadow: 0 1px 1px rgba(23,26,35,.04); } }
#live-pops { position: fixed; right: 18px; bottom: 18px; z-index: 95; display: grid; gap: 8px; width: min(340px, calc(100vw - 36px)); }
.live-pop { display: block; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--r); box-shadow: 0 16px 36px -12px rgba(23,26,35,.35); color: var(--ink-2); text-decoration: none; font-size: .88rem; opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s; }
.live-pop.is-on { opacity: 1; transform: none; }
.live-pop strong, .live-pop em { color: var(--ink); font-style: normal; }
.live-pop:hover { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .card.is-live { animation: none; } .live-pop { transition: none; } }

/* =========================================================
   Step 11 — reports, repeat, email settings
   ========================================================= */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 4px; }
.kpi span { font-size: .8rem; color: var(--ink-2); }
.kpi strong { font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-bad strong { color: var(--bad); }
.kpi-good strong { color: var(--ok); }
.report-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--ink-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.lg-created, .bar-created { background: #C9C3F2; }
.lg-done, .bar-done { background: var(--accent); }
.bars { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; height: 220px; align-items: end; padding-top: 10px; }
.bar-col { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; text-align: center; }
.bar-col small { font-size: .7rem; color: var(--ink-3); white-space: nowrap; }
.bar-pair { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; }
.bar { position: relative; width: 40%; max-width: 22px; min-height: 2px; border-radius: 4px 4px 1px 1px; }
.bar em { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: .68rem; color: var(--ink-2); font-weight: 600; }
.mix { margin-bottom: 16px; }
.mix-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.mix-head i, .mix-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.mix-stack { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--line-2); gap: 2px; }
.stack-empty { flex: 1; }
.mix-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: .78rem; color: var(--ink-2); }
.mix-legend b { color: var(--ink); }
.workload td, .workload th { text-align: right; }
.workload .ts-task { text-align: left; }
.wl-person { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.wl-person .avatar-xs { margin: 0; border: 0; }
.wl-bar-h { width: 30%; }
.wl-bar { text-align: left !important; }
.wl-bar span { display: block; height: 8px; border-radius: 99px; background: var(--accent); min-width: 2px; }
.repeat-form { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.drawer-foot { gap: 8px; flex-wrap: wrap; }
.drawer-foot form { margin: 0; }
.drawer-foot form:last-child { margin-left: auto; }
.move-form .select-sm { max-width: 200px; }
.email-prefs { display: grid; gap: 10px; }
.email-prefs .check { white-space: normal; }
.mail-status { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; }
.mail-status p { margin: 0; line-height: 1.7; }
.mail-status form { margin: 0; }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .report-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bars { gap: 4px; height: 180px; } .bar-col small { font-size: .6rem; } .drawer-foot form:last-child { margin-left: 0; } }

.overdue-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 10px 4px; }
.overdue-list .task-title { flex: 1 1 240px; min-width: 0; white-space: normal; }
.overdue-list .due { margin-left: auto; white-space: nowrap; }

/* =========================================================
   Step 12 — bulk edit, estimates, dependencies, watchers,
   reactions, saved views, templates
   ========================================================= */
.card { position: relative; }
.card-check { display: none; position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; border: 2px solid var(--line); border-radius: 5px; background: var(--surface); }
.is-selecting .card { cursor: pointer; user-select: none; }
.is-selecting .card-check { display: block; }
.is-selecting .card .card-title { padding-right: 24px; }
.card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }
.card.is-selected .card-check { background: var(--accent); border-color: var(--accent); }
.card.is-selected .card-check::after { content: ""; position: absolute; left: 4px; top: 0; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
[data-bulk-toggle][aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.bulk-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 70; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 44px -14px rgba(23,26,35,.45); width: max-content; max-width: calc(100vw - 24px); }
.bulk-bar:not(.has-some) select, .bulk-bar:not(.has-some) input, .bulk-bar:not(.has-some) .btn { opacity: .5; }
.bulk-count { font-size: .88rem; margin-right: 4px; white-space: nowrap; }
.bulk-bar input[type="date"] { min-height: 32px; padding: 3px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }

.watch-form { margin: 0 0 0 auto; }
.watch-form .btn { display: inline-flex; align-items: center; gap: 6px; }
.watch-form .btn.is-on { background: var(--accent-soft); color: var(--accent); border-color: #D5D0F6; }
.drawer-top .watch-form + .drawer-close { margin-left: 4px; }
.est-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.est-form input { width: 96px; min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.est-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.est-bar { width: 90px; height: 7px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.est-bar i { display: block; height: 100%; background: var(--ok); }
.est-bar.is-over i { background: var(--bad); }
.blocked-note { margin: 0 0 16px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--bad-soft); color: var(--bad); font-size: .88rem; font-weight: 500; }
.pill-blocked { background: var(--bad-soft) !important; color: var(--bad) !important; font-weight: 600; }
.dep-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; }
.dep-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: .88rem; }
.dep-list li a { color: var(--ink); text-decoration: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-list li a:hover { color: var(--accent); }
.dep-list li.is-done a { text-decoration: line-through; color: var(--ink-3); }
.dep-list form { margin: 0; }
.dep-add .select-sm { max-width: 100%; }
.dep-sub { margin: 12px 0 4px; }

.reactions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.reactions form { margin: 0; }
.react { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg); font-size: .85rem; cursor: pointer; line-height: 1.6; }
.react b { font-size: .76rem; color: var(--ink-2); }
.react.is-mine { border-color: var(--accent); background: var(--accent-soft); }
.react.is-mine b { color: var(--accent); }
.react-pick { position: relative; }
.react-pick summary { list-style: none; cursor: pointer; font-size: .78rem; color: var(--ink-3); padding: 2px 8px; border-radius: 99px; border: 1px dashed var(--line); }
.react-pick summary::-webkit-details-marker { display: none; }
.react-pick summary:hover { color: var(--accent); border-color: var(--accent); }
.react-pick > div { position: absolute; left: 0; bottom: calc(100% + 6px); display: flex; gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; box-shadow: 0 10px 24px -10px rgba(23,26,35,.35); z-index: 6; }
.react-pick > div form { margin: 0; }
.react-pick > div button { border: 0; background: none; font-size: 1.1rem; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; }
.react-pick > div button:hover { background: var(--line-2); transform: scale(1.15); }

.saved-views { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -6px 0 14px; }
.sv { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: .84rem; }
.sv a { padding: 4px 4px 4px 12px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.sv.is-on { border-color: var(--accent); background: var(--accent-soft); }
.sv.is-on a { color: var(--accent); }
.sv form { margin: 0; }
.sv button { border: 0; background: none; color: var(--ink-3); padding: 2px 10px 2px 6px; cursor: pointer; font-size: 1rem; }
.sv button:hover { color: var(--bad); }
.sv-save { display: inline-flex; gap: 6px; }
.sv-save input { min-height: 30px; padding: 3px 10px; border: 1px dashed var(--accent); border-radius: 99px; font-size: .84rem; width: 170px; background: var(--surface); }

.tpl-save { position: relative; }
.tpl-save summary { list-style: none; }
.tpl-save summary::-webkit-details-marker { display: none; }
.tpl-save form { position: absolute; bottom: calc(100% + 8px); left: 0; display: flex; gap: 6px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 16px 36px -12px rgba(23,26,35,.35); z-index: 5; width: 300px; }
.tpl-save input { flex: 1; min-width: 0; min-height: 32px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
#qa-tpl { max-width: 170px; }
.tpl-icon { font-size: 1.4rem; width: 32px; text-align: center; }
.tpl-row .s-name { min-width: 0; }

.theme-pick { display: flex; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.theme-pick button { flex: 1; border: 1px solid var(--line); background: var(--bg); border-radius: var(--r-sm); padding: 5px 4px; font-size: .74rem; cursor: pointer; white-space: nowrap; }
.theme-pick button.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

@media (max-width: 600px) {
  .bulk-bar { left: 8px; right: 8px; transform: none; width: auto; bottom: 8px; }
  .bulk-bar .select-sm { flex: 1 1 40%; }
  .tpl-save form { width: min(300px, 80vw); }
}

/* =========================================================
   Dark mode
   ========================================================= */
[data-theme="dark"] {
  --bg: #12141C;
  --surface: #1B1E29;
  --ink: #E8EAF1;
  --ink-2: #A9AFC0;
  --ink-3: #737A8E;
  --line: #2C3040;
  --line-2: #242836;
  --side: #0E1017;
  --side-2: #1C1F2C;
  --accent: #7F72F0;
  --accent-2: #9488F5;
  --accent-soft: #2A2752;
  --ok: #3CC47C;  --ok-soft: #173326;
  --bad: #F0675C; --bad-soft: #3A1E1D;
  color-scheme: dark;
}
[data-theme="dark"] .prio.p2, [data-theme="dark"] .role-owner { background: #3A2A12; color: #F3B35C; }
[data-theme="dark"] .prio.p3 { background: #182A4A; color: #7FA9F5; }
[data-theme="dark"] .card:hover { border-color: #3C4155; }
[data-theme="dark"] .cal-day.is-weekend { background: #171A24; }
[data-theme="dark"] mark { background: #5A4A10; }
[data-theme="dark"] .cal-task.is-late span { color: #FFB4AD; }
[data-theme="dark"] .btn-stop { border-color: #5A2B28; }
[data-theme="dark"] .top-timer { border-color: #5A2B28; }
[data-theme="dark"] .invite-link { border-color: #24503A; }
[data-theme="dark"] .invite-link p { color: #8EE0B4; }
[data-theme="dark"] .copy-row input { border-color: #24503A; }
[data-theme="dark"] .live-bar { border-color: #3B3672; }
[data-theme="dark"] .lg-created, [data-theme="dark"] .bar-created { background: #4B4590; }
[data-theme="dark"] .watch-form .btn.is-on { border-color: #3B3672; }
[data-theme="dark"] .alert-success { background: var(--ok-soft); color: #8EE0B4; border-color: #24503A; }
[data-theme="dark"] .alert-error { background: var(--bad-soft); color: #FFB4AD; border-color: #5A2B28; }
[data-theme="dark"] .drawer-scrim, [data-theme="dark"] .scrim { background: rgba(0,0,0,.55); }
[data-theme="dark"] img.avatar-img { background: var(--line); }
[data-theme="dark"] .card, [data-theme="dark"] .panel, [data-theme="dark"] .drawer, [data-theme="dark"] .bulk-bar { box-shadow: none; }
[data-theme="dark"] .top { background: rgba(18,20,28,.92); }
[data-theme="dark"] .add-task input:hover { background: rgba(255,255,255,.04); }
[data-theme="dark"] .drawer-top { background: var(--surface); }
[data-theme="dark"] select, [data-theme="dark"] input, [data-theme="dark"] textarea { background-color: var(--surface); }

/* ---- Workspace logo ---- */
.ws-logo-img { object-fit: cover; padding: 0; background: #fff; }
.ws-logo-sm { width: 22px; height: 22px; font-size: .62rem; border-radius: 6px; flex: none; }
.ws-logo-xl { width: 96px; height: 96px; font-size: 2rem; border-radius: 18px; }
.ws-menu button { display: flex; align-items: center; gap: 10px; }
.ws-menu button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =========================================================
   Step 13 — custom fields, table, timeline, automations,
   docs, forms, client access, app
   ========================================================= */
.type-badge { font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); }
.field-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; min-width: 240px; }
.field-edit input[name="name"] { min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.field-edit textarea, .field-add textarea { flex-basis: 100%; min-height: 54px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-size: .86rem; }
.cf-form { display: flex; align-items: center; gap: 6px; margin: 0; }
.cf-form input:not([type="checkbox"]), .cf-form select { min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); max-width: 240px; }
.cf-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cf-form input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.cf-open { text-decoration: none; font-weight: 700; }

/* table view */
.table-wrap { padding: 0; overflow-x: auto; }
.sheet { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; min-width: 760px; }
.sheet th, .sheet td { border-bottom: 1px solid var(--line-2); padding: 0; text-align: left; white-space: nowrap; }
.sheet thead th { position: sticky; top: 0; background: var(--bg); font-size: .76rem; font-weight: 600; color: var(--ink-2); padding: 9px 10px; z-index: 1; user-select: none; }
.sheet thead th[data-sort] { cursor: pointer; }
.sheet thead th[data-sort]:hover { color: var(--accent); }
.sheet thead th[data-dir="asc"]::after { content: " ▲"; font-size: .6rem; }
.sheet thead th[data-dir="desc"]::after { content: " ▼"; font-size: .6rem; }
.sheet td > input, .sheet td > select { width: 100%; min-width: 110px; height: 38px; padding: 0 10px; border: 1px solid transparent; background: transparent; border-radius: 0; font-size: .88rem; }
.sheet td > input[type="checkbox"] { width: 18px; min-width: 0; height: 18px; margin: 0 10px; accent-color: var(--accent); }
.sheet td > input:hover, .sheet td > select:hover { background: var(--line-2); }
.sheet td > input:focus, .sheet td > select:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent); }
.sheet td > input.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet .c-name { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 260px; border-right: 1px solid var(--line-2); }
.sheet thead .c-name, .sheet tfoot th { background: var(--bg); z-index: 2; }
.sheet tfoot th { position: sticky; left: 0; }
.sheet .c-in { display: flex; align-items: center; }
.sheet .c-in input { flex: 1; min-width: 0; height: 38px; padding: 0 10px; border: 1px solid transparent; background: transparent; font-weight: 500; font-size: .88rem; }
.sheet .c-in input:hover { background: var(--line-2); }
.sheet .c-in input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent); }
.sheet tr.is-done .c-in input { text-decoration: line-through; color: var(--ink-3); }
.sheet .open-row { padding: 0 10px; text-decoration: none; color: var(--ink-3); font-weight: 700; }
.sheet .open-row:hover { color: var(--accent); }
.sheet tr.is-done .c-name input { text-decoration: line-through; color: var(--ink-3); }
.sheet td.is-late input { color: var(--bad); font-weight: 600; }
.sheet .cell-status { font-weight: 600; color: color-mix(in srgb, var(--c) 78%, var(--ink)); }
.sheet .avatars { display: inline-flex; padding: 0 10px; }
.sheet .is-saving { opacity: .5; }
.sheet .is-saved { box-shadow: inset 0 0 0 2px var(--ok) !important; }
.sheet tfoot th, .sheet tfoot td { padding: 9px 10px; font-weight: 700; background: var(--bg); }
.sheet tfoot td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* timeline */
.tl-wrap { padding: 0; overflow: hidden; }
.tl-scroll { overflow-x: auto; }
.tl-grid { min-width: calc(220px + var(--days) * 30px); }
.tl-row { display: grid; grid-template-columns: 220px 1fr; border-bottom: 1px solid var(--line-2); min-height: 38px; }
.tl-label { display: flex; align-items: center; gap: 8px; padding: 0 12px; font-size: .86rem; color: var(--ink); text-decoration: none; border-right: 1px solid var(--line); position: sticky; left: 0; background: var(--surface); z-index: 2; min-width: 0; }
.tl-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-label i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tl-row.is-done .tl-label span { text-decoration: line-through; color: var(--ink-3); }
.tl-track { display: grid; grid-template-columns: repeat(var(--days), minmax(30px, 1fr)); position: relative; align-items: center; }
.tl-track > .tl-cell, .tl-track > .tl-day { grid-row: 1; align-self: stretch; }
.tl-cell { border-left: 1px solid var(--line-2); }
.tl-cell.is-weekend, .tl-day.is-weekend { background: color-mix(in srgb, var(--line-2) 55%, transparent); }
.tl-cell.is-today { background: color-mix(in srgb, var(--accent-soft) 70%, transparent); box-shadow: inset 2px 0 0 var(--accent); }
.tl-head { position: sticky; top: 0; z-index: 3; background: var(--bg); }
.tl-head .tl-label { background: var(--bg); font-size: .76rem; font-weight: 600; color: var(--ink-2); }
.tl-day { display: grid; place-items: end center; padding: 4px 0; font-size: .66rem; color: var(--ink-3); border-left: 1px solid var(--line-2); position: relative; }
.tl-day b { position: absolute; top: 3px; left: 4px; font-size: .68rem; color: var(--ink-2); white-space: nowrap; }
.tl-day i { font-style: normal; margin-top: 14px; }
.tl-day.is-today i { color: #fff; background: var(--accent); border-radius: 99px; padding: 0 5px; }
.tl-bar { grid-row: 1; position: relative; z-index: 1; height: 24px; margin: 0 2px; border-radius: 6px; background: color-mix(in srgb, var(--c) 30%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 70%, transparent);
  display: flex; align-items: center; overflow: hidden; cursor: grab; touch-action: none; user-select: none; }
.tl-bar.is-late { border-color: var(--bad); box-shadow: inset 3px 0 0 var(--bad); }
.tl-row.is-done .tl-bar { opacity: .55; }
.tl-bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-style: dashed; }
.tl-bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-style: dashed; }
.tl-bar.is-dragging { cursor: grabbing; box-shadow: 0 6px 16px -6px rgba(23,26,35,.4); z-index: 4; }
.tl-bar.is-saving { opacity: .6; }
.tl-bar-text { flex: 1; padding: 0 8px; font-size: .76rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: color-mix(in srgb, var(--c) 60%, var(--ink)); }
.tl-h { width: 8px; align-self: stretch; cursor: ew-resize; flex: none; }
.tl-h:hover { background: color-mix(in srgb, var(--c) 50%, transparent); }
.tl-out { grid-row: 1; padding-left: 8px; }
.tl-hint { padding: 8px 14px; margin: 0; }

/* automations */
.auto-row.is-off { opacity: .55; }
.auto-icon { font-size: 1.1rem; }
.auto-text { flex: 1; min-width: 220px; font-size: .9rem; display: grid; gap: 2px; }
.auto-add { display: grid; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.auto-step { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.auto-step > label { width: 46px; font-weight: 600; font-size: .86rem; color: var(--ink-2); }
.auto-step input { min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.auto-step input[name="name"] { flex: 1; min-width: 180px; }

/* docs */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.doc-card { display: grid; gap: 6px; align-content: start; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); text-decoration: none; min-height: 150px; }
.doc-card:hover { border-color: var(--accent); }
.doc-card strong { font-size: 1rem; }
.doc-space { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.doc-space i { width: 8px; height: 8px; border-radius: 2px; }
.doc-ex { font-size: .86rem; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.doc-view { max-width: 820px; padding: 28px 32px; }
.doc-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.doc-head h1 { font-size: 1.7rem; }
.doc-tools { display: flex; gap: 10px; align-items: center; }
.doc-tools form { margin: 0; }
.doc-body { font-size: 1rem; line-height: 1.7; overflow-wrap: anywhere; }
.doc-body h2 { font-size: 1.35rem; margin: 1.4em 0 .4em; }
.doc-body h3 { font-size: 1.12rem; margin: 1.2em 0 .3em; }
.doc-body h4 { font-size: 1rem; margin: 1em 0 .3em; }
.doc-body p { margin: 0 0 .9em; }
.doc-body ul, .doc-body ol { margin: 0 0 .9em; padding-left: 1.4em; }
.doc-body blockquote { margin: 0 0 .9em; padding: 4px 14px; border-left: 3px solid var(--accent); color: var(--ink-2); background: var(--line-2); border-radius: 0 6px 6px 0; }
.doc-body code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: .88em; }
.doc-body pre { background: #171A23; color: #E8EAF1; padding: 14px; border-radius: var(--r-sm); overflow-x: auto; }
.doc-body pre code { background: none; padding: 0; color: inherit; }
.doc-body hr { border: 0; border-top: 1px solid var(--line); margin: 1.5em 0; }
.doc-checks { list-style: none; padding-left: 0 !important; }
.doc-checks li { display: flex; gap: 8px; align-items: baseline; }
.doc-box { width: 14px; height: 14px; border: 2px solid var(--line); border-radius: 4px; flex: none; transform: translateY(2px); }
.doc-checks li.is-done { color: var(--ink-3); text-decoration: line-through; }
.doc-checks li.is-done .doc-box { background: var(--ok); border-color: var(--ok); }
.doc-task { background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; text-decoration: none; font-weight: 500; }
.doc-edit-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.doc-edit-head input[name="title"] { flex: 1; min-width: 220px; font-size: 1.4rem; font-weight: 700; border: 0; border-bottom: 2px solid var(--line); background: transparent; padding: 6px 2px; }
.doc-edit-head input[name="title"]:focus { outline: none; border-color: var(--accent); }
.doc-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-height: 60vh; }
.doc-split textarea { width: 100%; min-height: 60vh; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; }
.doc-split textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.doc-preview { padding: 14px 18px; border: 1px dashed var(--line); border-radius: var(--r); background: var(--surface); overflow: auto; max-height: 75vh; }

/* forms */
.form-link { overflow-wrap: anywhere; }
.form-link a { color: var(--ink-3); }
.person-row.is-off { opacity: .6; }
.form-new fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.form-new legend { font-weight: 600; font-size: .86rem; margin-bottom: 6px; }
.form-new textarea, .form-new select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.form-by { margin: 0 0 4px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.auth-main textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; background: var(--surface); }

/* client access */
.guest-access { flex-basis: 100%; margin-left: 44px; }
.guest-access summary { cursor: pointer; font-size: .84rem; color: var(--accent); font-weight: 600; }
.guest-access form { display: grid; gap: 6px; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); justify-items: start; }
.guest-access .dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

.install-btn { background: none; border: 0; padding: 6px 0; cursor: pointer; text-align: left; color: var(--accent); font: inherit; font-weight: 600; }

@media (max-width: 800px) {
  .doc-split { grid-template-columns: 1fr; }
  .doc-view { padding: 18px; }
  .tl-row { grid-template-columns: 140px 1fr; }
  .tl-grid { min-width: calc(140px + var(--days) * 28px); }
}
[data-theme="dark"] .doc-body pre { background: #0B0D13; }
@media (max-width: 600px) {
  .list-tools { max-width: 100%; }
  .list-tools .view-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .list-tools .view-tabs::-webkit-scrollbar { display: none; }
  .view-tabs a { padding-left: 10px; padding-right: 10px; white-space: nowrap; }
}
