/* THE DESIGN STUDIO (docs/claude/DESIGN.md "The Studio"; designer-css-plan section 3) - the library (/design) and the Studio
   (/design/{id}). Owns every dst-* class (Tests/ConversationBuilderCssOwnershipTests). Every colour, border, shadow and radius
   is a --theme-* / --wf-* token, so a workspace theme (a dark one included) re-skins it. The Studio sits on the builder's shell
   (conv-builder.css owns conv-header, conv-tabbar, conv-banner, conv-btn). This file styles the PORTAL's chrome only - a design's
   own CSS is never loaded here (Tests/Design/ThePortalNeverLoadsCustomerCssTests): it is shown only inside the go preview frame. */

/* ---- The library ---- */
.dst-library { gap: var(--wf-space-4); }

.dst-lib-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--wf-space-3);
    margin-bottom: var(--wf-space-4);
}

.dst-lib-search { max-width: 28rem; flex: 1 1 16rem; }

.dst-lib-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18rem;
    gap: var(--wf-space-5);
    align-items: start;
}

@container page (max-width: 900px) {
    .dst-lib-cols { grid-template-columns: minmax(0, 1fr); }
}

.dst-lib-heading {
    font-size: var(--wf-text-h3);
    font-weight: 600;
    color: var(--theme-text-emphasis);
    margin: var(--wf-space-4) 0 var(--wf-space-2);
}

.dst-lib-help { padding: var(--wf-space-4); position: sticky; top: var(--wf-sticky-top); }

.dst-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: var(--wf-space-4);
}

.dst-card {
    display: flex;
    flex-direction: column;
    background: var(--wf-card);
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--wf-radius-lg);
    box-shadow: var(--wf-elev-1);
    overflow: hidden;
    transition: box-shadow var(--wf-motion) var(--wf-ease);
}

.dst-card:hover { box-shadow: var(--wf-elev-2); }

.dst-card.is-retired { opacity: 0.72; }

/* The pictures sit in their own clipped strip (they once spilled under the card's words), dimmed a touch so the cards read as
   a calm wall - a card comes to full brightness when it is pointed at or tabbed to. */
.dst-card-thumbs {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 100%;
    gap: 2px;
    height: 8.5rem;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--theme-border-subtle);
    overflow: hidden;
    background: var(--theme-background-subtle);
    cursor: pointer;
}

.dst-card-thumbs img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    object-position: top;
    display: block;
    filter: saturate(0.85) brightness(0.92);
    transition: filter var(--wf-motion) var(--wf-ease);
}

.dst-card-thumbs::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 55%, var(--wf-neutral-soft));
    opacity: 0.55;
    pointer-events: none;
    transition: opacity var(--wf-motion) var(--wf-ease);
}

.dst-card:hover .dst-card-thumbs img,
.dst-card:focus-within .dst-card-thumbs img { filter: none; }

.dst-card:hover .dst-card-thumbs::after,
.dst-card:focus-within .dst-card-thumbs::after { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
    .dst-card-thumbs img,
    .dst-card-thumbs::after { transition: none; }
}

.dst-card-thumbs:focus-visible { outline: 2px solid var(--wf-primary-ink); outline-offset: -2px; }

.dst-card-placeholder {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--wf-primary-ink);
    background: var(--wf-primary-soft);
}

.dst-card-body { display: flex; flex-direction: column; gap: var(--wf-space-2); padding: var(--wf-space-3) var(--wf-space-4) var(--wf-space-4); }

.dst-card-title { font-size: var(--theme-font-size-lg); font-weight: 600; color: var(--theme-text-emphasis); margin: 0; }

.dst-card-meta { display: flex; flex-wrap: wrap; gap: var(--wf-space-2); align-items: center; font-size: var(--wf-text-sm); color: var(--theme-text-muted); }

/* The design's key is a quiet detail beside the version, never a loud coloured word. */
.dst-card-meta code { font-size: var(--wf-text-xs); color: var(--theme-text-muted); background: none; padding: 0; }

