/* Study Workspace — /studies/{id}
   Uses site tokens (var(--background), var(--foreground), var(--muted-foreground), var(--border), var(--primary), etc.)
   Chrome-only styles. All buttons/dialogs/badges/skeletons come from Blueprint components. */

.sw-shell {
    display: grid;
    grid-template-columns: minmax(280px, 310px) 1fr;
    gap: 0;
    height: 100%;
    min-height: 0;
    background: var(--background);
    color: var(--foreground);
    position: relative;
    overflow: hidden;
}

/* Scrollbars — thinner + higher contrast thumb so they read as interactive
   without dominating. Applies to every scroll container inside the study
   workspace (left panel, tabs strip, grids, wizard body, etc.). */
.sw-shell *,
.sw-shell {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--foreground) 32%, transparent) transparent;
}

.sw-shell *::-webkit-scrollbar,
.sw-shell::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.sw-shell *::-webkit-scrollbar-track,
.sw-shell::-webkit-scrollbar-track {
    background: transparent;
}

.sw-shell *::-webkit-scrollbar-thumb,
.sw-shell::-webkit-scrollbar-thumb {
    background-color: color-mix(in srgb, var(--foreground) 32%, transparent);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.sw-shell *::-webkit-scrollbar-thumb:hover,
.sw-shell::-webkit-scrollbar-thumb:hover {
    background-color: color-mix(in srgb, var(--foreground) 55%, transparent);
}

.sw-shell *::-webkit-scrollbar-corner,
.sw-shell::-webkit-scrollbar-corner {
    background: transparent;
}

/* Wizard now lives inline at the top of the left panel (Chris 2026-08-14),
   above the Content packets tree. Closed state renders a compact launch
   button (.sw-wizard-launch); open state renders the full 3-step accordion
   (.sw-wizard-inline). Replaced the earlier .sw-wizard-col floating overlay. */

/* ============ LEFT PANEL ============ */

.sw-left {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0.875rem;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    min-height: 0;
}

.sw-study-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.sw-eyebrow {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sw-study-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--foreground);
}

.sw-study-name-input {
    display: block;
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 0.2rem 2rem 0.2rem 0.35rem;
    margin-left: -0.35rem;
    font-family: inherit;
    line-height: 1.3;
}

.sw-study-name-input:hover {
    border-color: var(--border);
}

.sw-study-name-input:focus {
    outline: none;
    border-color: var(--primary, var(--foreground));
    background: var(--background);
}

/* Row wrapper for the study name input + pencil affordance. The pencil is
   positioned inside the input's visual bounds (right-inset) so the icon and
   the editable field read as a single control instead of two floating pieces.
   Passive indicator only — the whole input is already click-to-edit. */
.sw-study-name-row {
    position: relative;
    display: block;
    margin-left: 0.35rem;
}

.sw-study-name-pencil {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    width: 0.85rem;
    height: 0.85rem;
    color: var(--muted-foreground);
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

.sw-study-name-row:hover .sw-study-name-pencil,
.sw-study-name-row:focus-within .sw-study-name-pencil {
    opacity: 1;
}

.sw-study-desc {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    margin: 0;
    line-height: 1.4;
}

.sw-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sw-section-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sw-section-head-row {
    justify-content: space-between;
    text-transform: none;
    letter-spacing: 0;
}


.sw-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--foreground);
    text-transform: none;
    letter-spacing: 0;
}

.sw-section-icon {
    width: 14px;
    height: 14px;
    color: var(--muted-foreground);
}

.sw-btn-icon {
    width: 14px;
    height: 14px;
    margin-right: 0.25rem;
}

.sw-icon-xs { width: 12px; height: 12px; }
.sw-icon-sm { width: 14px; height: 14px; }

/* ============ PACKET TREE ============ */

