/* Intrapid portal. Mobile first; the desktop layout starts at 820px. */

:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #f1f1f3;
  --text: #17171c;
  --muted: #6b6b76;
  --line: #e6e6ea;
  --accent: #4f46e5;
  --accent-text: #ffffff;
  --accent-soft: #eef0ff;
  --ok: #15803d;
  --ok-soft: #e9f8ee;
  --warn: #a15c07;
  --warn-soft: #fff6e5;
  --danger: #c02626;
  --danger-soft: #fdeeee;
  --info: #1d4ed8;
  --info-soft: #ecf2ff;
  --pane-bg: #111216;
  --pane-text: #dfe1e6;
  --shadow: 0 1px 2px rgb(16 16 24 / 5%), 0 4px 16px rgb(16 16 24 / 5%);
  --radius: 16px;
  --radius-sm: 10px;
  --tabbar-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f12;
    --surface: #17181d;
    --surface-2: #1f2027;
    --text: #ececf1;
    --muted: #9a9aa6;
    --line: #2a2b33;
    --accent: #8b85ff;
    --accent-text: #0e0f12;
    --accent-soft: #23224a;
    --ok: #4ade80;
    --ok-soft: #12261a;
    --warn: #fbbf24;
    --warn-soft: #2b2110;
    --danger: #f87171;
    --danger-soft: #2c1414;
    --info: #93b4ff;
    --info-soft: #172038;
    --pane-bg: #08090b;
    --pane-text: #d7d9de;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
h4 { font-size: 0.78rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 1rem 0 0.35rem; }
p { margin: 0; }
code, pre, .path { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.85em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.icon { width: 18px; height: 18px; flex: none; }
.icon.big { width: 40px; height: 40px; color: var(--muted); }

/* --- layout ----------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--text); font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.topnav { display: none; margin-left: auto; align-items: center; gap: 0.25rem; }
.topnav a:not(.button) { color: var(--muted); padding: 0.45rem 0.75rem; border-radius: 999px; font-weight: 550; font-size: 0.95rem; }
.topnav a:not(.button):hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.topnav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }

.worker-dot { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--muted); padding: 0.3rem 0.6rem; border-radius: 999px; background: var(--surface-2); }
.worker-dot:hover { text-decoration: none; }
.worker-dot em { font-style: normal; }
.worker-dot span { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.worker-dot.on span { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.worker-dot.off span { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

.page { max-width: 980px; margin: 0 auto; padding: 1rem 1rem 2rem; }
.page-head { margin: 0.5rem 0 1rem; }
.page-head .sub { color: var(--muted); margin-top: 0.25rem; }
.section { margin-top: 2rem; }

.back { display: inline-flex; align-items: center; gap: 0.2rem; color: var(--muted); font-weight: 550; margin: 0.25rem 0 0.5rem -0.2rem; padding: 0.3rem 0; }
.back:hover { color: var(--text); text-decoration: none; }

/* --- bottom tab bar (phones) -------------------------------------------- */

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 0.5rem var(--safe-bottom);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 0.7rem; font-weight: 600; padding: 0.4rem 0; }
.tabbar a:hover { text-decoration: none; }
.tabbar a .icon { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--accent); }

.fab {
  position: fixed;
  right: 1rem;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 1rem);
  z-index: 26;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent);
}
.fab .icon { width: 26px; height: 26px; }
.fab:active { transform: scale(0.96); }
body:has(.actionbar) .fab { display: none; }

/* --- sticky action bar (idea page) -------------------------------------- */