.dst-card-essence {
    margin: 0;
    color: var(--theme-text-secondary);
    font-size: var(--wf-text-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dst-card-live { display: flex; flex-wrap: wrap; gap: var(--wf-space-1); align-items: center; }

.dst-card-actions { display: flex; flex-wrap: wrap; gap: var(--wf-space-2); margin-top: var(--wf-space-1); }

/* A card's actions read as buttons: an outline that fills on hover. */
.dst-card-btn {
    border: 1px solid var(--theme-border);
    border-radius: var(--wf-radius-md);
    background: var(--wf-card);
}

.dst-card-btn:hover,
.dst-card-btn:focus-visible {
    border-color: var(--wf-primary-ink);
    background: var(--wf-primary-soft);
    color: var(--wf-primary-ink);
}

.dst-new-from { display: flex; flex-direction: column; gap: var(--wf-space-2); border: 0; padding: 0; margin: 0; }

.dst-new-starter { margin-left: var(--wf-space-5); max-width: 20rem; }

/* ---- Shared bits ---- */
.dst-chip,
.dst-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--wf-space-1);
    padding: 1px 8px;
    border-radius: var(--wf-radius-pill);
    font-size: var(--wf-text-xs);
    font-weight: 500;
    background: var(--wf-neutral-soft);
    color: var(--theme-text-secondary);
    white-space: nowrap;
}

.dst-badge.is-ok { background: var(--wf-success-soft); color: var(--wf-success-ink); }

.dst-badge.is-low { background: var(--wf-warning-soft); color: var(--wf-warning-ink); }

.dst-count {
    display: inline-flex;
    min-width: 1.25rem;
    justify-content: center;
    margin-left: var(--wf-space-1);
    padding: 0 6px;
    border-radius: var(--wf-radius-pill);
    font-size: var(--wf-text-xs);
    background: var(--wf-danger-soft);
    color: var(--wf-danger-ink);
}

.dst-note { color: var(--theme-text-muted); font-size: var(--wf-text-sm); margin: 0; }

.dst-note.is-ok { color: var(--wf-success-ink); }

.dst-check { display: inline-flex; align-items: center; gap: var(--wf-space-2); cursor: pointer; }

.dst-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.dst-upload,
.dst-upload-btn { position: relative; cursor: pointer; }

.dst-upload-btn { margin-top: var(--wf-space-2); }

.dst-section { display: flex; flex-direction: column; gap: var(--wf-space-2); padding-bottom: var(--wf-space-4); border-bottom: 1px solid var(--theme-border-subtle); margin-bottom: var(--wf-space-4); }

.dst-section:last-child { border-bottom: 0; }

.dst-section-title { font-size: var(--theme-font-size-base); font-weight: 600; color: var(--theme-text-emphasis); margin: 0; }

.dst-section-text { color: var(--theme-text-muted); font-size: var(--wf-text-sm); margin: 0; }

/* Shared designs (2026-11-04): what a share carried - one line per picture, font or licence. */
.dst-share-went {
    margin: var(--wf-space-1) 0 0;
    padding-left: var(--wf-space-4);
    font-size: var(--wf-text-sm);
    color: var(--theme-text-emphasis);
    max-height: 14rem;
    overflow-y: auto;
}

/* ---- The Studio ---- */
.dst-shell { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }

.dst-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 26rem;
    flex: 1;
    min-height: 0;
}

.dst-body.is-wide { grid-template-columns: minmax(0, 1fr) 36rem; }

@media (max-width: 900px) {
    .dst-body,
    .dst-body.is-wide { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(22rem, 1fr) auto; overflow-y: auto; }
}

.dst-stage {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--theme-background-subtle);
    border-right: 1px solid var(--theme-border-subtle);
}

.dst-stage-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--wf-space-3);
    padding: var(--wf-space-2) var(--wf-space-4);
    border-bottom: 1px solid var(--theme-border-subtle);
    background: var(--theme-background-raised);
}

.dst-stage-field { display: inline-flex; align-items: center; gap: var(--wf-space-2); font-size: var(--wf-text-sm); color: var(--theme-text-muted); }

.dst-stage-field .form-select { width: auto; min-width: 8rem; padding-top: 2px; padding-bottom: 2px; }

/* What a design reaches: the emulator on a website, never a real phone's messaging app. */
.dst-stage-hint { display: inline-flex; align-items: center; gap: var(--wf-space-1); flex: 1 1 18rem; min-width: 0; font-size: var(--wf-text-xs); color: var(--theme-text-muted); }

/* The launcher's shape is a preview setting: its one line of help (with the page's mount option) sits on a line of its own. */
.dst-stage-hint--line { flex-basis: 100%; flex-wrap: wrap; }
.dst-stage-hint--line code { font-size: var(--wf-text-xs); overflow-wrap: anywhere; }

.dst-stage-frame { flex: 1; min-height: 0; display: flex; align-items: stretch; justify-content: center; overflow: auto; padding: var(--wf-space-4); }

.dst-preview-wait {
    align-self: center;
    max-width: 26rem;
    text-align: center;
    color: var(--theme-text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--wf-space-2);
}

.dst-preview-wait .bi { font-size: 2.5rem; color: var(--wf-primary-ink); }

.dst-preview-wait-title { font-weight: 600; color: var(--theme-text-emphasis); }

