/* ============================================================
   Generate (js/generate.js) — PatchWork Standard.
   The page frame of the Generate tool: the side list (All assets,
   projects), the header (Prompt · Clips · Nodes) and the top strip
   ("Waiting for your pick"). The gallery and prompt bar inside are
   js/studio.js (inline styles + css/studio.css). Only `.gen-*`
   selectors live here; shared components are the `.sl-*` classes
   from css/slate.css, extended by co-located modifiers, never
   restyled. Every colour is a --sl-* token (Dark and Light).
   ============================================================ */

.gen-page {
    display: flex;
    height: 100%;
    min-height: 0;
    width: 100%;
    font-family: var(--sl-font-ui);
    color: var(--sl-text-1);
    background: var(--sl-app);
}
.gen-grow { flex: 1 1 auto; min-width: 0; }
.gen-body.hidden, .gen-empty.hidden { display: none; }

/* ── side list ── */
.gen-side {
    width: 240px;
    flex: none;
    display: flex;
    flex-direction: column;
    min-height: 0;
    box-sizing: border-box;
    background: var(--sl-panel);
    border-right: 1px solid var(--sl-hairline);
}
.gen-side-head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 12px 8px 16px;
}
.gen-side-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; color: var(--sl-text-1); }
.gen-side-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.gen-libs, .gen-projects { display: flex; flex-direction: column; gap: 2px; }
.gen-row .gen-row-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gen-row > svg { flex: none; color: var(--sl-text-3); }
.gen-row.is-active > svg { color: var(--sl-link); }
.gen-count { flex: none; margin-left: auto; font-family: var(--sl-font-mono); font-size: 10.5px; color: var(--sl-text-3); }
.gen-dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.gen-group {
    display: flex;
    align-items: center;
    padding: 14px 9px 4px;
    font-family: var(--sl-font-mono);
    font-size: 9.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sl-text-3);
}
.gen-group > :first-child { flex: 1; }
.gen-group-sort { letter-spacing: 0.04em; text-transform: none; font-size: 10px; }
.gen-add, .gen-more { color: var(--sl-text-2); }
.gen-more > svg { flex: none; }

/* search over the project list: a field, then Projects | Prompts */
.gen-search { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 0 10px 6px; }
.gen-search-field {
    display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 9px;
    border-radius: 8px; box-sizing: border-box;
    background: var(--sl-card); border: 1px solid var(--sl-hairline); color: var(--sl-text-3);
}
.gen-search-field:focus-within { border-color: var(--sl-focus); }
.gen-search-field > svg { flex: none; }
.gen-search-input {
    flex: 1; min-width: 0; height: 100%; border: none; outline: none; background: transparent;
    font-family: var(--sl-font-ui); font-size: 12.5px; color: var(--sl-text-1);
}
.gen-search-input::placeholder { color: var(--sl-placeholder); }
.gen-search-mode { align-self: stretch; display: flex; }
.gen-search-mode .sl-seg-btn { flex: 1; }
.gen-search-none { padding: 6px 9px; font-size: 12px; color: var(--sl-text-3); }
.gen-row-hit { height: auto; padding-top: 6px; padding-bottom: 6px; align-items: flex-start; }
.gen-row-hit > .gen-dot { margin-top: 4px; }
.gen-row-hit .gen-row-label { display: flex; flex-direction: column; gap: 2px; white-space: normal; }
.gen-row-name, .gen-row-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gen-row-snippet { font-size: 11px; font-weight: 400; color: var(--sl-text-3); }
.gen-add > svg { flex: none; }

/* ── main column ── */
.gen-main {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.gen-head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    height: 56px;
    padding: 0 20px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--sl-hairline);
}
.gen-mark {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sl-accent-tint);
    color: var(--sl-accent-text);
}
.gen-title {
    margin: 0;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 38%;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gen-views { flex: none; margin-left: 6px; }
.gen-waits { flex: none; white-space: nowrap; }
.gen-head .sl-btn-primary, .gen-head .sl-btn-secondary { flex: none; }

/* ── body: the gallery (js/studio.js), or Nodes' empty state ── */
.gen-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}
.gen-body > .studio-shell { flex: 1; min-width: 0; }
.gen-empty {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: var(--sl-app);
    background-image: radial-gradient(color-mix(in oklab, var(--sl-ink) 9%, transparent) 1px, transparent 1px);
    background-size: 18px 18px;
}
.gen-empty-box {
    padding: 28px 32px;
    border-radius: 14px;
    background: var(--sl-card);
    border: 1px solid var(--sl-hairline);
}
.gen-empty-acts { display: flex; gap: 8px; margin-top: 6px; }
.gen-note { font-size: 12px; color: var(--sl-error); max-width: 360px; }

/* ── phone: one column; the side list is its own page ── */
.gen-page.is-phone { flex-direction: column; }
.gen-page.is-phone .gen-side { display: none; }
.gen-page.is-phone.is-list .gen-side {
    display: flex;
    width: 100%;
    flex: 1;
    border-right: none;
    background: var(--sl-app);
}
.gen-page.is-phone.is-list .gen-main { display: none; }
.gen-page.is-phone .gen-side-head { padding: 14px 14px 8px 18px; }
.gen-page.is-phone .gen-side-title { font-size: 20px; }
.gen-page.is-phone .gen-side .sl-navitem { height: 44px; font-size: 14px; }
.gen-page.is-phone .gen-side .gen-row-hit { height: auto; min-height: 44px; }
.gen-page.is-phone .gen-search-field { height: 38px; }
.gen-page.is-phone .gen-search-input { font-size: 16px; }
.gen-page.is-phone .gen-side .gen-new { width: 40px; height: 40px; }
.gen-page.is-phone .gen-head {
    height: auto;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px 10px;
}
.gen-page.is-phone .gen-back,
.gen-page.is-phone .gen-more { width: 40px; height: 40px; flex: none; }
.gen-page.is-phone .gen-title { max-width: none; flex: 1 1 0; font-size: 17px; }
.gen-page.is-phone .gen-head > .gen-grow { display: none; }
.gen-page.is-phone .gen-views.is-wide { order: 10; flex: 1 1 100%; margin: 0; display: flex; }
.gen-page.is-phone .gen-views.is-wide .sl-seg-btn { flex: 1; justify-content: center; min-height: 36px; }