.actionbar {
  position: fixed;
  inset: auto 0 calc(var(--tabbar-h) + var(--safe-bottom)) 0;
  z-index: 25;
  padding: 0.65rem 1rem;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.actionbar-inner { max-width: 980px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 0.6rem; }
/* Each action needs room for its label. When the row cannot give it, the row
   wraps and the last action, the primary one, takes the next line. */
.actionbar form { flex: 1 1 8rem; display: flex; min-width: 0; }
.actionbar-note { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0; padding: 0.3rem 0; flex: 1 1 100%; order: -1; min-width: 0; }
body:has(.actionbar-note) { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 140px); }
.actionbar-note .icon { flex: none; margin-top: 0.15rem; }
.actionbar form:last-child:not(:first-child) { flex-grow: 1.5; }
.actionbar .button { flex: 1; min-width: 0; padding: 0.5rem 0.75rem; white-space: normal; line-height: 1.2; }
/* With three actions on a phone, the labels need the room the icons take. */
.actionbar:has(form:nth-of-type(3)) .button .icon { display: none; }
body:has(.actionbar form:nth-of-type(3)) { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 136px); }
body:has(.actionbar form:nth-of-type(3)):has(.actionbar-note) { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 200px); }
.idea-page .fab { display: none; }
body:has(.actionbar) { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 76px); }

