﻿/* ============================================================
   Viz UI — Apple-inspired polish layer over MudBlazor components
   Scoped to .viz-* classes applied by the Viz* wrapper components.
   ============================================================ */

/* ── Buttons: pill shape, press-scale, layered shadow ── */
.viz-btn {
    border-radius: 9999px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    transition: transform 120ms cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 160ms ease,
                background-color 160ms ease,
                opacity 160ms ease !important;
}

/* Roomier pill padding + tuned icon gap (icon-only buttons keep their square padding) */
.mud-button-root.viz-btn:not(.mud-icon-button) {
    padding: 7px 18px;
}

.mud-button-root.viz-btn:not(.mud-icon-button).mud-button-filled-size-small,
.mud-button-root.viz-btn:not(.mud-icon-button).mud-button-text-size-small {
    padding: 4px 13px;
}

.mud-button-root.viz-btn .mud-button-label .mud-icon-button-size-small,
.mud-button-root.viz-btn .mud-button-icon-start {
    margin-left: -4px;
    margin-right: 7px;
}

.viz-btn:active {
    transform: scale(0.965);
}

.viz-btn.viz-btn--primary {
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12),
                0 6px 16px -8px rgba(79, 70, 229, 0.55) !important;
}

.viz-btn.viz-btn--primary:hover {
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.12),
                0 10px 22px -8px rgba(79, 70, 229, 0.65) !important;
}

.viz-btn.viz-btn--tonal {
    background-color: rgba(100, 116, 139, 0.1) !important;
    color: #334155 !important;
    box-shadow: none !important;
}

.viz-btn.viz-btn--tonal:hover {
    background-color: rgba(100, 116, 139, 0.18) !important;
}

.dark .viz-btn.viz-btn--tonal {
    background-color: rgba(148, 163, 184, 0.14) !important;
    color: #E2E8F0 !important;
}

.dark .viz-btn.viz-btn--tonal:hover {
    background-color: rgba(148, 163, 184, 0.22) !important;
}

.viz-btn.viz-btn--danger-soft {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: #DC2626 !important;
    box-shadow: none !important;
}

.viz-btn.viz-btn--danger-soft:hover {
    background-color: rgba(239, 68, 68, 0.18) !important;
}

.dark .viz-btn.viz-btn--danger-soft {
    background-color: rgba(248, 113, 113, 0.14) !important;
    color: #F87171 !important;
}

/* ── Tables: floating card, hairline rows, quiet hover ── */
.viz-table {
    border-radius: 14px !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04),
                0 12px 32px -20px rgba(15, 23, 42, 0.18) !important;
    overflow: hidden;
}

.dark .viz-table {
    border-color: #313E59 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25),
                0 16px 40px -24px rgba(0, 0, 0, 0.6) !important;
}

.viz-table .mud-table-cell {
    border-bottom: 1px solid rgba(226, 232, 240, 0.7) !important;
}

.dark .viz-table .mud-table-cell {
    border-bottom-color: rgba(49, 62, 89, 0.8) !important;
}

.viz-table th.mud-table-cell {
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94A3B8 !important;
    background-color: rgba(248, 250, 252, 0.8) !important;
}

.dark .viz-table th.mud-table-cell {
    color: #94A3B8 !important;
    background-color: rgba(25, 33, 50, 0.5) !important;
}

.viz-table .mud-table-row:hover .mud-table-cell {
    background-color: rgba(248, 250, 252, 0.9);
    transition: background-color 120ms ease;
}

.dark .viz-table .mud-table-row:hover .mud-table-cell {
    background-color: rgba(44, 58, 87, 0.6);
}

/* A cell that truncates instead of widening the table: max-width:0 stops the nowrap
   content from setting the column's width, so the column takes its share and the
   text ellipsizes. The content element must be a block for text-overflow to apply. */
.viz-table td.viz-cell-truncate {
    width: 50%;
    max-width: 0;
}

.viz-table td.viz-cell-truncate > * {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Modal: blurred backdrop, spring pop-in ── */
.viz-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    animation: viz-fade-in 200ms ease both;
}

.viz-modal-card {
    width: 100%;
    background: #FFFFFF;
    border-radius: 18px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08),
                0 32px 80px -24px rgba(15, 23, 42, 0.45);
    animation: viz-pop-in 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
    overflow: hidden;
}

.dark .viz-modal-card {
    background: #26334D;
    border-color: #313E59;
}

.viz-modal-card:focus {
    outline: none;
}

.viz-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.5rem 0.9rem;
}

.viz-modal-title {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #1E293B;
    margin: 0;
}

.dark .viz-modal-title {
    color: #E2E8F0;
}

.viz-modal-body {
    padding: 0.25rem 1.5rem 1.5rem;
    overflow-y: auto;
    max-height: calc(100vh - 12rem);
    text-align: left;
}

.viz-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.625rem;
    padding: 0.85rem 1.5rem;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    background: rgba(248, 250, 252, 0.65);
}

.dark .viz-modal-footer {
    border-top-color: rgba(49, 62, 89, 0.8);
    background: rgba(25, 33, 50, 0.35);
}

.viz-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 1.75rem;
    width: 1.75rem;
    border: none;
    border-radius: 9999px;
    background: rgba(100, 116, 139, 0.1);
    color: #64748B;
    cursor: pointer;
    transition: background-color 140ms ease, transform 120ms ease;
}

.viz-modal-close:hover {
    background: rgba(100, 116, 139, 0.2);
}

.viz-modal-close:active {
    transform: scale(0.92);
}

.dark .viz-modal-close {
    background: rgba(148, 163, 184, 0.14);
    color: #94A3B8;
}

@keyframes viz-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes viz-pop-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Inputs: soft focus ring ── */
.viz-input .mud-input-outlined-border {
    border-radius: 10px;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.viz-input.mud-input-control:focus-within .mud-input-outlined-border {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

.dark .viz-input.mud-input-control:focus-within .mud-input-outlined-border {
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.24);
}

/* ── Searchable select (MudAutocomplete): empty-result row ── */
.viz-select-empty {
    padding: 0.65rem 0.75rem;
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary);
}

/* ── File picker drop zone ── */
.viz-filepicker-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1.4rem 1rem;
    border: 1.5px dashed rgba(100, 116, 139, 0.4);
    border-radius: 12px;
    color: #64748B;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.viz-filepicker-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.viz-filepicker-zone:hover,
.viz-filepicker-zone-active {
    border-color: #4F46E5;
    background-color: rgba(79, 70, 229, 0.04);
}

.dark .viz-filepicker-zone {
    border-color: rgba(148, 163, 184, 0.35);
    color: #94A3B8;
}

.dark .viz-filepicker-zone:hover,
.dark .viz-filepicker-zone-active {
    border-color: #818CF8;
    background-color: rgba(129, 140, 248, 0.06);
}

.viz-filepicker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    border-radius: 9px;
    background: rgba(100, 116, 139, 0.07);
    font-size: 0.8125rem;
    color: #334155;
}

.dark .viz-filepicker-item {
    background: rgba(148, 163, 184, 0.1);
    color: #E2E8F0;
}

/* ── Form sections: grouped fields with quiet uppercase labels ── */
.viz-form-section + .viz-form-section {
    margin-top: 1.4rem;
}

