/* Planar app styles. Every color, size and font comes from design/tokens.css.
   Layout: day strip on top · rail · page (list + detail) · assistant. */

@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jbm-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jbm-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jbm-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--wall); color: var(--fg); font-family: var(--font-ui); font-size: var(--fs-body); line-height: var(--lh); -webkit-font-smoothing: antialiased; }
[x-cloak] { display: none !important; }
a { color: inherit; }
a.plain { text-decoration: none; }
a.plain:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
:focus-visible { outline: var(--bar) solid var(--accent); outline-offset: var(--s-1); }
.sr-only { position: absolute; width: var(--hair); height: var(--hair); overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s-4); top: calc(-1 * var(--h-strip)); z-index: 60; background: var(--accent); color: var(--on); padding: var(--s-3) var(--s-6); border-radius: var(--r-2); text-decoration: none; }
.skip:focus { top: var(--s-4); }
.mono { font-family: var(--font-mono); }
.meta { color: var(--muted); font-size: var(--fs-small); }
.muted { color: var(--muted); }
.ok { color: var(--status-ok); }
.late { color: var(--status-late); }
.warn { color: var(--status-due); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.row.tight { gap: var(--s-3); }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
.empty { color: var(--muted); font-size: var(--fs-small); padding: var(--s-6) var(--s-9); }
.empty-state { margin: auto; max-width: calc(var(--w-list) * 0.8); text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: var(--s-4); align-items: center; padding: var(--s-10); }
.empty-state b { color: var(--fg2); font-family: var(--font-mono); font-size: var(--fs-lead); }
.ico { width: calc(var(--s-9) - var(--s-1)); height: calc(var(--s-9) - var(--s-1)); flex: none; }
.ico.sm { width: var(--s-8); height: var(--s-8); }

/* ---------- shell ---------- */
.app {
  height: 100vh; height: 100dvh; padding: var(--gap); gap: var(--gap);
  display: grid; grid-template-columns: var(--w-rail) minmax(0, 1fr) var(--agent-w); grid-template-rows: var(--h-strip) minmax(0, 1fr);
  grid-template-areas: "strip strip strip" "rail main agent";
  --agent-w: var(--w-agent-wide);
}
/* the assistant gives room to an open task, and takes more when asked */
.app:has(.page.has-detail) { --agent-w: var(--w-agent); }
.app.is-agent-wide, .app.is-agent-wide:has(.page.has-detail) { --agent-w: min(var(--w-agent-max), 46vw); }
.tile { background: var(--bg); border: var(--hair) solid var(--line); border-radius: var(--r-3); min-height: 0; min-width: 0; overflow: hidden; }
.tile.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 var(--hair) var(--accent); }
.main { grid-area: main; min-height: 0; min-width: 0; display: flex; }

/* ---------- day strip ---------- */
.strip { grid-area: strip; display: grid; grid-template-columns: var(--w-date) minmax(0, 1fr); gap: var(--s-7); padding: 0 var(--s-9) 0 var(--s-9); }
.strip-date { display: flex; flex-direction: column; justify-content: center; gap: var(--s-1); min-width: 0; }
.strip-when { display: flex; align-items: baseline; gap: var(--s-4); }
.strip-date b { font-family: var(--font-mono); font-size: var(--fs-lead); font-weight: 700; line-height: var(--lh-tight); white-space: nowrap; }
.planar .strip-accounts { min-height: var(--h-control-sm); padding: 0 var(--s-3); font-size: var(--fs-label); margin-top: var(--s-2); width: 100%; }
.strip-time { font-family: var(--font-mono); font-size: var(--fs-label); color: var(--muted); }
.legend { display: flex; gap: var(--s-5); margin-top: var(--s-2); font-size: var(--fs-micro); color: var(--muted); }
.legend i { display: inline-block; width: var(--s-5); height: var(--s-4); margin-right: var(--s-2); border-radius: var(--r-1); vertical-align: baseline; }
.legend .k-cust { background: var(--orange); }
.legend .k-team { background: var(--accent); }
.legend .k-maybe { border: var(--hair) dashed var(--muted); }
.strip-scroll { min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; display: flex; }
.strip-scroll::-webkit-scrollbar { display: none; }
.strip-axis { position: relative; flex: 1; margin: var(--s-5) 0 var(--s-4); min-width: 0; min-height: calc(var(--h-event) + var(--s-2) + var(--s-8) + var(--s-2)); }
.strip-past { position: absolute; left: 0; top: 0; bottom: calc(var(--s-8) + var(--s-1)); background: var(--past); border-radius: var(--r-2) 0 0 var(--r-2); opacity: 0.55; }
.strip-hour { position: absolute; bottom: 0; transform: translateX(-50%); font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--muted); line-height: 1; }
.strip-hour.is-past { opacity: 0.55; }
.strip-now { position: absolute; top: calc(-1 * var(--s-2)); bottom: var(--s-7); border-left: var(--bar) solid var(--red); z-index: 3; pointer-events: none; }
.strip-now::before { content: ""; position: absolute; top: calc(-1 * var(--s-2)); left: calc(-1 * var(--s-2) - var(--hair)); width: var(--s-4); height: var(--s-4); border-radius: 50%; background: var(--red); }
.strip-empty, .strip-allday { position: absolute; z-index: 2; left: 0; top: var(--s-6); font-size: var(--fs-small); color: var(--fg2); background: var(--bg); padding: 0 var(--s-3); border-radius: var(--r-2); }
.strip-allday { top: auto; bottom: calc(var(--s-8) + var(--s-4)); font-size: var(--fs-label); }
.ev {
  position: absolute; top: var(--s-2); height: var(--h-event); padding: var(--s-3) var(--s-5) var(--s-2) var(--s-6);
  display: flex; flex-direction: column; justify-content: center; gap: var(--s-1); overflow: hidden;
  border-radius: var(--r-2); background: var(--bg3); border-left: var(--edge) solid var(--accent);
  color: var(--fg); text-decoration: none; font-size: var(--fs-small); line-height: var(--lh-tight);
  transition: filter var(--t-fast), transform var(--t-fast);
}
.ev-link { position: absolute; inset: 0; z-index: 1; }
.ev-move { position: absolute; z-index: 2; right: var(--s-2); top: var(--s-2); display: none; gap: var(--s-1); }
.ev:hover .ev-move, .ev:focus-within .ev-move { display: flex; }
.ev-move button { height: var(--h-control-sm); padding: 0 var(--s-3); border: var(--hair) solid var(--green); border-radius: var(--r-2); background: var(--bg); color: var(--green); font-family: var(--font-mono); font-size: var(--fs-micro); cursor: pointer; }
.ev-move button:hover { background: color-mix(in srgb, var(--green) var(--tint), var(--bg)); }
.ev:hover { filter: brightness(1.12); z-index: 2; }
.ev small { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--muted); }
.ev span, .ev small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.cust { border-left-color: var(--orange); background: color-mix(in srgb, var(--orange) var(--tint), var(--bg)); }
.ev.focus { border-left-color: var(--green); background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--green) var(--tint), var(--bg)) 0 var(--s-3), var(--bg) var(--s-3) var(--s-5)); }
.ev.tent { background: transparent; border: var(--hair) dashed var(--border); border-left: var(--edge) dashed var(--accent); color: var(--fg2); }
.ev.tent.cust { border-left-color: var(--orange); }
.ev.past { opacity: 0.45; background: transparent; border-left-color: var(--muted); color: var(--muted); }
.ev.past span { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.ev.next { box-shadow: 0 0 0 var(--hair) var(--orange); }
.ev.next:not(.cust) { box-shadow: 0 0 0 var(--hair) var(--accent); }
.ev.next small { color: var(--orange); font-weight: 700; }
.ev.next:not(.cust) small { color: var(--accent); }
.ev.now { background: var(--accent); border-left-color: var(--on); color: var(--on); font-weight: 600; }
.ev.now.cust { background: var(--orange); }
.ev.now small { color: color-mix(in srgb, var(--on) 75%, transparent); font-weight: 500; }
.ev.now::after { content: ""; position: absolute; left: 0; bottom: 0; height: var(--s-1); width: var(--progress, 0); background: var(--on); opacity: 0.5; }

/* ---------- rail ---------- */
.rail { grid-area: rail; background: var(--bg2); display: flex; flex-direction: column; align-items: center; gap: var(--s-2); padding: var(--s-6) 0; }
.rail-logo { font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-lead); color: var(--accent); text-decoration: none; margin: var(--s-1) 0 var(--s-7); }
.rail-item {
  position: relative; width: var(--w-rail-item); height: var(--h-rail-item); border-radius: var(--r-2); border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-1);
  color: var(--muted); text-decoration: none; font-size: var(--fs-micro); cursor: pointer; transition: background var(--t-fast), color var(--t-fast);
}
.rail-item .ico { color: var(--fg2); }
.rail-item:hover { background: var(--bg3); color: var(--fg); }
.rail-item.is-on { background: var(--sel); color: var(--fg); box-shadow: inset var(--bar) 0 0 var(--accent); }
.rail-item.is-on .ico { color: var(--accent); }
.rail-badge { position: absolute; top: var(--s-2); right: var(--s-3); min-width: var(--s-8); height: var(--s-8); padding: 0 var(--s-2); border-radius: var(--s-4); background: var(--orange); color: var(--on); font: 700 var(--fs-micro) / var(--s-8) var(--font-mono); font-style: normal; text-align: center; }
.rail-items { display: contents; }
.rail-fill { flex: 1; }
.rail-agent { display: none; }

