/* TaskHub — one stylesheet. Tokens first; dark theme only swaps tokens. */
:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --sidebar: #fbfbfc;
  --col: #f1f2f5;
  --border: #e4e6ea;
  --border-strong: #d3d6dc;
  --text: #1f2328;
  --muted: #687080;
  --faint: #a3a9b4;
  --hover: #f1f2f5;
  --active: #ecebfd;
  --accent: #7b68ee;
  --accent-strong: #5f4fe0;
  --accent-text: #5a48d8;
  --danger: #d33d44;
  --good: #0f8a4a;
  --warn: #c98a00;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .08);
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18191d;
    --panel: #212227;
    --sidebar: #1b1c20;
    --col: #1d1e23;
    --border: #30323a;
    --border-strong: #41444d;
    --text: #e6e7ea;
    --muted: #9aa1ad;
    --faint: #6c7280;
    --hover: #2a2c32;
    --active: #2f2b52;
    --accent: #8b7af2;
    --accent-strong: #9d8ff5;
    --accent-text: #b3a8ff;
    --danger: #ef6b71;
    --good: #3fbf7f;
    --warn: #e0a930;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.bad-text { color: var(--danger); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { flex: none; }

/* ------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: var(--panel); font-weight: 550; white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-ghost { color: var(--danger); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; height: 40px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.tiny { width: 24px; height: 24px; }
.icon-btn.danger:hover { color: var(--danger); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-text); font-weight: 550; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.input {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 7px;
  background: var(--panel);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input.sm { height: 30px; width: auto; font-size: 13px; }
select.input { padding-right: 6px; }
textarea.input { height: auto; padding: 8px 10px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.inline-field { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.inline-field .input { width: auto; height: 32px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 12px; }
.chip {
  border: 1px solid var(--border-strong); background: var(--panel); border-radius: 999px; padding: 3px 10px; font-size: 12.5px;
}
.chip:hover { background: var(--hover); }
.chip-toggle {
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px; border-radius: 7px;
  border: 1px solid var(--border-strong); background: var(--panel); font-size: 13px; font-weight: 550; color: var(--muted);
}
.chip-toggle:hover { background: var(--hover); }
.chip-toggle.on { background: var(--active); border-color: var(--accent); color: var(--accent-text); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 0 12px; height: 32px; font-size: 13px; font-weight: 550; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--active); color: var(--accent-text); }
.badge { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--hover); color: var(--muted); white-space: nowrap; }
.count { font-size: 12px; font-weight: 600; color: var(--muted); }
kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 5px; font: 12px var(--mono); text-align: center; background: var(--panel);
}
.spinner {
  width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  display: inline-block; animation: spin .7s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 60px 20px; color: var(--muted); }

/* avatars */
.avatar {
  display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none;
  box-shadow: 0 0 0 2px var(--panel); letter-spacing: -.02em; line-height: 1;
}
.avatar.more { background: var(--border-strong); color: var(--text); }
.avatar.ghost { background: var(--hover); color: var(--muted); box-shadow: none; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar + .avatar { margin-left: -6px; }

/* ------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  overflow-y: auto; padding: 12px 8px 0;
}
.sidebar-scrim { display: none; }
#drawer-host { display: contents; } /* its children are fixed overlays; it must not take a grid cell */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: 50px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px;
  border-bottom: 1px solid var(--border); background: var(--panel);
}
.topbar-title { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.help-btn { font-weight: 700; font-size: 15px; border: 1px solid var(--border-strong); width: 30px; height: 30px; border-radius: 50%; }
.view { flex: 1; overflow: auto; min-height: 0; display: flex; flex-direction: column; }
.view > * { flex: none; }
.only-mobile { display: none; }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 16px; padding: 4px 8px 14px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #8f7cf7, #5f4fe0);
  color: #fff; display: grid; place-items: center; font-weight: 800;
}
.brand.big { justify-content: center; font-size: 20px; padding-bottom: 18px; }
.brand.big .brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 19px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--text); font-weight: 550;
}
.nav-item svg { color: var(--muted); }
.nav-item:hover { background: var(--hover); text-decoration: none; }
.nav-item.active { background: var(--active); color: var(--accent-text); }
.nav-item.active svg { color: var(--accent-text); }
.side-section {
  display: flex; align-items: center; justify-content: space-between; padding: 18px 6px 6px 10px;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
.tree { flex: 1; padding-bottom: 12px; }
.tree-row {
  display: flex; align-items: center; gap: 2px; min-height: 32px; border-radius: 7px;
  padding-left: calc(var(--depth, 0) * 14px);
}
.tree-row:hover { background: var(--hover); }
.tree-row.active { background: var(--active); }
.tree-row.active .tree-name { color: var(--accent-text); font-weight: 650; }
.tree-link {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 5px 4px; color: var(--text); cursor: pointer;
}
.tree-link:hover { text-decoration: none; }
.tree-link svg { color: var(--muted); }
.tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-more { opacity: 0; }
.tree-row:hover .tree-more, .tree-row:focus-within .tree-more, .tree-row.active .tree-more { opacity: 1; }
.list-row .tree-link { padding-left: 26px; }
.list-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.caret svg { transition: transform .15s; }
.caret.open svg { transform: rotate(90deg); }
.caret-space { width: 24px; flex: none; }
.space-icon {
  width: 22px; height: 22px; border-radius: 6px; color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 750; flex: none;
}
.space-icon.lg { width: 34px; height: 34px; border-radius: 9px; font-size: 17px; }
.tree-add {
  border: 0; background: none; color: var(--muted); padding: 6px 10px 6px calc(10px + var(--depth, 0) * 14px + 26px);
  width: 100%; text-align: left; border-radius: 7px; font-size: 13px;
}
.tree-add:hover { background: var(--hover); color: var(--text); }
.side-foot { position: sticky; bottom: 0; background: var(--sidebar); border-top: 1px solid var(--border); padding: 8px 0; margin: 0 -8px; padding-inline: 8px; }
.me-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 6px 8px; border-radius: 8px; text-align: left;
}
.me-btn:hover { background: var(--hover); }
.me-name { display: flex; flex-direction: column; line-height: 1.2; font-weight: 600; min-width: 0; }
.me-name small { color: var(--muted); font-weight: 500; text-transform: capitalize; }

