/* Studio: a calm, minimal look on top of the framework's base styles.
   One soft indigo accent, neutral greys, muted status colours; light and dark. */

:root {
  /* The studio's names for the framework palette (core/static/css/theme.css). */
  --st-bg: var(--app-bg);
  --st-surface: var(--app-surface);
  --st-subtle: var(--app-subtle);
  --st-border: var(--app-border);
  --st-text: var(--app-text);
  --st-muted: var(--app-muted);
  --st-accent: var(--app-accent-tone);
  --st-accent-hover: var(--app-accent-hover);
  --st-accent-soft: var(--app-accent-soft);
  --st-on-accent: var(--app-on-accent);
  --st-success: var(--app-success);
  --st-success-soft: var(--app-success-soft);
  --st-warning: var(--app-warning);
  --st-warning-soft: var(--app-warning-soft);
  --st-danger: var(--app-danger);
  --st-danger-soft: var(--app-danger-soft);
  --st-shadow: var(--app-shadow);
}

body { background: var(--st-bg); }
article { border: 1px solid var(--st-border); }
.muted { color: var(--st-muted); }
.pad { padding: 0.75rem 1rem; }
.error-text { color: var(--st-danger); }
.empty-state { text-align: center; padding: 2.5rem 1rem; }

/* --- projects ----------------------------------------------------------------- */
.project-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(26rem, 100%), 1fr)); }
.project-grid > div { min-width: 0; container-type: inline-size; }
.project-grid article { margin: 0; }
/* A project's card: what it is and how it stands, then the ways on. */
.project-card { display: flex; flex-direction: column; height: 100%; }
.project-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.project-card header small { display: block; font-weight: 400; }
.project-head-side { display: flex; align-items: center; gap: 0.35rem; flex: none; }
button.danger { --btn-bg: var(--st-danger); --btn-hover: color-mix(in srgb, var(--st-danger) 85%, black); --btn-color: #fff; }
.project-delete { color: var(--st-muted); }
.project-delete:hover { color: var(--st-danger); }
.project-name { font-size: 1.1rem; }
.project-facts { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem 1rem; margin: 0 0 var(--pico-block-spacing-vertical, 1rem); flex: 1; align-content: start; }
.project-facts dt { color: var(--st-muted); font-size: 0.85rem; font-weight: 400; padding-top: 0.1rem; }
.project-facts dd { margin: 0; min-width: 0; font-size: 0.95rem; }
.project-waiting { color: var(--st-warning); }
.task-count { display: inline-flex; align-items: center; gap: 0.3rem; margin-right: 0.6rem; font-size: 0.85rem; color: var(--st-muted); white-space: nowrap; }
.task-count::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: currentColor; }
.task-count b { color: var(--app-text); }
.task-count.is-todo::before { background: var(--st-danger); }
.task-count.is-doing::before { background: var(--st-warning); }
.task-count.is-done::before { background: var(--st-success); }
.project-address { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-address-row { display: flex; align-items: center; gap: 0.35rem; }
.own-domain-steps { padding-left: 1.2rem; }
.own-domain-steps li { margin-bottom: 0.35rem; }
/* The buttons stay on one line; on a narrow card the main one takes a row and the other two share the next. */
.project-card footer { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0; }
.project-card footer button { width: auto; margin: 0; padding: 0.4rem 0.75rem; font-size: 0.88rem; white-space: nowrap; }
.project-more { display: flex; gap: 0.5rem; margin-left: auto; }
@container (max-width: 24rem) {
  .project-card footer { flex-direction: column; align-items: stretch; }
  .project-more { margin-left: 0; }
  .project-more button { flex: 1; }
}
.project-setup { flex: 1; }
.project-setup .steps { margin-bottom: 0.75rem; }
.project-setup blockquote { margin: 0.5rem 0 1rem; white-space: pre-wrap; }

.status-pill { display: inline-block; padding: 0.15rem 0.65rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
  background: var(--st-subtle); color: var(--st-muted); white-space: nowrap; }
.status-live { background: var(--st-success-soft); color: var(--st-success); }
.status-provisioning, .status-new { background: var(--st-warning-soft); color: var(--st-warning); }
.status-failed { background: var(--st-danger-soft); color: var(--st-danger); }

.steps { list-style: none; padding-left: 0; }
.steps li { list-style: none; padding: 0.35rem 0 0.35rem 1.8rem; position: relative; }
.steps li::before { position: absolute; left: 0.2rem; font-weight: 700; }
.steps li.done::before { content: "✓"; color: var(--st-success); }
.steps li.failed::before { content: "✕"; color: var(--st-danger); }
.steps li.running::before { content: "•"; color: var(--st-accent); animation: st-pulse 1s ease-in-out infinite; }
@keyframes st-pulse { 50% { opacity: 0.25; } }
.job-log { max-height: 24rem; overflow: auto; font-size: 0.78rem; white-space: pre-wrap; }
.login-box { border-left: 3px solid var(--st-accent); padding: 0.5rem 1rem; margin-top: 1rem; background: var(--st-subtle);
  border-radius: 0 var(--app-radius) var(--app-radius) 0; }

/* --- workspace ------------------------------------------------------------------ */
.workspace { display: flex; flex-direction: column; height: calc(100dvh - 1.2rem); min-height: 26rem; }
body:has(.workspace) > main { padding-block: 0.6rem 0.6rem; }
.ws-actions { align-items: center; }
/* Accept shows only while there are steps not accepted yet (the history tile,
   hidden or not, always holds them) and no older version is being viewed. */
.ws-accept { display: none; }
.workspace:has(.h-milestone.is-pending):not(:has(#view-bar)) .ws-accept { display: inline-block; }
.ws-more { margin: 0; }
details.dropdown.ws-more > summary:not([role]) { height: auto; padding: 0.3rem 0.55rem; line-height: 1.2; border: none; background: none;
  box-shadow: none; color: var(--st-muted); font-size: 1.2rem; border-radius: var(--app-radius); }
details.dropdown.ws-more > summary:not([role]):hover { background: var(--app-subtle); color: var(--st-text, var(--app-text)); }
details.dropdown.ws-more > summary::after { display: none; }
.ws-more li a { white-space: nowrap; }
.ws-bar { display: flex; align-items: center; gap: 0.75rem; padding-bottom: 0.6rem; flex-wrap: wrap; }
.ws-name { margin: 0; font-size: 1rem; font-weight: 700; line-height: 1.5; }
.ws-title { display: flex; align-items: center; gap: 0.5rem; margin-right: auto; }
/* Back to the project: the same chevron as in Files and History, larger, pointing left. */
.ws-back { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 0.4rem; text-decoration: none; }
.ws-back::before { content: ""; width: 0.6rem; height: 0.6rem; margin-left: 0.25rem; border-left: 2px solid var(--st-muted); border-bottom: 2px solid var(--st-muted);
  transform: rotate(45deg); transition: border-color 0.1s; }
.ws-back:hover { background: var(--app-subtle); }
.ws-back:hover::before { border-color: var(--st-text); }
/* The same chevron before a back link with text (the project page). */
.back-link { display: inline-flex; align-items: center; gap: 0.45rem; margin-left: -0.4rem; padding: 0.2rem 0.6rem 0.2rem 0.4rem; border-radius: 0.4rem;
  color: var(--st-muted); text-decoration: none; }
.back-link::before { content: ""; width: 0.6rem; height: 0.6rem; margin-left: 0.25rem; border-left: 2px solid var(--st-muted); border-bottom: 2px solid var(--st-muted);
  transform: rotate(45deg); transition: border-color 0.1s; }
.back-link:hover { background: var(--app-subtle); color: var(--st-text); }
.back-link:hover::before { border-color: var(--st-text); }
/* And after a link that goes forward (a project's card), pointing right. */
.go-link { display: inline-flex; align-items: center; gap: 0.45rem; text-decoration: none; }
.go-link::after { content: ""; width: 0.55rem; height: 0.55rem; border-right: 2px solid currentColor; border-top: 2px solid currentColor;
  transform: rotate(45deg); transition: translate 0.1s; }
.go-link:hover::after { translate: 0.15rem 0; }
/* Search: a magnifier that opens an input; results drop under it, grouped. */
.ws-search { position: relative; display: flex; align-items: center; gap: 0.25rem; }
.ws-search [data-search-open] { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; padding: 0; }
.ws-search [data-search-open] svg { width: 1.15rem; height: 1.15rem; display: block; }
.ws-search input { width: min(18rem, 46vw); height: auto; margin: 0; padding: 0.3rem 1.9rem 0.3rem 0.7rem; font-size: 0.85rem; border-radius: 999px; background-image: none; }
.ws-search input[hidden] { display: none; }
.ws-search input::-webkit-search-cancel-button { display: none; }
.ws-search .search-clear { position: absolute; right: 0.3rem; top: 50%; translate: 0 -50%; width: 1.3rem; height: 1.3rem; padding: 0; line-height: 1; font-size: 1rem; }
.ws-search .search-clear[hidden] { display: none; }
.search-results { position: absolute; top: calc(100% + 0.35rem); right: 0; z-index: 60; width: min(34rem, calc(100vw - 2rem)); max-height: min(70vh, 34rem);
  overflow: auto; padding: 0.35rem; background: var(--app-surface); border: 1px solid var(--st-border); border-radius: 12px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.18); font-size: 0.84rem; }
.search-results[hidden] { display: none; }
.search-results section + section { margin-top: 0.35rem; padding-top: 0.35rem; border-top: 1px solid var(--st-subtle); }
.search-results h6 { margin: 0.2rem 0.5rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--st-muted); }
.search-hit { display: flex; flex-direction: column; gap: 0.05rem; padding: 0.3rem 0.5rem; border-radius: 8px; color: var(--st-text); text-decoration: none; min-width: 0; }
.search-hit.is-marked { background: var(--st-accent-soft); }
.search-hit > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit small { font-size: 0.78rem; }
.search-hit code { padding: 0; background: none; font-size: 0.8rem; color: inherit; }
.search-hit mark { padding: 0; border-radius: 2px; background: color-mix(in srgb, var(--st-warning) 40%, transparent); color: inherit; }
.search-note { margin: 0.4rem 0.5rem; font-size: 0.8rem; }
/* What a result points at lights up for a moment. */
.search-flash { animation: search-flash 1.6s ease-out; }
@keyframes search-flash { from { box-shadow: 0 0 0 3px var(--st-warning); background-color: color-mix(in srgb, var(--st-warning) 22%, transparent); } to { box-shadow: 0 0 0 3px transparent; } }
.ws-toggles, .ws-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.ws-bar button { margin: 0; }

button.chip, button.ghost, button.icon, a.icon, button.small {
  width: auto; margin: 0; padding: 0.3rem 0.75rem; font-size: 0.82rem; line-height: 1.2; border-radius: 999px;
  background: transparent; border: 1px solid var(--st-border); color: var(--st-muted); box-shadow: none; }
button.chip:hover, button.ghost:hover, button.icon:hover, a.icon:hover { color: var(--st-text); border-color: var(--st-muted); }
button.chip[aria-pressed="true"] { background: var(--st-accent-soft); border-color: transparent; color: var(--st-accent); font-weight: 600; }
button.icon, a.icon { display: inline-grid; place-items: center; min-width: 1.6rem; min-height: 1.6rem; padding: 0.15rem 0.45rem; border-color: transparent; border-radius: 0.4rem; text-decoration: none; }
button.small { background: var(--st-accent); border-color: var(--st-accent); color: var(--st-on-accent); }

.ws-tiles { position: relative; flex: 1; min-height: 0; }
.tile { position: absolute; box-sizing: border-box; padding: 4px; display: flex; flex-direction: column; }
.tile[hidden] { display: none; }
.tile.is-moving { opacity: 0.45; }
.tile-head { display: flex; align-items: center; gap: 0.4rem; height: 2.3rem; padding: 0 0.4rem 0 0.8rem; flex: none;
  background: var(--st-surface); border: 1px solid var(--st-border); border-bottom-color: var(--st-subtle);
  border-radius: 10px 10px 0 0; cursor: grab; user-select: none; font-size: 0.82rem; }
.tile-name { font-weight: 600; color: var(--st-text); white-space: nowrap; }
.tile-head .tile-float { margin-left: auto; }
/* The chat's history icon sits just before the enlarge button, at the right. */
.tile-head .chat-history-btn { margin-left: auto; }
.tile-head .chat-history-btn ~ :is(.tile-float, .tile-close) { margin-left: 0; }
.tile-head .tile-float[aria-pressed="true"] { color: var(--st-accent); }
/* Every icon in a tile's head: one box, one glyph size. */
.tile-head :is(button, a).icon { width: 1.75rem; height: 1.75rem; min-width: 0; min-height: 0; padding: 0; flex: none; }
.tile-head .icon svg { width: 1.1rem; height: 1.1rem; display: block; }
.tile-head .tile-float[aria-pressed="true"] .when-off, .tile-head .tile-float:not([aria-pressed="true"]) .when-on,
.tile-head [data-folded="true"] .when-off, .tile-head :is([data-files-toggle], [data-diff-toggle]):not([data-folded="true"]) .when-on { display: none; }
/* A floating tile: large over the others until toggled back (the inline
   position from the layout is overridden, not lost). */
.tile.is-floating { position: fixed !important; inset: 3vh 3vw !important; width: auto !important; height: auto !important; z-index: 900;
  padding: 0; border-radius: 12px; box-shadow: 0 24px 70px rgba(17, 24, 39, 0.35); }
.tile.is-floating .tile-head { cursor: default; }
/* Files and Code float as a pair: the list on the left, the code beside it. */
#tile-files.is-float-pair { inset: 3vh auto 3vh 3vw !important; width: min(22vw, 22rem) !important; }
#tile-code.is-float-pair { inset: 3vh 3vw 3vh calc(3vw + min(22vw, 22rem) + 0.6rem) !important; }
.tile-backdrop { position: fixed; inset: 0; z-index: 899; background: color-mix(in srgb, var(--app-overlay) 60%, transparent); backdrop-filter: blur(2px); }
@media (max-width: 760px) { .tile-head .tile-float { display: none; } .tile-head .tile-close { margin-left: auto; } }
.tile-body { flex: 1; min-height: 0; overflow: auto; background: var(--st-surface); border: 1px solid var(--st-border);
  border-top: none; border-radius: 0 0 10px 10px; }
.tile-gutter { position: absolute; z-index: 5; }
.tile-gutter.is-row { width: 10px; margin-left: -5px; cursor: col-resize; }
.tile-gutter.is-col { height: 10px; margin-top: -5px; cursor: row-resize; }
.tile-gutter:hover::after { content: ""; position: absolute; inset: 0; margin: auto; background: var(--st-accent); border-radius: 2px; }
.tile-gutter.is-row:hover::after { width: 2px; }
.tile-gutter.is-col:hover::after { height: 2px; }
.tile-drop { position: absolute; z-index: 6; pointer-events: none; border-radius: 10px;
  background: color-mix(in srgb, var(--st-accent) 14%, transparent); border: 2px dashed var(--st-accent); }
.ws-tiles.is-dragging { user-select: none; }
.ws-tiles.is-dragging iframe { pointer-events: none; }

/* preview */
.tile-body[data-slot="preview"] { overflow: hidden; background: var(--st-subtle); }
.preview-frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.preview-nav { display: flex; flex: 1; align-items: center; gap: 0.2rem; margin: 0 0 0 0.5rem; min-width: 0; }
.preview-nav input { flex: 1; min-width: 4rem; height: 1.7rem; margin: 0; padding: 0 0.6rem; font-size: 0.8rem;
  border-radius: 999px; background: var(--st-subtle); border-color: transparent; font-family: var(--app-font-mono); }
.preview-wait { padding: 1.5rem; max-width: 36rem; }

/* chat */
.chat { display: flex; flex-direction: column; }
.chat-log { flex: 1; overflow: auto; padding: 1rem 0.9rem; }
.chat-compose { display: flex; gap: 0.5rem; align-items: flex-end; padding: 0.6rem; margin: 0; border-top: 1px solid var(--st-subtle); }
.chat-compose textarea { margin: 0; resize: none; font-size: 0.9rem; }
.chat-full-note { flex: 0 0 100%; display: flex; align-items: center; gap: 0.5rem; margin: 0; padding: 0.35rem 0.6rem; border-radius: 0.4rem;
  background: var(--st-warning-soft); color: var(--st-warning); font-size: 0.78rem; line-height: 1.35; }
.chat-full-note[hidden] { display: none; }
.chat-full-note span { flex: 1; }
.chat-full-note button { flex: none; width: auto; margin: 0; white-space: nowrap; }
.compose-actions { display: flex; flex-direction: column; gap: 0.35rem; }
.compose-actions button { width: auto; margin: 0; }
/* The model for the next message, above Send. */
.compose-actions select.chat-model { width: auto; height: auto; margin: 0; padding: 0.3rem 1.6rem 0.3rem 0.6rem; font-size: 0.8rem;
  background-position: center right 0.4rem; background-size: 0.8rem auto; }
.chat:not(:has(.chat-turns[data-live])) [data-chat-stop] { display: none; }
.chat:has(.chat-turns[data-live]) .compose-actions button[type=submit] { opacity: 0.5; pointer-events: none; }
.chat-msg { display: flex; margin-bottom: 0.75rem; }
.chat-msg .bubble { max-width: 88%; padding: 0.6rem 0.85rem; border-radius: 14px; font-size: 0.9rem; line-height: 1.55; }
.chat-msg.from-user { justify-content: flex-end; }
.chat-msg.from-user .bubble { background: var(--st-accent-soft); color: var(--st-text); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.chat-msg.from-ai .bubble { background: var(--st-subtle); border-bottom-left-radius: 4px; }
/* The AI's answer, formatted from its Markdown (workspace/markdown.go). */
.chat-msg .reply { overflow-wrap: anywhere; }
.chat-msg .reply > :first-child { margin-top: 0; }
.chat-msg .reply > :last-child { margin-bottom: 0; }
.chat-msg .reply p, .chat-msg .reply ul, .chat-msg .reply ol, .chat-msg .reply pre, .chat-msg .reply blockquote { margin: 0 0 0.6rem; }
.chat-msg .reply ul, .chat-msg .reply ol { padding-left: 1.2rem; }
.chat-msg .reply li { margin: 0 0 0.25rem; }
.chat-msg .reply li > ul, .chat-msg .reply li > ol { margin: 0.25rem 0 0; }
.chat-msg .reply h4, .chat-msg .reply h5 { margin: 0.8rem 0 0.35rem; font-size: 0.95rem; }
.chat-msg .reply h5 { font-size: 0.9rem; }
.chat-msg .reply code { padding: 0.05rem 0.3rem; border-radius: 0.3rem; background: var(--app-surface); font-size: 0.82em; }
.chat-msg .reply pre { padding: 0.6rem 0.7rem; background: var(--app-surface); font-size: 0.8rem; }
.chat-msg .reply pre code { padding: 0; background: none; }
.chat-msg .reply hr { margin: 0.6rem 0; }
.chat-msg .reply blockquote { padding: 0.2rem 0.7rem; }
.chat-msg .thinking { margin: 0.25rem 0 0; color: var(--st-muted); font-size: 0.85rem; }
.chat-msg p { margin-bottom: 0; }
/* Above the conversation: what it cost so far, and "New conversation". */
.chat-bar { position: sticky; top: -1rem; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  margin: -1rem -0.9rem 0.8rem; padding: 0.35rem 0.9rem; background: var(--st-surface, var(--app-surface)); border-bottom: 1px solid var(--st-subtle);
  font-size: 0.78rem; color: var(--st-muted); }
/* Files attached to a message: waiting above the box, and in the sent message. */
.chat-compose .attach-pending { flex: 0 0 100%; display: flex; flex-wrap: wrap; gap: 0.3rem; min-width: 0; }
.chat-compose .attach-pending[hidden] { display: none; }
.attach-chip { display: inline-flex; align-items: center; gap: 0.15rem; max-width: 100%; padding: 0.1rem 0.15rem 0.1rem 0.55rem; border-radius: 999px;
  background: var(--st-subtle); font-size: 0.8rem; }
.attach-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip button.icon { min-width: 1.5rem; min-height: 1.5rem; padding: 0; }
.chat-compose.is-drop { outline: 2px dashed var(--st-accent); outline-offset: -4px; border-radius: 10px; }
.compose-send { display: flex; gap: 0.25rem; align-items: center; }
.compose-send button[type=submit] { flex: 1; }
.chat-files { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.4rem; white-space: normal; }
.chat-file { padding: 0.05rem 0.5rem; border-radius: 999px; background: color-mix(in srgb, var(--st-text) 10%, transparent); font-size: 0.78rem; }
/* Earlier conversations: a list, then one of them read only; no message box meanwhile. */
.chat:has(.chat-past) .chat-compose { display: none; }
.chat-past .chat-bar { gap: 0.5rem; }
.chat-past .chat-bar .chip { flex: none; white-space: nowrap; }
.chat-past .chat-bar > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-past-hint { margin: 0.6rem 0; font-size: 0.82rem; }
.past-chats { list-style: none; margin: 0; padding: 0; }
.past-chats li { list-style: none; margin: 0 0 0.4rem; }
.past-chats a { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.55rem 0.7rem; border: 1px solid var(--st-border); border-radius: 10px;
  color: var(--st-text); text-decoration: none; min-width: 0; }
.past-chats a:hover { border-color: var(--st-accent); background: var(--st-accent-soft); }
.past-title { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-bar .chat-new { margin-left: auto; display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; padding: 0; }
.chat-new svg { width: 1rem; height: 1rem; display: block; }
.chat-event.is-fresh { display: flex; align-items: center; gap: 0.6rem; }
.chat-event.is-fresh::before, .chat-event.is-fresh::after { content: ""; flex: 1; border-top: 1px dashed var(--app-border-strong); }
.chat-event { text-align: center; color: var(--st-muted); font-size: 0.8rem; margin: 0.5rem 0 0.9rem; }
.did { margin: 0.5rem 0 0; font-size: 0.8rem; }
.did summary { color: var(--st-muted); padding: 0; }
.did summary::after { display: none; }
.did ul { margin: 0.35rem 0 0; padding-left: 0; }
.did li { list-style: none; margin: 0.1rem 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.did code { font-size: 0.75rem; background: none; padding: 0; }
.act { display: inline-block; min-width: 4.5rem; color: var(--st-muted); }
.act-edit, .act-write { color: var(--st-accent); }
.turn-foot { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 0.5rem; font-size: 0.8rem; }
.turn-foot .cost { margin-left: auto; white-space: nowrap; }
.chat-empty ul, .chat-examples { margin: 0.5rem 0 0; padding-left: 1.1rem; color: var(--st-muted); font-size: 0.88rem; }
.chat-note { background: var(--st-warning-soft); border-radius: 10px; padding: 0.75rem 0.9rem; font-size: 0.9rem; }
.chat-note p { margin-bottom: 0.5rem; }
a.small-link { padding: 0.25rem 0.8rem; font-size: 0.82rem; }

/* history: a timeline of versions (milestones) and their steps */
.timeline { list-style: none; margin: 0; padding: 0.5rem 0.6rem; }
.timeline > li { list-style: none; margin: 0 0 0.6rem; }
.h-milestone { border: 1px solid var(--st-border); border-radius: 10px; padding: 0.5rem 0.6rem; }
.h-milestone.is-pending { border-style: dashed; border-color: var(--st-accent); }
.h-milestone.is-current, .h-step.is-current { background: var(--st-accent-soft); border-color: transparent; }
.h-milestone.is-start { border-style: dotted; }
.h-head { display: flex; align-items: center; gap: 0.2rem; font-size: 0.86rem; }
.h-head .v-number { margin-right: 0.25rem; }
.h-waiting { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.4rem; font-size: 0.82rem; color: var(--st-warning); }
.h-waiting button { width: auto; margin: 0; flex: none; }
.h-head .h-title { flex: 1; min-width: 2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-head small { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-milestone.is-pending .h-head { gap: 0.45rem; flex-wrap: wrap; }
.h-head > :is(button, .h-state):first-of-type { margin-left: auto; }
/* Actions are icons with a tooltip (View, Rename, Restore); states are dots (Live, Was live, Saved, Current). */
button.h-act, a.h-act { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; padding: 0; flex: none; }
.h-act svg, .h-state svg { width: 1rem; height: 1rem; display: block; }
.h-state { flex: none; display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; }
.h-state:empty:where(:not(.is-publishing))::before { content: ""; box-sizing: border-box; width: 0.6rem; height: 0.6rem; border-radius: 50%; border: 2px solid var(--st-muted); }
.h-state.is-live::before { border-color: var(--st-success); background: var(--st-success); }
/* Publish again on the live version: the publish arrow in the accent colour (as Current), not grey like the others. */
.h-act.publish-again { color: var(--st-accent); }
.h-state.is-was::before { border-color: var(--st-success); }
.h-state.is-current::before { border-color: var(--st-accent); background: var(--st-accent); box-shadow: 0 0 0 2px var(--st-accent-soft), 0 0 0 3px var(--st-accent); width: 0.45rem; height: 0.45rem; border: 0; }
.h-state.h-viewing { color: var(--st-warning); }
.h-step > .h-act, .h-step > .h-state { margin-left: -0.25rem; }
/* A version's steps, folded under an arrow. */
.h-fold { margin: 0.35rem 0 0; }
.h-fold > summary { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.1rem 0.4rem 0.1rem 0.2rem; border-radius: 0.35rem;
  font-size: 0.78rem; color: var(--st-muted); list-style: none; cursor: pointer; }
.h-fold > summary:hover { background: var(--app-subtle); color: var(--st-text); }
.h-fold > summary::after, .h-fold > summary::-webkit-details-marker { display: none; }
.h-steps { list-style: none; margin: 0.4rem 0 0; padding: 0 0 0 0.6rem; border-left: 2px solid var(--st-subtle); }
.h-step { list-style: none; display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.4rem; border-radius: 8px; font-size: 0.84rem; }
.h-icon { color: var(--st-muted); width: 1rem; text-align: center; }
.h-step .h-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.h-step .h-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* settings */
.narrow { max-width: 42rem; }
label.choice { display: flex; width: 100%; gap: 0.75rem; align-items: flex-start; padding: 0.6rem 0.8rem; border: 1px solid var(--st-border);
  border-radius: 10px; margin-bottom: 0.5rem; cursor: pointer; }
label.choice:has(input:checked) { border-color: var(--st-accent); background: var(--st-accent-soft); }
label.choice input { margin-top: 0.3rem; }
.narrow form button[type=submit] { width: auto; }

/* files and code */
/* Plumbing is left out until "Show all files" is on; what changed always shows. */
#tile-files:not(.show-all) .file-tree li.is-plumbing:not(:has(.is-added, .is-modified, .is-inside)) { display: none; }
button.icon[data-files-all][aria-pressed="true"] { background: var(--st-accent-soft); color: var(--st-accent); }
button.icon[data-files-all] { padding: 0; }
[data-files-all] svg { width: 0.82rem; height: 0.82rem; display: block; flex: none; }
[data-files-all] > span { display: grid; }
[data-files-all][aria-pressed="true"] .when-off, [data-files-all][aria-pressed="false"] .when-on { display: none; }
.file-tree { list-style: none; margin: 0; padding: 0 0 0 0.85rem; font-size: 0.84rem; }
.tile-body > .file-tree { padding: 0.35rem 0.3rem; }
.file-tree li { list-style: none; margin: 0; padding: 0; }
.file-tree details { margin: 0; padding: 0; border: 0; }
.file-tree details[open] > summary { margin-bottom: 0; }
.file-tree ul { margin: 0; }
.file-tree summary { list-style: none; }
.file-tree summary::-webkit-details-marker, .file-tree summary::after { display: none; }
/* One row: arrow, icon, name, change dot. */
.ft-row { display: flex; align-items: center; gap: 0.3rem; padding: 0.12rem 0.35rem; border-radius: 0.35rem; line-height: 1.5;
  color: var(--st-text); text-decoration: none; cursor: pointer; white-space: nowrap; }
.ft-row:hover { background: var(--app-subtle); color: var(--st-text); }
a.ft-row.is-active { background: var(--app-accent-soft); }
.ft-name { overflow: hidden; text-overflow: ellipsis; }
.ft-arrow { flex: none; width: 0.7rem; height: 0.7rem; display: grid; place-items: center; }
.ft-arrow::before { content: ""; width: 0.32rem; height: 0.32rem; border-right: 1.5px solid var(--st-muted); border-bottom: 1.5px solid var(--st-muted);
  transform: rotate(-45deg); transition: transform 0.1s; }
details[open] > summary .ft-arrow::before { transform: rotate(45deg) translate(-1px, -1px); }
.ft-arrow.is-none::before { display: none; }
/* Icons: a folder (closed / open), and a short coloured glyph per file type. */
.ft-icon { flex: none; width: 1.25rem; text-align: center; font: 700 0.66rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: -0.03em; color: var(--st-muted); }
.ft-folder { height: 0.95rem; background: no-repeat center / 0.95rem
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23d9a441' d='M3 5.5A1.5 1.5 0 0 1 4.5 4h4.9a1.5 1.5 0 0 1 1.06.44L12 6h7.5A1.5 1.5 0 0 1 21 7.5v10A1.5 1.5 0 0 1 19.5 19h-15A1.5 1.5 0 0 1 3 17.5z'/%3E%3C/svg%3E"); }
details[open] > summary .ft-folder { background-image:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23b98a2f' d='M3 5.5A1.5 1.5 0 0 1 4.5 4h4.9a1.5 1.5 0 0 1 1.06.44L12 6h7.5A1.5 1.5 0 0 1 21 7.5V9H3z'/%3E%3Cpath fill='%23e3b65a' d='M4.6 10h17a1 1 0 0 1 .96 1.27l-1.9 6.6A1.5 1.5 0 0 1 19.2 19H4.5A1.5 1.5 0 0 1 3 17.5v-5.9A1.6 1.6 0 0 1 4.6 10z'/%3E%3C/svg%3E"); }
.ft-go { color: #007f9e; } .ft-gomod { color: #517a84; }
.ft-js { color: #8b7100; } .ft-ts { color: #3076c2; }
.ft-html { color: #c74d26; } .ft-css { color: #3578b9; font-size: 0.75rem; }
.ft-json { color: #7c7700; } .ft-sql { color: #bd4e7f; }
.ft-md { color: #417c97; } .ft-sh { color: #33844b; font-size: 0.72rem; }
.ft-img { color: #8b5fc1; font-size: 0.7rem; }
/* The same families, lighter, on the dark theme. */
:root[data-theme="dark"] .ft-go { color: #29b8dc; } :root[data-theme="dark"] .ft-gomod { color: #8cc7d6; }
:root[data-theme="dark"] .ft-js { color: #d9b61f; } :root[data-theme="dark"] .ft-ts { color: #6ea8ea; }
:root[data-theme="dark"] .ft-html { color: #f0805c; } :root[data-theme="dark"] .ft-css { color: #6aaae8; }
:root[data-theme="dark"] .ft-json { color: #bdb62a; } :root[data-theme="dark"] .ft-sql { color: #e582ac; }
:root[data-theme="dark"] .ft-md { color: #6fb0cd; } :root[data-theme="dark"] .ft-sh { color: #5fbd7b; }
:root[data-theme="dark"] .ft-img { color: #b490e6; }
.ft-conf, .ft-txt, .ft-file { font-size: 0.72rem; }
/* Changes since the live version: a dot and a tinted name. */
.ft-dot { flex: none; margin-left: auto; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--app-warning); }
.ft-row.is-added .ft-dot { background: var(--app-success); }
.ft-row.is-added .ft-name { color: var(--app-success); }
.ft-row.is-modified .ft-name { color: var(--app-warning); }
.ft-row.is-inside .ft-dot { opacity: 0.55; }
.code { display: flex; flex-direction: column; height: 100%; margin: 0; }
.code-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--st-subtle); font-size: 0.8rem; }
.code-head code { background: none; padding: 0; font-size: 0.8rem; }
.code-head button { margin-left: auto; }
.code-state { color: var(--st-warning); }
/* The editor: a transparent textarea over its highlighted copy (same metrics). */
.code-editor { flex: 1; min-height: 0; display: flex; background: var(--st-surface); border-radius: 0 0 10px 10px; overflow: hidden; }
.code-gutter, .code-hl, .code-area textarea.code-text {
  font-family: var(--app-font-mono); font-size: var(--code-size, 13px); line-height: 1.6; tab-size: 4; white-space: pre; }
/* Smaller / larger text in the editor (the tile's head; app.js sets --code-size on the tile). */
.tile-head button.code-size { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: 1px; font-size: 0.82rem; font-weight: 600; }
.code-size-sign { font-size: 0.85em; font-weight: 700; }
.code-size:disabled { opacity: 0.35; cursor: default; }
.code-gutter { flex: none; min-width: 3.2em; padding: 0.75rem 0.6rem 0.75rem 0.4rem; overflow: hidden; text-align: right;
  color: var(--st-muted); user-select: none; border-right: 1px solid var(--st-subtle); }
.code-area { position: relative; flex: 1; min-width: 0; }
.code-hl, .code-area textarea.code-text { position: absolute; inset: 0; margin: 0; padding: 0.75rem 1rem; border: 0; border-radius: 0; }
.code-hl { overflow: hidden; pointer-events: none; color: var(--st-text); background: transparent; }
.code-hl code { padding: 0; background: none; color: inherit; font: inherit; }
/* The line of what was pointed at in the preview: marked, then fading. */
.code-line-mark { position: absolute; left: 0; width: 400vw; pointer-events: none; background: color-mix(in srgb, var(--st-accent) 22%, transparent);
  animation: code-line-fade 3s ease-out forwards; }
@keyframes code-line-fade { 0%, 55% { opacity: 1; } 100% { opacity: 0; } }
/* The text is visible until the highlighted copy is painted (is-highlighted):
   if highlighting cannot run, the code still shows, uncoloured. */
.code-area textarea.code-text { height: 100%; overflow: auto; resize: none; background: transparent; color: var(--st-text);
  caret-color: var(--st-text); box-shadow: none; outline: none; transition: none; }
.code.is-highlighted .code-area textarea.code-text { color: transparent; -webkit-text-fill-color: transparent; }
.code:not(.is-highlighted) .code-hl { visibility: hidden; }
.code.is-highlighted .code-area textarea.code-text::selection { background: color-mix(in srgb, var(--st-accent) 28%, transparent); color: transparent; }

/* Token colours: soft, readable, one family per kind. */
:root:not([data-theme="dark"]) {
  --tk-kw: #8a3fd1; --tk-type: #0e7f86; --tk-fn: #2b62c9; --tk-str: #2d844c; --tk-num: #b25f0f;
  --tk-com: #6f757e; --tk-tag: #c03b6f; --tk-attr: #8f6a14; --tk-tpl: #4f5fd8; --tk-head: #1f2430;
}
:root[data-theme="dark"] {
  --tk-kw: #c9a3ff; --tk-type: #6fd3d8; --tk-fn: #8fb6ff; --tk-str: #93d3a2; --tk-num: #f2b275;
  --tk-com: #858c97; --tk-tag: #f48fb8; --tk-attr: #e7c07a; --tk-tpl: #a9b3f6; --tk-head: #e5e7eb;
}
.tk-kw { color: var(--tk-kw); }
.tk-type { color: var(--tk-type); }
.tk-fn { color: var(--tk-fn); }
.tk-str { color: var(--tk-str); }
.tk-num { color: var(--tk-num); }
.tk-com { color: var(--tk-com); font-style: italic; }
.tk-tag { color: var(--tk-tag); }
.tk-attr { color: var(--tk-attr); }
.tk-tpl { color: var(--tk-tpl); background: color-mix(in srgb, var(--tk-tpl) 10%, transparent); border-radius: 3px; }
.tk-head { color: var(--tk-head); font-weight: 700; }

/* diff */
/* Changes: fits any tile width. A file's header wraps (the path breaks, the
   counts stay at the right); long code lines scroll inside the file's box. */
.diff { padding: 0.5rem 0.75rem; font-size: 0.84rem; min-width: 0; }
.diff-summary { margin-bottom: 0.5rem; color: var(--st-muted); }
.diff-file { border: 1px solid var(--st-border); border-radius: 8px; margin-bottom: 0.5rem; padding: 0; min-width: 0; overflow: hidden; }
.diff-file summary { padding: 0.35rem 0.6rem; display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; align-items: center; }
.diff-file summary code { flex: 1 1 6rem; min-width: 0; padding: 0; background: none; overflow-wrap: anywhere; }
/* The line under the file name is on the code, so it slides with it (on the summary it would jump). */
.diff-file > summary + * { border-top: 1px solid var(--st-border); }
.diff-file summary::after { display: none; }
.diff-status { flex: none; font-size: 0.72rem; font-weight: 600; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--st-subtle); color: var(--st-muted); }
.diff-added { background: var(--st-success-soft); color: var(--st-success); }
.diff-deleted { background: var(--st-danger-soft); color: var(--st-danger); }
.diff-counts { flex: none; margin-left: auto; font-family: var(--app-font-mono); font-size: 0.75rem; white-space: nowrap; }
.diff-counts .add { color: var(--st-success); }
.diff-counts .del { color: var(--st-danger); }
/* A grid as wide as its longest line, so line backgrounds reach the end when scrolled. */
.diff-lines { display: grid; grid-template-columns: minmax(100%, max-content); margin: 0; padding: 0.25rem 0; font-size: 0.76rem; line-height: 1.5;
  border-radius: 0; background: none; overflow-x: auto; }
.dl { display: block; min-height: 1.5em; padding: 0 0.75rem; white-space: pre; }
.dl-add { background: var(--st-success-soft); }
.dl-add::before { content: "+ "; color: var(--st-success); }
.dl-del { background: var(--st-danger-soft); }
.dl-del::before { content: "− "; color: var(--st-danger); }
.dl-ctx::before { content: "  "; }
.dl-hunk { color: var(--st-muted); background: var(--st-subtle); }

/* versions */
.v-number { font-family: var(--app-font-mono); color: var(--st-muted); font-size: 0.85rem; }
.accept-changes { margin: 0 0 1rem; color: var(--st-muted); }
.chat-event.is-version { color: var(--st-success); font-weight: 600; }
dialog.wide > article { max-width: min(64rem, 95vw); width: 64rem; }
.row .col-label { flex: 0 0 9rem; }

/* viewing a version */
.view-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  margin: 0 0 0.6rem; padding: 0.5rem 0.75rem; border-radius: 10px; background: var(--st-warning-soft); font-size: 0.88rem; }
.view-bar .actions { display: flex; gap: 0.4rem; }
.h-milestone.is-viewing, .h-step.is-viewing { background: var(--st-warning-soft); border-color: var(--st-warning); }
.h-milestone.is-viewing.is-current { border-color: var(--st-warning); }

/* code repository */
.remote-form .actions { margin-top: 0.25rem; }
.remote-form .actions button { width: auto; }
.remote-status p { margin: 0.5rem 0; }
.deploy-key pre.key { white-space: pre-wrap; word-break: break-all; font-size: 0.78rem; padding: 0.6rem 0.75rem; }

/* pointing at the preview */
/* Point at something: larger than the other icons; grey like them until it is on. */
button.pick-btn { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; padding: 0; flex: none; }
button.icon[data-pick][aria-pressed="true"] { background: var(--st-accent); color: var(--st-on-accent); }
.chat-compose { flex-wrap: wrap; }
.chat-compose .pick-pending { flex: 0 0 100%; min-width: 0; max-width: 100%; box-sizing: border-box; display: flex; flex-wrap: wrap;
  align-items: center; gap: 0.25rem 0.4rem; font-size: 0.84rem;
  background: var(--st-accent-soft); color: var(--st-accent); border-radius: 8px; padding: 0.3rem 0.4rem 0.3rem 0.7rem; }
.chat-compose .pick-pending[hidden] { display: none; }
/* The label shrinks to "…" first; in a narrow tile the buttons go under it. */
.chat-compose .pick-pending span { flex: 1 1 7rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-compose .pick-pending button { flex: none; width: auto; margin: 0; white-space: nowrap; }
.chat-compose textarea { flex: 1; min-width: 0; }
.pick-chip { display: block; margin-bottom: 0.3rem; font-size: 0.8rem; color: var(--st-accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Planning the first version: the plan's label and "Build it" under it. */
.plan-label { display: inline-block; margin-bottom: 0.4rem; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
  background: color-mix(in srgb, var(--app-accent-tone) 14%, transparent); color: var(--app-accent-tone); }
.chat-next { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 0.25rem 0 0.75rem; }
.chat-next button { margin: 0; }
/* The project page's cards, side by side from laptop width up. */

/* Status page */
.dot { display: inline-block; width: 0.55rem; height: 0.55rem; margin-right: 0.45rem; border-radius: 50%; background: var(--app-border); vertical-align: 0.05rem; }
.dot.is-good { background: var(--app-success); }
.dot.is-bad { background: var(--app-danger); }
.is-bad-text { color: var(--app-danger); font-weight: 600; }
/* The verdict at the top: green and quiet when all is well, red with the list when not. */
.status-banner { border-left: 4px solid var(--app-border); }
.status-banner.is-good { border-left-color: var(--app-success); }
.status-banner.is-good strong { color: var(--app-success); }
.status-banner.is-bad { border-color: var(--app-danger); border-left-width: 4px; background: var(--app-danger-soft); }
.status-banner-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.25rem 1rem; }
.status-banner .rows { margin-top: 0.75rem; }
.status-banner.is-bad .rows > li { border-color: color-mix(in srgb, var(--app-danger) 25%, transparent); }
/* Numbers at a glance. */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; margin-bottom: var(--app-space); }
.stat { display: flex; flex-direction: column; padding: 0.75rem 1rem; border: 1px solid var(--st-border); border-radius: var(--app-radius); background: var(--app-surface); }
.stat > span { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat > small { color: var(--st-muted); }
.section-title { margin: 1.5rem 0 0.6rem; font-size: 1.05rem; }
/* A server: its state in the head, then how full it is. */
.server-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); gap: 0.75rem; margin-bottom: var(--app-space); }
.server-card { margin: 0; }
.server-card header small { margin-left: 0.4rem; font-weight: 400; }
.meters { display: grid; gap: 0.7rem; }
.meter-label { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.25rem; font-size: 0.86rem; }
.meter-bar { height: 0.45rem; border-radius: 999px; background: var(--app-subtle); overflow: hidden; }
.meter-bar > span { display: block; height: 100%; min-width: 0.2rem; border-radius: inherit; background: var(--app-success); transition: width var(--st-slow, 0.2s); }
.meter.is-bad .meter-bar > span { background: var(--app-danger); }
.meter.is-bad .meter-label > :last-child { color: var(--app-danger); font-weight: 600; }
.server-backup { margin: 0.9rem 0 0; font-size: 0.86rem; }
.status-recent li { font-size: 0.9rem; }

/* --- Motion -----------------------------------------------------------------------------
   Things that open, close or appear do so smoothly, in CSS only: an element that
   becomes visible starts from @starting-style, one that gets [hidden] fades out before
   it leaves (display … allow-discrete). Browsers without these simply switch at once.
   Reduced motion (base.css) turns all of it off. */
:root { --st-fast: 0.14s; --st-slow: 0.22s; --st-ease: cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Search: the input grows out of the magnifier; the results drop down. */
.ws-search input { transition: width var(--st-slow) var(--st-ease), padding var(--st-slow) var(--st-ease), opacity var(--st-fast),
  border-color 0.15s, box-shadow 0.15s, display var(--st-slow) allow-discrete; }
.ws-search input[hidden] { width: 0; padding-inline: 0; opacity: 0; }
@starting-style { .ws-search input:not([hidden]) { width: 0; padding-inline: 0; opacity: 0; } }
.search-results, .ws-search .search-clear { transition: opacity var(--st-fast), translate var(--st-fast) var(--st-ease), display var(--st-fast) allow-discrete; }
.search-results[hidden] { opacity: 0; translate: 0 -0.35rem; }
@starting-style { .search-results:not([hidden]) { opacity: 0; translate: 0 -0.35rem; } }
.ws-search .search-clear[hidden] { opacity: 0; }
@starting-style { .ws-search .search-clear:not([hidden]) { opacity: 0; } }

/* Menus drop down. */
details.dropdown[open] > ul { transition: opacity var(--st-fast), translate var(--st-fast) var(--st-ease); }
@starting-style { details.dropdown[open] > ul { opacity: 0; translate: 0 -0.35rem; } }

/* Dialogs come up. */
dialog[open] { transition: opacity var(--st-fast); }
dialog[open] > article { transition: translate var(--st-slow) var(--st-ease), scale var(--st-slow) var(--st-ease); }
@starting-style {
  dialog[open] { opacity: 0; }
  dialog[open] > article { translate: 0 0.6rem; scale: 0.98; }
}

/* Tiles: one that is switched on fades in; a floated one pops up over a fading backdrop. */
.tile { transition: opacity var(--st-fast); }
@starting-style { .tile:not([hidden]) { opacity: 0; } }
.tile.is-floating { animation: st-pop var(--st-slow) var(--st-ease); }
@keyframes st-pop { from { opacity: 0.4; scale: 0.97; } }
.tile-backdrop { transition: opacity var(--st-slow), display var(--st-slow) allow-discrete; }
.tile-backdrop[hidden] { opacity: 0; }
@starting-style { .tile-backdrop:not([hidden]) { opacity: 0; } }

/* Rows that appear: what was pointed at, the bar of a viewed version. */
.chat-compose .pick-pending, .view-bar { transition: opacity var(--st-slow), translate var(--st-slow) var(--st-ease); }
@starting-style { .chat-compose .pick-pending:not([hidden]), .view-bar { opacity: 0; translate: 0 -0.3rem; } }

/* The switches in the bar and the arrows of folders and folds. */
button.chip { transition: background-color 0.15s, border-color 0.15s, color 0.15s; }
.ft-arrow::before { transition: transform var(--st-fast) var(--st-ease); }

/* Folders and a version's changes slide open (where the browser can animate to a content's height). */
@supports (interpolate-size: allow-keywords) {
  :is([data-slot="files"] details, .h-fold, .diff-file) { interpolate-size: allow-keywords; }
  /* No space under an open title: base.css adds it at once, which would jump before the slide
     (as strong as base.css's rule, and later). */
  :is([data-slot="files"] details, .h-fold, .diff-file)[open] > summary { margin-bottom: 0; }
  :is([data-slot="files"] details, .h-fold, .diff-file)::details-content { height: 0; overflow: hidden; /* hidden, not clip: it holds the margins inside, which would jump at the end */
    transition: height var(--st-slow) var(--st-ease), content-visibility var(--st-slow) allow-discrete; }
  :is([data-slot="files"] details, .h-fold, .diff-file)[open]::details-content { height: auto; }
  [data-slot="files"] details.ft-still::details-content { transition: none; }
  /* "Show all files" by hand: the plumbing rows slide in and out. */
  #tile-files.ft-sliding .file-tree li.is-plumbing { interpolate-size: allow-keywords; overflow: clip;
    transition: height var(--st-slow) var(--st-ease), opacity var(--st-slow), display var(--st-slow) allow-discrete; }
  #tile-files.ft-sliding:not(.show-all) .file-tree li.is-plumbing:not(:has(.is-added, .is-modified, .is-inside)) { height: 0; opacity: 0; }
  @starting-style { #tile-files.ft-sliding.show-all .file-tree li.is-plumbing { height: 0; opacity: 0; } }
}

/* The menu panel (☰) slides in from the left over a backdrop that fades in and out. */
:root.nav-open .nav-links { transition: translate var(--st-slow) var(--st-ease), opacity var(--st-fast); }
@starting-style { :root.nav-open .nav-links { translate: -100% 0; opacity: 0.6; } }
.nav-backdrop { position: fixed; inset: 0; z-index: 999; background: rgba(17, 24, 39, 0.25); opacity: 0;
  transition: opacity var(--st-slow), display var(--st-slow) allow-discrete; }
:root.nav-open .nav-backdrop { opacity: 1; }
@starting-style { :root.nav-open .nav-backdrop { opacity: 0; } }

/* --- The Board tile: tasks in three columns (the framework's board, its own cards) --- */
.task-board { grid-auto-columns: minmax(11rem, 1fr); gap: 0.5rem; padding: 0.5rem; margin: 0; font-size: 0.86rem; }
.task-board .board-col { padding: 0.4rem; }
.task-col-todo { border-top-color: var(--st-danger); }
.task-col-doing { border-top-color: var(--st-warning); }
.task-col-done { border-top-color: var(--st-success); }
.task-card { display: flex; flex-direction: column; gap: 0.3rem; cursor: default; }
.task-card[draggable="true"] { cursor: grab; }
.task-top { display: flex; align-items: flex-start; gap: 0.25rem; }
/* The title opens the task; it reads as the card's text, not as a button. */
button.task-title { flex: 1; min-width: 0; width: auto; margin: 0; padding: 0; border: 0; background: none; box-shadow: none; color: var(--st-text);
  font: inherit; font-weight: 600; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
button.task-title:hover { color: var(--st-accent); }
.task-run { color: var(--st-accent) !important; font-size: 0.95rem; }
.task-body { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
/* The AI's mark: on what it works on and on what it did. */
.task-card.is-ai { border-left: 3px solid var(--st-accent); }
.task-ai { display: flex; align-items: center; gap: 0.3rem; margin: 0; font-size: 0.78rem; color: var(--st-accent); }
.task-ai.is-failed { color: var(--st-danger); }
.task-ai-mark { font-size: 0.9rem; }
.task-card.is-running { background: var(--st-accent-soft); }
.task-approve { display: flex; align-items: center; gap: 0.4rem; margin: 0.15rem 0 0; font-size: 0.8rem; cursor: pointer; }
.task-approve input { margin: 0; }
.task-approve:has(input:checked) { color: var(--st-success); font-weight: 600; }
.task-approver { font-size: 0.76rem; }

/* A task's line of facts on its card: priority, who has it, how many comments. */
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; margin: 0; font-size: 0.76rem; color: var(--st-muted); }
.task-prio { padding: 0 0.45rem; border-radius: 999px; font-weight: 600; background: color-mix(in srgb, var(--st-text) 9%, transparent); color: var(--st-text); }
.task-prio.is-high { background: var(--st-danger-soft); color: var(--st-danger); }
.task-prio.is-low { background: none; padding: 0; font-weight: 400; color: var(--st-muted); }
.task-who::before { content: "👤 "; font-size: 0.7rem; }
.task-facts { margin: 0 0 1rem; font-size: 0.82rem; }
.task-activity-title { margin: 1.25rem 0 0.5rem; font-size: 0.95rem; }
dialog[data-task-modal] .activity { font-size: 0.9rem; }

/* New project: app or website. */
.project-kind { border: 0; margin: 0 0 1rem; padding: 0; }
.project-kind legend { margin-bottom: 0.4rem; padding: 0; }