/* ---------- pages: list + detail ---------- */
.page { flex: 1; min-width: 0; min-height: 0; display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
.page.has-detail { grid-template-columns: var(--w-list) minmax(0, 1fr); }
.page > .tile { display: flex; flex-direction: column; }
.list-tile, .detail { min-height: 0; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.scroll::-webkit-scrollbar { width: var(--s-4); }
.scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--s-2); border: var(--s-1) solid var(--bg); }
.list-head { padding: var(--s-8) var(--s-9) var(--s-6); display: flex; align-items: center; gap: var(--s-7); min-height: calc(var(--h-control) + var(--s-8) + var(--s-6)); }
.list-head h1, .page-title { font-family: var(--font-mono); font-size: var(--fs-title); font-weight: 700; line-height: var(--lh-tight); white-space: nowrap; }
.list-head .meta { white-space: nowrap; }
.list-head .spacer { flex: 1; }
.list-tools { padding: 0 var(--s-7) var(--s-4); display: flex; flex-direction: column; gap: var(--s-4); }
.list-body { padding: 0 0 var(--s-8); }
/* on a wide screen a list keeps a readable width instead of stretching */
.list-tile > .list-head, .list-tile > .list-tools, .list-tile > .scroll > * { width: 100%; max-width: var(--w-read); }

/* section heading inside a list */
.sect { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); padding: var(--s-9) var(--s-9) var(--s-3); font-size: var(--fs-small); font-weight: 600; color: var(--fg2); }
.sect span:last-child { font-weight: 400; color: var(--muted); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-3); height: var(--h-control); padding: 0 var(--s-7);
  border: var(--hair) solid var(--border); border-radius: var(--r-2); background: transparent; color: var(--fg);
  font-size: var(--fs-small); font-weight: 500; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn:hover { background: var(--bg3); border-color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on); font-weight: 600; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--fg)); }
.btn.good { background: var(--green); border-color: var(--green); color: var(--on); font-weight: 600; }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.btn.danger:hover { background: color-mix(in srgb, var(--red) var(--tint), transparent); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--fg); background: var(--bg3); }
.btn.sm { height: var(--h-control-sm); padding: 0 var(--s-5); font-size: var(--fs-label); }
.btn.icon { width: var(--h-control); padding: 0; }
.btn.icon.sm { width: var(--h-control-sm); }
.btn kbd, .kbd { font-family: var(--font-mono); font-size: var(--fs-micro); color: inherit; opacity: 0.7; }

.seg { display: inline-flex; border: var(--hair) solid var(--border); border-radius: var(--r-2); overflow: hidden; flex: none; }
.seg > a, .seg > button, .seg > label { display: inline-flex; align-items: center; height: var(--h-control-sm); padding: 0 var(--s-6); font-size: var(--fs-small); color: var(--muted); text-decoration: none; background: none; border: 0; border-left: var(--hair) solid var(--border); cursor: pointer; white-space: nowrap; }
.seg > :first-child { border-left: 0; }
.seg > :hover { color: var(--fg); background: var(--bg3); }
.seg > .is-on, .seg > [aria-pressed="true"], .seg > [aria-current] { background: var(--sel); color: var(--fg); font-weight: 600; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--sel); color: var(--fg); font-weight: 600; }
.seg label:has(input:focus-visible) { outline: var(--bar) solid var(--accent); outline-offset: calc(-1 * var(--bar)); }

.input, .planar input[type=text], .planar input[type=email], .planar input[type=password], .planar input[type=number], .planar input[type=time], .planar input[type=date], .planar input[type=search], .planar input[type=url], .planar select, .planar textarea {
  width: 100%; min-height: var(--h-control); padding: var(--s-3) var(--s-6); border: var(--hair) solid var(--border); border-radius: var(--r-2);
  background: var(--bg2); color: var(--fg); font: inherit; font-size: var(--fs-body); transition: border-color var(--t-fast);
}
.planar textarea { resize: vertical; line-height: var(--lh); }
.planar input:hover, .planar select:hover, .planar textarea:hover { border-color: var(--muted); }
.planar input:focus, .planar select:focus, .planar textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 var(--hair) var(--accent); }
.planar input::placeholder, .planar textarea::placeholder { color: var(--muted); opacity: 1; }
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field > label, .field > .label { font-size: var(--fs-small); font-weight: 600; color: var(--fg2); }
.field .hint { font-size: var(--fs-label); color: var(--muted); }
.field > .seg { align-self: flex-start; }
.check { display: inline-flex; align-items: center; gap: var(--s-4); cursor: pointer; }
.check input { width: var(--size-box); height: var(--size-box); accent-color: var(--accent); margin: 0; }

