/* ToDo Smart — soft paper light, Notion-like calm, warm dark. */

:root {
  --bg: #f8f7f4;
  --surface: #fdfdfc;
  --raised: #ffffff;
  --text: #37352f;
  --text-2: #5f5e5b;
  --muted: #73716c;
  --faint: #b4b2ad;
  --line: rgba(55, 53, 47, .09);
  --line-strong: rgba(55, 53, 47, .16);
  --hover: rgba(55, 53, 47, .045);
  --press: rgba(55, 53, 47, .08);
  --accent: #1f6fc5;
  --accent-soft: rgba(31, 111, 197, .11);
  --on-accent: #ffffff;
  --doing: #c4851c;
  --doing-soft: rgba(203, 145, 47, .16);
  --done: #448361;
  --star: #d9a21b;
  --danger: #d44c47;
  --shadow-1: 0 1px 2px rgba(15, 15, 15, .04), 0 2px 8px rgba(15, 15, 15, .04);
  --shadow-2: 0 2px 4px rgba(15, 15, 15, .05), 0 12px 32px rgba(15, 15, 15, .10);
  --selection: rgba(35, 131, 226, .22);

  --c-gray: #787774;   --c-gray-bg: #efeeeb;
  --c-brown: #9f6b53;  --c-brown-bg: #f4eeee;
  --c-orange: #d9730d; --c-orange-bg: #fbecdd;
  --c-yellow: #b7811f; --c-yellow-bg: #fbf3db;
  --c-green: #448361;  --c-green-bg: #edf3ec;
  --c-blue: #337ea9;   --c-blue-bg: #e7f3f8;
  --c-purple: #9065b0; --c-purple-bg: #f6f3f9;
  --c-pink: #c14c8a;   --c-pink-bg: #faf1f5;
  --c-red: #d44c47;    --c-red-bg: #fdebec;

  --pad-x: clamp(20px, 4.5vw, 72px);
  --tabbar-h: 76px;
  --radius: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #191919;
  --surface: #1f1f1f;
  --raised: #252525;
  --text: #e3e2df;
  --text-2: #bdbbb6;
  --muted: #8f8d88;
  --faint: #5d5b57;
  --line: rgba(255, 255, 255, .075);
  --line-strong: rgba(255, 255, 255, .13);
  --hover: rgba(255, 255, 255, .045);
  --press: rgba(255, 255, 255, .08);
  --accent: #5aa3e0;
  --accent-soft: rgba(90, 163, 224, .16);
  --on-accent: #10161c;
  --doing: #d9a24f;
  --doing-soft: rgba(217, 162, 79, .16);
  --done: #5fae84;
  --star: #e2b23c;
  --danger: #e5625d;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 4px 10px rgba(0, 0, 0, .3), 0 16px 40px rgba(0, 0, 0, .35);
  --selection: rgba(90, 163, 224, .3);

  --c-gray: #9b9a97;   --c-gray-bg: #2f2f2f;
  --c-brown: #ba856f;  --c-brown-bg: #3a2c26;
  --c-orange: #d48a50; --c-orange-bg: #44301f;
  --c-yellow: #cfa152; --c-yellow-bg: #413724;
  --c-green: #5fae84;  --c-green-bg: #233429;
  --c-blue: #5aa3e0;   --c-blue-bg: #1d3140;
  --c-purple: #a98bd6; --c-purple-bg: #322a3e;
  --c-pink: #d36fa4;   --c-pink-bg: #3d2733;
  --c-red: #e0706b;    --c-red-bg: #432826;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
::selection { background: var(--selection); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
code { font: .88em ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--press); padding: .1em .35em; border-radius: 4px; }
kbd { font: 500 11px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: .02em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i .dot { fill: currentColor; stroke: none; }
.i .fill { fill: currentColor; stroke: none; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--muted);
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { background: var(--press); }

/* ---------- Top bar ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--pad-x);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.brand img { border-radius: 6px; }
.top-tools { display: flex; align-items: center; gap: 6px; }
.search input {
  width: 180px;
  height: 34px;
  padding: 0 12px 0 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--hover) no-repeat 11px 50% / 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8883' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m20 20-4.4-4.4'/%3E%3C/svg%3E");
  font-size: 14px;
  outline: none;
  transition: width .2s var(--ease), border-color .15s, background-color .15s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { width: 260px; border-color: var(--line-strong); background-color: var(--surface); }
.search input::-webkit-search-cancel-button { display: none; }
.sync { display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.sync.synced::before { background: var(--done); }
.sync.offline::before { background: var(--doing); }

main { padding: 8px var(--pad-x) calc(var(--tabbar-h) + 72px); }

/* ---------- Composer ---------- */

.composer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .2s var(--ease);
}
.composer:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.composer-input {
  min-height: 64px;
  max-height: 45vh;
  overflow-y: auto;
  padding: 20px 24px 8px;
  font-size: 18px;
  line-height: 1.55;
  outline: none;
}
.composer-input > div:first-child, .composer-input > :first-child { font-weight: 500; }
.composer-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px 12px 18px; }
.fmt-group { display: flex; gap: 2px; }
.fmt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--muted);
  transition: background-color .15s, color .15s;
}
.fmt-btn:hover { background: var(--hover); color: var(--text); }
.fmt-btn .i { width: 17px; height: 17px; }
.dest { margin-left: auto; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dest b { font-weight: 500; color: var(--tc, var(--text-2)); }
.send {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 14px 0 16px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14.5px;
  font-weight: 550;
  transition: filter .15s, transform .1s, opacity .15s;
}
.send kbd { padding: 3px 6px; border-radius: 5px; background: rgba(255, 255, 255, .2); }
:root[data-theme="dark"] .send kbd { background: rgba(0, 0, 0, .15); }
.send:hover { filter: brightness(.93); }
.send:active { transform: translateY(1px); }
.send:disabled { opacity: .45; cursor: default; filter: none; transform: none; }

/* ---------- Rich text ---------- */

.rich { overflow-wrap: anywhere; }
.rich:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.rich[contenteditable="true"] { outline: none; cursor: text; }
.rich ul { margin: 4px 0; padding-left: 24px; }
.rich ul li { padding: 1px 0; }
.rich ul li::marker { color: var(--muted); }
.rich ul.checks { list-style: none; padding-left: 2px; }
.rich ul.checks > li { position: relative; padding: 3px 0 3px 30px; }
.rich ul.checks > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: calc(.8em - 5px);
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--faint);
  border-radius: 5px;
  background: var(--raised) no-repeat center / 13px;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.rich ul.checks > li[data-checked="true"]::before {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5.5 12.5 4 4 9-9.5'/%3E%3C/svg%3E");
}
.rich ul.checks > li[data-checked="true"] { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.rich h3 { margin: 10px 0 2px; font-size: 1.05em; font-weight: 600; }

/* ---------- View header ---------- */

.view { margin-top: clamp(36px, 6vh, 64px); }
.view-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 6px 24px; margin-bottom: 20px; }
.view-title-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.view-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--tc-bg, var(--hover));
  color: var(--tc, var(--muted));
  flex: none;
}
.view-icon .i { width: 22px; height: 22px; }
.view-icon .square { width: 16px; height: 16px; border-radius: 5px; background: currentColor; }
.view-title {
  margin: 0;
  min-width: 0;
  font-size: clamp(28px, 2.6vw, 36px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
  border-radius: 6px;
}
.view-title.renamable { cursor: text; }
.view-title.renamable:hover { background: var(--hover); box-shadow: 0 0 0 6px var(--hover); }
.view-title[contenteditable="true"] { outline: none; background: var(--hover); box-shadow: 0 0 0 6px var(--hover); }
.view-meta { grid-column: 1; margin: 0 0 0 52px; font-size: 14px; color: var(--muted); }
.filters { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip .i { width: 16px; height: 16px; }
.chip:hover { background: var(--hover); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.clear { border-color: transparent; color: var(--muted); padding: 0 10px; }

/* ---------- Tasks ---------- */

.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.task {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 16px;
  padding: 16px 16px 16px 12px;
  margin: 0 -16px 0 -40px;
  padding-left: 40px;
  border-radius: 12px;
  transition: background-color .15s, opacity .2s var(--ease), transform .2s var(--ease);
}
.task:hover, .task:focus-within { background: var(--hover); }
.task + .task::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 40px;
  right: 16px;
  height: 1px;
  background: var(--line);
}
.task:hover::before, .task:hover + .task::before, .task:focus-within::before, .task:focus-within + .task::before { opacity: 0; }
.task.fresh { animation: fresh 1.4s var(--ease); }
@keyframes fresh { from { background: var(--accent-soft); } }
.task.leaving { opacity: 0; transform: translateX(16px); }
.task.dragging { opacity: .4; }
.task.is-done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }

.grip {
  position: absolute;
  left: 8px;
  top: 17px;
  width: 24px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--faint);
  cursor: grab;
  opacity: 0;
  transition: opacity .15s;
}
.grip:hover { background: var(--press); color: var(--muted); }
.task:hover .grip, .grip:focus-visible { opacity: 1; }