.sw-packet-tree {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.8125rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sw-pt-group {
    display: flex;
    flex-direction: column;
}

.sw-pt-grouphead {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.4rem;
    border: none;
    background: transparent;
    color: var(--foreground);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    text-align: left;
    width: 100%;
}

.sw-pt-grouphead:hover {
    background: var(--accent, rgba(0, 0, 0, 0.04));
}

.sw-pt-chev,
.sw-pt-groupicon {
    flex-shrink: 0;
    color: var(--muted-foreground);
}

.sw-pt-grouplabel {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sw-pt-children {
    list-style: none;
    padding: 0 0 0 1rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Leaf row (Chris 2026-08-16 v2). Two affordances side-by-side: a subtle
   checkbox on the left owns Study membership, and the label to its right
   opens the packet in the middle body. Kept quiet in the resting state so a
   Study with many packets included doesn't read as "everything highlighted". */
.sw-pt-leaf {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 4px;
    padding: 0 0.3rem;
    color: var(--muted-foreground);
    transition: background-color 120ms ease, color 120ms ease;
}

.sw-pt-leaf:hover {
    background: var(--accent, rgba(0, 0, 0, 0.04));
    color: var(--foreground);
}

/* Checked-but-not-open packets read as "included in the Study" — keep the
   label at foreground weight so an included packet doesn't look inert next
   to unchecked siblings (Chris 2026-08-16). */
.sw-pt-leaf-checked {
    color: var(--foreground);
}

.sw-pt-leaf-open {
    background: color-mix(in srgb, var(--primary, #6366f1) 10%, transparent);
    color: var(--foreground);
}

.sw-pt-leaf-open:hover {
    background: color-mix(in srgb, var(--primary, #6366f1) 14%, transparent);
}

.sw-pt-leaf-disabled {
    opacity: 0.55;
}

.sw-pt-leaf-disabled:hover {
    background: transparent;
    color: var(--muted-foreground);
}

.sw-pt-leaficon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    flex-shrink: 0;
    border-radius: 4px;
    color: inherit;
}

/* Chris 2026-08-16: bump the data-icon a touch inside the tree without
   growing sw-icon-sm globally (used elsewhere). */
.sw-pt-leaficon > * {
    width: 16px;
    height: 16px;
}

/* Right-anchored membership checkbox (Chris 2026-08-16 v7). Row click opens
   the packet; this checkbox toggles Study membership without switching the
   active tab. Kept small + quiet in the resting state so a Study with many
   included packets doesn't read as a wall of checkmarks. */
.sw-pt-leafcheck {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    margin-left: 0.25rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--primary, var(--foreground));
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

/* Reveal on row hover so unchecked leaves aren't visually noisy at rest.
   Checked leaves stay visible always so the in-Study set is legible. */
.sw-pt-leaf:hover .sw-pt-leafcheck,
.sw-pt-leaf[aria-selected="true"] .sw-pt-leafcheck {
    opacity: 1;
}

.sw-pt-leafcheck[aria-pressed="true"] {
    opacity: 1;
    background: var(--primary, var(--foreground));
    border-color: var(--primary, var(--foreground));
    color: #fff;
}

.sw-pt-leafcheck:hover:not(:disabled) {
    border-color: var(--primary, var(--foreground));
}

.sw-pt-leafcheck:disabled {
    cursor: default;
    opacity: 0;
}

.sw-icon-2xs {
    width: 12px;
    height: 12px;
    display: inline-block;
    vertical-align: middle;
}

.sw-pt-leafbtn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
    padding: 0.2rem 0.25rem;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    text-align: left;
    border-radius: 4px;
}

.sw-pt-leafbtn:disabled {
    cursor: default;
}

.sw-pt-leaf-open .sw-pt-leafbtn {
    font-weight: 600;
    color: var(--primary, #6366f1);
}

.sw-pt-leaflabel {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============ LIVE-LINK PARAMS LIST ============ */

.sw-params-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sw-params-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    background: var(--muted, rgba(0, 0, 0, 0.03));
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--foreground);
    border: 1px solid transparent;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.sw-params-item:hover {
    background: var(--accent, rgba(0, 0, 0, 0.05));
    border-color: var(--border);
}

.sw-params-icon {
    width: 14px;
    height: 14px;
    color: var(--primary, #6366f1);
    flex-shrink: 0;
}

.sw-params-label {
    flex: 1;
    line-height: 1.3;
}

.sw-params-link {
    background: transparent;
    border: 0;
    padding: 0;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: var(--muted-foreground, rgba(0, 0, 0, 0.3));
    text-underline-offset: 2px;
}

.sw-params-link:hover {
    color: var(--primary, #6366f1);
    text-decoration-color: var(--primary, #6366f1);
}

.sw-params-remove {
    background: transparent;
    border: 0;
    padding: 2px;
    cursor: pointer;
    color: var(--muted-foreground);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.sw-params-remove:hover {
    background: var(--accent, rgba(0, 0, 0, 0.08));
    color: var(--foreground);
}

.sw-params-empty {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    padding: 0.5rem;
    background: var(--muted, rgba(0, 0, 0, 0.03));
    border-radius: 6px;
    line-height: 1.4;
}

.sw-params-add {
    list-style: none;
    padding: 0;
    margin-top: 0.25rem;
}

/* Filters sub-group (Chris 2026-08-16). Filters are still Study parameters
   but read as a distinct concern from fiscal/focal/group. Hairline + small
   caps subhead + left inset on the sub-items groups them visually without
   splitting the DOM into a second section. */
.sw-params-subhead {
    list-style: none;
    padding: 0.65rem 0.15rem 0.25rem 0.15rem;
    margin-top: 0.35rem;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--foreground);
    text-transform: none;
    letter-spacing: 0;
}

.sw-params-item-sub {
    margin-left: 0.5rem;
}

.sw-params-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--muted-foreground);
    font-size: 0.8125rem;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
}

.sw-params-add-btn:hover {
    color: var(--foreground);
    border-color: var(--foreground);
}

.sw-add-filter-form {
    display: grid;
    gap: 0.4rem;
    padding: 0.5rem;
    border: 1px dashed var(--border);
    border-radius: 6px;
    background: var(--muted, rgba(0, 0, 0, 0.02));
}

.sw-add-filter-form .sw-input {
    font-size: 0.8125rem;
    padding: 0.35rem 0.5rem;
}

.sw-add-filter-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
}

/* ============ WIZARD COLUMN (adjacent to chat) ============ */

.sw-wizard-inline {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: color-mix(in srgb, var(--primary, #6366f1) 3%, var(--background));
    animation: sw-slide-down 0.18s ease;
}

@keyframes sw-slide-down {
    from { transform: translateY(-6px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Closed-state launcher: single-line row that sits in the same slot the open
   wizard occupies. Keeps setup discoverable once the wizard is dismissed. */
.sw-wizard-launch {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.55rem 0.7rem;
    background: color-mix(in srgb, var(--primary, #6366f1) 5%, transparent);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    color: var(--foreground);
    font-size: 0.8125rem;
    line-height: 1.2;
}

.sw-wizard-launch:hover {
    background: color-mix(in srgb, var(--primary, #6366f1) 9%, transparent);
}

.sw-wizard-launch-icon {
    color: var(--primary, #6366f1);
    flex-shrink: 0;
}

.sw-wizard-launch-label {
    font-weight: 600;
    flex: 1;
}

.sw-wizard-launch-status {
    color: var(--muted-foreground);
    font-size: 0.75rem;
    font-weight: 500;
}

.sw-wizard-launch-chev {
    color: var(--muted-foreground);
}

.sw-wizard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* Wireframe §4a — design-goal blurb at top of wizard. Chris 2026-08-16 v2:
   white card with dark text — the muted-on-tint variant read as an alert;
   this reads as reference copy the user might actually want to reread. */
.sw-wiz-goal {
    font-size: 0.75rem;
    color: #111827;
    line-height: 1.45;
    padding: 0.65rem 0.8rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-left: 2px solid var(--primary, #6366f1);
    border-radius: 4px;
}

.sw-wiz-goal-lead {
    color: var(--foreground);
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.sw-wiz-goal-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.4rem 0;
    display: grid;
    gap: 0.15rem;
}

.sw-wiz-goal-list li {
    padding-left: 0.7rem;
    position: relative;
}

.sw-wiz-goal-list li::before {
    content: "·";
    position: absolute;
    left: 0.2rem;
    color: var(--primary, #6366f1);
    font-weight: 700;
}

.sw-wiz-goal-list strong {
    color: var(--foreground);
    font-weight: 600;
}

.sw-wiz-goal-foot {
    font-style: italic;
    opacity: 0.9;
}

/* Numbered wizard step — collapsible accordion (Chris 2026-08-13).
   Head is a clickable row (number + title + summary + chevron); body
   drops beneath when the step is open. Only one step open at a time. */
.sw-wiz-step {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border);
}

.sw-wiz-step:last-of-type {
    border-bottom: 0;
}

.sw-wiz-step-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.35rem;
    background: transparent;
    border: 0;
    width: 100%;
    text-align: left;
    cursor: pointer;
    color: var(--foreground);
}

.sw-wiz-step-head:hover {
    background: color-mix(in srgb, var(--foreground) 3%, transparent);
}

.sw-wiz-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--muted, rgba(0, 0, 0, 0.05));
    color: var(--muted-foreground);
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.sw-wiz-step-done .sw-wiz-step-num {
    background: color-mix(in srgb, var(--primary, #6366f1) 15%, transparent);
    color: var(--primary, #6366f1);
}

.sw-wiz-step-titlebox {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.sw-wiz-step-summary {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sw-wiz-step-chevron {
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.sw-wiz-step-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.1rem 0.35rem 0.75rem 2.3rem;
    min-width: 0;
}

.sw-wiz-step-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
}

/* Focal step "Skip — no focal for this study" link.
   Underlined text-link styling so it reads as a soft-out affordance,
   not a primary action. */
.sw-wiz-skip {
    align-self: flex-start;
    background: transparent;
    border: 0;
    padding: 0.25rem 0;
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sw-wiz-skip:hover {
    color: var(--foreground);
}

/* Complete-setup CTA sits at the bottom of the wizard column. */
.sw-wiz-complete {
    padding: 0.75rem 0.35rem 0.25rem;
    display: flex;
    justify-content: flex-end;
}

/* Checkbox row — used in numbered steps AND panel sections. */
.sw-wiz-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.8125rem;
    color: var(--foreground);
    cursor: pointer;
    padding: 0.2rem 0;
    line-height: 1.35;
}

.sw-wiz-check input[type="checkbox"] {
    margin: 0;
    accent-color: var(--primary, #6366f1);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.sw-wiz-check input[type="checkbox"]:disabled {
    cursor: not-allowed;
}

.sw-wiz-check input[type="checkbox"]:disabled + span {
    color: var(--muted-foreground);
    cursor: not-allowed;
}

/* Packet reference row (§4d packet tree in wizard). Not a selection control —
   packet membership is implicit (all packets included). The data icon labels
   the row as a packet, matching the left tree's icon. Click-to-expand for
   field-level filter creation (§m) lands with sub #9 chat wiring. */
.sw-wiz-packet-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--foreground);
    padding: 0.2rem 0;
    line-height: 1.35;
}

.sw-wiz-packet-icon {
    width: 14px;
    height: 14px;
    color: var(--muted-foreground);
    flex: none;
}

/* §m — Table (and any packet with fields) becomes a nested <details> so
   clicking the row expands the field list. Non-expandable packets keep the
   plain .sw-wiz-packet-row style above. */
.sw-wiz-packet {
    display: flex;
    flex-direction: column;
}

.sw-wiz-packet-clickable {
    cursor: pointer;
    list-style: none;
    border-radius: 4px;
    user-select: none;
}

.sw-wiz-packet-clickable::-webkit-details-marker { display: none; }

.sw-wiz-packet-clickable:hover {
    background: var(--accent, rgba(0, 0, 0, 0.04));
}

.sw-wiz-packet-caret {
    width: 10px;
    height: 10px;
    color: var(--muted-foreground);
    flex: none;
    transition: transform 0.15s ease;
}

.sw-wiz-packet[open] > .sw-wiz-packet-clickable .sw-wiz-packet-caret {
    transform: rotate(90deg);
}

/* Field list under a packet. Each field is a button — click routes to chat
   (sub #9). MVP is a no-op stub with an explanatory hover title. */
.sw-wiz-fields {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    padding: 0.15rem 0 0.35rem 1.85rem;
}

.sw-wiz-field {
    display: flex;
    align-items: center;
    text-align: left;
    padding: 0.2rem 0.5rem;
    font-size: 0.8125rem;
    color: var(--foreground);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1.35;
    font-family: inherit;
}

.sw-wiz-field:hover {
    background: color-mix(in srgb, var(--primary, #6366f1) 8%, transparent);
    color: var(--primary, #6366f1);
}

/* Radio row (data step). */
.sw-wiz-radio {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.8125rem;
    color: var(--foreground);
    cursor: pointer;
    padding: 0.15rem 0;
}

.sw-wiz-radio input[type="radio"] {
    margin: 0;
    accent-color: var(--primary, #6366f1);
}

.sw-wiz-radio input[type="radio"]:disabled {
    cursor: not-allowed;
}

.sw-wiz-radio input[type="radio"]:disabled + span {
    color: var(--muted-foreground);
    cursor: not-allowed;
}

/* Placeholder inline prompt (styled as a chat bubble hint — obvious sub #9 will
   move these into the chat pane). Dashed border marks it as scaffold, not chrome. */
.sw-wiz-prompt {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.6rem 0.75rem;
    background: color-mix(in srgb, var(--primary, #6366f1) 6%, transparent);
    border: 1px dashed color-mix(in srgb, var(--primary, #6366f1) 35%, var(--border));
    border-radius: 10px;
    position: relative;
    margin-left: 0.25rem;
}

.sw-wiz-prompt::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 14px;
    width: 8px;
    height: 8px;
    background: inherit;
    border-left: 1px dashed color-mix(in srgb, var(--primary, #6366f1) 35%, var(--border));
    border-top: 1px dashed color-mix(in srgb, var(--primary, #6366f1) 35%, var(--border));
    transform: rotate(45deg);
}

.sw-wiz-prompt-soon {
    background: var(--muted, rgba(0, 0, 0, 0.03));
    border-color: var(--border);
}

.sw-wiz-prompt-soon::before {
    border-left-color: var(--border);
    border-top-color: var(--border);
}

.sw-wiz-prompt-q {
    font-size: 0.8125rem;
    color: var(--foreground);
    line-height: 1.4;
}

.sw-wiz-prompt-input {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.sw-wiz-prompt-input .sw-input {
    flex: 1;
    min-width: 0;
}

.sw-wiz-note {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    line-height: 1.4;
    font-style: italic;
}

.sw-wiz-radio-hint {
    color: var(--muted-foreground);
    font-size: 0.75rem;
    margin-left: 0.15rem;
}

.sw-wiz-applied {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.75rem;
    color: var(--primary);
    white-space: nowrap;
}

/* Chip (selected focal / exec / group display in the wizard). */
.sw-wiz-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem 0.3rem 0.6rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.8125rem;
    color: var(--foreground);
    max-width: 100%;
    align-self: flex-start;
}

.sw-wiz-chip > span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sw-wiz-chip-x {
    background: transparent;
    border: 0;
    padding: 2px;
    cursor: pointer;
    color: var(--muted-foreground);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.sw-wiz-chip-x:hover {
    background: var(--accent, rgba(0, 0, 0, 0.06));
    color: var(--foreground);
}

/* Wizard §4h — study-group chat-launcher. Each row is a button that fires a
   programmatic chat turn; the trailing chat-bubble icon signals "clicking me
   opens a chat, not a form." Active row = kind currently on State.StudyGroup. */
.sw-wiz-launcher-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.sw-wiz-launcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--foreground);
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.sw-wiz-launcher:hover {
    background: var(--accent, rgba(0, 0, 0, 0.04));
    border-color: var(--muted-foreground);
}

.sw-wiz-launcher > span {
    flex: 1;
    min-width: 0;
}

.sw-wiz-launcher-chat {
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.sw-wiz-launcher-active {
    background: var(--accent, rgba(0, 0, 0, 0.05));
    border-color: var(--primary, var(--foreground));
}

.sw-wiz-launcher-disabled,
.sw-wiz-launcher-disabled:hover {
    background: var(--muted, rgba(0, 0, 0, 0.02));
    color: var(--muted-foreground);
    border-color: var(--border);
    cursor: not-allowed;
}

.sw-wiz-launcher-badge {
    flex-shrink: 0;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: var(--muted, rgba(0, 0, 0, 0.06));
    color: var(--muted-foreground);
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Wizard pick row: single-select radio-style row that displays current
   selection and routes to chat on click. Spec 04b §B step 1. */
.sw-wiz-pick {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    margin-top: 0.35rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--foreground);
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.sw-wiz-pick:hover {
    background: var(--accent, rgba(0, 0, 0, 0.04));
    border-color: var(--muted-foreground);
}

.sw-wiz-pick-radio {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--muted-foreground);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.sw-wiz-pick-filled .sw-wiz-pick-radio {
    border-color: var(--primary, var(--foreground));
}

.sw-wiz-pick-filled .sw-wiz-pick-radio::after {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary, var(--foreground));
}

/* When a parent pick row has an expanded sub-list of options (CDBA with
   >1 peer group), the parent stops being a single choice and becomes a
   category header — the actual radio selection lives on the sub-rows. */
.sw-wiz-pick-hasSub .sw-wiz-pick-radio {
    display: none;
}

.sw-wiz-pick-label {
    color: var(--foreground);
    flex-shrink: 0;
    white-space: nowrap;
}

.sw-wiz-pick-opt {
    color: var(--muted-foreground);
    font-weight: 400;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    opacity: 0.75;
}

.sw-wiz-pick-value {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    color: var(--foreground);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sw-wiz-pick-empty .sw-wiz-pick-value {
    color: var(--muted-foreground);
    font-weight: 400;
    text-align: right;
}

/* Muted label used in empty-state rows (e.g. "Focal executive" before a
   name is set). Keeps the label present as context without competing
   with the value on the right. */
.sw-wiz-pick-label-muted {
    color: var(--muted-foreground);
    font-weight: 400;
}

.sw-wiz-pick-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 4px;
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.sw-wiz-pick-clear:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--foreground);
}

/* Disabled state for pick rows whose resolver isn't wired yet (Index,
   PriorStudy, ContentFilters). Kept in-place — not hidden — so users see
   the future menu shape and know something is coming. */
.sw-wiz-pick-disabled,
.sw-wiz-pick-disabled:hover {
    cursor: not-allowed;
    background: var(--muted, rgba(0, 0, 0, 0.03));
    border-color: var(--border);
    color: var(--muted-foreground);
    opacity: 0.65;
}

.sw-wiz-pick-disabled .sw-wiz-pick-value {
    font-style: italic;
}

/* CDBA multi-peer-group sub-list: renders indented under the CDBA row
   when the focal has >1 peer group on file. Sub-rows are visually nested
   with a left inset + connector so they clearly belong to CDBA. Indent
   reduced (Chris 2026-08-16 v8) — 1.5rem read as "detached child"; 0.6rem
   still reads as nested but recovers width for the wrapped label. */
.sw-wiz-pick-sub {
    margin: -0.35rem 0 0 0.6rem;
    padding: 0.35rem 0 0 0.5rem;
    border-left: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sw-wiz-pick-sub-row {
    margin-top: 0;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    align-items: flex-start;
}

/* Label + meta stacked in a single text column (Chris 2026-08-16 v8).
   Previously they were siblings of the radio and collided on wrap; now
   they live in .sw-wiz-pick-sub-text so the label wraps freely with the
   meta on its own line below. */
.sw-wiz-pick-sub-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    flex: 1 1 auto;
}

.sw-wiz-pick-sub-row .sw-wiz-pick-label {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.3;
    flex: 0 0 auto;
}

.sw-wiz-pick-sub-row .sw-wiz-pick-value {
    flex: 0 0 auto;
    font-weight: 400;
    color: var(--muted-foreground);
    font-size: 0.7rem;
    line-height: 1.3;
}

.sw-wiz-pick-sub-row .sw-wiz-pick-radio {
    margin-top: 2px;
}

/* Inline status/caveat under a wizard pick row. Replaces title-tooltip-only
   messaging so users see "loading", "no options", "0 matched" without hover. */
.sw-wiz-pick-note {
    margin: 0.2rem 0 0 2rem;
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--muted-foreground);
    font-style: italic;
}

.sw-wiz-pick-note-warn {
    color: var(--destructive, #b45309);
    font-style: normal;
}

/* Inline action link inside a pick-note (e.g. "Set a focal first →").
   Reads as a bounded text button — no big affordance, just enough color
   contrast to signal it's clickable. */
.sw-wiz-pick-note-link {
    background: transparent;
    border: 0;
    padding: 0 0 0 0.15rem;
    margin: 0;
    font: inherit;
    color: var(--primary, #6366f1);
    font-style: normal;
    cursor: pointer;
    text-decoration: none;
}

.sw-wiz-pick-note-link:hover {
    text-decoration: underline;
}

/* CompanyList inline picker. Rendered as a nested sub-panel under the
   CompanyList row (reuses .sw-wiz-pick-sub for the left-inset connector).
   Search input + result list reuse the Focal step-1 typeahead classes
   (.sw-wiz-search-box, .sw-wiz-search-results) — chips are the unique
   surface for building a multi-pick list. */
.sw-wiz-cl-form {
    padding: 0.5rem 0.6rem;
    gap: 0.4rem;
}

.sw-wiz-cl-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.sw-wiz-cl-name {
    width: 100%;
    padding: 0.35rem 0.5rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8125rem;
    color: var(--foreground);
    font-family: inherit;
}

.sw-wiz-cl-name:focus {
    outline: none;
    border-color: var(--primary, var(--foreground));
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.sw-wiz-cl-picks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.35rem 0.4rem;
    min-height: 1.9rem;
    background: var(--background);
    border: 1px dashed var(--border);
    border-radius: 4px;
    align-items: center;
}

.sw-wiz-cl-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.35rem 0.15rem 0.5rem;
    background: var(--muted, rgba(0, 0, 0, 0.05));
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--foreground);
    max-width: 100%;
}

.sw-wiz-cl-chip-label {
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sw-wiz-cl-chip-meta {
    font-size: 0.7rem;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
}

.sw-wiz-cl-chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.1rem;
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    border-radius: 999px;
    cursor: pointer;
    opacity: 0.7;
}

.sw-wiz-cl-chip-x:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.08);
    color: var(--foreground);
}

.sw-wiz-cl-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.35rem;
    margin-top: 0.25rem;
}

.sw-wiz-cl-cancel,
.sw-wiz-cl-set {
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--foreground);
}

.sw-wiz-cl-cancel:hover {
    background: var(--muted, rgba(0, 0, 0, 0.04));
}

.sw-wiz-cl-set {
    background: var(--primary, var(--foreground));
    color: var(--primary-foreground, var(--background));
    border-color: transparent;
}

.sw-wiz-cl-set:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sw-wiz-cl-set:not(:disabled):hover {
    filter: brightness(0.94);
}

/* Focal picker — empty state. Distinct from .sw-wiz-pick (which is a
   radio-style click-to-select row) because this is a search-and-pick input,
   not a single-select toggle. Rendered as a small form-field label + input
   with search icon so the affordance reads unambiguously. */
.sw-wiz-field-label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 0.35rem 0 0.25rem;
}

/* Divider between the chat-launcher route and the typeahead shortcut in
   the empty-state focal picker. Reads as "either / or" without being a
   heavy separator line. */
.sw-wiz-or {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0.5rem 0 0.35rem;
}

.sw-wiz-or::before,
.sw-wiz-or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.sw-wiz-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 0.5rem 0 2rem;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.sw-wiz-search-box:focus-within {
    border-color: var(--primary, var(--foreground));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #6366f1) 15%, transparent);
}

.sw-wiz-search-icon {
    position: absolute;
    left: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--muted-foreground);
    pointer-events: none;
}

.sw-wiz-search-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    padding: 0.5rem 0;
    font-size: 0.8125rem;
    color: var(--foreground);
}

.sw-wiz-search-input::placeholder {
    color: var(--muted-foreground);
    opacity: 0.75;
}

/* Focal picker — live search results under the input. Replaces the old
   sample-companies pill row; results come from ICompanyClient.SearchCompaniesAsync. */
.sw-wiz-search-status {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    padding: 0.15rem 0.25rem;
}

.sw-wiz-search-results {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    max-height: 14rem;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card, var(--background));
}

.sw-wiz-search-result {
    width: 100%;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.4rem 0.6rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.1s ease;
}

.sw-wiz-search-result:hover,
.sw-wiz-search-result:focus-visible {
    background: color-mix(in srgb, var(--primary, #6366f1) 8%, transparent);
    outline: none;
}

.sw-wiz-search-result-name {
    font-size: 0.85rem;
    color: var(--foreground);
}

.sw-wiz-search-result-meta {
    font-size: 0.7rem;
    color: var(--muted-foreground);
}

/* Wireframe §4d / §4m — one collapsible content-packet tree below the numbered steps.
   Two groups (Basic Info + Dataset); each group is a <details>/<summary> pair. */
.sw-wiz-tree {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.sw-wiz-group {
    display: flex;
    flex-direction: column;
}

.sw-wiz-group-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    list-style: none;
    border-radius: 4px;
    user-select: none;
}

.sw-wiz-group-head::-webkit-details-marker {
    display: none;
}

.sw-wiz-group-head:hover {
    background: var(--accent, rgba(0, 0, 0, 0.04));
    color: var(--foreground);
}

.sw-wiz-caret {
    width: 12px;
    height: 12px;
    transition: transform 0.15s ease;
    color: var(--muted-foreground);
}

.sw-wiz-group[open] > .sw-wiz-group-head .sw-wiz-caret {
    transform: rotate(90deg);
}

.sw-wiz-group-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.15rem 0 0.35rem 1rem;
}

/* "Filter on Fields:" wizard panel (Paul 2026-08-11 — replaces the content-
   packet tree). Flat list; click a field to open the chat filter prompt.
   Active filters render inline as `field  op value` with a clear-x. */
.sw-wiz-fofh {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.sw-wiz-fofh-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sw-wiz-fof-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sw-wiz-fof-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.35rem;
    border-radius: 4px;
    border: 1px solid transparent;
}

.sw-wiz-fof-check {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary, var(--foreground));
}

.sw-wiz-fof-row:hover {
    background: var(--accent, rgba(0, 0, 0, 0.03));
    border-color: var(--border);
}

.sw-wiz-fof-label {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    color: var(--foreground);
    font-size: 0.8125rem;
    cursor: pointer;
}

.sw-wiz-fof-name {
    flex-shrink: 0;
}

.sw-wiz-fof-value {
    flex: 1;
    min-width: 0;
    color: var(--muted-foreground);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sw-wiz-fof-chat {
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.sw-wiz-fof-x {
    background: none;
    border: none;
    padding: 0.15rem;
    border-radius: 3px;
    color: var(--muted-foreground);
    cursor: pointer;
    flex-shrink: 0;
}

.sw-wiz-fof-x:hover {
    background: var(--muted, rgba(0, 0, 0, 0.06));
    color: var(--foreground);
}

.sw-wiz-textarea {
    resize: vertical;
    min-height: 60px;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 0.75rem;
    line-height: 1.35;
}

.sw-input {
    width: 100%;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8125rem;
    background: var(--background);
    color: var(--foreground);
    font-family: inherit;
}

.sw-input:focus {
    outline: none;
    border-color: var(--primary, #6366f1);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

/* ============ MAIN AREA ============ */

.sw-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--background);
    overflow: hidden;
}

.sw-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--background);
}

.sw-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sw-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sw-save-state {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.sw-save-state .sw-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted-foreground);
}

.sw-save-state.saved .sw-dot {
    background: #22c55e;
}

.sw-save-state.saving .sw-dot {
    background: #eab308;
    animation: sw-pulse 1s infinite;
}

@keyframes sw-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.sw-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ============ MULTI-PACKET TABS (Sub 3) ============
   Segmented pill row (Chris 2026-08-16 v4). Each checked packet is a rounded
   button inside a subtle track; the active one lifts to a white pill with a
   solid border + soft shadow so the affordance reads as "which packet am I
   looking at right now" without borrowing the loud underline treatment. */
.sw-tabs-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    margin: 0.5rem 0;
}

.sw-tabs-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sw-tabs {
    display: inline-flex;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.25rem;
    background: color-mix(in srgb, var(--foreground) 6%, transparent);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
    max-width: 100%;
}

.sw-tab {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--muted-foreground);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.sw-tab:hover:not(.sw-tab-active) {
    color: #111827;
    background: color-mix(in srgb, #ffffff 60%, transparent);
}

.sw-tab-active {
    color: #000;
    font-weight: 600;
    background: #ffffff;
    border-color: #d1d5db;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.sw-tab-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.5rem 0.4rem 0.85rem;
    background: transparent;
    border: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.sw-tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.5rem 0 0.25rem;
    background: transparent;
    border: 0;
    color: var(--muted-foreground);
    cursor: pointer;
    border-radius: 0 6px 6px 0;
    transition: color 120ms ease, background-color 120ms ease;
}

.sw-tab-close:hover {
    color: var(--foreground);
    background: color-mix(in srgb, var(--foreground) 8%, transparent);
}

.sw-tab-label {
    display: inline-block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Muted "Loading…" placeholder shown while packet metadata resolves —
   distinguishes a transient label from a real name so users don't read it
   as content (Chris 2026-08-17). */
.sw-tab-label-loading {
    color: var(--muted-foreground);
    font-style: italic;
}

/* Alert with inline recovery action (e.g. version-conflict Reload). */
.sw-alert-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sw-alert-row > span {
    flex: 1;
    min-width: 0;
}

/* Configure-Study empty state — new-Study path before Focal is set (04-brief §68). */
.sw-configure-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    gap: 1rem;
    color: var(--foreground);
}

.sw-configure-empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--muted, rgba(99, 102, 241, 0.08));
    color: var(--primary, #6366f1);
}

.sw-icon-lg {
    width: 24px;
    height: 24px;
}

.sw-configure-empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.sw-configure-empty-desc {
    font-size: 0.9375rem;
    color: var(--muted-foreground);
    max-width: 56ch;
    line-height: 1.5;
    margin: 0;
}

.sw-configure-empty-ctas {
    margin-top: 0.5rem;
}

.sw-configure-empty-hints {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    text-align: left;
}

.sw-configure-empty-hints li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sw-packet-header h1.sw-packet-title {
    font-size: 1.375rem;
    font-weight: 600;
    margin: 0 0 0.35rem;
    color: var(--foreground);
}

.sw-packet-desc {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 0;
    line-height: 1.5;
    max-width: 68ch;
}

.sw-table-lead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.sw-table-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--foreground);
}

/* ============ GRID TABLE ============ */

.sw-grid-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
}

.sw-grid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.sw-grid-table thead {
    background: var(--muted, rgba(0, 0, 0, 0.03));
    position: sticky;
    top: 0;
    z-index: 1;
}

.sw-grid-table th,
.sw-grid-table td {
    padding: 0.55rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    vertical-align: middle;
}

.sw-grid-table th {
    font-weight: 600;
    color: var(--foreground);
    font-size: 0.75rem;
}

.sw-grid-table tbody tr:hover {
    background: var(--muted, rgba(0, 0, 0, 0.02));
}

.sw-grid-th {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.sw-th-icons {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.35rem;
    color: var(--muted-foreground);
}

.sw-th-icon {
    width: 12px;
    height: 12px;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: color 0.12s ease;
}

.sw-th-icon:hover {
    color: var(--foreground);
}

.sw-th-icon-active {
    color: var(--primary, #6366f1);
}

.sw-th-icon-btn {
    background: transparent;
    border: 0;
    padding: 2px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
}

.sw-th-icon-btn:hover {
    background: var(--accent, rgba(0, 0, 0, 0.06));
}

.sw-focal-col {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sw-focal-star {
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: var(--muted-foreground);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sw-focal-star:hover {
    color: var(--foreground);
}

.sw-focal-star.is-focal {
    color: #eab308;
}

.sw-cell-highlighted {
    background: rgba(99, 102, 241, 0.08);
    outline: 1px solid var(--primary, #6366f1);
    outline-offset: -2px;
}

.sw-table-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.sw-table-foot-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ============ FIELD-INFO DIALOG BODY ============ */

.sw-fd-subject {
    color: var(--muted-foreground);
    font-weight: 400;
}

.sw-fd-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem 0 0;
}

.sw-fd-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--foreground);
    padding: 0.75rem 1rem;
    background: var(--muted, rgba(0, 0, 0, 0.04));
    border-radius: 8px;
    text-align: center;
}

.sw-fd-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: var(--foreground);
    line-height: 1.5;
}

.sw-fd-section-head {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sw-fd-section p {
    margin: 0;
}

.sw-fd-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.sw-fd-foot-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ============ RESPONSIVE ============ */

@media (max-width: 900px) {
    .sw-shell {
        grid-template-columns: 1fr;
    }
    .sw-left {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        max-height: 45vh;
    }
}