/* ---------- capture prompt ---------- */
.planar-prompt { position: relative; background: var(--bg2); border: var(--hair) solid var(--line); border-radius: var(--r-2); padding: var(--s-5) var(--s-7); transition: border-color var(--t-fast); }
.planar-prompt:hover { border-color: var(--border); }
.planar-prompt.is-focused { border-color: var(--accent); box-shadow: 0 0 0 var(--hair) var(--accent); }
.prompt-field { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--s-4); }
.prompt-field .caret-sym { color: var(--muted); display: flex; padding-top: var(--s-1); }
.planar-prompt.is-focused .caret-sym { color: var(--accent); }
.prompt-stack { position: relative; min-height: calc(var(--fs-lead) * var(--lh)); }
.prompt-stack textarea, .prompt-mirror { font: inherit; font-size: var(--fs-lead); line-height: var(--lh); margin: 0; padding: 0; border: 0; white-space: pre-wrap; overflow-wrap: anywhere; width: 100%; }
.prompt-mirror { color: var(--fg); pointer-events: none; min-height: calc(var(--fs-lead) * var(--lh)); }
.prompt-mirror:empty::before, .prompt-mirror.is-empty::before { content: attr(data-placeholder); color: var(--muted); }
.planar .prompt-stack textarea { position: absolute; inset: 0; resize: none; background: transparent; color: transparent; caret-color: var(--fg); outline: none; overflow: hidden; min-height: 0; box-shadow: none; border: 0; padding: 0; }
.prompt-mirror .tok-person { color: var(--tag-person); }
.prompt-mirror .tok-project { color: var(--tag-project); }
.prompt-mirror .tok-customer { color: var(--tag-customer); }
.prompt-mirror .tok-unknown { color: var(--tag-project); text-decoration: underline dotted; }
.prompt-mirror .tok-when { color: var(--status-due); }
.prompt-mirror .tok-label { color: var(--fg2); }
.prompt-mirror .tok-priority { color: var(--status-late); font-weight: 700; }
.prompt-mirror .tok-estimate { color: var(--green); }
.prompt-mirror .tok-invalid { color: var(--status-late); }
.planar-prompt-parse { font-size: var(--fs-label); color: var(--muted); padding-left: calc(var(--s-9) - var(--s-1) + var(--s-4)); min-height: 0; }
.planar-prompt-parse:empty { display: none; }
.planar-prompt.is-focused .planar-prompt-parse:not(:empty), .planar-prompt-parse:not(:empty) { margin-top: var(--s-3); }
.planar-prompt-parse .kind { color: var(--accent); font-weight: 600; }
.planar-prompt-parse .err { color: var(--status-late); }
.suggest { position: absolute; left: calc(-1 * var(--s-7)); right: calc(-1 * var(--s-7)); top: calc(100% + var(--s-5)); z-index: 20; margin: 0; padding: var(--s-2); list-style: none; background: var(--bg); border: var(--hair) solid var(--border); border-radius: var(--r-3); box-shadow: 0 var(--s-6) var(--s-10) var(--shadow); }
.suggest li { padding: var(--s-3) var(--s-5); display: flex; justify-content: space-between; gap: var(--s-6); border-radius: var(--r-2); cursor: pointer; }
.suggest li.sel { background: var(--sel); }
.suggest .planar-tag.person { color: var(--tag-person); } .suggest .planar-tag.project { color: var(--tag-project); } .suggest .planar-tag.customer { color: var(--tag-customer); } .suggest .planar-tag.date { color: var(--status-due); }

/* ---------- rows ---------- */
.rows { display: flex; flex-direction: column; padding: 0 var(--s-4); }
.list-tile, .detail, .group { container-type: inline-size; }
/* a row reads as two lines: the title (date on its right), then what it is
   for and who it is with. No dividers: space and hover carry the rhythm. */
.planar-row {
  position: relative; display: grid; grid-template-columns: calc(var(--size-box) + var(--s-3)) minmax(0, 1fr) auto; column-gap: var(--s-6); align-items: start;
  min-height: var(--h-row); padding: var(--s-5) var(--s-6) var(--s-5); border-radius: var(--r-2); cursor: pointer; transition: background var(--t-fast);
}
.planar-row:hover { background: color-mix(in srgb, var(--sel) 55%, transparent); }
.planar-row.is-cursor, .planar-row.is-open { background: var(--sel); box-shadow: inset var(--bar) 0 0 var(--accent); }
.planar-row > .mark, .planar-row > .ini.sm { align-self: start; margin-top: calc((var(--fs-lead) * var(--lh-tight) - var(--size-box)) / 2); }
.planar-row > .ini.sm { margin-top: calc((var(--fs-lead) * var(--lh-tight) - var(--size-ini-sm)) / 2); }
.planar-row-main { min-width: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.planar-row-title { font-size: var(--fs-lead); line-height: var(--lh-tight); color: var(--fg); overflow-wrap: anywhere; }
.planar-row-sub { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); min-width: 0; font-size: var(--fs-small); line-height: var(--lh-tight); color: var(--muted); }
.planar-row-note { font-size: var(--fs-small); color: var(--muted); }
.planar-row.is-done .planar-row-title { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.planar-row-trail { display: flex; gap: var(--s-3); align-items: center; justify-content: flex-end; min-width: 0; min-height: calc(var(--fs-lead) * var(--lh-tight)); }
.planar-row-trail:empty { display: none; }
.planar-row .prio { color: var(--status-late); font-weight: 700; margin-right: var(--s-2); }
.planar-row .planar-tag.inline { color: var(--tag-project); }

/* check box / marks */
.mark { width: var(--size-box); height: var(--size-box); padding: 0; margin: 0; border: calc(var(--hair) * 1.5) solid var(--border); border-radius: var(--r-1); background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--on); transition: border-color var(--t-fast), background var(--t-fast); }
.mark:hover { border-color: var(--accent); }
.mark .ico { width: calc(var(--size-box) - var(--s-2)); height: calc(var(--size-box) - var(--s-2)); opacity: 0; stroke-width: 3; }
.mark.is-done { background: var(--green); border-color: var(--green); }
.mark.is-done .ico { opacity: 1; }
.mark.is-parked { border-style: dashed; }
.ini {
  width: var(--size-ini); height: var(--size-ini); flex: none; border-radius: var(--r-2); display: grid; place-items: center;
  font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700; background: var(--bg3); color: var(--fg); border-left: var(--edge) solid var(--muted);
}
.ini.sm { width: var(--size-ini-sm); height: var(--size-ini-sm); font-size: var(--fs-micro); border-left-width: var(--bar); border-top: var(--hair) solid var(--border); border-right: var(--hair) solid var(--border); border-bottom: var(--hair) solid var(--border); }
.ini.lg { width: var(--size-ini-lg); height: var(--size-ini-lg); font-size: var(--fs-lead); }
.ini.team { border-left-color: var(--accent); }
.ini.client { border-left-color: var(--orange); }
.ini.project { border-left-color: var(--magenta); }

/* labels (task chips) and due text */
/* a label is a small tinted box with a colored left edge: the hue says
   customer, project or person (boxes read better than dots, by use) */