/* --- buttons ------------------------------------------------------------ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 46px;
  padding: 0 1.1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.06s ease, opacity 0.15s ease, background 0.15s ease;
}
.button:hover { text-decoration: none; filter: brightness(1.05); }
.button:active { transform: scale(0.98); }
.button.secondary { background: var(--accent-soft); color: var(--accent); }
.button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.button.ghost.danger { color: var(--danger); }
.button.small { min-height: 36px; padding: 0 0.8rem; font-size: 0.9rem; border-radius: 10px; }
.button[aria-busy="true"] { opacity: 0.6; pointer-events: none; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-button:hover { background: var(--surface-2); color: var(--text); }
.icon-button.copied { color: var(--ok); }
.link { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 600; font-size: 0.9rem; }
.link .icon { width: 15px; height: 15px; }

/* --- cards and lists ---------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 0.9rem;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.card-head h2 { display: flex; align-items: center; gap: 0.45rem; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.cards > .card { margin: 0; }
.row { display: flex; align-items: center; gap: 0.5rem; justify-content: space-between; }
.row.meta { justify-content: flex-start; flex-wrap: wrap; }
.meta { color: var(--muted); font-size: 0.85rem; }
.hint { color: var(--muted); font-size: 0.88rem; margin-top: 0.35rem; }
.help { color: var(--muted); font-size: 0.88rem; margin-top: 0.35rem; }
.help.strong { color: var(--warn); font-weight: 600; }
.hint.strong { color: var(--warn); font-weight: 600; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.ok-text { color: var(--ok); }

.idea-card a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; color: var(--text); box-shadow: var(--shadow); transition: border-color 0.15s ease, transform 0.06s ease; }
.idea-card a:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.idea-card a:active { transform: scale(0.995); }
.idea-card h3 { font-size: 1.02rem; font-weight: 650; overflow-wrap: anywhere; }
.idea-card .row.meta { margin-top: 0.45rem; gap: 0.4rem; }
.idea-card .chev { color: var(--muted); }

.session-card h2 a { color: var(--text); }
.project-card h2 { display: flex; align-items: center; gap: 0.45rem; }
.path { color: var(--muted); margin-top: 0.35rem; overflow-wrap: anywhere; }

.chips { display: flex; gap: 0.45rem; overflow-x: auto; padding: 0.1rem 0 0.8rem; margin: 0 -1rem; padding-left: 1rem; padding-right: 1rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 0.45rem 0.85rem; font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; min-height: 38px; }
.chip b { color: var(--muted); font-weight: 600; margin-left: 0.2rem; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip[aria-pressed="true"] b { color: inherit; opacity: 0.7; }

/* The ideas page toolbar: status chips on the left, the source toggle on the right. */
.list-tools { display: flex; align-items: flex-start; column-gap: 0.75rem; }
.list-tools .chips { flex: 1 1 auto; min-width: 0; }
.source-toggle { flex: none; margin: 0 0 0.8rem auto; display: flex; align-items: center; gap: 0.5rem; }
.source-toggle > span { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.segments { display: flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.segments button { flex: 1; border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.88rem; font-weight: 600; padding: 0 0.85rem; border-radius: 999px; cursor: pointer; min-height: 32px; }
.segments button:hover { color: var(--text); }
.segments button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.list-tools button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Phones: the source toggle takes its own row above the chips, which fade at
   the right edge to show that they scroll. */
@media (max-width: 819px) {
  .list-tools { flex-direction: column; align-items: stretch; }
  .source-toggle { order: -1; margin: 0 0 0.6rem; }
  .segments { flex: 1; }
  .segments button { min-height: 40px; }
  .list-tools .chips { mask-image: linear-gradient(to right, #000 85%, transparent); }
}

/* One section per stage on the ideas page. */
.stage + .stage { margin-top: 1.5rem; }
.stage-head { display: flex; align-items: baseline; gap: 0.6rem; margin: 0 0 0.6rem; }
.stage-head h2 { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stage-head h2 b { font-weight: 600; margin-left: 0.2rem; }
.stage-head p { color: var(--muted); font-size: 0.85rem; }
.empty[data-empty] { display: grid; justify-items: center; gap: 0.8rem; }
.empty[data-empty][hidden] { display: none; }

/* --- pills -------------------------------------------------------------- */

.pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-draft, .s-distilling { background: var(--surface-2); color: var(--muted); }
.s-distilling::before { animation: pulse 1.2s ease-in-out infinite; }
.s-distilled, .s-review, .s-waiting { background: var(--warn-soft); color: var(--warn); }
.s-ready, .s-requested { background: var(--info-soft); color: var(--info); }
.s-building, .s-live { background: var(--accent-soft); color: var(--accent); }
.s-building::before, .s-live::before { animation: pulse 1.2s ease-in-out infinite; }
.s-done { background: var(--ok-soft); color: var(--ok); }
.s-dropped { background: var(--surface-2); color: var(--muted); }
@keyframes pulse { 50% { opacity: 0.25; } }

/* --- notices and toasts ------------------------------------------------- */

.notice, .toast { display: flex; gap: 0.7rem; align-items: flex-start; border-radius: var(--radius-sm); padding: 0.8rem 0.9rem; margin-bottom: 0.9rem; background: var(--info-soft); color: var(--info); font-size: 0.93rem; }
.notice .icon, .toast .icon { margin-top: 0.15rem; }
.notice p + p { margin-top: 0.2rem; }
.notice > div, .toast > div, .notice p, .toast p { min-width: 0; overflow-wrap: anywhere; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice code { background: transparent; color: inherit; }
.notice a, .toast a { color: inherit; text-decoration: underline; font-weight: 600; }
.toast.error { background: var(--danger-soft); color: var(--danger); }
.toast.ok { background: var(--ok-soft); color: var(--ok); }
.toast { animation: drop 0.25s ease; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* --- idea page ---------------------------------------------------------- */

.idea-head { margin-bottom: 1rem; }
.idea-head h1 { margin: 0.5rem 0 0.9rem; overflow-wrap: anywhere; }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; font-size: 0.68rem; color: var(--muted); font-weight: 600; }
.stepper li { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.stepper li span { height: 4px; border-radius: 4px; background: var(--line); }
.stepper li.done span { background: var(--accent); }
.stepper li.current span { background: linear-gradient(90deg, var(--accent) 50%, var(--line) 50%); }
.stepper li.current, .stepper li.done { color: var(--text); }

.brief h3 { font-size: 1.15rem; }
.brief .meta { margin-top: 0.2rem; }
.list { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.3rem; }
.list.checks { list-style: none; padding-left: 0; }
.list.checks li { position: relative; padding-left: 1.6rem; }
.list.checks li::before { content: ""; position: absolute; left: 0; top: 0.2rem; width: 1rem; height: 1rem; border-radius: 5px; border: 1.5px solid var(--line); }
.inline-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }

.pane { margin: 0 0 0.9rem; background: var(--pane-bg); color: var(--pane-text); border-radius: var(--radius-sm); padding: 0.8rem; height: 300px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.74rem; line-height: 1.4; overscroll-behavior: contain; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 0.75rem; align-items: center; font-size: 0.85rem; }
.kv > span { color: var(--muted); }
.copyline { display: flex; align-items: center; gap: 0.25rem; background: var(--surface-2); border-radius: 9px; padding-left: 0.6rem; min-width: 0; }
.copyline code { flex: 1; min-width: 0; white-space: normal; overflow-wrap: anywhere; padding: 0.45rem 0; }
.copyline code::-webkit-scrollbar { display: none; }

.disclosure { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 0.75rem; }
.disclosure.flush { margin: 0; border: 0; padding: 0; }
.disclosure > summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; align-items: center; gap: 0.5rem; min-height: 32px; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.15s ease; }
.disclosure[open] > summary::after { transform: rotate(-135deg); }
.disclosure > *:not(summary) { margin-top: 0.75rem; }
.version { border-top: 1px dashed var(--line); padding-top: 0.75rem; }
.version:first-of-type { border-top: 0; padding-top: 0; }
.version h3 { margin: 0.3rem 0; font-size: 1rem; }

.decisions { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.decisions li { border-left: 3px solid var(--accent-soft); padding-left: 0.75rem; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; font-size: 0.88rem; }
.timeline li { display: grid; gap: 0.1rem; }
.danger-zone { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.5rem; }

.comments { list-style: none; margin: 0 0 0.5rem; padding: 0; display: grid; gap: 0.8rem; }
.comment { border-left: 3px solid var(--warn-soft); padding-left: 0.75rem; display: grid; gap: 0.25rem; }
.comment.resolved { border-left-color: var(--ok-soft); }
.comment.resolved > .prose { color: var(--muted); }
.comment .row.meta { gap: 0.35rem; }
.comment-close .link { background: none; border: 0; padding: 0.2rem 0; cursor: pointer; font: inherit; font-size: 0.85rem; color: var(--muted); }
.comment-close .link:hover { color: var(--text); }
.comment-form { margin-top: 0.5rem; }
.comment-form .form-actions { margin-top: 0.6rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- forms -------------------------------------------------------------- */

.form h2 { margin-bottom: 0.25rem; }
.field { display: grid; gap: 0.35rem; margin-top: 1rem; }
.field label { font-weight: 650; font-size: 0.92rem; }
input, textarea, select {
  width: 100%;
  font: inherit;
  font-size: 16px; /* 16px stops iOS from zooming into fields */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  min-height: 48px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { resize: vertical; line-height: 1.45; }
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.5rem;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.form-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.25rem; }
.form-actions .button { flex: 1; }
.split { display: grid; gap: 0.9rem; margin-top: 1.25rem; }
.split .card { margin: 0; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.9rem; margin: 0.75rem 0 0; font-size: 0.88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* --- empty states ------------------------------------------------------- */

.empty-state { text-align: center; padding: 3rem 1rem; display: grid; justify-items: center; gap: 0.6rem; }
.empty-state.small { padding: 1.5rem 1rem; }
.empty-state p { color: var(--muted); max-width: 32ch; }
.empty-state .button { margin-top: 0.5rem; }
.empty { color: var(--muted); text-align: center; padding: 2rem 0; }

/* --- desktop ------------------------------------------------------------ */

@media (min-width: 820px) {
  body { padding-bottom: 0; }
  body:has(.actionbar) { padding-bottom: 90px; }
  .tabbar, .fab { display: none; }
  .topnav { display: flex; }
  .worker-dot { margin-left: 0.5rem; }
  .actionbar { inset: auto 0 0 0; }
  .actionbar-inner { justify-content: flex-end; }
  .actionbar form, .actionbar .button { flex: none; }
  .actionbar .button { white-space: nowrap; padding: 0 1.1rem; }
  .actionbar:has(form:nth-of-type(3)) .button .icon { display: inline; }
  body:has(.actionbar form:nth-of-type(3)), body:has(.actionbar form:nth-of-type(3)):has(.actionbar-note) { padding-bottom: 90px; }
  .actionbar-inner { flex-wrap: nowrap; align-items: center; }
  .actionbar-note { flex: 0 1 auto; order: 0; }
  body:has(.actionbar-note) { padding-bottom: 90px; }
  .page { padding: 1.5rem 1.5rem 3rem; }
  h1 { font-size: 1.9rem; }
  .split { grid-template-columns: 1fr 1fr; }
  .form-actions .button { flex: none; }
  .stepper { font-size: 0.75rem; }
  .pane { height: 380px; font-size: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body:has([data-form]) .fab { display: none; }

/* --- scouting, builds, and project settings ------------------------------ */

.s-proposed { background: var(--accent-soft); color: var(--accent); }
.s-proposed::before { display: none; }
.s-bug { background: var(--danger-soft); color: var(--danger); }
.s-bug::before { display: none; }
.danger-text { color: var(--danger); }
.pane.small { height: auto; max-height: 240px; margin: 0; }
.commits { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.45rem; font-size: 0.88rem; }
.commits li { display: grid; grid-template-columns: auto 1fr auto; gap: 0.6rem; align-items: baseline; }
.commits code { color: var(--muted); }
.commits span { overflow-wrap: anywhere; }
.commits time { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.project-card { min-width: 0; }
.project-card .row h2 { margin-right: auto; }
.project-card .row > * { min-width: 0; }
.project-card .row .meta { flex: none; white-space: nowrap; }
.project-card h2 { overflow-wrap: anywhere; }
.about { margin-bottom: 0.9rem; font-size: 0.9rem; }
.about .facts { margin-top: 0.6rem; }
.setting { display: grid; gap: 0.5rem; margin-top: 0.7rem; padding-top: 0.7rem; border-top: 1px solid var(--line); min-width: 0; }
.setting > * { min-width: 0; }
.setting-text { display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; align-items: baseline; }
.setting-text b { font-size: 0.93rem; }
.setting-text .meta { font-size: 0.85rem; }
.meta.wrap { overflow-wrap: anywhere; }
.setting-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.setting-actions.grow input { flex: 1 1 8rem; width: 100%; min-width: 0; }
.setting-actions select { padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem; min-height: 38px; max-width: 100%; }
.inline-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.setting-actions input { padding: 0.5rem 0.65rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.85rem; min-height: 38px; }
.button[disabled] { opacity: 0.55; cursor: default; }
@media (min-width: 820px) {
  .setting { grid-template-columns: 1fr auto; align-items: center; }
  .setting-actions.grow { min-width: 24rem; }
}

/* --- development servers ------------------------------------------------- */

.server-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 0.9rem; }
.server-actions .button { min-width: 0; max-width: 100%; overflow-wrap: anywhere; white-space: normal; text-align: left; }
.server-actions form { margin: 0; }
.button.disabled { opacity: 0.55; pointer-events: none; }
code.wrap { overflow-wrap: anywhere; white-space: normal; }
.setting-text .pill { margin-left: 0.4rem; vertical-align: middle; }

.checkline { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.9rem; line-height: 1.4; margin: 0.2rem 0 0.9rem; min-width: 0; }
.checkline span { min-width: 0; overflow-wrap: anywhere; }
input[type="checkbox"] {
  width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0.1rem 0 0; flex: none;
  border-radius: 6px; accent-color: var(--accent);
}
.project-card .link { margin: -0.3rem 0 0.6rem; }

/* The "More actions" menu on a project card. */
.menu { position: relative; flex: none; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--surface-2); color: var(--text); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 0.3rem); z-index: 20;
  width: min(21rem, calc(100vw - 2rem)); padding: 0.35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgb(16 16 24 / 18%);
}
.menu-panel form { margin: 0; }
.menu-item {
  display: flex; gap: 0.6rem; align-items: flex-start; width: 100%; padding: 0.55rem 0.6rem;
  border: 0; border-radius: 8px; background: transparent; color: var(--text);
  font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); text-decoration: none; }
.menu-item .icon { width: 17px; height: 17px; flex: none; margin-top: 0.1rem; color: var(--muted); }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-item span, .menu-form label { display: grid; gap: 0.1rem; min-width: 0; }
.menu-panel small { color: var(--muted); font-size: 0.8rem; line-height: 1.35; overflow-wrap: anywhere; }
.menu-form { padding: 0.55rem 0.6rem; border-top: 1px solid var(--line); font-size: 0.9rem; }
.menu-form + form:not(.menu-form) { border-top: 1px solid var(--line); padding-top: 0.25rem; }
.menu-row { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.menu-row input, .menu-row select {
  flex: 1 1 auto; min-width: 0; min-height: 36px; padding: 0.4rem 0.6rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.85rem;
}
.menu-row input { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* The knowledge graph of one project. */
.kb-view { display: grid; gap: 0.9rem; }
.kb-view > .card { margin: 0; min-width: 0; }
.kb-graph svg { display: block; width: 100%; height: auto; max-height: 75vh; }
.kb-tree { stroke: var(--line); stroke-width: 2; }
.kb-link { stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 5 4; opacity: 0.55; }
.kb-node circle { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.kb-node.depth-0 circle { fill: var(--accent); }
.kb-node.depth-2 circle { stroke: var(--muted); stroke-width: 2; }
.kb-node text { fill: var(--text); font-size: 22px; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.kb-node.depth-0 text { font-weight: 700; font-size: 25px; }
.kb-node:hover circle, .kb-node:focus-visible circle { stroke-width: 4; }
.kb-node.picked circle { fill: var(--accent); stroke: var(--accent); stroke-width: 5; }
.kb-node.picked text { font-weight: 700; }
.kb-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-top: 0.6rem; color: var(--muted); font-size: 0.82rem; }
.kb-key { display: inline-block; width: 22px; height: 0; vertical-align: middle; border-top: 2px solid var(--line); }
.kb-key.link { border-top: 2px dashed var(--accent); opacity: 0.7; }
.kb-reader h2 { overflow-wrap: anywhere; }
.kb-text { overflow-wrap: anywhere; font-size: 0.92rem; line-height: 1.55; margin-top: 0.5rem; }
.kb-text h3 { font-size: 0.98rem; margin: 1rem 0 0.35rem; }
.kb-text p { margin: 0.5rem 0; }
.kb-text ul { margin: 0.4rem 0; padding-left: 1.2rem; }
.kb-text pre { white-space: pre-wrap; background: var(--surface-2); padding: 0.6rem; border-radius: 8px; font-size: 0.82rem; }
.kb-away { color: var(--muted); }
@media (min-width: 820px) {
  .kb-view { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
  .kb-reader { position: sticky; top: 5rem; max-height: calc(100vh - 6rem); overflow: auto; }
}

/* Sharing: the workspace in use, and the people on a workspace or an idea. */
.workspace-tag { display: inline-flex; align-items: center; gap: 0.35rem; min-width: 0; max-width: 14rem; font-size: 0.8rem; color: var(--muted); padding: 0.3rem 0.6rem; border-radius: 999px; background: var(--surface-2); }
.workspace-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-tag .icon { width: 14px; height: 14px; flex: none; }
.workspace-tag:hover { text-decoration: none; color: var(--text); }
.people { list-style: none; margin: 0.5rem 0 0.75rem; padding: 0; }
.people li { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.5rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.people li:first-child { border-top: 0; }
.people form { flex: none; }
.people .row-actions { flex: none; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