.viz-form-section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94A3B8;
    margin: 0 0 0.6rem 0.1rem;
}

.viz-form-section-body {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.viz-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    align-items: start;
}

/* Sections side by side start on the same line; the stacked-section spacing does not apply. */
.viz-form-row > .viz-form-section + .viz-form-section {
    margin-top: 0;
}

@media (max-width: 960px) {
    .viz-form-row { grid-template-columns: 1fr; }
}

/* ── Switch rows: label left, toggle right (settings-style) ── */
.viz-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0.85rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 10px;
}

.dark .viz-switch-row {
    border-color: rgba(49, 62, 89, 0.9);
}

.viz-switch-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    text-align: left;
}

.viz-switch-label {
    font-size: 0.8438rem;
    font-weight: 500;
    color: #334155;
}

.dark .viz-switch-label {
    color: #E2E8F0;
}

.viz-switch-description {
    font-size: 0.75rem;
    color: #94A3B8;
}

.viz-switch-row .mud-switch {
    margin: 0;
}

/* ── Split panes: first pane resizes via native corner grip ── */
.viz-split {
    display: flex;
    gap: 0.75rem;
    min-height: 0;
    min-width: 0;
    height: 100%;
    width: 100%;
}

.viz-split--v {
    flex-direction: column;
}

.viz-split-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.viz-split--h > .viz-split-pane--fixed {
    resize: horizontal;
    overflow: auto;
    min-width: 240px;
    max-width: 75%;
    flex-shrink: 0;
}

.viz-split--v > .viz-split-pane--fixed {
    resize: vertical;
    overflow: auto;
    min-height: 140px;
    max-height: 80%;
    flex-shrink: 0;
}

.viz-split-pane--fill {
    flex: 1;
    overflow: auto;
}

@media (max-width: 960px) {
    .viz-split--h.viz-split--stack-md { flex-direction: column; }
    .viz-split--h.viz-split--stack-md > .viz-split-pane--fixed { width: 100% !important; max-width: none; resize: none; order: 2; }
    .viz-split--h.viz-split--stack-md > .viz-split-pane--fill { order: 1; }
}

/* ── Toggle chip ── */
.viz-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 2rem;
    padding: 0 0.9rem;
    border-radius: 9999px;
    border: 1px solid rgba(100, 116, 139, 0.25);
    background: transparent;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748B;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 140ms ease, color 140ms ease,
                border-color 140ms ease, transform 120ms ease;
}

.viz-toggle:active {
    transform: scale(0.96);
}

.viz-toggle--on {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.35);
    color: #4F46E5;
}

.dark .viz-toggle {
    border-color: rgba(148, 163, 184, 0.25);
    color: #94A3B8;
}

.dark .viz-toggle--on {
    background: rgba(129, 140, 248, 0.14);
    border-color: rgba(129, 140, 248, 0.4);
    color: #A5B4FC;
}

/* ── Variable list toolbar: full-width search over an even row of compact chips.
   Sized for a narrow side pane; each chip shows a check when on, since they
   switch independently rather than as one choice. ── */
.viz-varlist-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.6rem 0.7rem;
}

.viz-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.viz-chip-row .viz-toggle {
    flex: 1 1 auto;
    justify-content: center;
    gap: 0.3rem;
    height: 1.625rem;
    padding: 0 0.4rem;
    font-size: 0.75rem;
}

.viz-chip-row .viz-toggle--on::before {
    content: '';
    flex-shrink: 0;
    width: 0.28rem;
    height: 0.52rem;
    margin-top: -0.12rem;
    border: solid currentColor;
    border-width: 0 1.6px 1.6px 0;
    transform: rotate(45deg);
}

/* Empty-state text, shared by lists and panels. */
.viz-bar-empty {
    font-size: 0.8125rem;
    color: #94A3B8;
    text-align: center;
    padding: 1.5rem 0;
}

/* ── Panel: card container for tool areas (lists, editors) ── */
.viz-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #FFFFFF;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04),
                0 12px 32px -20px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.dark .viz-panel {
    border-color: #313E59;
    background: #26334D;
}

.viz-panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
}

.dark .viz-panel-toolbar {
    border-bottom-color: rgba(49, 62, 89, 0.8);
}

/* ── Selectable list rows (variable pickers) ── */
.viz-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.35rem;
}

.viz-list-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.45rem 0.7rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 0.8125rem;
    color: #334155;
    text-align: left;
    cursor: pointer;
    transition: background-color 100ms ease;
}

.viz-list-row:hover {
    background: rgba(100, 116, 139, 0.08);
}

.viz-list-row--selected,
.viz-list-row--selected:hover {
    background: rgba(79, 70, 229, 0.1);
    color: #4F46E5;
    font-weight: 500;
}

.dark .viz-list-row {
    color: #E2E8F0;
}

.dark .viz-list-row:hover {
    background: rgba(148, 163, 184, 0.1);
}

.dark .viz-list-row--selected,
.dark .viz-list-row--selected:hover {
    background: rgba(129, 140, 248, 0.16);
    color: #A5B4FC;
}

.viz-list-row-name {
    flex-shrink: 0;
    width: 30%;
    max-width: 160px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viz-list-row-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Inline-editable rows (banner/filter expression builders) ── */
.viz-editrows {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.6rem 0.85rem;
    overflow-y: auto;
}

.viz-editrow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.viz-editrow-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.85rem;
    margin-top: 0.6rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94A3B8;
}

.viz-inline-input {
    height: 2.1rem;
    padding: 0 0.65rem;
    border: 1px solid rgba(100, 116, 139, 0.25);
    border-radius: 8px;
    background: transparent;
    font-size: 0.8125rem;
    color: #334155;
    transition: border-color 140ms ease, box-shadow 140ms ease;
    min-width: 0;
}

.viz-inline-input:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.dark .viz-inline-input {
    border-color: rgba(148, 163, 184, 0.25);
    color: #E2E8F0;
}

.dark .viz-inline-input:focus {
    border-color: #818CF8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.viz-editrow-total {
    flex-shrink: 0;
    width: 64px;
    text-align: right;
    font-size: 0.8125rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #334155;
}

.dark .viz-editrow-total {
    color: #E2E8F0;
}

/* ── Native checkbox in Viz lists/tables (indigo accent) ── */
.viz-check {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    accent-color: #4F46E5;
    cursor: pointer;
}

.viz-dropzone--active {
    outline: 2px dashed rgba(79, 70, 229, 0.5);
    outline-offset: -6px;
    border-radius: 12px;
}

/* ── Page header ── */
.viz-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 0 1.5rem;
}

.viz-page-title {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #334155;
    margin: 0;
}

.dark .viz-page-title {
    color: #F1F5F9;
}

.viz-page-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

/* Search sits apart from the action buttons */
.viz-page-actions > label {
    margin-left: 0.5rem;
}

/* MudBlazor popovers must float above the app sidebar/header (z-index 60-ish)
   and the viz modal backdrop (100). */
.mud-popover-provider .mud-popover,
.mud-overlay {
    z-index: 1400;
}

/* ── Draggable list rows (crosstab variable panel) ── */
.viz-list-row--draggable {
    user-select: none;
}