.lbl { display: inline-flex; align-items: center; max-width: 18em; height: calc(var(--fs-label) * 1.75); padding: 0 var(--s-4); border-radius: var(--r-1); background: var(--bg3); color: var(--fg2); border-left: var(--bar) solid var(--muted); font-size: var(--fs-label); line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
a.lbl:hover { filter: brightness(1.15); }
.lbl.customer { background: color-mix(in srgb, var(--orange) var(--tint), var(--bg)); color: var(--orange); border-color: var(--orange); }
.lbl.project { background: color-mix(in srgb, var(--magenta) var(--tint), var(--bg)); color: var(--magenta); border-color: var(--magenta); }
.lbl.person { background: color-mix(in srgb, var(--cyan) var(--tint), var(--bg)); color: var(--cyan); border-color: var(--cyan); }
.lbl.plain { background: none; border-color: transparent; padding: 0; color: var(--muted); }
.due { font-family: var(--font-mono); font-size: var(--fs-label); color: var(--muted); white-space: nowrap; }
.due.soon { color: var(--status-due); }
.due.late { color: var(--status-late); font-weight: 700; }
.due.ok { color: var(--status-ok); }

/* grouped lists (week, projects) */
.groups { display: flex; flex-direction: column; gap: var(--s-4); padding: 0 var(--s-6) var(--s-8); }
.group { border: var(--hair) solid var(--line); border-radius: var(--r-3); overflow: hidden; }
.group-head { display: flex; align-items: center; gap: var(--s-5); padding: var(--s-4) var(--s-6); background: var(--bg2); border-bottom: var(--hair) solid var(--line); text-decoration: none; }
.group-head .sw { width: var(--s-5); height: var(--s-5); border-radius: var(--r-1); background: var(--muted); flex: none; }
.group-head .sw.customer { background: var(--orange); } .group-head .sw.project { background: var(--magenta); } .group-head .sw.person { background: var(--cyan); }
.group-head b { font-family: var(--font-mono); font-size: var(--fs-small); font-weight: 700; }
.group-head .goal { color: var(--muted); font-size: var(--fs-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.group-head .count { margin-left: auto; font-size: var(--fs-label); color: var(--muted); white-space: nowrap; }
.bar-mini { width: calc(var(--s-11) * 2.5); height: var(--s-2); border-radius: var(--r-1); background: var(--line); overflow: hidden; flex: none; }
.bar-mini i { display: block; height: 100%; background: var(--accent); }
.bar-mini.customer i { background: var(--orange); } .bar-mini.project i { background: var(--magenta); }
.group .rows { padding: 0; }
.group .planar-row { border-radius: 0; padding-left: var(--s-6); }

/* entity rows (people, projects) */
.erow { display: grid; grid-template-columns: var(--size-ini) minmax(0, 1fr) auto; gap: var(--s-6); align-items: center; }
.erow .name { font-size: var(--fs-lead); line-height: var(--lh-tight); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erow .sub { font-size: var(--fs-small); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- detail pane ---------- */
.detail { background: var(--bg); }
.tile-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.detail-top { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-7) var(--s-9) 0 var(--s-10); min-height: calc(var(--h-control) + var(--s-7)); }
.detail-top .crumb { font-size: var(--fs-small); color: var(--muted); flex: 1; min-width: 0; display: flex; gap: var(--s-4); align-items: center; }
.detail-top .saved { color: var(--status-ok); font-size: var(--fs-label); opacity: 0; transition: opacity var(--t-med); }
.detail-top .saved.is-on { opacity: 1; }
.detail-body { padding: var(--s-6) var(--s-10) var(--s-10); display: flex; flex-direction: column; gap: var(--s-9); }
.detail-foot { border-top: var(--hair) solid var(--line); padding: var(--s-6) var(--s-10); display: flex; gap: var(--s-4); align-items: center; flex-wrap: wrap; background: var(--bg); }
.detail-foot .spacer { flex: 1; }
.planar .title-input, .title-input {
  width: 100%; margin: 0 calc(-1 * var(--s-4)); width: calc(100% + var(--s-4) * 2); padding: var(--s-2) var(--s-4); border: var(--hair) solid transparent; border-radius: var(--r-2);
  background: transparent; box-shadow: none; font-family: var(--font-mono); font-size: var(--fs-title); font-weight: 700; line-height: var(--lh-tight); color: var(--fg); resize: none; overflow: hidden;
}
.planar .title-input:hover { border-color: var(--line); background: transparent; }
.planar .title-input:focus { border-color: var(--accent); background: var(--bg2); }
.head-block { display: flex; gap: var(--s-7); align-items: center; }
.head-block .grow { display: flex; flex-direction: column; gap: var(--s-2); }
.head-block h2 { font-size: var(--fs-title); font-weight: 650; letter-spacing: -0.01em; line-height: var(--lh-tight); overflow-wrap: anywhere; }
.head-block .meta { overflow-wrap: anywhere; }

.props { display: grid; grid-template-columns: var(--w-field-key) minmax(0, 1fr); gap: var(--s-5) var(--s-7); align-items: center; }
.props { align-items: start; }
.props > dt, .props > .k { font-size: var(--fs-small); color: var(--muted); line-height: var(--h-control-sm); }
.planar .props input[type=date] { width: auto; min-height: var(--h-control-sm); padding: 0 var(--s-5); font-size: var(--fs-small); }
.props > dd, .props > .v { margin: 0; display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; min-height: var(--h-control-sm); min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: var(--s-2); height: var(--h-control-sm); padding: 0 var(--s-2) 0 var(--s-5); border-radius: var(--r-2); border: var(--hair) solid var(--border); font-size: var(--fs-small); background: var(--bg2); color: var(--fg); }
.chip.customer { border-color: color-mix(in srgb, var(--orange) 55%, var(--border)); color: var(--orange); background: color-mix(in srgb, var(--orange) var(--tint), var(--bg)); }
.chip.project { border-color: color-mix(in srgb, var(--magenta) 55%, var(--border)); color: var(--magenta); background: color-mix(in srgb, var(--magenta) var(--tint), var(--bg)); }
.chip.person { border-color: color-mix(in srgb, var(--cyan) 55%, var(--border)); color: var(--cyan); background: color-mix(in srgb, var(--cyan) var(--tint), var(--bg)); }
.chip button { width: calc(var(--h-control-sm) - var(--s-3)); height: calc(var(--h-control-sm) - var(--s-3)); border: 0; background: none; padding: 0; display: grid; place-items: center; color: inherit; opacity: 0.7; cursor: pointer; border-radius: var(--r-1); }
.chip button:hover { opacity: 1; background: color-mix(in srgb, currentColor 15%, transparent); }
.chip button .ico { width: var(--s-7); height: var(--s-7); }
.chip.static { padding-right: var(--s-5); }
.chip a { text-decoration: none; color: inherit; }
.chip a:hover { text-decoration: underline; }
@container (max-width: 34em) {
  .props { grid-template-columns: minmax(0, 1fr); gap: var(--s-2); }
  .props > dd { margin-bottom: var(--s-4); }
}
.adder { position: relative; }
.adder > button { height: var(--h-control-sm); padding: 0 var(--s-5); border: var(--hair) dashed var(--border); border-radius: var(--r-2); background: none; color: var(--muted); font-size: var(--fs-small); cursor: pointer; }
.adder > button:hover { color: var(--fg); border-color: var(--muted); }
.adder .pop { position: absolute; z-index: 25; top: calc(100% + var(--s-2)); left: 0; width: calc(var(--w-list) * 0.62); background: var(--bg); border: var(--hair) solid var(--border); border-radius: var(--r-3); box-shadow: 0 var(--s-6) var(--s-10) var(--shadow); padding: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); }
.adder .pop input { min-height: var(--h-control-sm); }
.detail-foot .adder > button { height: var(--h-control); padding: 0 var(--s-7); border-style: solid; color: var(--fg); font-weight: 500; }
.detail-foot .adder > button:hover { background: var(--bg3); }
.detail-foot .adder .pop { top: auto; bottom: calc(100% + var(--s-2)); }
.adder .pop ul { list-style: none; margin: 0; padding: 0; max-height: calc(var(--h-row) * 6); overflow-y: auto; }
.adder .pop li { padding: var(--s-3) var(--s-4); border-radius: var(--r-2); cursor: pointer; display: flex; justify-content: space-between; gap: var(--s-4); font-size: var(--fs-small); }
.adder .pop li:hover, .adder .pop li.sel { background: var(--sel); }
.adder .pop li .meta { font-size: var(--fs-label); }

.blk { display: flex; flex-direction: column; }
.blk-head { font-size: var(--fs-small); font-weight: 600; color: var(--fg2); padding-bottom: var(--s-4); display: flex; justify-content: space-between; align-items: baseline; }
.blk-head span:last-child:not(:first-child) { font-weight: 400; color: var(--muted); }
.blk .planar-row { padding-left: 0; padding-right: 0; border-radius: 0; }
.blk .planar-row.is-cursor { padding-left: var(--s-4); }
.li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-5); align-items: center; padding: var(--s-4) 0; border-bottom: var(--hair) solid var(--line); font-size: var(--fs-body); }
.li:last-child { border-bottom: 0; }
.li .src { display: block; font-size: var(--fs-label); color: var(--muted); }
.li a { text-decoration: none; }
.li a:hover { text-decoration: underline; }
.quote { background: var(--bg2); border: var(--hair) solid var(--line); border-left: var(--edge) solid var(--border); border-radius: var(--r-2); padding: var(--s-6) var(--s-7); font-size: var(--fs-body); white-space: pre-wrap; overflow-wrap: anywhere; }
.quote .src { display: block; font-size: var(--fs-label); color: var(--muted); margin-bottom: var(--s-3); }
.planar .note-input { min-height: calc(var(--fs-body) * var(--lh) * 7 + var(--s-6)); font-size: var(--fs-body); line-height: var(--lh); }
.notes-list { display: flex; flex-direction: column; gap: var(--s-4); }
.note { position: relative; background: var(--bg2); border: var(--hair) solid var(--line); border-radius: var(--r-2); padding: var(--s-5) var(--s-7); white-space: pre-wrap; overflow-wrap: anywhere; }
.note .meta { display: flex; justify-content: space-between; align-items: center; margin-top: var(--s-3); font-size: var(--fs-label); }

/* inbox: what is it? a short list of answers, the likely one marked */
.choice { display: flex; flex-direction: column; gap: var(--s-2); }
.choice button, .choice .choice-btn { position: relative; width: 100%; text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-1); padding: var(--s-4) var(--s-6); border: var(--hair) solid transparent; border-radius: var(--r-2); background: var(--bg2); color: var(--fg); cursor: pointer; font-size: var(--fs-body); transition: background var(--t-fast), border-color var(--t-fast); }
.choice button:hover, .choice .choice-btn:hover { background: var(--bg3); border-color: var(--line); }
.choice button small { color: var(--muted); font-size: var(--fs-small); }
.choice button.is-guess { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); box-shadow: inset var(--bar) 0 0 var(--accent); }
.choice button.is-guess::after { content: "suggested"; position: absolute; top: var(--s-4); right: var(--s-6); font-size: var(--fs-label); color: var(--accent); }