.task-state { display: flex; gap: 4px; padding-top: 1px; }
.state-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--faint);
  transition: background-color .15s, color .15s;
}
.state-btn .i { width: 22px; height: 22px; }
.state-btn:hover { background: var(--press); }
.btn-check .i circle { transition: fill .15s; }
.btn-check:hover { color: var(--done); }
.btn-check[aria-pressed="true"] { color: var(--done); }
.btn-check[aria-pressed="true"] .i circle { fill: var(--done); stroke: var(--done); }
.btn-check[aria-pressed="true"] .i path { stroke: var(--surface); }
.btn-check .i path { opacity: 0; transition: opacity .15s; }
.btn-check:hover .i path, .btn-check[aria-pressed="true"] .i path { opacity: 1; }
.btn-doing .i .fill { opacity: 0; transition: opacity .15s; }
.btn-doing:hover { color: var(--doing); }
.btn-doing:hover .i .fill { opacity: .45; }
.btn-doing[aria-pressed="true"] { color: var(--doing); }
.btn-doing[aria-pressed="true"] .i .fill { opacity: 1; }

.task-body { min-width: 0; padding-top: 3px; }
.task-title { max-width: 80ch; font-size: 16.5px; line-height: 1.55; cursor: text; border-radius: 4px; }
.task-title[contenteditable="true"] { box-shadow: 0 0 0 4px var(--raised), 0 0 0 5px var(--line-strong); background: var(--raised); }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.task-meta time { font-variant-numeric: tabular-nums; }
.tab-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  background: var(--tc-bg);
  color: var(--tc);
  font-size: 12.5px;
  font-weight: 500;
}
.tab-chip:hover { filter: brightness(.97); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px; font-size: 12.5px; font-weight: 500; }
.pill.doing { background: var(--doing-soft); color: var(--doing); }
.pill.doing::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Description: preview on hover (clamped), full when opened. */
.task-desc {
  display: grid;
  grid-template-rows: 0fr;
  max-width: 80ch;
  transition: grid-template-rows .22s var(--ease) 0s, opacity .18s 0s;
  opacity: 0;
}
.task-desc > .desc-inner { overflow: hidden; min-height: 0; }
.task:hover .task-desc, .task:focus-within .task-desc {
  grid-template-rows: 1fr;
  opacity: 1;
  transition-delay: .18s;
}
.desc-rich {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.6;
  cursor: text;
}
.task-desc:not(.is-open) .desc-rich {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.task-desc.is-open { grid-template-rows: 1fr; opacity: 1; transition-delay: 0s; }
.task-desc.is-open .desc-rich { box-shadow: inset 0 0 0 1px var(--line-strong); background: var(--surface); }
.desc-more { display: inline-block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.desc-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.task-actions { display: flex; gap: 2px; padding-top: 1px; }
.act {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--faint);
  opacity: 0;
  transition: opacity .15s, background-color .15s, color .15s;
}
.act:hover { background: var(--press); color: var(--text); }
.task:hover .act, .task:focus-within .act, .act:focus-visible, .act.on, .act.has { opacity: 1; }
.act.has { color: var(--muted); }
.act.on.star { color: var(--star); }
.act.on.star .i { fill: currentColor; }
.act.on.pin { color: var(--accent); }
.act.on.pin .i { fill: var(--accent-soft); }
.act.danger:hover { color: var(--danger); }

.empty { padding: 56px 0; text-align: center; color: var(--muted); font-size: 15px; }
.empty strong { display: block; margin-bottom: 6px; color: var(--text-2); font-size: 17px; font-weight: 600; }
.empty button { margin-top: 14px; }

/* ---------- Tab bar ---------- */

.tabbar {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 0 var(--pad-x) env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(15, 15, 15, .03);
}
.tabs { display: flex; align-items: center; gap: 6px; height: var(--tabbar-h); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  height: 48px;
  padding: 0 18px 0 14px;
  border-radius: 12px;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.tab:hover { background: var(--hover); color: var(--text); }
.tab .i { width: 18px; height: 18px; color: var(--muted); }
.tab .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--tc); flex: none; }
.tab .n { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--press); color: var(--muted); font-size: 12px; font-weight: 600; line-height: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.tab .n:empty { display: none; }
.tab[aria-current="page"] { background: var(--tc-bg, var(--press)); color: var(--tc-strong, var(--text)); }
.tab[aria-current="page"] .i { color: currentColor; }
.tab[aria-current="page"] .n { background: rgba(255, 255, 255, .55); color: inherit; }
:root[data-theme="dark"] .tab[aria-current="page"] .n { background: rgba(0, 0, 0, .25); }
.tab.drop { box-shadow: inset 0 0 0 2px var(--tc, var(--accent)); background: var(--tc-bg, var(--accent-soft)); }
.tab.drop-before::after, .tab.drop-after::after { content: ""; position: absolute; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--accent); }
.tab.drop-before::after { left: -5px; }
.tab.drop-after::after { right: -5px; }
.tab.dragging { opacity: .4; }
.tab-sep { width: 1px; height: 26px; margin: 0 8px; background: var(--line-strong); flex: none; }
.tab-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 48px;
  padding: 0 16px 0 12px;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 14.5px;
  transition: background-color .15s, color .15s, border-color .15s;
}
.tab-add:hover { background: var(--hover); color: var(--text); border-color: var(--faint); }
.tab-name-input {
  width: 14ch;
  border: 0;
  outline: none;
  background: transparent;
  font-weight: 500;
}

