/* Helios: calm, dark-first, one warm signature (the logo's sunrise).
   Hairlines instead of boxes, glass only on floating chrome, metadata that
   stays quiet until it has something to say. */

:root {
  /* Old names the calendar stylesheet still uses. */
  --border: var(--line);
  --pill: var(--surface-2);
  --radius: var(--r-sm);
  --bg: #f6f6f9;
  --surface: #ffffff;
  --surface-2: #f0f0f5;
  --hover: rgb(18 20 40 / .04);
  --line: rgb(18 20 40 / .08);
  --line-strong: rgb(18 20 40 / .15);
  --text: #12131c;
  --muted: #646778;
  --faint: #9a9cab;
  --accent: #5457f0;
  --accent-soft: rgb(84 87 240 / .1);
  --accent-text: #ffffff;
  --good: #16935a;
  --warn: #b86e00;
  --bad: #d63f33;
  --glass: rgb(255 255 255 / .72);
  --shadow: 0 1px 2px rgb(18 20 40 / .04), 0 4px 16px rgb(18 20 40 / .06);
  --shadow-lift: 0 2px 4px rgb(18 20 40 / .05), 0 12px 32px rgb(18 20 40 / .1);
  --sunrise: linear-gradient(100deg, #ffb35c 0%, #ff6a5c 55%, #8a5cff 100%);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0c14;
    --surface: #12141e;
    --surface-2: #1a1c28;
    --hover: rgb(255 255 255 / .04);
    --line: rgb(255 255 255 / .07);
    --line-strong: rgb(255 255 255 / .14);
    --text: #ecedf3;
    --muted: #9194a7;
    --faint: #5f6275;
    --accent: #8e90ff;
    --accent-soft: rgb(142 144 255 / .14);
    --accent-text: #0b0c14;
    --good: #4fcf8f;
    --warn: #f2b54e;
    --bad: #ff7b6c;
    --glass: rgb(18 20 30 / .7);
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .25);
    --shadow-lift: 0 2px 6px rgb(0 0 0 / .35), 0 16px 40px rgb(0 0 0 / .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: 26px; letter-spacing: -.025em; }
h2 { font-size: 15px; }
a { color: inherit; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ── controls ── */
button, input, select, textarea {
  font: inherit; color: inherit;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 7px 11px;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
button { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 550; white-space: nowrap; }
button:hover { background: var(--hover); }
button:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: default; transform: none; }
button.primary { background: var(--text); border-color: transparent; color: var(--bg); }
button.primary:hover { background: var(--text); opacity: .88; }
button.accent { background: var(--accent); border-color: transparent; color: var(--accent-text); }
button.quiet { border-color: transparent; background: transparent; color: var(--muted); }
button.quiet:hover { background: var(--hover); color: var(--text); }
button.icon { padding: 7px; border-color: transparent; background: transparent; color: var(--muted); border-radius: 999px; }
button.icon:hover { background: var(--hover); color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent);
}
label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 550; }
label > input, label > select, label > textarea { color: var(--text); font-size: 14px; font-weight: 400; }

/* ── header ── */
.top {
  position: sticky; top: 0; z-index: 4;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 24px;
  background: var(--glass);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 15px; letter-spacing: -.01em; text-decoration: none; }
.brand img { width: 24px; height: 24px; border-radius: 7px; }
.top nav { display: flex; gap: 4px; align-items: center; }
.top nav form { margin: 0; }
.top nav .primary { margin-right: 6px; padding: 6px 12px 6px 9px; border-radius: 999px; }

main { max-width: 1120px; margin: 0 auto; padding: 32px 24px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }

/* ── summary chips ── */
.summary { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: 12.5px; font-weight: 550; white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.chip.bad, .chip.bad b { color: var(--bad); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.active, .dot.doing { background: var(--accent); }
.dot.planning { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); }
.dot.on_hold, .dot.waiting { background: var(--warn); }
.dot.done, .dot.sent { background: var(--good); }
.dot.todo { background: transparent; box-shadow: inset 0 0 0 1.5px var(--faint); }
.dot.bad, .dot.failed { background: var(--bad); }
.dot.pending, .dot.approved, .dot.sending { background: var(--warn); }
.late { color: var(--bad) !important; }

/* ── avatars ── */
.av {
  --h: 230;
  display: inline-grid; place-items: center; flex: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: hsl(var(--h) 70% 92%); color: hsl(var(--h) 45% 32%);
  font-size: 9.5px; font-weight: 700; letter-spacing: .02em;
}
@media (prefers-color-scheme: dark) { .av { background: hsl(var(--h) 35% 24%); color: hsl(var(--h) 70% 82%); } }
.av.lg { width: 32px; height: 32px; font-size: 12px; }
.av.empty { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); color: var(--faint); }