/* ---------- assistant ---------- */
.agent { grid-area: agent; display: flex; flex-direction: column; }
.agent-live { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.agent-head { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-6) var(--s-8); border-bottom: var(--hair) solid var(--line); min-height: calc(var(--h-control) + var(--s-6) * 2); }
.agent-head h2 { font-family: var(--font-mono); font-size: var(--fs-body); font-weight: 700; color: var(--accent); }
.agent-head .spacer { flex: 1; }
.agent-head .close { display: none; }
.agent-status { display: inline-flex; align-items: center; gap: var(--s-3); font-size: var(--fs-label); color: var(--muted); white-space: nowrap; }
.agent-status .dot { width: var(--s-4); height: var(--s-4); border-radius: 50%; background: var(--green); }
.agent-status.working .dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.agent-status.queued .dot { background: var(--yellow); }
.agent-status.paused .dot, .agent-status.error .dot { background: var(--red); }
.agent-status.off .dot { background: var(--faint); }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.8); } }
.agent-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s-7) var(--s-8) var(--s-8); display: flex; flex-direction: column; gap: var(--s-7); scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.agent-lead { font-size: var(--fs-body); line-height: 1.6; color: var(--fg); }
.agent-lead b { font-weight: 600; }
.agent-lead a { color: var(--accent); text-decoration: none; }
.agent-lead a:hover { text-decoration: underline; }
.agent-banner { display: flex; gap: var(--s-4); align-items: flex-start; padding: var(--s-5) var(--s-6); border-radius: var(--r-2); background: color-mix(in srgb, var(--red) var(--tint), var(--bg)); border: var(--hair) solid color-mix(in srgb, var(--red) 40%, var(--border)); font-size: var(--fs-small); }
.agent-banner .grow { display: flex; flex-direction: column; gap: var(--s-3); }

.sugg { position: relative; background: var(--bg2); border: var(--hair) solid var(--line); border-left: var(--edge) solid var(--yellow); border-radius: var(--r-2); padding: var(--s-6) var(--s-7); display: flex; flex-direction: column; gap: var(--s-4); }
.sugg-top { display: flex; gap: var(--s-4); align-items: baseline; font-size: var(--fs-label); color: var(--muted); }
.sugg-top .kind { color: var(--yellow); font-size: var(--fs-small); font-weight: 600; }
.sugg-top .n { margin-left: auto; font-family: var(--font-mono); }
.sugg-title { font-size: var(--fs-body); line-height: var(--lh-tight); color: var(--fg); }
.sugg-ev { font-size: var(--fs-small); color: var(--muted); border-left: var(--bar) solid var(--border); padding-left: var(--s-4); overflow-wrap: anywhere; }
.sugg-nav { display: flex; gap: var(--s-2); }

.convo { display: flex; flex-direction: column; gap: var(--s-10); }
/* older turns fold to their question */
.turn-old { font-size: var(--fs-small); color: var(--muted); }
.turn-old > summary { list-style: none; cursor: pointer; padding: var(--s-1) 0 var(--s-1) var(--s-5); border-left: var(--bar) solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn-old > summary::-webkit-details-marker { display: none; }
.turn-old > summary:hover { color: var(--fg2); border-left-color: var(--border); }
.turn-old[open] > summary { margin-bottom: var(--s-6); }
.turn { display: flex; flex-direction: column; gap: var(--s-4); }
.q { align-self: flex-end; max-width: 85%; background: var(--sel); color: var(--fg); padding: var(--s-4) var(--s-6); border-radius: var(--r-3) var(--r-3) var(--r-1) var(--r-3); font-size: var(--fs-body); line-height: var(--lh-tight); overflow-wrap: anywhere; white-space: pre-wrap; }
.a { max-width: 100%; font-size: var(--fs-body); line-height: 1.6; color: var(--fg); overflow-wrap: anywhere; }
.a a { color: var(--accent); text-decoration: underline dotted; text-underline-offset: 0.2em; }
.a.error { color: var(--red); }
.steps { display: flex; flex-direction: column; gap: var(--s-2); border-left: var(--bar) solid var(--line); padding: var(--s-1) 0 var(--s-1) var(--s-6); margin-left: var(--s-2); }
.steps summary { list-style: none; cursor: pointer; font-size: var(--fs-label); color: var(--muted); display: flex; gap: var(--s-3); align-items: center; }
.steps summary::-webkit-details-marker { display: none; }
.steps summary::before { content: "›"; display: inline-block; transition: transform var(--t-fast); font-family: var(--font-mono); }
.steps[open] summary::before { transform: rotate(90deg); }
.step { display: grid; grid-template-columns: var(--s-8) minmax(0, 1fr) auto; gap: var(--s-4); align-items: baseline; font-size: var(--fs-label); color: var(--fg2); }
.step .st { font-family: var(--font-mono); color: var(--green); text-align: center; }
.step.running .st { color: var(--accent); }
.step.running .st::before { content: ""; display: inline-block; width: var(--s-4); height: var(--s-4); border-radius: 50%; border: var(--bar) solid var(--accent); border-right-color: transparent; animation: spin 0.8s linear infinite; }
.step.failed .st { color: var(--red); }
.step .t { color: var(--muted); font-family: var(--font-mono); font-size: var(--fs-micro); }
.step .what { overflow-wrap: anywhere; }
@keyframes spin { to { transform: rotate(360deg); } }
.thinking { display: inline-flex; gap: var(--s-2); align-items: center; font-size: var(--fs-small); color: var(--muted); }
.thinking i { width: var(--s-3); height: var(--s-3); border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite both; }
.thinking i:nth-child(2) { animation-delay: 0.2s; } .thinking i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }
.turn-meta { display: flex; gap: var(--s-4); font-size: var(--fs-label); color: var(--faint); }

.activity { display: flex; flex-direction: column; }
.activity summary { cursor: pointer; font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); padding: var(--s-2) 0; list-style: none; }
.activity summary::-webkit-details-marker { display: none; }
.activity .act { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-4); align-items: center; padding: var(--s-3) 0; border-bottom: var(--hair) solid var(--line); font-size: var(--fs-label); color: var(--fg2); }
.activity .act:last-child { border-bottom: 0; }
.activity .act .when { color: var(--muted); font-family: var(--font-mono); }

