/* ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
   THE FIELD SHELF (2026-11-24 - Kirk: "a sexy dialog or some special way that will be a property editor ... shelf style
   like the builder"). Slides over the drawer (it is the drawer's own child, so it covers exactly the drawer) and edits
   the FIELD a moment is saved to. The ONE owner of every conv-fs-* class (ConversationBuilderCssOwnershipTests); only
   --theme-* / --conv-* / --wf-* tokens; the moment's family hue (--conv-fam) carries the accents, so a question's field
   reads in the Ask hue. Reuses the drawer's conv-input / conv-textarea / conv-field-label and the builder's conv-btn /
   conv-icon-btn / conv-chip as they are.
   ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════ */

.conv-fs {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    background: var(--theme-background-raised);
    animation: conv-fs-in 200ms ease;
}

@keyframes conv-fs-in {
    from { transform: translateX(28px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

/* ── The head: back, the kicker, Data Studio - then the field itself on a soft family wash ── */

.conv-fs-head {
    padding: 10px 14px 16px;
    border-bottom: 1px solid var(--theme-border-subtle);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--conv-fam, var(--conv-ask)) 9%, transparent), transparent 92%),
        var(--theme-background-raised);
}

.conv-fs-topline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.conv-fs-kicker {
    color: var(--conv-fam, var(--conv-ask));
    font-size: var(--theme-font-size-xs);
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.conv-fs-ds {
    margin-left: auto;
    font-size: var(--theme-font-size-xs);
}

.conv-fs-identity {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 12px;
}

.conv-fs-tile {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--theme-radius);
    background: var(--conv-fam-soft, var(--conv-ask-soft));
    color: var(--conv-fam, var(--conv-ask));
    font-size: 1.15rem;
}

.conv-fs-identity-text {
    min-width: 0;
}

.conv-fs-title {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--theme-text-emphasis);
    font-size: var(--theme-font-size-lg);
    font-weight: 600;
    line-height: 1.3;
}

.conv-fs-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

/* ── The body: calm cards on the canvas tone ── */

.conv-fs-scroll {
    flex: 1;
    min-height: 0;
    padding: 14px;
    overflow-y: auto;
    background: var(--conv-canvas-bg, var(--theme-background-subtle));
}

.conv-fs-card {
    padding: 14px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--theme-radius);
    background: var(--theme-background-raised);
    box-shadow: var(--theme-shadow);
}

.conv-fs-card + .conv-fs-card {
    margin-top: 12px;
}

.conv-fs-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.conv-fs-card-title {
    margin: 0 0 10px;
    color: var(--theme-text-emphasis);
    font-size: var(--theme-font-size-sm);
    font-weight: 600;
}

.conv-fs-card-head .conv-fs-card-title {
    margin-bottom: 0;
}

.conv-fs-count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: var(--theme-radius-button);
    background: var(--conv-fam-soft, var(--conv-ask-soft));
    color: var(--conv-fam, var(--conv-ask));
    font-size: var(--theme-font-size-xs);
    font-weight: 600;
    text-align: center;
}

.conv-fs-hint,
.conv-fs-empty {
    margin: 6px 0 10px;
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-xs);
}

.conv-fs-empty {
    padding: 12px;
    border: 1px dashed var(--theme-border);
    border-radius: var(--theme-radius);
    text-align: center;
}

.conv-fs-subtitle {
    margin-bottom: 6px;
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-xs);
    font-weight: 600;
}

.conv-fs-divider {
    height: 1px;
    margin: 14px 0 12px;
    background: var(--theme-border-subtle);
}

.conv-fs-gap {
    margin-top: 12px;
}

.conv-fs-gap-sm {
    margin-bottom: 6px;
}

.conv-fs-short {
    min-height: 56px;
}

.conv-fs-narrow {
    max-width: 120px;
}

.conv-fs-mono {
    font-family: var(--theme-font-mono, ui-monospace, monospace);
}

.conv-fs-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

/* ── The choices: one card each - number, words, picture, order; what it is stored as; what it means ── */