/* ---------- Floating format bar, menus, toast ---------- */

.fmtbar, .menu {
  position: fixed;
  z-index: 40;
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-2);
}
.fmtbar { display: flex; align-items: center; gap: 2px; padding: 4px; }
.fmtbar .fmt-btn { color: var(--text-2); }
.fmtbar .fmt-btn.wide { padding: 0 10px; font-size: 13.5px; }
.fmtbar-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--line-strong); }
.menu { min-width: 220px; max-height: min(60vh, 420px); overflow: auto; padding: 6px; }
.menu-label { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 14px;
  text-align: left;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--tc); flex: none; }
.menu-item.cur { color: var(--accent); }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.swatches { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; padding: 6px 10px 10px; }
.swatch { width: 22px; height: 22px; border-radius: 6px; background: var(--tc-bg); box-shadow: inset 0 0 0 1.5px var(--tc); }
.swatch[aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px var(--tc), 0 0 0 2px var(--raised), 0 0 0 4px var(--tc); }

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  box-shadow: var(--shadow-2);
  animation: toast-in .2s var(--ease);
}
.toast button { font-weight: 600; color: var(--bg); text-decoration: underline; text-underline-offset: 3px; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- Touch & small screens ---------- */

@media (hover: none) {
  .task-desc { grid-template-rows: 1fr; opacity: 1; }
  .act { opacity: 1; }
  .grip { display: none; }
}

@media (max-width: 760px) {
  :root { --tabbar-h: 68px; }
  .top { padding-block: 12px; }
  .search input { width: 38px; padding-right: 0; color: transparent; cursor: pointer; }
  .search input::placeholder { color: transparent; }
  .search input:focus { width: 160px; color: var(--text); cursor: text; }
  .sync { font-size: 0; padding: 0 6px; }
  .composer-input { padding: 16px 16px 6px; font-size: 17px; min-height: 56px; }
  .composer-bar { padding: 6px 8px 8px 10px; gap: 6px; }
  .dest { display: none; }
  .send { margin-left: auto; padding: 0 16px; }
  .send kbd { display: none; }
  .view-head { grid-template-columns: 1fr; }
  .view-meta { margin-left: 52px; }
  .filters { grid-column: 1; grid-row: auto; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; margin: 6px calc(-1 * var(--pad-x)) 0; padding: 0 var(--pad-x) 4px; scrollbar-width: none; }
  .task { grid-template-columns: auto 1fr; gap: 10px; margin: 0 -10px; padding: 14px 10px; }
  .task + .task::before { left: 10px; right: 10px; }
  .task-actions { grid-column: 2; padding-top: 0; margin: -4px 0 0 -8px; }
  .tab { height: 44px; padding: 0 14px 0 12px; }
  .tab-add .label { display: none; }
  .tab-add { padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; transition-delay: 0s !important; }
}

/* ---------- Review fixes ---------- */

/* Done and in-progress read differently at rest: solid ring vs dashed ring. */
.state-btn { color: var(--muted); }
.btn-doing:not([aria-pressed="true"]) .i circle { stroke-dasharray: 3.1 2.5; }
.act { color: var(--muted); }

/* Scroll strips show they continue past the edge. */
.tabs { mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
@media (max-width: 760px) {
  .filters { mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
  .sync.local { display: none; }
}

/* ---------- Narrower, calmer column (tab bar unchanged) ---------- */

.top, main { width: 100%; max-width: min(1000px, 72vw); margin-inline: auto; }
@media (max-width: 1100px) { .top, main { max-width: none; } }
.composer-input { font-size: 16.5px; min-height: 56px; padding: 16px 20px 6px; }
.view-title { font-size: clamp(24px, 2vw, 30px); }
.view-icon { width: 34px; height: 34px; border-radius: 9px; }
.view-meta { margin-left: 46px; }
.task { padding-top: 12px; padding-bottom: 12px; }
.task-title { font-size: 15.5px; }
.state-btn { width: 28px; height: 28px; }
.state-btn .i { width: 20px; height: 20px; }
.chip { height: 32px; font-size: 13.5px; }

/* ---------- Done at the bottom, bolder titles, per-task colour ---------- */

.task-title { font-weight: 500; }
.task.is-done .task-body { opacity: .55; }
.task.has-color { background: var(--ic-bg); }
.task.has-color:hover, .task.has-color:focus-within { background: color-mix(in srgb, var(--ic) 13%, var(--bg)); }
.task.is-done.has-color { background: transparent; }
.task.is-done.has-color:hover, .task.is-done.has-color:focus-within { background: var(--hover); }
.act.palette.has { color: var(--ic); }

/* ---------- Projets (Claude Code projects, filled by scripts/scan-projects.mjs) ---------- */

.mode-projects .composer { display: none; }
.mode-projects .view { margin-top: 20px; }
.mode-projects .view-head { grid-template-columns: 1fr; }
.mode-projects .filters { grid-column: 1; grid-row: auto; justify-content: flex-start; margin: 14px 0 0 46px; }

.seg { display: inline-flex; align-items: center; gap: 2px; height: 32px; padding: 2px; border-radius: 999px; background: var(--hover); color: var(--muted); }
.seg > .i { width: 15px; height: 15px; margin: 0 4px 0 8px; }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; color: var(--text-2); font-size: 13.5px; white-space: nowrap; transition: background-color .15s, color .15s, box-shadow .15s; }
.seg-btn .i { width: 15px; height: 15px; }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--raised); color: var(--text); box-shadow: var(--shadow-1); font-weight: 500; }
.chip.small { height: 28px; padding: 0 10px 0 8px; font-size: 12.5px; }