.agent-foot { padding: var(--s-6) var(--s-8) var(--s-8); border-top: var(--hair) solid var(--line); display: flex; flex-direction: column; gap: var(--s-4); }
.quick { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.quick button { height: var(--h-control-sm); padding: 0 var(--s-5); border: var(--hair) solid var(--line); border-radius: var(--r-2); background: none; color: var(--fg2); font-size: var(--fs-label); cursor: pointer; }
.quick button:hover { border-color: var(--border); color: var(--fg); background: var(--bg3); }
.ask { display: flex; align-items: flex-end; gap: var(--s-4); background: var(--bg2); border: var(--hair) solid var(--border); border-radius: var(--r-2); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-6); transition: border-color var(--t-fast); }
.ask:focus-within { border-color: var(--accent); box-shadow: 0 0 0 var(--hair) var(--accent); }
.planar .ask textarea { flex: 1; min-height: calc(var(--fs-body) * var(--lh) * 2 + var(--s-2) * 2); font-size: var(--fs-body); max-height: calc(var(--fs-body) * var(--lh) * 6); border: 0; background: transparent; padding: var(--s-2) 0; resize: none; box-shadow: none; }
.planar .ask textarea:focus { box-shadow: none; }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; display: none; }
.scrim.is-on { display: block; }
.palette { position: fixed; top: var(--top-palette); left: 50%; transform: translateX(-50%); width: min(var(--w-palette), calc(100vw - var(--s-10))); z-index: 41; background: var(--bg); border: var(--hair) solid var(--border); border-radius: var(--r-3); box-shadow: 0 var(--s-10) var(--s-11) var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.planar .palette input { border: 0; border-bottom: var(--hair) solid var(--line); border-radius: 0; background: transparent; padding: var(--s-7) var(--s-8); font-size: var(--fs-lead); box-shadow: none; }
.palette ul { list-style: none; margin: 0; padding: var(--s-2); max-height: 50vh; overflow-y: auto; }
.palette li { padding: var(--s-4) var(--s-6); display: flex; justify-content: space-between; gap: var(--s-6); border-radius: var(--r-2); cursor: pointer; }
.palette li.sel { background: var(--sel); }
.palette li .meta { font-size: var(--fs-label); font-family: var(--font-mono); }
.toasts { position: fixed; bottom: var(--s-9); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: var(--s-4); z-index: 50; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: var(--s-6); align-items: center; min-width: calc(var(--w-toast) * 0.6); max-width: min(var(--w-toast), calc(100vw - var(--s-10))); padding: var(--s-5) var(--s-5) var(--s-5) var(--s-7); background: var(--fg); color: var(--bg); border-radius: var(--r-3); box-shadow: 0 var(--s-6) var(--s-10) var(--shadow); font-size: var(--fs-small); animation: toast-in var(--t-med) ease-out; }
.toast .grow { display: flex; flex-direction: column; gap: var(--s-1); }
.toast .t { font-weight: 600; }
.toast.warn { background: var(--red); color: var(--on); }
.toast .btn { height: var(--h-control-sm); color: inherit; border-color: color-mix(in srgb, currentColor 40%, transparent); }
.toast .btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(var(--s-4)); } }

/* ---------- settings, simple pages ---------- */
.doc { flex: 1; min-height: 0; overflow-y: auto; }
.doc-inner { max-width: calc(var(--w-list) * 2); padding: var(--s-9) var(--s-10) var(--s-11); display: flex; flex-direction: column; gap: var(--s-10); }
.section { display: flex; flex-direction: column; gap: var(--s-6); scroll-margin-top: var(--s-9); }
.section > h2 { font-family: var(--font-mono); font-size: var(--fs-lead); font-weight: 700; }
.section > p.meta { margin: 0; }
.panel { border: var(--hair) solid var(--line); border-radius: var(--r-3); background: var(--bg); overflow: hidden; }
.panel-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-7); align-items: center; padding: var(--s-6) var(--s-8); border-bottom: var(--hair) solid var(--line); }
.panel-row:last-child { border-bottom: 0; }
.panel-row .grow { display: flex; flex-direction: column; gap: var(--s-1); }
.panel-row .meta { font-size: var(--fs-label); }
.panel-pad { padding: var(--s-7) var(--s-8); display: flex; flex-direction: column; gap: var(--s-6); }
.settings-nav { display: flex; gap: var(--s-2); flex-wrap: wrap; position: sticky; top: 0; z-index: 2; background: var(--bg); padding: var(--s-6) var(--s-10); border-bottom: var(--hair) solid var(--line); }
.settings-nav a { padding: var(--s-2) var(--s-5); border-radius: var(--r-2); color: var(--muted); text-decoration: none; font-size: var(--fs-small); }
.settings-nav a:hover { color: var(--fg); background: var(--bg3); }
.kv { display: grid; grid-template-columns: minmax(0, 12em) minmax(0, 1fr); gap: var(--s-2) var(--s-7); font-size: var(--fs-small); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.steps-list { margin: 0; padding-left: var(--s-9); display: flex; flex-direction: column; gap: var(--s-6); }
.steps-list > li { padding-left: var(--s-2); }
.steps-list > li::marker { font-family: var(--font-mono); color: var(--muted); }
.copybox { display: flex; flex-direction: column; gap: var(--s-3); align-items: flex-start; margin-top: var(--s-3); }
.planar textarea.code { font-family: var(--font-mono); font-size: var(--fs-label); resize: vertical; }
.planar code { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--fg2); background: var(--bg2); padding: 0 var(--s-2); border-radius: var(--r-1); }
.planar details > summary { cursor: pointer; }
.pill-status { display: inline-flex; align-items: center; gap: var(--s-3); font-size: var(--fs-label); color: var(--muted); white-space: nowrap; }
.pill-status::before { content: ""; width: var(--s-4); height: var(--s-4); border-radius: 50%; background: currentColor; }
.pill-status.ok { color: var(--status-ok); } .pill-status.late { color: var(--status-late); } .pill-status.warn { color: var(--status-due); }
.theme-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-6); }
.theme-pick button { display: flex; flex-direction: column; gap: var(--s-4); padding: var(--s-4); border: var(--hair) solid var(--border); border-radius: var(--r-3); background: var(--bg2); cursor: pointer; text-align: left; font-size: var(--fs-small); }
.theme-pick button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 var(--hair) var(--accent); }
.theme-pick .sw { position: relative; height: calc(var(--s-11) * 1.5); border-radius: var(--r-2); border: var(--hair) solid var(--line); background: linear-gradient(90deg, var(--bg2) 0 20%, var(--bg) 20% 100%); overflow: hidden; }
.theme-pick .sw::after { content: ""; position: absolute; left: 28%; top: 30%; width: 40%; height: var(--s-4); border-radius: var(--r-1); background: var(--accent); box-shadow: 0 var(--s-5) 0 var(--fg2); }
.theme-pick .sw[data-sys] { background: linear-gradient(135deg, var(--bg) 0 50%, var(--fg) 50% 100%); }
.qr { width: calc(var(--s-11) * 7); max-width: 100%; image-rendering: pixelated; border-radius: var(--r-2); background: var(--on); padding: var(--s-4); }
.msg { display: flex; flex-direction: column; gap: var(--s-2); border-bottom: var(--hair) solid var(--line); padding-bottom: var(--s-5); }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.digest { line-height: var(--lh); }
.digest a { color: var(--accent); }