.viz-list-row-grip {
    flex-shrink: 0;
    display: inline-flex;
    color: #CBD5E1;
    cursor: grab;
}

.viz-list-row:hover .viz-list-row-grip {
    color: #94A3B8;
}

.dark .viz-list-row-grip {
    color: #475569;
}

.dark .viz-list-row:hover .viz-list-row-grip {
    color: #64748B;
}

/* ── Tab bar (crosstab views) ── */
.viz-tabbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0.65rem;
    border-bottom: 1px solid rgba(100, 116, 139, 0.15);
}

.viz-tabbar-tabs {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    overflow-x: auto;
    scrollbar-width: thin;
    padding: 0.15rem;
}

.viz-tabbar-tab {
    flex-shrink: 0;
    max-width: 200px;
    padding: 0.32rem 0.85rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.viz-tabbar-tab:hover {
    background: rgba(100, 116, 139, 0.1);
    color: #334155;
}

.viz-tabbar-tab--selected,
.viz-tabbar-tab--selected:hover {
    background: #fff;
    color: #4F46E5;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
}

.dark .viz-tabbar {
    border-bottom-color: rgba(148, 163, 184, 0.15);
}

.dark .viz-tabbar-tab {
    color: #94A3B8;
}

.dark .viz-tabbar-tab:hover {
    background: rgba(148, 163, 184, 0.12);
    color: #E2E8F0;
}

.dark .viz-tabbar-tab--selected,
.dark .viz-tabbar-tab--selected:hover {
    background: #313E59;
    color: #A5B4FC;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.viz-tabbar-tab--disabled,
.viz-tabbar-tab--disabled:hover {
    opacity: 0.45;
    cursor: not-allowed;
    background: transparent;
}

.viz-tabbar-add {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px dashed #CBD5E1;
    border-radius: 999px;
    background: transparent;
    color: #64748B;
    cursor: pointer;
    transition: border-color 120ms ease, color 120ms ease;
}

.viz-tabbar-add:hover {
    border-color: #4F46E5;
    color: #4F46E5;
}

.dark .viz-tabbar-add {
    border-color: #475569;
    color: #94A3B8;
}

.dark .viz-tabbar-add:hover {
    border-color: #818CF8;
    color: #A5B4FC;
}

.viz-tabbar-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ── Prompt dialog ── */
.viz-prompt {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 260px;
}

.viz-prompt-message {
    font-size: 0.875rem;
    color: #475569;
    margin: 0;
}

.dark .viz-prompt-message {
    color: #CBD5E1;
}

.viz-prompt-input {
    width: 100%;
}

/* ── Checkable selection lists (report dialogs) ── */
.viz-checklist {
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(100, 116, 139, 0.25);
    border-radius: 10px;
    overflow: hidden;
    max-height: 320px;
}

.dark .viz-checklist {
    border-color: rgba(148, 163, 184, 0.25);
}

.viz-checklist-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid rgba(100, 116, 139, 0.15);
    background: rgba(100, 116, 139, 0.04);
}

.dark .viz-checklist-toolbar {
    border-bottom-color: rgba(148, 163, 184, 0.15);
    background: rgba(148, 163, 184, 0.06);
}

.viz-checklist-link {
    border: none;
    background: transparent;
    padding: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4F46E5;
    cursor: pointer;
}

.viz-checklist-link:hover {
    text-decoration: underline;
}

.dark .viz-checklist-link {
    color: #A5B4FC;
}

.viz-checklist-sep {
    color: #CBD5E1;
    font-size: 0.75rem;
}

.dark .viz-checklist-sep {
    color: #475569;
}

.viz-checklist-items {
    flex: 1;
    overflow-y: auto;
    padding: 0.3rem;
    min-height: 120px;
}

.viz-checklist-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    border-radius: 7px;
    font-size: 0.8125rem;
    color: #334155;
    cursor: pointer;
}

.viz-checklist-item:hover {
    background: rgba(100, 116, 139, 0.08);
}

.dark .viz-checklist-item {
    color: #CBD5E1;
}

.dark .viz-checklist-item:hover {
    background: rgba(148, 163, 184, 0.1);
}

.viz-checklist-item input[type="checkbox"] {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    accent-color: #4F46E5;
    cursor: pointer;
}

.viz-checklist-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   App shell — sidebar nav, header buttons, and the profile /
   notifications menus (MudMenu popovers). Apple-like polish.
   ============================================================ */

/* ── Sidebar nav items ── */
.viz-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    color: #475569;
    outline: none;
    transition: background-color 160ms ease, color 160ms ease;
}

.viz-nav-item:hover {
    background-color: #F1F5F9;
    color: #0F172A;
}

.viz-nav-item svg {
    transition: color 160ms ease;
}

.viz-nav-item--active,
.viz-nav-item--active:hover {
    color: #4F46E5;
    background-color: rgba(79, 70, 229, 0.10);
    font-weight: 600;
}

/* Left accent indicator on the active item */
.viz-nav-item--active::before {
    content: "";
    position: absolute;
    left: -0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 1.15rem;
    border-radius: 0 3px 3px 0;
    background-color: #4F46E5;
}

.dark .viz-nav-item {
    color: #A9B6D0;
}

.dark .viz-nav-item:hover {
    background-color: #313E59;
    color: #E2E8F0;
}

.dark .viz-nav-item--active,
.dark .viz-nav-item--active:hover {
    color: #C7D2FE;
    background-color: rgba(129, 140, 248, 0.16);
}

.dark .viz-nav-item--active::before {
    background-color: #818CF8;
}

/* ── Header icon buttons ── */
.viz-hdr-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.25rem;
    width: 2.25rem;
    border-radius: 9999px;
    color: #64748B;
    cursor: pointer;
    transition: background-color 160ms ease, transform 120ms cubic-bezier(0.16, 1, 0.3, 1);
}

.viz-hdr-btn:hover {
    background-color: #F1F5F9;
}

.viz-hdr-btn:active {
    transform: scale(0.92);
}

.dark .viz-hdr-btn {
    color: #C2CFE0;
}

.dark .viz-hdr-btn:hover {
    background-color: #313E59;
}

/* ── Profile trigger (sidebar footer) ── */
.viz-profile-trigger {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.75rem;
    border-radius: 12px;
    padding: 0.5rem 0.625rem;
    cursor: pointer;
    transition: background-color 160ms ease;
}

.viz-profile-trigger:hover {
    background-color: #F1F5F9;
}

.dark .viz-profile-trigger:hover {
    background-color: #313E59;
}

/* ── Self-contained popover (profile / notifications) ── */
.viz-pop {
    position: relative;
}

.viz-pop-panel {
    position: absolute;
    z-index: 61;
    border-radius: 14px;
    border: 1px solid #E9EEF5;
    background-color: #FFFFFF;
    box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.10),
                0 16px 40px -12px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    transform-origin: var(--viz-pop-origin, top center);
    animation: viz-pop-in 140ms cubic-bezier(0.16, 1, 0.3, 1);
}

.dark .viz-pop-panel {
    border-color: #313E59;
    background-color: #26334D;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.35),
                0 16px 40px -12px rgba(0, 0, 0, 0.5);
}