.crumbs { display: flex; align-items: center; gap: 6px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--faint); }

/* timer pill */
.timer-pill {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 4px; border-radius: 999px;
  background: color-mix(in srgb, var(--danger) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  max-width: 320px;
}
.timer-stop {
  width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--danger); color: #fff; display: grid; place-items: center;
}
.timer-stop svg { width: 11px; height: 11px; }
.timer-clock { font-weight: 650; color: var(--danger); }
.timer-task { border: 0; background: none; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; min-width: 0; }
.timer-task:hover { text-decoration: underline; }

/* ------------------------------------------------------------ pages */
.page-head { padding: 20px 24px 12px; border-bottom: 1px solid var(--border); background: var(--panel); }
.page-head > p { margin-top: 6px; max-width: 760px; }
.page-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px; color: var(--muted); font-weight: 600;
}
.tab:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.tab.active { background: var(--active); color: var(--accent-text); }
.search {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--border-strong);
  border-radius: 7px; background: var(--panel); color: var(--muted); width: 200px;
}
.search input { border: 0; outline: none; background: none; width: 100%; color: var(--text); }
.search:focus-within { border-color: var(--accent); }
.pad { padding: 20px 24px 40px; }

.empty { text-align: center; padding: 56px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty.small { padding: 24px; }
.empty p { max-width: 420px; }
.empty .btn { margin-top: 8px; }
.empty-icon {
  width: 48px; height: 48px; border-radius: 50%; background: var(--active); color: var(--accent-text);
  display: grid; place-items: center; margin-bottom: 4px;
}
.empty-icon svg { width: 22px; height: 22px; }

/* stats + panels */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; color: var(--text);
}
a.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat-v { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-l { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.stat.bad .stat-v { color: var(--danger); }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.progress { height: 6px; background: var(--hover); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--good); border-radius: 99px; transition: width .3s; }
.gs-steps { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.gs-steps li { display: flex; align-items: center; gap: 12px; }
.gs-steps li > div { flex: 1; }
.gs-steps li.done b { color: var(--muted); text-decoration: line-through; }
.gs-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex: none;
}
.gs-steps li.done .gs-check { background: var(--good); border-color: var(--good); color: #fff; }
.gs-check svg { width: 12px; height: 12px; }

/* ------------------------------------------------------------ list view */
.lv-body.lv-list { padding: 8px 24px 40px; }
.lv-body.lv-board { flex: 1 1 auto; min-height: 0; }
.lv-body.lv-calendar { padding: 16px 24px 40px; }
.table-head, .task-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 110px 96px 72px 72px; align-items: center;
}
.table-head {
  font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 0 4px; position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.table-head .c-name { padding-left: 34px; }
.group { margin-top: 12px; }
.group-head { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.group-title { font-weight: 700; }
.group-title.bad { color: var(--danger); }
.status-pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 5px; background: var(--c);
  color: var(--fg, #fff); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}
.rows { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.rows:empty { display: none; }
.task-row { min-height: 42px; border-top: 1px solid var(--border); cursor: pointer; }
.rows > .task-row:first-child { border-top: 0; }
.task-row:hover { background: var(--hover); }
.task-row > div { padding: 0 8px; min-width: 0; }
.c-name { display: flex; align-items: center; gap: 8px; }
.task-row .c-name { padding-left: 6px !important; }
.task-row.is-sub .c-name { padding-left: 38px !important; }
.task-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.is-done .task-title { color: var(--muted); text-decoration: line-through; }
.list-crumb { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1000; min-width: 0; }
.c-assignee, .c-due, .c-prio { height: 100%; display: flex; align-items: center; border-radius: 6px; }
.task-row .c-assignee:hover, .task-row .c-due:hover, .task-row .c-prio:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.c-time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.ph { color: var(--faint); opacity: 0; display: inline-flex; }
.task-row:hover .ph { opacity: 1; }
.status-dot {
  width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--c); background: transparent; flex: none;
  display: grid; place-items: center; padding: 0; color: var(--fg, #fff);
}
.status-dot:hover { background: color-mix(in srgb, var(--c) 25%, transparent); }
.status-dot.done { background: var(--c); }
.status-dot svg { width: 10px; height: 10px; stroke-width: 3.5; }
.chip-meta {
  display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); white-space: nowrap; flex: none;
}
.chip-meta svg { width: 13px; height: 13px; }
.chip-meta.ok { color: var(--good); }
.due { font-size: 12.5px; white-space: nowrap; font-weight: 550; }
.due.overdue { color: var(--danger); }
.due.due-today { color: var(--warn); }
.flag { display: inline-flex; align-items: center; gap: 5px; }
.add-row { padding: 4px 0; }
.add-btn {
  border: 0; background: none; color: var(--muted); padding: 7px 8px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
}
.add-btn:hover { background: var(--hover); color: var(--text); }
.inline-add input {
  width: 100%; height: 40px; border: 1px solid var(--accent); border-radius: 8px; padding: 0 12px; background: var(--panel); outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.show-closed { margin: 16px 0 0 8px; }

/* ------------------------------------------------------------ board */
.board { display: flex; gap: 12px; overflow-x: auto; height: 100%; padding: 16px 24px; align-items: flex-start; }
.col {
  flex: 0 0 280px; max-height: 100%; background: var(--col); border-radius: 10px; display: flex; flex-direction: column;
  border: 1px solid var(--border);
}
.col-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px 12px; border-top: 3px solid var(--c); border-radius: 10px 10px 0 0;
}
.col-name { font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
.col-cards { overflow-y: auto; padding: 2px 8px; min-height: 12px; flex: 0 1 auto; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 11px; margin-bottom: 8px;
  box-shadow: var(--shadow); cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.card:hover { border-color: var(--border-strong); }
.card.is-done .card-title { color: var(--muted); text-decoration: line-through; }
.card-title { font-weight: 550; overflow-wrap: anywhere; }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; min-height: 22px; }
.card-meta:has(.grow:only-child) { display: none; }
.col-add-slot { padding: 0 8px 8px; }
.col-add {
  width: 100%; border: 0; background: none; color: var(--muted); text-align: left; padding: 7px 6px; border-radius: 6px;
  display: flex; align-items: center; gap: 6px; font-size: 13px;
}
.col-add:hover { background: var(--hover); color: var(--text); }
.add-card { cursor: default; }
.add-card textarea { width: 100%; border: 0; outline: none; resize: none; background: none; }
.row-end { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.drop-ph { border: 2px dashed var(--accent); border-radius: 8px; margin-bottom: 8px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; margin: 0; cursor: grabbing;
  box-shadow: var(--shadow-lg); opacity: .95;
}
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; }

/* ------------------------------------------------------------ calendar */
.cal-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.cal-bar h2 { min-width: 170px; text-align: center; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.cal-dow { padding: 8px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--border); }
.cal-day { min-height: 116px; padding: 4px 5px 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: color-mix(in srgb, var(--bg) 60%, var(--panel)); }
.cal-day.other .cal-num { color: var(--faint); }
.cal-day.drop-hover { background: var(--active); }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; }
.cal-num { font-size: 12.5px; font-weight: 650; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--accent); color: #fff; }
.cal-add { opacity: 0; }
.cal-day:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-task {
  display: flex; align-items: center; gap: 4px; width: 100%; margin-top: 3px; padding: 3px 6px; border: 0; border-left: 3px solid var(--c);
  border-radius: 4px; background: color-mix(in srgb, var(--c) 13%, var(--panel)); font-size: 12px; text-align: left; min-width: 0;
}
.cal-task:hover { background: color-mix(in srgb, var(--c) 24%, var(--panel)); }
.cal-task-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-task.is-done .cal-task-t { text-decoration: line-through; color: var(--muted); }
.cal-more { border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; padding: 3px 6px; }
.cal-more:hover { color: var(--text); }

/* ------------------------------------------------------------ space overview */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.list-card {
  display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text);
}
.list-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow); }
.list-card-h { display: flex; align-items: center; gap: 8px; }
.list-card-f { display: flex; gap: 12px; }
.status-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--hover); gap: 2px; }
.status-bar i { display: block; }
.status-bar .empty-bar { flex: 1; }
.folder-sec { margin-top: 24px; }
.folder-sec h3 { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--muted); }