/* login / setup */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s-9); background: var(--wall); }
.gate-card { width: min(var(--w-login), 100%); background: var(--bg); border: var(--hair) solid var(--line); border-radius: var(--r-3); padding: var(--s-10); display: flex; flex-direction: column; gap: var(--s-9); }
.gate-card.wide { width: min(var(--w-dialog), 100%); }
.gate-card h1 { font-family: var(--font-mono); font-size: var(--fs-title); color: var(--accent); }
.gate-card form { display: flex; flex-direction: column; gap: var(--s-8); }
.error { color: var(--status-late); font-size: var(--fs-small); margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 80em) {
  .page.has-detail { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr); }
}
/* below 1100: the assistant becomes a drawer opened from the rail */
@media (max-width: 68.75em) {
  .app { grid-template-columns: var(--w-rail) minmax(0, 1fr); grid-template-areas: "strip strip" "rail main"; }
  .agent { position: fixed; z-index: 45; top: var(--gap); right: var(--gap); bottom: var(--gap); width: min(var(--w-agent), calc(100vw - var(--s-10))); transform: translateX(calc(100% + var(--gap) * 2)); transition: transform var(--t-med) ease; box-shadow: 0 0 var(--s-11) var(--shadow); }
  .agent-open .agent { transform: none; }
  .agent-open .agent-scrim { display: block; }
  .agent-head .close { display: inline-flex; }
  .agent-head .wide-toggle { display: none; }
  .rail-agent { display: flex; }
  .legend { display: none; }
}
/* below 860: list and detail stack; the detail replaces the list */
@media (max-width: 53.75em) {
  .strip-axis { min-width: calc(var(--s-11) * 28); }
  .page.has-detail { grid-template-columns: minmax(0, 1fr); }
  .page.has-detail > .list-tile { display: none; }
  .strip { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 0; padding: var(--s-4) var(--s-7) 0; }
  .strip-date { flex-direction: row; align-items: baseline; gap: var(--s-4); }
}
/* phones: the rail moves to the bottom */
@media (max-width: 37.5em) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--h-strip) minmax(0, 1fr) auto; grid-template-areas: "strip" "main" "rail"; }
  .rail { flex-direction: row; justify-content: space-around; padding: var(--s-2); }
  .rail-logo, .rail-fill { display: none; }
  .rail-item { width: auto; flex: 1; }
  .list-head { padding: var(--s-6) var(--s-7) var(--s-4); flex-wrap: wrap; }
  .detail-top, .detail-body, .detail-foot { padding-left: var(--s-7); padding-right: var(--s-7); }
  .props { grid-template-columns: minmax(0, 1fr); gap: var(--s-2); }
  .props > dd { margin-bottom: var(--s-4); }
  .doc-inner { padding: var(--s-7); }
  .theme-pick { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.choice .adder > button { height: auto; border-style: solid; color: var(--fg); font-size: var(--fs-body); }
.choice .adder .pop { width: 100%; }
@media (hover: none) { .btn kbd { display: none; } }

a.quote { display: block; text-decoration: none; color: inherit; }
a.quote:hover { border-left-color: var(--accent); }
/* muted text is too faint on the selection color */
.planar-row.is-open :is(.planar-row-note, .sub, .due:not(.late):not(.soon)), .planar-row.is-cursor :is(.planar-row-note, .sub, .due:not(.late):not(.soon)) { color: var(--fg2); }
.agent-hint { margin: 0; color: var(--muted); font-size: var(--fs-small); }
/* switching pages: dim the page only if the switch takes a moment */
html.is-loading #page { opacity: 0.6; transition: opacity var(--t-med) var(--t-fast); }

/* ---------- quick edits: the date on a row, renaming, dragging ---------- */
.planar-row-trail button.due { display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--h-control-sm); margin: calc(-1 * var(--s-2)) calc(-1 * var(--s-3)); padding: 0 var(--s-3); border: var(--hair) solid transparent; border-radius: var(--r-2); background: transparent; cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast); }
.planar-row-trail button.due:hover, .planar-row-trail button.due[aria-expanded="true"] { border-color: var(--border); background: var(--bg); color: var(--fg); }
.planar-row-trail button.due:focus-visible { outline: var(--hair) solid var(--accent); outline-offset: 0; }
.planar-row-trail button.due .ico { width: var(--s-8); height: var(--s-8); }
.planar-row-trail button.due.is-empty { opacity: 0; }
.planar-row:hover button.due.is-empty, .planar-row.is-cursor button.due.is-empty, .planar-row.is-open button.due.is-empty, button.due.is-empty:focus-visible, button.due.is-empty[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .planar-row-trail button.due.is-empty { opacity: 0.5; } }

.when-menu { position: fixed; z-index: 40; min-width: calc(var(--w-list) * 0.44); display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-2); background: var(--bg); border: var(--hair) solid var(--border); border-radius: var(--r-3); box-shadow: 0 var(--s-6) var(--s-10) var(--shadow); outline: none; }
.when-menu button { display: flex; justify-content: space-between; align-items: center; gap: var(--s-8); min-height: var(--h-control-sm); padding: var(--s-2) var(--s-5); border: 0; border-radius: var(--r-2); background: transparent; color: var(--fg); font: inherit; font-size: var(--fs-small); text-align: left; cursor: pointer; }
.when-menu button.sel { background: var(--sel); }
.when-menu button[aria-checked="true"] { color: var(--accent); font-weight: 700; }
.when-menu button .meta { font-family: var(--font-mono); font-size: var(--fs-label); color: var(--muted); }
.when-date { display: flex; margin-top: var(--s-1); padding: var(--s-3) var(--s-2) var(--s-1); border-top: var(--hair) solid var(--line); }
.when-date input { flex: 1; min-height: var(--h-control-sm); }

.title-edit { position: relative; margin: 0 calc(-1 * var(--s-4)); padding: var(--s-2) var(--s-4); border: var(--hair) solid transparent; border-radius: var(--r-2); transition: border-color var(--t-fast); }
.title-edit:hover { border-color: var(--line); }
.title-edit.is-focused { border-color: var(--accent); background: var(--bg2); }
.title-edit .prompt-stack { min-height: calc(var(--fs-title) * var(--lh-tight)); }
.title-edit .prompt-stack textarea, .title-edit .prompt-mirror { font-family: var(--font-mono); font-size: var(--fs-title); font-weight: 700; line-height: var(--lh-tight); min-height: 0; }
.title-edit .suggest { left: calc(-1 * var(--s-4)); right: calc(-1 * var(--s-4)); top: calc(100% + var(--s-3)); font-family: var(--font-ui); font-size: var(--fs-small); font-weight: 400; }
.title-edit .planar-prompt-parse { padding-left: 0; }
.title-edit .planar-prompt-parse:not(:empty) { margin-top: var(--s-2); }

.row-edit { min-width: 0; }
.row-edit .title-edit { margin: calc(-1 * var(--s-2)) calc(-1 * var(--s-3)); padding: var(--s-1) var(--s-3); }
.row-edit .title-edit .prompt-stack { min-height: calc(var(--fs-lead) * var(--lh-tight)); }
.row-edit .title-edit .prompt-stack textarea, .row-edit .title-edit .prompt-mirror { font-family: var(--font-ui); font-size: var(--fs-lead); font-weight: 400; line-height: var(--lh-tight); }
.planar-row.is-editing { cursor: default; background: var(--sel); }

.planar-row[draggable="true"]:active { cursor: grabbing; }
.planar-row.is-dragging { opacity: 0.4; }
[data-sortable].is-drop.group { box-shadow: inset 0 0 0 var(--hair) var(--accent); }
@media (prefers-reduced-motion: reduce) { .planar-row-trail button.due, .title-edit { transition: none; } }