/* ── project cards ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card {
  display: grid; gap: 12px; align-content: start;
  padding: 16px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--line-strong); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.card-top .state { display: inline-flex; align-items: center; gap: 6px; font-weight: 550; }
.card-name { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .progress { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { flex: 1; height: 4px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--sunrise); border-radius: 99px; transition: width .6s var(--ease); }
.bar.complete i { background: var(--good); }
.next { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.next .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.next.empty { color: var(--faint); }
.card-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.card-foot .chip, .summary .chip { display: inline-flex; width: auto; padding: 3px 10px; }  /* calendar.css has its own .chip */
.card-foot .owner { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; }
.card.done { opacity: .55; }
.card.other { background: transparent; box-shadow: none; border-style: dashed; }
.empty-state { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty-state b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

details.fold { margin-top: 20px; }
details.fold > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 13px; font-weight: 550; padding: 4px 8px; margin-left: -8px; border-radius: var(--r-sm);
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary:hover { background: var(--hover); color: var(--text); }
details.fold > summary svg { transition: transform .2s var(--ease); }
details.fold[open] > summary svg { transform: rotate(90deg); }
details.fold > .grid, details.fold > .recent { margin-top: 10px; }

/* ── outbox ── */
.outbox { margin-bottom: 36px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.section-head .count { background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
@media (prefers-color-scheme: dark) { .section-head .count { color: #1a1205; } }
.drafts { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.draft {
  display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.draft-to { display: flex; gap: 10px; align-items: center; min-width: 0; }
.draft-to .who { min-width: 0; flex: 1; }
.draft-to .who b { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-to .who span { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-to time { color: var(--faint); font-size: 12px; white-space: nowrap; }
.draft textarea {
  width: 100%; resize: none; overflow: hidden;
  border: 1px solid transparent; border-radius: 18px 18px 6px 18px;
  background: var(--accent-soft); padding: 10px 14px; line-height: 1.45;
}
.draft textarea:hover { border-color: var(--line-strong); }
.draft .why { display: flex; gap: 6px; align-items: flex-start; margin: 0; color: var(--muted); font-size: 12.5px; }
.draft .why svg { width: 14px; height: 14px; margin-top: 2px; color: var(--accent); }
.draft .actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: auto; }
.draft .actions button { border-radius: 999px; padding: 6px 14px; }

.recent { list-style: none; margin: 0; padding: 4px; display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.recent li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; font-size: 13px; border-radius: var(--r-sm); min-width: 0; }
.recent li + li { border-top: 1px solid var(--line); border-radius: 0; }
.recent .to { font-weight: 600; white-space: nowrap; }
.recent .t { flex: 1; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .state { font-size: 12px; color: var(--faint); white-space: nowrap; }
.recent .state.failed { color: var(--bad); }

/* ── project detail ── */
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 550; padding: 4px 8px 4px 4px; margin-left: -4px; border-radius: var(--r-sm); }
.crumb:hover { background: var(--hover); color: var(--text); }
.detail-head { display: grid; gap: 4px; margin: 14px 0 22px; }
.detail-head .title {
  font-size: 28px; font-weight: 700; letter-spacing: -.025em; line-height: 1.2;
  border-color: transparent; background: transparent; padding: 2px 6px; margin-left: -7px; width: 100%;
}
.detail-head .description {
  width: 100%; resize: none; overflow: hidden; color: var(--muted); font-size: 14.5px;
  border-color: transparent; background: transparent; padding: 4px 6px; margin-left: -7px; line-height: 1.5;
}
.detail-head .title:hover, .detail-head .description:hover { background: var(--hover); }
.detail-head .title:focus, .detail-head .description:focus { background: var(--surface); }
.meta-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.meta-row .ring { margin-left: auto; }

/* A native control dressed as a chip: the select or date input still does the work. */
.pick {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text);
  font-size: 12.5px; font-weight: 550; white-space: nowrap; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, border-color .15s, opacity .15s;
}
.pick:hover { border-color: var(--line-strong); }
.pick:focus-within { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
.pick > select, .pick > input {
  position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer;
  border: 0; padding: 0; font-size: 16px; /* no iOS zoom */
}
.pick > select:focus-visible, .pick > input:focus-visible { box-shadow: none; }
.pick .lead { display: inline-flex; }
.pick .lbl { overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.pick.placeholder { color: var(--faint); background: transparent; border-color: var(--line); border-style: dashed; }
.pick.p1 { color: var(--bad); }
.pick.p2 { color: var(--warn); }
.pick svg.i { width: 14px; height: 14px; }

.ring { --p: 0; display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 550; font-variant-numeric: tabular-nums; }
.ring i {
  width: 22px; height: 22px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0);
  -webkit-mask: radial-gradient(circle, transparent 6.5px, #000 7px); mask: radial-gradient(circle, transparent 6.5px, #000 7px);
}
.ring.complete i { background: var(--good); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 10px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button:hover { background: transparent; color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
@media (prefers-color-scheme: dark) { .seg button.on { background: #2a2c3b; } }
.seg .count { color: var(--faint); font-weight: 550; font-variant-numeric: tabular-nums; }
.seg button.drop { outline: 2px dashed var(--accent); outline-offset: -2px; color: var(--text); }
.switch { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; font-weight: 550; }
.switch input { appearance: none; -webkit-appearance: none; width: 30px; height: 18px; padding: 0; border: 0; border-radius: 99px; background: var(--line-strong); position: relative; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(12px); }

/* composer: one line; details appear once you start typing */
.add-task {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px 6px 6px 12px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.add-task:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.add-task > svg { color: var(--faint); }
.add-task input[name=title] { flex: 1 1 220px; border: 0; background: transparent; padding: 6px 4px; font-size: 14.5px; }
.add-task input[name=title]:focus-visible { box-shadow: none; }
.add-task .extras { display: flex; gap: 4px; flex-wrap: wrap; }
.add-task .extras input.section { height: 28px; width: 120px; border-radius: 999px; font-size: 12.5px; padding: 0 10px; border: 1px dashed var(--line); background: transparent; }
.add-task button[type=submit] { border-radius: 9px; padding: 6px 12px; }

.tasks { display: grid; gap: 18px; }
.group-head { display: flex; align-items: center; gap: 8px; padding: 0 4px 6px 10px; font-size: 12.5px; font-weight: 650; color: var(--muted); }
.group-head .count { color: var(--faint); font-weight: 550; }
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 4px; box-shadow: var(--shadow); }
.task {
  display: flex; align-items: center; gap: 4px; min-height: 42px;
  padding: 3px 6px 3px 2px; border-radius: 10px; position: relative;
  transition: background .12s;
}
.task + .task::before { content: ""; position: absolute; top: 0; left: 40px; right: 10px; border-top: 1px solid var(--line); }
.task:hover, .task:focus-within { background: var(--hover); }
.task:hover::before, .task:hover + .task::before, .task:focus-within::before, .task:focus-within + .task::before { opacity: 0; }
.grip { width: 14px; color: var(--faint); cursor: grab; user-select: none; display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.grip svg.i { width: 12px; height: 12px; }
.task:hover .grip { opacity: 1; }
.check {
  appearance: none; -webkit-appearance: none; flex: none; cursor: pointer;
  width: 18px; height: 18px; margin: 0 6px 0 2px; padding: 0;
  border: 1.5px solid var(--line-strong); border-radius: 50%; background: transparent;
  display: grid; place-items: center; transition: background .2s var(--ease), border-color .2s;
}
.check:hover { border-color: var(--good); }
.check:checked { background: var(--good); border-color: var(--good); }
.check:checked::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); animation: pop .25s var(--ease); }
.task .task-title { flex: 1; min-width: 80px; border-color: transparent; background: transparent; padding: 6px; font-size: 14px; }
.task .task-title:focus { background: var(--surface); border-color: var(--line-strong); }
.task.is-done .task-title { text-decoration: line-through; color: var(--faint); }
.task .chips { display: flex; gap: 4px; align-items: center; }
.task .pick { background: transparent; }
/* fixed slots, so chips line up down the list */
.task .chips > .pick:nth-child(1) { width: 92px; }
.task .chips > .pick:nth-child(2) { width: 116px; }
.task .chips > .pick:nth-child(3) { width: 96px; }
.task .chips > .pick:nth-child(4) { width: 90px; }
.task .pick:hover { background: var(--surface-2); }
.task .pick.quiet { opacity: 0; }
.task:hover .pick.quiet, .task:focus-within .pick.quiet { opacity: 1; }
.task .pick.status .lbl { color: var(--muted); }
.task .more { opacity: 0; }
.task:hover .more, .task:focus-within .more, .task .more:focus-visible { opacity: 1; }
.task.dragging { opacity: .4; }

/* ── dialogs ── */
dialog {
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--text);
  padding: 22px; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-lift);
}
dialog[open] { animation: rise .28s var(--ease); }
dialog::backdrop { background: rgb(6 7 14 / .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
dialog form { display: grid; gap: 14px; }
dialog h2 { font-size: 18px; }
dialog .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
dialog .grid3 select, dialog .grid3 input { width: 100%; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.actions button { border-radius: 999px; padding: 7px 16px; }
.person-form { display: flex; gap: 6px; flex-wrap: wrap; }
.person-form input { flex: 1 1 130px; min-width: 0; }
.people { list-style: none; padding: 0; margin: 14px -8px 0; max-height: 52vh; overflow: auto; }
.people li { display: flex; gap: 10px; padding: 8px; border-radius: 10px; align-items: center; }
.people li:hover { background: var(--hover); }
.people li > div { flex: 1; min-width: 0; }
.people .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people li button { opacity: 0; }
.people li:hover button, .people li button:focus-visible { opacity: 1; }

#toast {
  position: fixed; bottom: 20px; left: 50%; z-index: 9; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 999px; margin: 0;
  font-size: 13px; font-weight: 550; box-shadow: var(--shadow-lift);
  animation: toast .35s var(--ease);
}

/* ── chat ── */
body.has-chat main { padding-bottom: 120px; }
.chat { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; pointer-events: none; display: grid; justify-items: center; padding: 0 16px 18px; gap: 10px; }
.chat > * { pointer-events: auto; width: min(720px, 100%); }
.chat-bar {
  display: flex; gap: 8px; align-items: flex-end;
  background: var(--glass); backdrop-filter: saturate(1.8) blur(24px); -webkit-backdrop-filter: saturate(1.8) blur(24px);
  border: 1px solid var(--line-strong); border-radius: 24px; padding: 6px 6px 6px 14px;
  box-shadow: var(--shadow-lift); transition: border-color .2s, box-shadow .2s;
}
.chat-bar:focus-within { border-color: var(--accent); box-shadow: var(--shadow-lift), 0 0 0 3px var(--accent-soft); }
.chat-bar > .spark { align-self: center; width: 18px; height: 18px; flex: none; color: #ff7a5c; }
.chat-bar textarea { flex: 1; resize: none; border: 0; background: transparent; font-size: 15px; overflow-y: auto; max-height: 160px; padding: 7px 4px; line-height: 1.4; }
.chat-bar textarea:focus-visible { box-shadow: none; }
.chat-bar kbd { align-self: center; font: 600 11px/1 inherit; color: var(--faint); border: 1px solid var(--line-strong); border-radius: 5px; padding: 3px 5px; }
.chat-bar:focus-within kbd { display: none; }
.chat-bar .send { width: 34px; height: 34px; padding: 0; border-radius: 50%; }
.chat-panel {
  background: var(--glass); backdrop-filter: saturate(1.8) blur(24px); -webkit-backdrop-filter: saturate(1.8) blur(24px);
  border: 1px solid var(--line-strong); border-radius: 22px; box-shadow: var(--shadow-lift);
  display: grid; grid-template-rows: auto 1fr; max-height: min(62vh, 600px); overflow: hidden;
  animation: rise .3s var(--ease);
}
.chat-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); }
.chat-head b { margin-right: auto; display: flex; align-items: center; gap: 8px; }
.chat-head b img { width: 18px; height: 18px; border-radius: 5px; }
.chat-log { overflow-y: auto; padding: 16px; display: grid; gap: 12px; align-content: start; min-height: 140px; }
.chat-empty { display: grid; gap: 12px; justify-items: start; color: var(--muted); font-size: 13.5px; }
.chat-empty p { margin: 0; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.suggest button { border-radius: 999px; font-size: 13px; font-weight: 500; padding: 6px 12px; background: var(--surface); border-color: var(--line-strong); }
.bubble { padding: 9px 13px; border-radius: 18px; overflow-wrap: anywhere; max-width: 85%; font-size: 14px; line-height: 1.5; animation: rise .25s var(--ease); }
.bubble.user { justify-self: end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.bubble.assistant { justify-self: start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble p { margin: 0; }
.bubble p + p, .bubble p + ul, .bubble ul + p, .bubble p + ol, .bubble ol + p { margin-top: 8px; }
.bubble ul, .bubble ol { margin: 0; padding-left: 20px; }
.bubble li + li { margin-top: 2px; }
.bubble code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.bubble a { color: var(--accent); }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
.steps-used { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.steps-used span { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 2px 8px; border-radius: 99px; }
.steps-used span.failed { color: var(--bad); }
body.has-chat #toast { bottom: 92px; }
body.chat-open #toast { bottom: calc(min(62vh, 600px) + 100px); }

/* ── login ── */
body.login {
  display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; overflow: hidden;
  background: radial-gradient(60% 50% at 50% 0%, rgb(255 106 92 / .18), transparent 70%),
              radial-gradient(50% 50% at 80% 100%, rgb(138 92 255 / .16), transparent 70%), var(--bg);
}
.login-box { display: grid; justify-items: center; gap: 6px; width: min(340px, calc(100vw - 32px)); text-align: center; animation: rise .5s var(--ease); }
.login-box img { width: 76px; height: 76px; border-radius: 20px; margin-bottom: 14px; box-shadow: 0 12px 40px rgb(255 106 92 / .3); }
.login-box h1 { font-size: 30px; }
.login-box p { margin: 0 0 22px; color: var(--muted); }
.login-box a.button {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  text-decoration: none; padding: 11px 16px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-weight: 600; transition: transform .1s, opacity .15s;
}
.login-box a.button:hover { opacity: .9; }
.login-box a.button:active { transform: scale(.98); }
.login-box a.button svg { width: 18px; height: 18px; }
.login-box .error { color: var(--bad); margin: 0 0 10px; }

/* ── motion ── */
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes pop { from { transform: translateY(-1px) rotate(45deg) scale(.3); } to { transform: translateY(-1px) rotate(45deg) scale(1); } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
main.enter > * { animation: rise .4s var(--ease) both; }
main.enter > *:nth-child(2) { animation-delay: .03s; }
main.enter > *:nth-child(3) { animation-delay: .06s; }
main.enter > *:nth-child(4) { animation-delay: .09s; }
main.enter > *:nth-child(n+5) { animation-delay: .12s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Touch screens have no hover: empty fields stay out of the way, and ⋯ opens them all. */
@media (hover: none) {
  .task .pick.quiet { display: none; }
  .task .more { opacity: 1; }
  .people li button { opacity: 1; }
}

/* ── small screens ── */
@media (max-width: 860px) {
  .chat { padding: 0 10px 10px; }
  body.chat-open .chat { top: 0; padding-top: 10px; grid-template-rows: 1fr auto; background: var(--bg); }
  body.chat-open .chat-panel { max-height: none; height: 100%; }
  body.chat-open #toast { bottom: 92px; }
  .chat-bar kbd { display: none; }
}
@media (max-width: 640px) {
  main { padding: 20px 16px 40px; }
  .top { padding: 8px 12px; }
  .top nav .primary .lbl { display: none; }
  .top nav .primary { padding: 7px; margin-right: 2px; }
  h1 { font-size: 23px; }
  .detail-head .title { font-size: 23px; }
  .grid, .drafts { grid-template-columns: 1fr; }
  .task { flex-wrap: wrap; padding: 6px 6px 8px 2px; }
  .task .task-title { flex-basis: calc(100% - 60px); }
  .task .chips { width: 100%; padding-left: 32px; flex-wrap: wrap; gap: 0; }
  .task .pick { padding: 0 7px; }
  .add-task:not(.filled):not(:focus-within) .extras,
  .add-task:not(.filled) button[type=submit] { display: none; }
  .task .chips > .pick:nth-child(n) { width: auto; }
  .grip { display: none; }
  .task .more { position: absolute; top: 5px; right: 4px; }
  .task .task-title { margin-right: 30px; }
  .task + .task::before { left: 10px; }
  .recent .t { display: none; }
  dialog .grid3 { grid-template-columns: 1fr; }
  .meta-row .ring { margin-left: 0; }
}

/* Why a task exists, shown when you hover its name. */
.why { position: fixed; z-index: 50; width: min(440px, calc(100vw - 16px)); max-height: 60vh; overflow: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r);
  box-shadow: 0 12px 32px rgb(0 0 0 / .18); padding: 12px 14px; font-size: 13px; line-height: 1.45; pointer-events: none; }
.why[hidden] { display: none; }
.why p { margin: 0; white-space: pre-wrap; }
.why blockquote { margin: 10px 0 0; padding: 2px 0 2px 10px; border-left: 3px solid var(--line-strong); color: var(--muted); white-space: pre-wrap; }
.why .meta { margin-top: 10px; font-size: 12px; color: var(--muted); }

/* ── workspaces ── */
.ws { position: relative; }
.ws-button {
  display: inline-flex; align-items: center; gap: 7px; max-width: 220px;
  padding: 5px 8px 5px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  font-size: 13px; font-weight: 600;
}
.ws-button:hover { border-color: var(--line-strong); }
.ws-button .ws-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-button .i { width: 14px; height: 14px; color: var(--muted); flex: none; }
.ws-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; background: var(--accent); }
.ws-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 8; min-width: 220px;
  display: grid; gap: 1px; padding: 5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lift);
  animation: rise .18s var(--ease);
}
.ws-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  justify-content: flex-start; padding: 7px 9px; border-radius: 9px; background: none; border: 0; color: var(--text); font-size: 13.5px;
}
.ws-menu button:hover, .ws-menu button:focus-visible { background: var(--hover); outline: none; }
.ws-menu button.on { font-weight: 650; }
.ws-menu button.on::after { content: "✓"; margin-left: auto; color: var(--accent); }
.ws-menu button.on kbd { display: none; }
.ws-menu .ws-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-menu kbd { margin-left: auto; color: var(--muted); font-size: 11px; font-family: inherit; }
.ws-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.ws-help { font-size: 13px; margin: -6px 0 6px; }
.workspaces { list-style: none; padding: 0; margin: 8px 0 14px; display: grid; gap: 6px; }
.workspaces li { display: flex; align-items: center; gap: 8px; }
.workspaces li input:not(.swatch) { flex: 1; min-width: 0; }
.workspaces li > button { flex: none; }
.ws-current { flex: none; padding: 0 12px; color: var(--muted); font-size: 12.5px; font-weight: 550; }
.swatch, .person-form .swatch { width: 34px; height: 34px; padding: 3px; border-radius: 10px; flex: none; cursor: pointer; }
.pick.ws-pick .lead { display: inline-flex; }
@media (max-width: 640px) {
  .brand span { display: none; }
  .top .left { gap: 8px; }
  .ws-button { max-width: 130px; }
}
/* Phones: the colour says which workspace; the menu names them. */
@media (max-width: 480px) {
  .ws-button { padding: 7px 6px 7px 9px; gap: 4px; }
  .ws-button .ws-name { display: none; }
  .ws-button .ws-dot { width: 11px; height: 11px; }
}

/* ── suggested tasks (the intake queue) ── */
.nav-count { margin-left: 6px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: var(--accent-text);
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 17px; display: inline-block; }
.nav-count[hidden] { display: none; }
.toast-action { margin-left: 12px; padding: 2px 10px; border: 0; border-radius: 99px; background: rgb(127 127 127 / .25); color: inherit; font-size: 12.5px; }
.toast-action:hover { background: rgb(127 127 127 / .4); }

.suggest-banner {
  display: flex; align-items: center; gap: 12px; margin: 0 0 24px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  text-decoration: none; color: var(--muted); transition: border-color .15s, box-shadow .15s;
}
.suggest-banner:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.suggest-banner b { color: var(--text); font-weight: 650; }
.suggest-banner .t { flex: 1; min-width: 0; }
.suggest-banner .go { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-weight: 600; font-size: 13px; }
.spark-badge { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--sunrise); color: #fff; }
.spark-badge svg.i { width: 16px; height: 16px; }
.detail-head + .suggest-banner, .toolbar ~ .suggest-banner { margin-bottom: 16px; }
.chip.suggested { color: var(--accent); background: var(--accent-soft); }
.chip.suggested svg.i { width: 12px; height: 12px; }

.bulk-bar {
  position: sticky; top: 58px; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 16px; padding: 8px 8px 8px 14px;
  background: var(--glass); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
}
.select-all { display: inline-flex; flex-direction: row; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); cursor: pointer; }
.bulk-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bulk-actions button { border-radius: 999px; padding: 6px 14px; }
.bulk-actions .pick.move { border: 1px solid var(--line); border-radius: 999px; }
.pick-box { width: 16px; height: 16px; margin: 0; padding: 0; flex: none; accent-color: var(--accent); cursor: pointer; }

.suggest-group .group-head { padding-left: 14px; }
.suggest-group .group-head a { color: var(--text); text-decoration: none; }
.suggest-group .group-head a:hover { text-decoration: underline; }
.group-head .spacer { flex: 1; }
button.small { padding: 4px 11px; font-size: 12.5px; border-radius: 999px; }
button.approve-all { color: var(--good); border-color: var(--line); background: var(--surface); }
button.approve-all svg.i, .bulk-actions .accent svg.i { width: 14px; height: 14px; }

.task.suggestion { align-items: flex-start; padding: 8px 6px 8px 12px; gap: 10px; outline: none; }
.task.suggestion > .pick-box { margin-top: 10px; }
.task.suggestion + .task.suggestion::before { left: 38px; }
.task.suggestion:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.task.suggestion.picked { background: var(--accent-soft); }
.s-body { flex: 1; min-width: 0; }
.s-body .task-title { width: 100%; font-weight: 550; }
.s-why { margin: 0 6px; color: var(--muted); font-size: 12.5px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.s-meta { display: flex; gap: 5px; align-items: center; margin: 4px 6px 0; color: var(--faint); font-size: 12px; }
.s-meta svg.i { width: 12px; height: 12px; color: var(--accent); flex: none; }
.task.suggestion .chips { margin-top: 3px; }
.task.suggestion .chips > .pick:nth-child(1) { width: 150px; }
.task.suggestion .chips > .pick:nth-child(2) { width: 92px; }
.task.suggestion .chips > .pick:nth-child(3) { width: 104px; }
.task.suggestion .chips > .pick:nth-child(4) { width: 96px; }
.task.suggestion .pick.project .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-actions { display: flex; gap: 2px; margin-top: 3px; }
.s-actions .approve { color: var(--good); }
.s-actions .approve:hover { background: rgb(22 147 90 / .12); color: var(--good); }
.s-actions .dismiss:hover { color: var(--bad); }
.keys { margin-top: 18px; font-size: 12px; text-align: center; }
.keys kbd { font: inherit; font-size: 11px; padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 4px; margin: 0 1px; }
@media (hover: none) { .keys { display: none; } }
.suggest-group .group-head a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) {
  .task.suggestion { flex-wrap: wrap; }
  .task.suggestion .s-body { flex: 1 1 0; }
  .task.suggestion .chips { order: 3; width: 100%; padding-left: 22px; flex-wrap: wrap; gap: 0; }
  .task.suggestion .chips > .pick:nth-child(n) { width: auto; }
}
@media (max-width: 640px) {
  /* Phone header: logo only, and the section tabs scroll rather than slide under the buttons. */
  header.top .left { gap: 8px; flex: 1; min-width: 0; }
  header.top .brand { font-size: 0; gap: 0; flex: none; }
  .top .sections { overflow-x: auto; min-width: 0; scrollbar-width: none; }
  .top .sections::-webkit-scrollbar { display: none; }
  .top .sections a { padding: 5px 6px; }
  .top .sections a[data-section=suggested] { display: none; }  /* the Projects page banner leads there */
  .suggest-group .group-head .quiet { display: none; }
  .bulk-bar { top: 52px; }
  .bulk-actions { width: 100%; }
  .bulk-actions .accent { margin-left: auto; }
}

/* ── Settings (settings.js) ── */
a.button-icon { display: inline-flex; padding: 7px; border-radius: 999px; color: var(--muted); }
a.button-icon:hover { background: var(--surface-2); color: var(--text); }
.settings { max-width: 760px; margin: 0 auto; padding: 8px 0 48px; }
.settings h1 { font-size: 22px; margin: 8px 0 16px; }
.settings-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; }
.settings-card h2 { font-size: 15px; margin: 0 0 8px; }
.settings-list { list-style: none; margin: 8px 0; padding: 0; }
.settings-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.settings-list li:first-child { border-top: 0; }
.settings-token { background: var(--surface-2); border-radius: 10px; padding: 12px; margin: 8px 0; }
.settings-token code { display: block; word-break: break-all; margin: 6px 0; font-size: 12.5px; }
.settings-legal { text-align: center; }
button.danger { color: #fff; background: #d92d20; border-color: #d92d20; }