/* ------------------------------------------------------------ timesheet */
.ts-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.ts { width: 100%; border-collapse: collapse; min-width: 720px; }
.ts th, .ts td { padding: 10px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.ts th { font-size: 11.5px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.ts th small { display: block; font-size: 13px; color: var(--text); text-transform: none; }
.ts th.today small { color: var(--accent-text); }
.ts .ts-task { text-align: left; white-space: normal; min-width: 220px; }
.ts tfoot td { font-weight: 700; border-bottom: 0; background: var(--bg); }

/* ------------------------------------------------------------ team */
.people { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.person:first-child { border-top: 0; }
.person.inactive { opacity: .6; }
.person-b { flex: 1; display: flex; flex-direction: column; min-width: 160px; }
.sec-title { margin: 24px 0 10px; }
.invite-link { display: flex; gap: 8px; margin: 6px 0; }

/* ------------------------------------------------------------ drawer (task detail) */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15, 17, 22, .28); z-index: 40; animation: fade .15s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--panel); z-index: 41;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer-loading { padding: 40px; color: var(--muted); }
.drawer-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px 10px 20px; border-bottom: 1px solid var(--border); }
.drawer-crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; min-width: 0; overflow: hidden; white-space: nowrap; }
.drawer-crumbs a { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.drawer-crumbs .sep { color: var(--faint); }
.save-state { font-size: 12.5px; color: var(--muted); }
.save-state.saved { color: var(--good); }
.save-state.error { color: var(--danger); font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 28px 24px; }
.title-row { display: flex; gap: 8px; margin-bottom: 8px; }
.complete-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 7px;
  border: 1px solid var(--border-strong); background: var(--panel); font-weight: 600; font-size: 13px; color: var(--muted);
}
.complete-btn:hover { border-color: var(--good); color: var(--good); }
.complete-btn.on { background: var(--good); border-color: var(--good); color: #fff; }
.title-input {
  width: 100%; border: 0; outline: none; resize: none; background: none; font-size: 24px; font-weight: 700; line-height: 1.3;
  padding: 4px 0; border-radius: 6px; overflow: hidden;
}
.title-input:hover { background: var(--hover); }
.title-input:focus { background: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.props { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; margin: 14px 0 8px; }
.prop { display: flex; align-items: center; gap: 10px; min-height: 38px; }
.prop-l { display: flex; align-items: center; gap: 8px; width: 118px; flex: none; color: var(--muted); font-size: 13px; }
.prop-v {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border: 0; background: none; padding: 4px 6px; border-radius: 6px;
  text-align: left; min-width: 0; min-height: 32px;
}
button.prop-v:hover, .date-btn:hover { background: var(--hover); }
.assignee { display: inline-flex; align-items: center; gap: 6px; }
.prop:has(.pending-assignees) { flex-wrap: wrap; }
.pending-assignees { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-left: 128px; width: 100%; margin-top: -6px; }
.assignee.pending { border: 1px dashed var(--border-strong); border-radius: 99px; padding: 1px 9px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) { .pending-assignees { padding-left: 0; } }
.status-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 11px; border: 0; border-radius: 6px;
  background: var(--c); color: var(--fg, #fff); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
}
.status-btn svg { width: 14px; height: 14px; }
.date-btn { border: 0; background: none; padding: 4px 6px; border-radius: 6px; font-size: 13px; }
.timer-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--border-strong);
  background: var(--panel); font-weight: 600; font-size: 13px;
}
.timer-btn svg { width: 11px; height: 11px; color: var(--good); }
.timer-btn:hover { border-color: var(--good); }
.timer-btn.running { background: var(--danger); border-color: var(--danger); color: #fff; }
.timer-btn.running svg { color: #fff; }
.dsec { margin-top: 22px; }
.dsec h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.desc {
  width: 100%; min-height: 70px; border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; resize: none; background: var(--bg);
  overflow: hidden;
}
.desc:hover { border-color: var(--border); }
.desc:focus { outline: none; border-color: var(--accent); background: var(--panel); }
.add-input { margin-top: 6px; height: 34px; border-style: dashed; background: none; }
.add-input:focus { border-style: solid; }
.sublist { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.sublist:empty { display: none; }
.sub-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--border); cursor: pointer; }
.sub-row:first-child { border-top: 0; }
.sub-row:hover { background: var(--hover); }
.sub-row .task-title { flex: 1; }
.checklist { margin-top: 6px; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.check-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--good); flex: none; }
.check-text { flex: 1; border: 0; background: none; padding: 5px 6px; border-radius: 6px; outline: none; }
.check-text:hover { background: var(--hover); }
.check-text:focus { background: var(--bg); }
.check-row.is-done .check-text { color: var(--muted); text-decoration: line-through; }
.check-row .icon-btn { opacity: 0; }
.check-row:hover .icon-btn, .check-row:focus-within .icon-btn { opacity: 1; }
.time-list { border: 1px solid var(--border); border-radius: 8px; }
.time-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-top: 1px solid var(--border); font-size: 13px; flex-wrap: wrap; }
.time-row:first-child { border-top: 0; }
.feed { display: flex; flex-direction: column; gap: 10px; }
.feed-act { font-size: 12.5px; color: var(--muted); padding-left: 38px; }
.feed-act b { color: var(--text); font-weight: 600; }
.comment { display: flex; gap: 10px; }
.comment-b { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; min-width: 0; }
.comment-h { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.comment-h .icon-btn { margin-left: auto; opacity: 0; }
.comment:hover .comment-h .icon-btn { opacity: 1; }
.comment-t { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.comment-box { display: flex; gap: 8px; align-items: flex-end; padding: 10px 20px 14px; border-top: 1px solid var(--border); }
.comment-box textarea {
  flex: 1; resize: none; border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; max-height: 160px; background: var(--panel);
}
.comment-box textarea:focus { outline: none; border-color: var(--accent); }

/* ------------------------------------------------------------ overlays */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(15, 17, 22, .4); display: grid; place-items: center; padding: 16px;
  animation: fade .12s;
}
.modal {
  width: min(460px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--panel);
  border-radius: 12px; box-shadow: var(--shadow-lg); animation: pop .15s ease-out;
}
.modal.wide { width: min(640px, 100%); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px 20px; }
.modal-body { padding: 8px 20px; overflow-y: auto; }
.modal-body > p { margin-bottom: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; }
.menu {
  position: fixed; z-index: 80; min-width: 200px; max-width: 320px; max-height: 60vh; overflow-y: auto; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; animation: pop .1s ease-out;
}
.menu-header { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px 4px; }
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; padding: 7px 8px; border-radius: 6px; text-align: left;
}
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--danger); }
.mi-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-icon { display: inline-flex; color: var(--muted); }
.menu-item.danger .mi-icon { color: var(--danger); }
.mi-check { color: var(--accent-text); display: inline-flex; visibility: hidden; }
.menu-item.checked .mi-check { visibility: visible; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.menu-pad { padding: 4px; display: flex; flex-direction: column; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.date-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; padding: 0; flex: none; }
.swatch.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
.status-edit-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.status-edit { display: flex; align-items: center; gap: 6px; }
.status-edit .input { height: 32px; }
.status-edit .type-sel { width: 118px; flex: none; }
.status-add { display: flex; gap: 8px; margin-bottom: 8px; }
.status-add .input { height: 34px; }
.assign-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.assign-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 99px; border: 1px solid var(--border-strong);
  background: var(--panel); font-size: 13px;
}
.assign-chip.on { background: var(--active); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.pw-details { margin: 4px 0 12px; }
.pw-details summary { cursor: pointer; color: var(--accent-text); font-weight: 600; margin-bottom: 10px; }

#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; background: #1f2328; color: #fff; padding: 9px 8px 9px 16px;
  border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; max-width: min(520px, calc(100vw - 32px)); animation: pop .15s;
  transition: opacity .3s, transform .3s;
}
.toast.error { background: #b4232a; }
.toast.good { background: #136c3f; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast-action { border: 0; background: rgba(255, 255, 255, .16); color: #fff; font-weight: 700; padding: 4px 10px; border-radius: 6px; }
.toast-action:hover { background: rgba(255, 255, 255, .28); }
.toast-x { border: 0; background: none; color: rgba(255, 255, 255, .7); display: grid; place-items: center; padding: 2px; border-radius: 4px; }
.toast-x:hover { color: #fff; }
.toast-x svg { width: 14px; height: 14px; }
.offline-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 95; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 16px; background: #fff4d6; color: #6b4b00; border-bottom: 1px solid #f0d58a; font-weight: 550; font-size: 13px;
}

/* help */
.help section + section { margin-top: 18px; }
.help h3 { margin-bottom: 8px; }
.help-dl { display: grid; grid-template-columns: 80px 1fr; gap: 6px 12px; margin: 0; }
.help-dl dt { font-weight: 700; }
.help-dl dd { margin: 0; color: var(--muted); }
.help-ul { margin: 0; padding-left: 18px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.kbd-table { border-collapse: collapse; }
.kbd-table td { padding: 4px 16px 4px 0; }
.kbd-table td:first-child { white-space: nowrap; color: var(--muted); }

/* ------------------------------------------------------------ auth */
.auth-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-card {
  width: min(400px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 28px 28px 24px;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.auth-card h1 { text-align: center; }
.auth-card > p.muted { text-align: center; margin: 6px 0 20px; }
.auth-card .btn.block { margin-top: 4px; }
.auth-card > p.small { margin-top: 16px; }
.auth-error { color: var(--danger); font-weight: 550; min-height: 20px; margin: -4px 0 8px; font-size: 13px; }
.auth-error:empty { display: none; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(290px, 86vw); z-index: 70; transform: translateX(-100%);
    transition: transform .2s ease, visibility .2s; visibility: hidden;
  }
  .sidebar.open { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
  .sidebar.open + .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 69; background: rgba(15, 17, 22, .35); }
  .only-mobile { display: inline-grid; }
  .tree-more { opacity: 1; }
  .topbar { padding: 0 8px; }
  .page-head { padding: 14px 16px 10px; }
  .pad { padding: 16px 16px 40px; }
  .lv-body.lv-list, .lv-body.lv-calendar { padding-left: 16px; padding-right: 16px; }
  .board { padding: 12px 16px; }
  .search { width: auto; flex: 1 1 140px; }
  .props { grid-template-columns: 1fr; }
  .drawer-body { padding: 12px 16px 20px; }
  .comment-box { padding: 10px 12px 12px; }
  .timer-pill { max-width: 46vw; }
}
@media (max-width: 640px) {
  h1 { font-size: 19px; }
  .table-head { display: none; }
  .task-row { grid-template-columns: minmax(0, 1fr) auto auto; padding: 4px 0; }
  .c-prio, .c-time { display: none !important; }
  .task-row .c-assignee, .task-row .c-due { padding: 0 4px; }
  .task-row .ph { display: none; }
  .list-crumb { display: none; }
  .col { flex-basis: 84vw; }
  .cal-day { min-height: 74px; padding: 2px; }
  .cal-task { padding: 2px 3px; font-size: 11px; border-left-width: 2px; }
  .cal-task .avatar-stack { display: none; }
  .cal-dow { padding: 6px 2px; text-align: center; font-size: 10.5px; }
  .cal-add { display: none; }
  .timer-task { display: none; }
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { width: 100%; border-radius: 14px 14px 0 0; max-height: 92dvh; }
  .modal.wide { width: 100%; }
  .prop-l { width: 104px; }
  .title-input { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