/* ---------- briefs and answers (Markdown) ---------- */
/* set like a short document: plain headings, tight lists, room between parts */
:is(.digest, .a, .md) > * + * { margin-top: var(--s-5); }
:is(.digest, .a, .md) :is(h3, h4) { margin: var(--s-9) 0 0; font-size: var(--fs-lead); font-weight: 650; line-height: var(--lh-tight); color: var(--fg); }
:is(.digest, .a, .md) h4 { font-size: var(--fs-body); }
:is(.digest, .a, .md) > :is(h3, h4) + * { margin-top: var(--s-3); }
:is(.digest, .a, .md) > :is(h3, h4):first-child { margin-top: 0; }
:is(.digest, .a, .md) p { margin: 0; }
:is(.digest, .a, .md) :is(ul, ol) { margin: 0; padding-left: var(--s-8); display: flex; flex-direction: column; gap: var(--s-1); }
:is(.digest, .a, .md) li { padding-left: var(--s-1); }
:is(.digest, .a, .md) li::marker { color: var(--faint); }
:is(.digest, .a, .md) b { font-weight: 650; color: var(--fg); }
:is(.digest, .a, .md) li > b:first-child { color: var(--fg2); }
:is(.digest, .a, .md) code { font-family: var(--font-mono); font-size: var(--fs-small); padding: 0 var(--s-2); border-radius: var(--r-1); background: var(--bg3); }
:is(.digest, .a, .md) blockquote { margin: 0; padding-left: var(--s-5); border-left: var(--bar) solid var(--line); color: var(--fg2); }
:is(.digest, .a, .md) hr { border: 0; border-top: var(--hair) solid var(--line); }
:is(.digest, .a, .md) a { color: var(--accent); }
:is(.digest, .a, .md) .md-table { overflow-x: auto; }
:is(.digest, .a, .md) table { border-collapse: collapse; font-size: var(--fs-small); }
:is(.digest, .a, .md) :is(th, td) { padding: var(--s-2) var(--s-5); border-bottom: var(--hair) solid var(--line); text-align: left; vertical-align: top; }
:is(.digest, .a, .md) th { font-size: var(--fs-small); color: var(--fg2); font-weight: 600; }

/* ---------- meetings and follow-ups ---------- */
.planar-row.is-meeting .due { color: var(--fg2); }
.planar-row.is-meeting .due.soon { color: var(--status-due); font-weight: 700; }
.planar-row.is-meeting.is-done .planar-row-title { text-decoration: none; }
.meeting-time { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--fg2); }
.parent-link { color: var(--accent); overflow-wrap: anywhere; }
.followups { display: flex; flex-direction: column; gap: var(--s-3); }
.followups .blk-head { padding-bottom: 0; }
.followups .rows { padding: 0; }
.followups .planar-prompt { padding: var(--s-3) var(--s-5); }
.followups .prompt-stack textarea, .followups .prompt-mirror { font-size: var(--fs-body); }
.followups .prompt-stack { min-height: calc(var(--fs-body) * var(--lh)); }

/* ---------- MCP servers (Settings → Tools) ---------- */
#mcp-servers { display: flex; flex-direction: column; gap: var(--s-6); }
.mcp-head .grow, .mcp-tool .grow { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.mcp-head .meta, .mcp-tool .meta { overflow-wrap: anywhere; }
.mcp-tool code { align-self: flex-start; color: var(--fg); }
.mcp-head { flex-wrap: wrap; }
.mcp-add { display: flex; flex-direction: column; gap: var(--s-5); margin-top: var(--s-6); }
.mcp-add-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--s-4) var(--s-5); }
.mcp-add-grid label { display: flex; flex-direction: column; gap: var(--s-2); font-size: var(--fs-label); color: var(--muted); }
@container (max-width: 30em) { .mcp-add-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- signed notes on a task ---------- */
.note-log { display: flex; flex-direction: column; gap: var(--s-4); }
.note-log .blk-head { padding-bottom: 0; }
.note-entry { border: var(--hair) solid var(--line); border-left: var(--bar) solid var(--line); border-radius: var(--r-2); background: var(--bg2); padding: var(--s-4) var(--s-6) var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.note-entry.is-agent { border-left-color: var(--accent); }
.note-entry header { display: flex; align-items: center; gap: var(--s-4); font-size: var(--fs-label); }
.note-entry .who { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--fg2); }
.note-entry.is-agent .who { color: var(--accent); }
.note-entry .who .ico { width: var(--s-8); height: var(--s-8); }
.note-entry header .meta { flex: 1; }
.note-entry header .btn { opacity: 0; }
.note-entry:hover header .btn, .note-entry header .btn:focus-visible { opacity: 1; }
@media (hover: none) { .note-entry header .btn { opacity: 1; } }
.md { font-size: var(--fs-body); line-height: var(--lh); overflow-wrap: anywhere; min-width: 0; }
.note .md { white-space: normal; }
.note.is-agent { border-left: var(--bar) solid var(--accent); }

/* ---------- the task's details as one row of small controls ---------- */
.pills { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: center; }
.pill { position: relative; display: inline-flex; align-items: center; gap: var(--s-3); height: var(--h-control-sm); padding: 0 var(--s-5); border: var(--hair) solid var(--line); border-radius: var(--r-2); background: var(--bg2); color: var(--fg); font: inherit; font-size: var(--fs-small); white-space: nowrap; cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast); }
.pill:hover, .pill:focus-within, .pill[aria-expanded="true"] { border-color: var(--border); background: var(--bg3); }
.pill:focus-visible { outline: var(--bar) solid var(--accent); outline-offset: 0; }
.pill .k, .chip .k { color: var(--muted); }
.pill b { font-weight: 500; }
.pill .caret { color: var(--faint); font-size: var(--fs-micro); }
.pill.static { cursor: default; background: transparent; }
.pill.static:hover { border-color: var(--line); background: transparent; }
.planar .pill select { appearance: none; -webkit-appearance: none; height: 100%; min-height: 0; width: auto; padding: 0; margin: 0; border: 0; background: transparent; box-shadow: none; color: var(--fg); font: inherit; font-weight: 500; cursor: pointer; }
.planar .pill select:focus { box-shadow: none; outline: none; }
.pill.is-hot b, .planar .pill.is-hot select { color: var(--status-late); }
.pills .adder > button { height: var(--h-control-sm); }
.from-parent { margin-top: calc(-1 * var(--s-4)); }
.from-parent .parent-link { color: var(--accent); text-decoration: none; }
.from-parent .parent-link:hover { text-decoration: underline; }
.title-edit .prompt-stack textarea, .title-edit .prompt-mirror { font-family: var(--font-ui); font-weight: 650; letter-spacing: -0.01em; }
.detail-body { gap: var(--s-10); }

/* suggestions fold to one line while you talk */
.sugg-box > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--s-4); font-size: var(--fs-small); font-weight: 600; color: var(--fg2); padding: var(--s-1) 0; }
.sugg-box > summary::-webkit-details-marker { display: none; }
.sugg-box > summary::before { content: "›"; display: inline-block; color: var(--muted); transition: transform var(--t-fast); }
.sugg-box[open] > summary::before { transform: rotate(90deg); }
.sugg-box > summary .n { font-weight: 400; color: var(--on); background: var(--yellow); border-radius: var(--r-1); padding: 0 var(--s-3); font-size: var(--fs-label); line-height: 1.5; }
.sugg-box[open] > summary { margin-bottom: var(--s-4); }
.quick .ctx { display: inline-flex; align-items: center; gap: var(--s-3); min-width: 0; max-width: 100%; height: var(--h-control-sm); font-size: var(--fs-label); color: var(--muted); }
.quick .ctx b { font-weight: 500; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* a narrow list keeps the add box on one line: the token hint goes */
@container (max-width: 30em) { .planar-prompt .prompt-mirror.is-empty::before { content: attr(data-placeholder-short); } }

/* narrow panes: keep headers on one line and the editor's buttons in one row */
.group-head b { white-space: nowrap; }
.list-head { flex-wrap: wrap; row-gap: var(--s-3); }
@container (max-width: 30em) {
  .group-head .goal, .group-head .bar-mini { display: none; }
  .detail-foot { padding-left: var(--s-8); padding-right: var(--s-8); gap: var(--s-3); }
  .detail-foot .btn { padding: 0 var(--s-5); }
  .detail-foot .btn kbd { display: none; }
}