.conv-fs-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.conv-fs-choice {
    position: relative;
    padding: 10px 10px 10px 14px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--theme-radius);
    background: var(--theme-background);
    transition: border-color var(--conv-motion), box-shadow var(--conv-motion);
}

.conv-fs-choice::before {
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--conv-fam, var(--conv-ask));
    content: "";
    opacity: .55;
}

.conv-fs-choice:hover,
.conv-fs-choice:focus-within {
    border-color: color-mix(in srgb, var(--conv-fam, var(--conv-ask)) 40%, var(--theme-border-subtle));
    box-shadow: var(--theme-shadow);
}

.conv-fs-choice.is-new {
    animation: conv-fs-choice-in 160ms ease;
}

@keyframes conv-fs-choice-in {
    from { transform: scale(.97); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.conv-fs-choice-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.conv-fs-choice-num {
    flex: none;
    width: 20px;
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-xs);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    text-align: center;
}

.conv-fs-choice-label {
    flex: 1;
    min-width: 0;
    font-weight: 500;
}

.conv-fs-choice-tools {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

.conv-fs-remove:hover:not(:disabled),
.conv-fs-remove:focus-visible {
    color: var(--conv-issue-error, var(--theme-danger));
}

.conv-fs-choice-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    margin: 4px 0 0 28px;
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-xs);
}

.conv-fs-code {
    padding: 1px 6px;
    border-radius: var(--theme-radius-button);
    background: var(--theme-background-subtle);
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-xs);
}

.conv-fs-meaning {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0 0 28px;
}

.conv-fs-meaning .conv-meaning-spark {
    margin-top: 7px;
}

.conv-fs-meaning-box {
    min-height: 52px;
    font-size: var(--theme-font-size-xs);
}

.conv-fs-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
    padding: 9px 12px;
    border: 1px dashed color-mix(in srgb, var(--conv-fam, var(--conv-ask)) 45%, var(--theme-border));
    border-radius: var(--theme-radius);
    background: transparent;
    color: var(--conv-fam, var(--conv-ask));
    font: inherit;
    font-size: var(--theme-font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--conv-motion);
}

.conv-fs-add:hover:not(:disabled),
.conv-fs-add:focus-visible {
    background: var(--conv-fam-soft, var(--conv-ask-soft));
    outline: none;
}

.conv-fs-add:disabled {
    opacity: .55;
    cursor: default;
}

/* ── A two-step confirm, in place (a choice to remove, leaving with changes) ── */

.conv-fs-confirm {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: var(--theme-radius);
    background: color-mix(in srgb, var(--conv-issue-error, var(--theme-danger)) 8%, var(--theme-background-raised));
    color: var(--theme-text);
    font-size: var(--theme-font-size-xs);
}

.conv-fs-confirm-actions {
    display: inline-flex;
    gap: 6px;
    margin-left: auto;
}

/* ── Loading and a failed read ── */

.conv-fs-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conv-fs-skeleton span {
    height: 96px;
    border-radius: var(--theme-radius);
    background: linear-gradient(90deg, var(--theme-background-raised), var(--theme-background-subtle), var(--theme-background-raised));
    background-size: 200% 100%;
    animation: conv-fs-shimmer 1.2s linear infinite;
}

@keyframes conv-fs-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.conv-fs-failed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    border-radius: var(--theme-radius);
    background: var(--theme-background-raised);
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
}

/* ── The foot: what a save does, then Cancel and Save the field ── */

.conv-fs-foot {
    padding: 12px 14px;
    border-top: 1px solid var(--theme-border-subtle);
    background: var(--theme-background-raised);
}

.conv-fs-note {
    display: flex;
    gap: 6px;
    margin: 0 0 10px;
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-xs);
    line-height: 1.45;
}

.conv-fs-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.conv-fs-spin {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: conv-fs-spin 700ms linear infinite;
}

@keyframes conv-fs-spin {
    to { transform: rotate(360deg); }
}

/* A phone: the drawer is the whole width, so the pair stacks and the tools stay one row. */
@media (max-width: 480px) {
    .conv-fs-pair {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .conv-fs,
    .conv-fs-choice.is-new,
    .conv-fs-skeleton span,
    .conv-fs-spin {
        animation: none;
    }
}