/* Opens upward, aligned to the left edge (sidebar profile) */
.viz-pop-panel--up-left {
    bottom: calc(100% + 0.5rem);
    left: 0;
    --viz-pop-origin: bottom left;
}

/* Opens downward, aligned to the right edge (header notifications) */
.viz-pop-panel--down-right {
    top: calc(100% + 0.5rem);
    right: 0;
    --viz-pop-origin: top right;
}

/* Opens downward, aligned to the left edge (header survey switcher) */
.viz-pop-panel--down-left {
    top: calc(100% + 0.5rem);
    left: 0;
    --viz-pop-origin: top left;
}

/* ── Survey switcher ── */
.viz-switcher { flex-shrink: 1; min-width: 0; }

.viz-switcher-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: clamp(14rem, 32vw, 26rem);
    max-width: 100%;
    height: 2.25rem;
    padding: 0 0.375rem 0 0.625rem;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    background: #F8FAFC;
    color: #475569;
    font-size: 0.8125rem;
    text-align: left;
    transition: border-color 140ms, background-color 140ms, box-shadow 140ms;
}
.viz-switcher-trigger:hover { border-color: #CBD5E1; background: #FFFFFF; }
.viz-switcher-trigger:focus-visible,
.viz-switcher-trigger.is-open {
    outline: none;
    border-color: #1F4E79;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.14);
}
.dark .viz-switcher-trigger { border-color: #384766; background: #1E293B; color: #CBD5E1; }
.dark .viz-switcher-trigger:hover { border-color: #4B5B7C; background: #26334D; }
.dark .viz-switcher-trigger:focus-visible,
.dark .viz-switcher-trigger.is-open { border-color: #7AA7D6; background: #26334D; box-shadow: 0 0 0 3px rgba(122, 167, 214, 0.18); }
.viz-switcher-trigger-icon { color: #1F4E79; flex-shrink: 0; }
.dark .viz-switcher-trigger-icon { color: #7AA7D6; }

.viz-switcher-crumbs { display: flex; flex: 1; align-items: center; gap: 0.375rem; min-width: 0; }
.viz-switcher-crumb-folder { flex-shrink: 2; min-width: 2.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #64748B; }
.viz-switcher-crumb-survey { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: #1E293B; }
.dark .viz-switcher-crumb-folder { color: #94A3B8; }
.dark .viz-switcher-crumb-survey { color: #F1F5F9; }
.viz-switcher-placeholder { color: #94A3B8; }
.viz-switcher-sep { color: #CBD5E1; }
.dark .viz-switcher-sep { color: #4B5B7C; }

.viz-switcher-kbd,
.viz-switcher-hints kbd {
    display: inline-flex;
    align-items: center;
    height: 1.25rem;
    padding: 0 0.375rem;
    border: 1px solid #E2E8F0;
    border-bottom-width: 2px;
    border-radius: 5px;
    background: #FFFFFF;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.625rem;
    color: #64748B;
    white-space: nowrap;
}
.dark .viz-switcher-kbd,
.dark .viz-switcher-hints kbd { border-color: #384766; background: #1E293B; color: #94A3B8; }

.viz-switcher-panel { width: min(34rem, calc(100vw - 2rem)); }

.viz-switcher-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #E9EEF5;
}
.dark .viz-switcher-search { border-color: #313E59; }
.viz-switcher-search-icon { color: #94A3B8; flex-shrink: 0; }
.viz-switcher-search input {
    flex: 1;
    min-width: 0;
    height: 2.25rem;
    background: transparent;
    outline: none;
    font-size: 0.9375rem;
    color: #1E293B;
}
.viz-switcher-search input::placeholder { color: #94A3B8; }
.dark .viz-switcher-search input { color: #F1F5F9; }
.viz-switcher-back {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    border-radius: 7px;
    color: #475569;
}
.viz-switcher-back:hover { background: #F1F5F9; }
.dark .viz-switcher-back { color: #CBD5E1; }
.dark .viz-switcher-back:hover { background: #313E59; }
.viz-switcher-scope {
    max-width: 40%;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: rgba(31, 78, 121, 0.08);
    color: #1F4E79;
    font-size: 0.75rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dark .viz-switcher-scope { background: rgba(122, 167, 214, 0.16); color: #A9C8E8; }
.viz-switcher-spinner {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
    border: 2px solid #CBD5E1;
    border-top-color: #1F4E79;
    border-radius: 50%;
    animation: viz-switcher-spin 700ms linear infinite;
}
@keyframes viz-switcher-spin { to { transform: rotate(360deg); } }

.viz-switcher-list { max-height: min(26rem, 60vh); overflow-y: auto; padding: 0.25rem 0.375rem 0.375rem; }
.viz-switcher-section {
    padding: 0.625rem 0.5rem 0.25rem;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94A3B8;
}
.viz-switcher-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.4375rem 0.5rem;
    border-radius: 8px;
    color: #475569;
}
.viz-switcher-item.is-active { background: #EFF4FA; color: #1E293B; }
.viz-switcher-item.is-active::before {
    content: "";
    position: absolute;
    left: -0.375rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #1F4E79;
}
.dark .viz-switcher-item { color: #CBD5E1; }
.dark .viz-switcher-item.is-active { background: #313E59; color: #F1F5F9; }
.dark .viz-switcher-item.is-active::before { background: #7AA7D6; }
.viz-switcher-item-icon {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    border-radius: 7px;
    background: #F1F5F9;
    color: #64748B;
}
.viz-switcher-item.is-active .viz-switcher-item-icon { background: #1F4E79; color: #FFFFFF; }
.dark .viz-switcher-item-icon { background: #26334D; color: #94A3B8; }
.dark .viz-switcher-item.is-active .viz-switcher-item-icon { background: #7AA7D6; color: #0F172A; }
.viz-switcher-item-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.875rem; font-weight: 500; }
.viz-switcher-item-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; color: #94A3B8; }
.viz-switcher-item-chevron { color: #CBD5E1; flex-shrink: 0; }
.viz-switcher-empty { padding: 1.75rem 1rem; text-align: center; font-size: 0.875rem; color: #94A3B8; }
.viz-switcher-link { margin-left: 0.375rem; font-weight: 600; color: #1F4E79; }
.viz-switcher-link:hover { text-decoration: underline; }
.dark .viz-switcher-link { color: #7AA7D6; }
.viz-switcher-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.875rem;
    border-top: 1px solid #E9EEF5;
    background: #FAFBFD;
    font-size: 0.75rem;
}
.dark .viz-switcher-foot { border-color: #313E59; background: #222E46; }
.viz-switcher-hints { display: flex; align-items: center; gap: 0.25rem; color: #94A3B8; }
.viz-switcher-hints kbd:not(:first-child) { margin-left: 0.25rem; }

@media (max-width: 640px) {
    .viz-switcher-trigger { width: auto; max-width: 11rem; }
    .viz-switcher-kbd, .viz-switcher-crumb-folder:has(+ .viz-switcher-sep), .viz-switcher-sep, .viz-switcher-hints { display: none; }
}

@keyframes viz-pop-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* ── Profile card ── */
.viz-profile-card {
    width: 16rem;
}

.viz-profile-card-head {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem;
    background-color: #F8FAFC;
    border-bottom: 1px solid #E9EEF5;
}

.dark .viz-profile-card-head {
    background-color: #222E45;
    border-bottom-color: #313E59;
}

.viz-profile-card-body {
    padding: 0.875rem 1rem 1rem;
}

/* ── Notifications card ── */
.viz-notif-card {
    width: 20rem;
    max-width: calc(100vw - 2rem);
    display: flex;
    flex-direction: column;
}

.viz-notif-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: #F8FAFC;
    border-bottom: 1px solid #E9EEF5;
}

.dark .viz-notif-head {
    background-color: #222E45;
    border-bottom-color: #313E59;
}

.viz-notif-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #4F46E5;
    background-color: rgba(79, 70, 229, 0.12);
}

.dark .viz-notif-count {
    color: #C7D2FE;
    background-color: rgba(129, 140, 248, 0.18);
}

.viz-notif-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
    padding: 0.5rem;
}

.viz-notif-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 140ms ease;
}

.viz-notif-item:hover {
    background-color: #F1F5F9;
}

.dark .viz-notif-item:hover {
    background-color: #313E59;
}

.viz-notif-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 2.25rem;
    width: 2.25rem;
    border-radius: 10px;
    color: #4F46E5;
    background-color: rgba(79, 70, 229, 0.10);
}

.dark .viz-notif-item-icon {
    color: #C7D2FE;
    background-color: rgba(129, 140, 248, 0.16);
}

/* Empty state (list pages with nothing to show yet) */
.viz-empty-state {
    max-width: 32rem;
    margin: 4rem auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.viz-empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.viz-empty-state p {
    color: var(--mud-palette-text-secondary);
    font-size: 0.9rem;
}

/* ---------------------------------------------------------------------------
   Time-series tracker wizard (shell, stepper, rail, plain tables)
   --------------------------------------------------------------------------- */
.tracker-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18rem;
    gap: 1rem;
    padding: 0 1.5rem 1.5rem;
    height: calc(100vh - 7rem);
}

.tracker-shell--no-rail {
    grid-template-columns: minmax(0, 1fr);
}

.tracker-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tracker-stepper {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 0.75rem;
}

.tracker-name-field {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    min-width: 18rem;
}

    .tracker-name-field > * {
        min-width: 15rem;
    }

.tracker-step-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

/* Picker steps own their scrolling: the page itself does not scroll, only the lists inside it.
   The pane is a fixed width here (no drag-to-resize grip) so the two columns stay predictable. */
.tracker-step-body--fixed { overflow: hidden; }
.tracker-step-body--fixed .viz-split--h > .viz-split-pane--fixed { overflow: hidden; }
.tracker-step-body .viz-split--h > .viz-split-pane--fixed { resize: none; }

.tracker-footer {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-top: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background);
}

.tracker-footer-hint {
    font-size: 0.85rem;
    color: var(--mud-palette-text-secondary);
}

.tracker-rail-card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-size: 0.875rem;
}

.tracker-rail-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
}

.tracker-rail-label {
    color: var(--mud-palette-text-secondary);
}

/* Rail sections: a quiet heading with its rows stacked underneath, so waves and the questions being
   tracked read as two aligned lists rather than label/value pairs. */
.tracker-rail-section {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.tracker-rail-heading {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mud-palette-text-secondary);
}

.tracker-rail-list {
    display: flex;
    flex-direction: column;
}

.tracker-rail-item {
    display: grid;
    grid-template-columns: 1.15rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0;
    font-size: 0.8125rem;
}

.tracker-rail-index {
    font-variant-numeric: tabular-nums;
    font-size: 0.6875rem;
    color: var(--mud-palette-text-disabled);
    text-align: right;
}

.tracker-rail-item-text {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tracker-rail-item-end {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.tracker-rail-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    flex-shrink: 0;
    background: var(--mud-palette-text-disabled);
}

.tracker-rail-dot--ok { background: var(--mud-palette-success); }
.tracker-rail-dot--warn { background: var(--mud-palette-warning); }
.tracker-rail-dot--bad { background: var(--mud-palette-error); }

.tracker-rail-empty {
    font-size: 0.75rem;
    color: var(--mud-palette-text-disabled);
    padding: 0.15rem 0;
}

.viz-plain-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.viz-plain-table th {
    text-align: left;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.viz-plain-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    vertical-align: middle;
}

.viz-help {
    font-size: 0.85rem;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 0.5rem;
}

@media (max-width: 1100px) {
    .tracker-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .tracker-rail {
        display: none;
    }
}

/* ---------------------------------------------------------------------------
   Resolution table (question/banner × wave grid — Time-series tracker)
   --------------------------------------------------------------------------- */
.res-table-wrap { overflow: auto; border: 1px solid var(--mud-palette-lines-default); border-radius: 0.75rem; }
.res-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.85rem; }
.res-table th { position: sticky; top: 0; background: var(--mud-palette-surface); text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--mud-palette-lines-default); font-weight: 600; z-index: 1; }
.res-table td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--mud-palette-lines-default); vertical-align: middle; }
.res-table-item { min-width: 12rem; max-width: 18rem; }
/* A question label is often the whole question wording; one line with an ellipsis (full text on
   hover) keeps the wave columns wide enough to read. */
.res-table-clip { max-width: 17rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-cell { cursor: pointer; }
.res-cell:hover { background: var(--mud-palette-action-default-hover); }
.res-cell--empty { cursor: default; }
.res-cell-inner { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.res-cell-var { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }
.res-table-progress { height: 3px; margin-top: 4px; }

/* ---------------------------------------------------------------------------
   Time-series tracker — Questions step (variable picker, fixer modal, editors)
   --------------------------------------------------------------------------- */
.q-picker { display: flex; flex-direction: column; gap: 0.5rem; height: 100%; min-height: 0; }
/* Resolve row: fixed height at the bottom of the pane so the button never gets clipped. */
.q-picker-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    min-height: 3rem;
    padding: 0.65rem 0.15rem 0.85rem;
    border-top: 1px solid var(--mud-palette-lines-default);
}

/* Fills whatever height its parent gives it; only .var-picker-list scrolls. */
.var-picker { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; min-height: 0; }

/* MudBlazor ships `flex: 1 1 auto` on .mud-select / .mud-input-control, so in a column flex the base
   wave select and the search box grow and split the free space with the list — the list ends up
   squashed at the bottom. Exactly one child of each column is allowed to grow; everything else is
   pinned to its content height. */
.q-picker > *:not(.var-picker) { flex: 0 0 auto; }
.var-picker > *:not(.var-picker-list) { flex: 0 0 auto; }
.var-picker-toolbar { display: flex; justify-content: space-between; align-items: center; }
.var-picker-list { overflow-y: auto; overflow-x: hidden; flex: 1; min-height: 0; border: 1px solid var(--mud-palette-lines-default); border-radius: 0.5rem; }
.var-picker-row { display: flex; gap: 0.5rem; align-items: center; padding: 0.35rem 0.5rem; cursor: pointer; border-bottom: 1px solid var(--mud-palette-lines-default); }
.var-picker-row:hover { background: var(--mud-palette-action-default-hover); }
.var-picker-row--sel { background: var(--mud-palette-primary-hover); }
.var-picker-check { display: inline-flex; align-items: center; }
.var-picker-text { min-width: 0; }
/* Under the label: the variable name in mono plus its scale badge. */
.var-picker-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; color: var(--mud-palette-text-secondary); display: flex; gap: 0.4rem; align-items: center; }
.var-picker-label { font-size: 0.75rem; color: var(--mud-palette-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* A banner candidate is shown by its .sav label alone (the variable name rides on the row's tooltip). */
.var-picker-title { min-width: 0; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scale-badge { height: 1.1rem; font-size: 0.65rem; }

.fixer-summary { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.fixer-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1rem; min-height: 24rem; max-height: 60vh; }
.fixer-left, .fixer-right { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.fixer-h { font-size: 0.8rem; font-weight: 600; color: var(--mud-palette-text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }

/* Banners step — standard-banner catalog checklist */
/* Banners are ticked in a checklist of the first wave's variables; the picked banners show in the
   resolution table beside it, so there is no separate selected list. */

.banner-code-row { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.banner-code-label { font-weight: 500; font-size: 0.85rem; }

.response-group { border: 1px solid var(--mud-palette-lines-default); border-radius: 0.5rem; padding: 0.5rem; margin-bottom: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
/* The label field takes the slack; the reorder / show-in-report / delete controls keep their natural
   width and wrap to a second line in a narrow fixer pane rather than squeezing the label out. */
.response-group-head { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.response-group-head > .viz-input { flex: 1 1 12rem; min-width: 0; }

/* "Margin: [A] − [B]" above the groups — picking a pair moves those two groups to the top. */
.margin-picker {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    padding: 0.5rem 0.75rem; margin-bottom: 0.6rem; border-radius: 0.5rem;
    background: rgba(79, 70, 229, 0.06); border: 1px solid rgba(79, 70, 229, 0.18);
}
.dark .margin-picker { background: rgba(165, 180, 252, 0.08); border-color: rgba(165, 180, 252, 0.22); }
.margin-picker > .viz-input, .margin-picker > div { flex: 1 1 11rem; min-width: 0; }
.margin-picker-label { font-weight: 600; font-size: 0.8rem; letter-spacing: 0.02em; }
.margin-picker-minus { font-weight: 600; opacity: 0.6; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Review step — stacked coverage / weights / generate cards */
.review-grid { display: flex; flex-direction: column; gap: 1rem; max-width: 60rem; }

@media (max-width: 800px) {
    .fixer-grid { grid-template-columns: minmax(0, 1fr); max-height: none; }
}

/* Reasons inside an alert: one per line, indented under the summary sentence. */
.viz-error-list {
    margin: 0.35rem 0 0;
    padding-left: 1.1rem;
    list-style: disc;
}

.viz-error-list li {
    margin-top: 0.15rem;
}

/* ── Dashboard ── */
.viz-dash-section { padding-top: 1.5rem; }
.viz-dash-section + .viz-dash-section { padding-top: 2.25rem; }
.viz-dash-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-bottom: 0.875rem;
}
.viz-dash-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #1E293B;
}
.dark .viz-dash-heading { color: #F1F5F9; }
.viz-dash-subheading { margin-top: 0.125rem; font-size: 0.8125rem; color: #64748B; }
.dark .viz-dash-subheading { color: #94A3B8; }
.viz-dash-count {
    padding: 0 0.5rem;
    border-radius: 999px;
    background: #EEF2F7;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.375rem;
    color: #475569;
}
.dark .viz-dash-count { background: #313E59; color: #CBD5E1; }
.viz-dash-message { font-size: 0.875rem; color: #64748B; }

.viz-dash-cards {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 0.75rem;
}
@media (min-width: 640px) { .viz-dash-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .viz-dash-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.viz-dash-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 7.75rem;
    padding: 0.75rem 0.875rem 0.875rem 1rem;
    overflow: hidden;
    border: 1px solid #E9EEF5;
    border-radius: 12px;
    background: #FFFFFF;
    cursor: pointer;
    animation: viz-dash-rise 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
    transition: border-color 140ms, box-shadow 160ms, transform 160ms;
}
.viz-dash-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: #1F4E79;
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
.viz-dash-card:hover,
.viz-dash-card:focus-visible {
    border-color: #C9D6E6;
    box-shadow: 0 10px 24px -14px rgba(15, 23, 42, 0.35);
    transform: translateY(-1px);
    outline: none;
}
.viz-dash-card:hover::before,
.viz-dash-card:focus-visible::before { transform: scaleY(1); }
.dark .viz-dash-card { border-color: #313E59; background: #26334D; }
.dark .viz-dash-card:hover,
.dark .viz-dash-card:focus-visible { border-color: #4B5B7C; box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.6); }
.dark .viz-dash-card::before { background: #7AA7D6; }

.viz-dash-card-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: 1.75rem; }
.viz-dash-card-folder {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    min-width: 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: #1F4E79;
}
.viz-dash-card-folder > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz-dash-card-folder .mud-icon-root { font-size: 0.9375rem; opacity: 0.8; }
.dark .viz-dash-card-folder { color: #A9C8E8; }
.viz-dash-card-edit { opacity: 0; transition: opacity 140ms; }
.viz-dash-card:hover .viz-dash-card-edit,
.viz-dash-card:focus-within .viz-dash-card-edit { opacity: 1; }
@media (hover: none) { .viz-dash-card-edit { opacity: 1; } }

.viz-dash-card-title {
    display: -webkit-box;
    margin-top: 0.25rem;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
    color: #0F172A;
}
.dark .viz-dash-card-title { color: #F1F5F9; }
.viz-dash-card-meta {
    display: flex;
    align-items: center;
    gap: 0.4375rem;
    margin-top: auto;
    padding-top: 0.625rem;
    font-size: 0.75rem;
    color: #64748B;
    font-variant-numeric: tabular-nums;
}
.dark .viz-dash-card-meta { color: #94A3B8; }
.viz-dash-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.6; }

.viz-dash-card--skeleton {
    cursor: default;
    animation: viz-dash-shimmer 1.2s linear infinite;
    background: linear-gradient(90deg, #F1F5F9 25%, #E9EEF5 50%, #F1F5F9 75%);
    background-size: 200% 100%;
}
.viz-dash-card--skeleton::before { display: none; }
.dark .viz-dash-card--skeleton { background: linear-gradient(90deg, #26334D 25%, #2E3B57 50%, #26334D 75%); background-size: 200% 100%; }

.viz-dash-folder-name { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 500; color: #334155; }
.viz-dash-folder-name .mud-icon-root { color: #1F4E79; opacity: 0.75; }
.dark .viz-dash-folder-name { color: #E2E8F0; }
.dark .viz-dash-folder-name .mud-icon-root { color: #7AA7D6; }

@keyframes viz-dash-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes viz-dash-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
    .viz-dash-card, .viz-dash-card--skeleton { animation: none; }
    .viz-dash-card, .viz-dash-card::before { transition: none; }
}

/* ── Check picker (VizCheckPicker): a VizSelect-styled field opening a searchable checkbox list ── */
.viz-check-picker { position: relative; display: flex; flex-direction: column; gap: 0.25rem; }
.viz-check-picker-label { font-size: 0.75rem; color: var(--mud-palette-text-secondary); }
.viz-check-picker-field {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; width: 100%;
    min-height: 2.5rem; padding: 0.4rem 0.6rem 0.4rem 0.85rem;
    font: inherit; font-size: 0.875rem; text-align: left; cursor: pointer;
    color: var(--mud-palette-text-primary); background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-inputs); border-radius: 10px;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}
.viz-check-picker-field:hover { border-color: var(--mud-palette-text-primary); }
.viz-check-picker-field--open,
.viz-check-picker-field:focus-visible { outline: none; border-color: var(--mud-palette-primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18); }
.dark .viz-check-picker-field--open,
.dark .viz-check-picker-field:focus-visible { box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.24); }
.viz-check-picker--disabled .viz-check-picker-field { cursor: default; opacity: 0.6; }
.viz-check-picker-summary { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viz-check-picker-summary--empty { color: var(--mud-palette-text-secondary); }
/* The popover is portalled under MudPopoverProvider; RelativeWidth pins it to the field's width. */
.viz-check-picker-popover { border-radius: 10px; margin-top: 0.25rem; }
.viz-check-picker-body { padding: 0.6rem; max-height: 22rem; }
.viz-check-picker-list { max-height: 15rem; }
.var-picker-row--disabled { cursor: progress; opacity: 0.55; }
/* Virtualize needs every row the same height as its ItemSize (46px), one line or two. */
.viz-check-picker-row { box-sizing: border-box; height: 46px; }


/* ---------------------------------------------------------------------------
   Open Ends: AI-assisted coding of free-text questions
   --------------------------------------------------------------------------- */
/* The page fills the viewport below the header so both panes scroll inside themselves. */
.oe-page {
    height: calc(100vh - 60px - 6.5rem);
    min-height: 28rem;
}

/* Question rows are .viz-list-row; this only adds the two-line label. */
.oe-question { padding-top: 0.5rem; padding-bottom: 0.5rem; }

.oe-question-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }

.oe-question-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #1E293B;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.oe-question-meta { font-size: 0.6875rem; color: #94A3B8; }

.oe-status {
    flex-shrink: 0;
    padding: 0.1rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(100, 116, 139, 0.1);
    color: #64748B;
}

.oe-status--draft { background: rgba(217, 119, 6, 0.12); color: #B45309; }
.oe-status--coded { background: rgba(5, 150, 105, 0.12); color: #047857; }
.oe-status--new { background: rgba(79, 70, 229, 0.12); color: #4338CA; }
.oe-status--orphaned { background: rgba(220, 38, 38, 0.1); color: #B91C1C; }

.oe-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.1rem 0.6rem;
}

.oe-head-text { min-width: 0; }
.oe-head h2 { font-size: 1rem; font-weight: 600; color: #0F172A; line-height: 1.35; }
.oe-head p { margin-top: 0.15rem; font-size: 0.75rem; color: #64748B; }
.oe-head-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }

.oe-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    margin: 0 1.1rem 0.6rem;
    padding: 0.55rem 0.8rem;
    border-radius: 10px;
    border-left: 3px solid #059669;
    background: rgba(5, 150, 105, 0.07);
    font-size: 0.8125rem;
    color: #334155;
}

.oe-banner--warn { border-left-color: #D97706; background: rgba(217, 119, 6, 0.08); margin-top: 0.9rem; }
.oe-banner--new { border-left-color: #4F46E5; background: rgba(79, 70, 229, 0.07); }
.oe-banner--fold { border-left-color: #64748B; background: rgba(100, 116, 139, 0.08); margin: 0 0 0.6rem; }

.oe-fold { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 500; }

.oe-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0.9rem 1.1rem 1rem; overflow: auto; }

.oe-step { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.oe-setup { display: flex; flex-direction: column; gap: 1.1rem; max-width: 46rem; }


.oe-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.oe-toolbar-actions { display: flex; align-items: center; gap: 0.5rem; }

.oe-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.oe-spacer { flex: 1; }

.oe-categories { display: flex; flex-direction: column; gap: 0.4rem; overflow-y: auto; min-height: 0; padding-right: 0.2rem; }

.oe-category {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 10px;
    background: #FFFFFF;
}

.oe-category--selected { border-color: #818CF8; background: rgba(79, 70, 229, 0.04); }
.oe-category--fixed { background: rgba(100, 116, 139, 0.05); border-style: dashed; }

.oe-category-lead { display: flex; align-items: center; gap: 0.5rem; padding-top: 0.3rem; min-width: 3.6rem; justify-content: flex-end; }

.oe-code {
    min-width: 1.9rem;
    padding: 0 0.35rem;
    border-radius: 6px;
    background: rgba(79, 70, 229, 0.1);
    color: #4338CA;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.35rem;
    text-align: center;
}

.oe-category-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }

.oe-category-side { display: flex; align-items: center; gap: 0.75rem; padding-top: 0.15rem; flex-shrink: 0; }

.oe-row-actions { display: inline-flex; align-items: center; }

.oe-count { min-width: 2.5rem; text-align: right; font-size: 0.8125rem; font-weight: 600; color: #0F172A; font-variant-numeric: tabular-nums; }

.oe-keep { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; color: #64748B; white-space: nowrap; cursor: pointer; }

.oe-examples { font-size: 0.75rem; color: #94A3B8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.oe-input {
    width: 100%;
    padding: 0.3rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    font-size: 0.8125rem;
    color: #1E293B;
    transition: border-color 100ms ease, background-color 100ms ease;
}

.oe-input:hover:not(:disabled) { border-color: rgba(203, 213, 225, 0.9); }
.oe-input:focus { outline: none; border-color: #818CF8; background: #FFFFFF; box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.18); }
.oe-input:disabled { color: #64748B; cursor: default; }

.oe-input--name { font-weight: 600; }
.oe-input--definition { color: #475569; }
/* Category pickers in the review table: the app's select, compact enough for a 52px row. */
/* Pickers share the whole category column, so long category names stay readable. */
.oe-code-pick { min-width: 9rem; flex: 1 1 0; }
.oe-code-pick .mud-select, .oe-code-pick .mud-input-control { width: 100%; }
.oe-code-pick .mud-input-control { margin: 0; }
.oe-code-pick .mud-input-control-input-container .mud-input { min-height: 34px; }
.oe-code-pick--empty .mud-input-outlined .mud-input-outlined-border { border-color: #F59E0B; }
.oe-code-pick--empty .mud-input-outlined { background: rgba(245, 158, 11, 0.06); border-radius: 8px; }

.oe-threshold { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.8125rem; color: #475569; }
.oe-threshold-field { width: 6.5rem; }

.oe-stats { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; font-size: 0.8125rem; color: #475569; }
.oe-stats b { color: #0F172A; }
.oe-stat--low b { color: #B45309; }
.oe-stat--review b { color: #B91C1C; }
.oe-stat--pending b { color: #4338CA; }

.oe-table { flex: 1; min-height: 12rem; display: flex; flex-direction: column; border: 1px solid rgba(226, 232, 240, 0.9); border-radius: 10px; overflow: hidden; }

.oe-table-head, .oe-row { display: flex; align-items: center; gap: 0.75rem; padding: 0 0.8rem; }

.oe-table-head {
    height: 2.1rem;
    flex-shrink: 0;
    background: #F8FAFC;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748B;
}

.oe-table-body { flex: 1; overflow-y: auto; }

.oe-row { height: 52px; border-bottom: 1px solid rgba(226, 232, 240, 0.6); border-left: 3px solid transparent; }
.oe-row:hover { background: rgba(100, 116, 139, 0.05); }
.oe-row--review { border-left-color: #DC2626; background: rgba(220, 38, 38, 0.03); }
.oe-row--low { border-left-color: #F59E0B; }

.oe-cell-text {
    flex: 1;
    min-width: 0;
    font-size: 0.8125rem;
    line-height: 1.3;
    color: #1E293B;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.oe-cell-n { width: 3rem; flex-shrink: 0; text-align: right; font-size: 0.8125rem; color: #475569; font-variant-numeric: tabular-nums; }
.oe-cell-codes { flex-shrink: 0; display: flex; align-items: center; gap: 0.35rem; width: 46%; }

.oe-tag {
    margin-left: 0.35rem;
    padding: 0 0.35rem;
    border-radius: 5px;
    background: rgba(100, 116, 139, 0.12);
    color: #64748B;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.oe-tag--new { background: rgba(79, 70, 229, 0.12); color: #4338CA; }

/* Coding meter: a solid bar for answers the server has confirmed, and a striped, lighter segment
   ahead of it for the call under way that eases toward where that call should land. */
.oe-meter {
    width: 100%;
    max-width: 40rem;
    margin: 3.5rem auto;
    padding: 1.4rem 1.5rem 1.2rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 16px;
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(79, 70, 229, 0.06), transparent 55%),
        #FFFFFF;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 18px 40px -28px rgba(49, 46, 129, 0.35);
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    animation: oe-meter-in 240ms ease-out;
}

.oe-meter-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }

.oe-meter-count { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.2rem 0.5rem; }

.oe-meter-done {
    font-size: 2.25rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.03em;
    color: #1E1B4B;
    font-variant-numeric: tabular-nums;
}

.oe-meter-of { font-size: 1rem; font-weight: 500; color: #64748B; font-variant-numeric: tabular-nums; }
.oe-meter-label { font-size: 0.8125rem; color: #94A3B8; }

.oe-meter-track {
    position: relative;
    height: 12px;
    border-radius: 9999px;
    background: rgba(100, 116, 139, 0.14);
    overflow: hidden;
}

.oe-meter-confirmed {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 9999px;
    background: linear-gradient(90deg, #4338CA, #6366F1 70%, #818CF8);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.45);
    transition: width 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.oe-meter-estimate {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 0 9999px 9999px 0;
    background: repeating-linear-gradient(-45deg,
        rgba(129, 140, 248, 0.55) 0 6px,
        rgba(165, 180, 252, 0.35) 6px 12px);
    background-size: 17px 17px;
    animation: oe-meter-stripes 900ms linear infinite;
    transition: width 250ms linear, left 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.oe-meter-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1rem;
    font-size: 0.8125rem;
    color: #475569;
}

.oe-meter-status { display: inline-flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 14rem; }
.oe-meter-eta { color: #64748B; font-variant-numeric: tabular-nums; }
.oe-meter-warn { color: #B45309; font-weight: 600; }

.oe-meter-pulse {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: #6366F1;
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5);
    animation: oe-meter-pulse 1.6s ease-out infinite;
}

@keyframes oe-meter-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes oe-meter-stripes { to { background-position: 17px 0; } }
@keyframes oe-meter-pulse {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .oe-meter, .oe-meter-estimate, .oe-meter-pulse { animation: none; }
    .oe-meter-confirmed, .oe-meter-estimate { transition: none; }
}

.dark .oe-meter {
    border-color: #313E59;
    background: radial-gradient(120% 140% at 0% 0%, rgba(129, 140, 248, 0.12), transparent 55%), #26334D;
    box-shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.6);
}
.dark .oe-meter-done { color: #E0E7FF; }
.dark .oe-meter-of, .dark .oe-meter-eta { color: #94A3B8; }
.dark .oe-meter-foot { color: #CBD5E1; }
.dark .oe-meter-track { background: rgba(148, 163, 184, 0.16); }
.dark .oe-meter-warn { color: #FBBF24; }

.dark .oe-question-label, .dark .oe-head h2, .dark .oe-count, .dark .oe-stats b { color: #E2E8F0; }
.dark .oe-banner { color: #CBD5E1; }
.dark .oe-category { background: #26334D; border-color: #313E59; }
.dark .oe-category--fixed { background: rgba(15, 23, 42, 0.25); }
.dark .oe-category--selected { border-color: #818CF8; background: rgba(129, 140, 248, 0.1); }
.dark .oe-code { background: rgba(129, 140, 248, 0.2); color: #C7D2FE; }
.dark .oe-input { color: #E2E8F0; }
.dark .oe-input:focus { background: #1E293B; border-color: #313E59; }
.dark .oe-input--definition { color: #94A3B8; }
.dark .oe-table, .dark .oe-row { border-color: #313E59; }
.dark .oe-row { border-left-color: transparent; }
.dark .oe-row--review { border-left-color: #F87171; }
.dark .oe-row--low { border-left-color: #FBBF24; }
.dark .oe-table-head { background: #1E293B; border-bottom-color: #313E59; color: #94A3B8; }
.dark .oe-cell-text { color: #E2E8F0; }


/* ── output panel in the tracker rail (options → Generate → result → open) ── */
.tracker-rail { display: flex; flex-direction: column; gap: 0.75rem; min-height: 0; overflow-y: auto; }
.tracker-rail-card--output { background: var(--mud-palette-surface); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); }
.generate-panel { display: flex; flex-direction: column; gap: 0.5rem; }
.generate-options { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.35rem; }
.generate-options .tracker-rail-row { min-height: 1.6rem; }
.generate-options .generate-switch { margin: 0 -0.5rem 0 0; }
.generate-options .generate-switch .mud-switch-span { transform: scale(0.8); transform-origin: right center; }
.generate-n {
    width: 4.5rem; padding: 0.15rem 0.4rem; text-align: right;
    font: inherit; font-variant-numeric: tabular-nums; color: var(--mud-palette-text-primary);
    background: transparent; border: 1px solid var(--mud-palette-lines-default); border-radius: 0.375rem;
}
.generate-n:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 1px; }
.generate-help { font-size: 0.72rem; line-height: 1.35; color: var(--mud-palette-text-secondary); margin: 0.1rem 0 0; }
.generate-actions { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.35rem; }
.review-next { margin-top: 0.25rem; }

/* Collapsed tracker warnings: a count with a toggle, then a scrollable list. */
.warning-list-summary { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.warning-list-summary > span { font-weight: 600; margin-right: auto; }
.warning-list-items { list-style: none; margin: 0.25rem 0 0; padding: 0; max-height: 16rem; overflow-y: auto; }
.warning-list-items li { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; padding: 0.2rem 0; border-top: 1px solid var(--mud-palette-lines-default); }

/* Review step: the wording box takes the width the variable name does not need. */
.question-wording td:first-child { width: 1%; white-space: nowrap; }