.dst-preview-wait-text { margin: 0; font-size: var(--wf-text-sm); }

.dst-panel { display: flex; flex-direction: column; min-height: 0; background: var(--theme-background-raised); }

.dst-panel-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: var(--wf-space-2);
    border-bottom: 1px solid var(--theme-border-subtle);
}

.dst-panel-tab {
    border: 0;
    background: transparent;
    padding: 4px 10px;
    border-radius: var(--wf-radius-pill);
    font-size: var(--wf-text-sm);
    color: var(--theme-text-secondary);
    cursor: pointer;
}

.dst-panel-tab:hover { background: var(--theme-background-hover); color: var(--theme-text-emphasis); }

.dst-panel-tab.is-active { background: var(--wf-primary-soft); color: var(--wf-primary-ink); font-weight: 600; }

.dst-panel-tab:focus-visible { outline: 2px solid var(--wf-primary-ink); outline-offset: 1px; }

.dst-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--wf-space-4); }

/* Tokens */
.dst-token-list { display: flex; flex-direction: column; gap: var(--wf-space-2); }

.dst-token { display: flex; flex-direction: column; gap: 2px; }

.dst-token-name code { font-size: var(--wf-text-xs); color: var(--theme-text-secondary); }

/* What the token does - the contract's own sentence (tokenNotes); hover shows its default as shipped. */
.dst-token-note { font-size: var(--wf-text-xs); color: var(--theme-text-muted); line-height: 1.35; }

.dst-token-edit { display: flex; align-items: center; gap: var(--wf-space-1); }

.dst-token-value { font-family: var(--theme-font-mono); font-size: var(--wf-text-sm); }

.dst-token.is-error .dst-token-value { border-color: var(--theme-danger); }

.dst-token-issue { color: var(--wf-danger-ink); font-size: var(--wf-text-xs); }

.dst-swatch { width: 2.25rem; height: 2rem; padding: 2px; border: 1px solid var(--theme-border); border-radius: var(--wf-radius-sm); background: var(--theme-background-raised); flex: none; }

.dst-contrast { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--wf-space-1); }

.dst-contrast-row { display: flex; justify-content: space-between; align-items: center; gap: var(--wf-space-2); font-size: var(--wf-text-sm); }

/* CSS */
.dst-css { display: flex; flex-direction: column; gap: var(--wf-space-2); }

.dst-css-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--wf-space-3); }

.dst-css-face { font-weight: 600; color: var(--theme-text-emphasis); }

.dst-editor {
    height: 26rem;
    border: 1px solid var(--theme-border);
    border-radius: var(--wf-radius-md);
    overflow: hidden;
}

.dst-editor.is-readonly { height: 20rem; }

.dst-css-default { margin-top: var(--wf-space-3); display: flex; flex-direction: column; gap: var(--wf-space-2); }

.dst-face-picks { display: flex; flex-wrap: wrap; gap: var(--wf-space-2); }

/* Findings */
.dst-issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--wf-space-2); }

.dst-issue {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wf-space-2);
    align-items: baseline;
    padding: var(--wf-space-2);
    border-radius: var(--wf-radius-sm);
    background: var(--wf-danger-soft);
    font-size: var(--wf-text-sm);
}

.dst-issue-line {
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--wf-primary-ink);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.dst-issue-code { font-size: var(--wf-text-xs); color: var(--wf-danger-ink); }

.dst-issue-rule { flex-basis: 100%; font-size: var(--wf-text-xs); color: var(--theme-text-muted); }

/* Assets */
.dst-asset-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--wf-space-3); }

.dst-asset { display: flex; flex-direction: column; gap: var(--wf-space-1); padding: var(--wf-space-2); border: 1px solid var(--theme-border-subtle); border-radius: var(--wf-radius-md); }

.dst-asset-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--wf-space-2); }

.dst-asset-path { font-size: var(--wf-text-sm); word-break: break-all; }

.dst-asset-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--wf-space-1); }

.dst-use-as { width: auto; min-width: 10rem; }

/* Versions */
.dst-version-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--wf-space-3); }

.dst-version { padding: var(--wf-space-3); border: 1px solid var(--theme-border-subtle); border-radius: var(--wf-radius-md); display: flex; flex-direction: column; gap: var(--wf-space-2); }

.dst-version.is-open { border-color: var(--theme-border); box-shadow: var(--wf-elev-1); }

.dst-version-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--wf-space-2); }

.dst-version-note { margin: 0; font-size: var(--wf-text-sm); color: var(--theme-text-secondary); white-space: pre-wrap; }

.dst-version-actions { display: flex; flex-wrap: wrap; gap: var(--wf-space-1); }