.projects { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.proj {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  margin: 0 -16px;
  padding: 18px 16px;
  border-radius: 12px;
  transition: background-color .15s;
}
.proj + .proj::before { content: ""; position: absolute; top: -2px; left: 16px; right: 16px; height: 1px; background: var(--line); }
.proj:hover, .proj:focus-within, .proj.is-open { background: var(--hover); }
.proj:hover::before, .proj:hover + .proj::before, .proj.is-open::before, .proj.is-open + .proj::before { opacity: 0; }
.proj.is-open { background: var(--surface); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
.proj-main { min-width: 0; cursor: pointer; border-radius: 8px; }
.proj-main:focus-visible { outline-offset: 6px; }

.proj-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.proj-name { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.proj.is-pinned .proj-name::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 0 3px 8px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.machine { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px 0 6px; border-radius: 6px; font-size: 12px; font-weight: 500; }
.machine .i { width: 13px; height: 13px; }
.machine.mac { background: var(--c-gray-bg); color: var(--text-2); }
.machine.win { background: var(--c-blue-bg); color: var(--c-blue); }
.phase { height: 22px; padding: 0 8px; border-radius: 6px; background: var(--c-purple-bg); color: var(--c-purple); font-size: 12px; font-weight: 500; line-height: 22px; }
.proj-desc { margin: 6px 0 0; max-width: 72ch; color: var(--text-2); font-size: 14.5px; line-height: 1.55; }
.proj:not(.is-open) .proj-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.pbar { display: flex; align-items: center; gap: 14px; max-width: 640px; margin-top: 14px; }
.pbar-track { position: relative; flex: 1; height: 8px; border-radius: 999px; background: var(--press); overflow: hidden; }
.pbar-fill { position: absolute; inset: 0 auto 0 0; width: var(--p); border-radius: inherit; background: var(--accent); transform-origin: left; animation: pbar-grow .9s var(--ease) both; }
.pbar.high .pbar-fill { background: color-mix(in srgb, var(--accent) 55%, var(--done)); }
.pbar.full .pbar-fill { background: var(--done); }
.pbar.unknown .pbar-track { background: repeating-linear-gradient(-45deg, var(--press) 0 6px, transparent 6px 12px); }
.pbar-num { min-width: 52px; font-size: 18px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; text-align: right; }
.pbar-num small { margin-left: 2px; font-size: 12px; font-weight: 500; color: var(--muted); }
.pbar.full .pbar-num { color: var(--done); }
.pbar.unknown .pbar-num { color: var(--faint); }
@keyframes pbar-grow { from { transform: scaleX(0); } }

.proj-next, .proj-goal { margin: 10px 0 0; max-width: 72ch; font-size: 14px; line-height: 1.5; color: var(--text); }
.proj-next b, .proj-goal b { margin-right: 8px; font-size: 12px; font-weight: 600; color: var(--c-purple); }
.proj-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.proj-meta time:first-child { color: var(--text-2); font-weight: 500; }
.proj-folder { display: inline-flex; align-items: center; gap: 5px; }
.proj-folder .i { width: 14px; height: 14px; }

.proj-details { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); cursor: auto; animation: fresh-in .25s var(--ease); }
.proj-goal { margin-top: 0; }
.proj-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 32px; margin-top: 14px; }
.proj-cols h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.plist { list-style: none; margin: 0; padding: 0; font-size: 14px; line-height: 1.5; }
.plist li { display: flex; gap: 9px; padding: 3px 0; }
.plist .i { width: 16px; height: 16px; margin-top: 2px; }
.plist.done .i { color: var(--done); }
.plist.done li { color: var(--text-2); }
.plist.todo .i { color: var(--faint); }
.proj-path { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 16px; }
.proj-path code { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.proj-warn { font-size: 12.5px; color: var(--danger); }
@keyframes fresh-in { from { opacity: 0; transform: translateY(-4px); } }

.proj-actions { align-self: start; }
.proj:hover .act, .proj:focus-within .act, .proj.is-open .act { opacity: 1; }

.empty .cmd { display: block; width: fit-content; max-width: 100%; margin: 16px auto 0; padding: 10px 14px; border-radius: 8px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font-size: 13px; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .mode-projects .filters { margin-left: 0; flex-wrap: nowrap; overflow-x: auto; }
  .proj { grid-template-columns: 1fr; margin: 0 -8px; padding: 16px 8px; }
  .proj-actions { position: absolute; top: 10px; right: 4px; }
  .proj-head { padding-right: 104px; }
  .pbar-num { min-width: 44px; font-size: 16px; }
}