.dst-diff-tokens { width: 100%; font-size: var(--wf-text-xs); border-collapse: collapse; }

.dst-diff-tokens th,
.dst-diff-tokens td { text-align: left; padding: 4px; border-bottom: 1px solid var(--theme-border-subtle); vertical-align: top; word-break: break-all; }

.dst-diff { font-family: var(--theme-font-mono); font-size: var(--wf-text-xs); max-height: 18rem; overflow: auto; border: 1px solid var(--theme-border-subtle); border-radius: var(--wf-radius-sm); }

.dst-diff-line { white-space: pre-wrap; padding: 0 var(--wf-space-2); }

.dst-diff-line.is-add { background: var(--wf-success-soft); color: var(--wf-success-ink); }

.dst-diff-line.is-del { background: var(--wf-danger-soft); color: var(--wf-danger-ink); }

/* Where it is used, notes, help */
.dst-used-set { align-self: flex-start; margin-bottom: var(--wf-space-4); }

.dst-used-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--wf-space-2); }

.dst-used-list li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--wf-space-2); }

.dst-notes-area { min-height: 10rem; }

.dst-version-notes { margin: 0; padding-left: var(--wf-space-4); font-size: var(--wf-text-sm); display: flex; flex-direction: column; gap: var(--wf-space-1); }

.dst-help-list { list-style: none; margin: var(--wf-space-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--wf-space-3); }

.dst-help-item a { font-weight: 600; }

.dst-help-why { margin: 2px 0 0; font-size: var(--wf-text-sm); color: var(--theme-text-muted); }

/* Settings > Theme: Your designs */
.dst-theme-slots { list-style: none; margin: 0 0 var(--wf-space-3); padding: 0; display: flex; flex-direction: column; gap: var(--wf-space-1); }

.dst-theme-slots li { display: flex; gap: var(--wf-space-3); }

.dst-theme-slot { min-width: 9rem; color: var(--theme-text-muted); }

/* THE LOOK PICKER (P3): one conversation's or one launch code's design - the choices beside the live preview; a phone width
   stacks them. */
.dst-look-grid { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: var(--wf-space-4); align-items: start; }

.dst-look-side { display: flex; flex-direction: column; gap: var(--wf-space-3); min-width: 0; }

.dst-look-preview { min-height: 28rem; border: 1px solid var(--theme-border); border-radius: var(--theme-radius); background: var(--theme-surface); overflow: hidden; }

.dst-look-preview > .dst-note { padding: var(--wf-space-4); }

/* A test drive in a chosen look (P3 owed): the tour / drive switch, and the drive's stage (the embed library sizes its frame to it). */
.dst-look-views { display: flex; gap: var(--wf-space-2); padding: var(--wf-space-3) var(--wf-space-4) 0; }

.dst-look-views .is-active { font-weight: 600; }

.dst-look-drive { height: 34rem; margin: 0 var(--wf-space-4) var(--wf-space-4); border-radius: var(--theme-radius); overflow: hidden; }

@media (max-width: 860px) {
    .dst-look-grid { grid-template-columns: minmax(0, 1fr); }
}

/* SET ACTIVE on conversations or codes: the list to tick, scrolling inside the dialog. */
.dst-setactive-targets { display: flex; flex-direction: column; gap: var(--wf-space-1); max-height: 16rem; overflow-y: auto; margin-top: var(--wf-space-2);
    padding: var(--wf-space-2); border: 1px solid var(--theme-border); border-radius: var(--theme-radius); }
/* ---- Inspect (P3) ---- */
.dst-subtitle { font-size: var(--wf-text-sm); font-weight: 600; color: var(--theme-text-emphasis); margin: 0; }

.dst-inspect-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--wf-space-1) var(--wf-space-3); margin: 0; font-size: var(--wf-text-sm); }

.dst-inspect-facts dt { color: var(--theme-text-muted); font-weight: 400; }

.dst-inspect-facts dd { margin: 0; overflow-wrap: anywhere; }

.dst-inspect-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--wf-space-1); font-size: var(--wf-text-sm); }

.dst-inspect-list li { display: flex; flex-wrap: wrap; gap: var(--wf-space-2); align-items: baseline; overflow-wrap: anywhere; }

.dst-inspect-rule { margin: 0; padding: var(--wf-space-2); border-radius: var(--wf-radius-sm); background: var(--theme-surface-subtle); font-size: var(--wf-text-sm); white-space: pre-wrap; }

.dst-inspect-actions { display: flex; flex-wrap: wrap; gap: var(--wf-space-2); }

/* ---- Reported guard trips (P3) ---- */
.dst-trip { background: var(--wf-warning-soft); }

.dst-trip-meta { color: var(--theme-text-muted); }
