/* ── Dashboard Customize Panel ──
 * Slide-in panel on the right edge. Doesn't cover the full viewport so
 * users see live previews of changes as they toggle settings.
 */

.dash-cust-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: calc(var(--z-modal, 1000) - 5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.dash-cust-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.dash-cust-panel {
    position: fixed;
    top: 60px; /* below transport bar */
    right: 0;
    bottom: 0;
    width: min(440px, 92vw);
    background: var(--lux-bg-1, var(--card-bg));
    border-left: var(--lux-rule, 1px) solid var(--lux-line, var(--border-color));
    box-shadow: var(--lux-shadow-rack, -8px 0 32px rgba(0, 0, 0, 0.35));
    z-index: var(--z-modal, 1000);
    transform: translateX(100%);
    transition: transform 240ms cubic-bezier(0.2, 0.7, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dash-cust-panel.is-open {
    transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
    .dash-cust-panel { transition: none; }
    .dash-cust-backdrop { transition: none; }
}

.dash-cust-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
    flex: 0 0 auto;
}

.dash-cust-header h2 {
    margin: 0;
    font-family: var(--font-display, var(--font-mono, monospace));
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--lux-ink, var(--text-color));
    position: relative;
}

.dash-cust-header h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 32px;
    height: 1px;
    background: var(--ch-signal, var(--primary-color));
    box-shadow: 0 0 6px color-mix(in srgb, var(--ch-signal, var(--primary-color)) 50%, transparent);
}

.dash-cust-close {
    background: transparent;
    border: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
    color: var(--lux-ink-dim, var(--text-secondary));
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.dash-cust-close:hover {
    color: var(--lux-ink, var(--text-color));
    border-color: var(--ch-signal, var(--primary-color));
    background: color-mix(in srgb, var(--ch-signal, var(--primary-color)) 12%, transparent);
}

.dash-cust-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Prevent scroll chaining: when the panel's scroll reaches its top
     * or bottom, the wheel/touch scroll should NOT propagate to the
     * underlying dashboard page. */
    overscroll-behavior: contain;
}

/* Section blocks */
.dash-cust-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dash-cust-section + .dash-cust-section {
    margin-top: 4px;
}

.dash-cust-h3 {
    margin: 0 0 2px;
    font-family: var(--font-mono, monospace);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--lux-ink-dim, var(--text-secondary));
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 4px;
    border-bottom: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
}

.dash-cust-modified {
    font-size: 0.55rem;
    letter-spacing: 0.18em;
    color: var(--ch-amber, var(--warning-color));
    margin-left: auto;
    font-weight: 600;
    padding: 1px 6px;
    border: 1px solid color-mix(in srgb, var(--ch-amber, var(--warning-color)) 50%, transparent);
    border-radius: 2px;
}

/* Preset chips */
.dash-cust-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dash-cust-chip {
    background: var(--lux-bg-2, var(--bg-secondary));
    color: var(--lux-ink-dim, var(--text-secondary));
    border: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
    padding: 6px 12px;
    border-radius: 3px;
    font-family: var(--font-mono, monospace);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.dash-cust-chip:hover {
    color: var(--lux-ink, var(--text-color));
    border-color: var(--lux-line-bold, var(--text-secondary));
}

.dash-cust-chip.is-active {
    background: color-mix(in srgb, var(--ch-signal, var(--primary-color)) 14%, transparent);
    color: var(--lux-ink, var(--text-color));
    border-color: var(--ch-signal, var(--primary-color));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--ch-signal, var(--primary-color)) 25%, transparent),
                0 0 12px color-mix(in srgb, var(--ch-signal, var(--primary-color)) 30%, transparent);
}

/* Rows + lists */
.dash-cust-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dash-cust-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--lux-bg-2, var(--bg-secondary));
    border: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
    border-radius: 3px;
    transition: background 150ms ease, border-color 150ms ease, transform 100ms ease;
}

.dash-cust-row.is-dragging {
    opacity: 0.55;
    transform: scale(0.98);
}

.dash-cust-row.is-drop-target-before,
.dash-cust-row.is-drop-target-after {
    background: color-mix(in srgb, var(--ch-signal, var(--primary-color)) 6%, transparent);
}

.dash-cust-row.is-drop-target-before {
    box-shadow: 0 -2px 0 0 var(--ch-signal, var(--primary-color));
}

.dash-cust-row.is-drop-target-after {
    box-shadow: 0 2px 0 0 var(--ch-signal, var(--primary-color));
}

.dash-cust-row-fixed {
    background: color-mix(in srgb, var(--lux-line, var(--border-color)) 30%, transparent);
}

.dash-cust-row-drag {
    cursor: grab;
}

.dash-cust-row-drag:active {
    cursor: grabbing;
}

.dash-cust-row-label {
    flex: 1 1 auto;
    font-family: var(--font-body, inherit);
    font-size: 0.78rem;
    color: var(--lux-ink, var(--text-color));
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-cust-row-label .dash-cust-pin {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
    color: var(--lux-ink-mute, var(--text-muted));
}

.dash-cust-grip {
    color: var(--lux-ink-mute, var(--text-muted));
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-cust-row-drag:hover .dash-cust-grip {
    color: var(--lux-ink, var(--text-color));
}

/* Density buttons */
.dash-cust-density-group {
    display: inline-flex;
    border: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
    border-radius: 3px;
    overflow: hidden;
}

.dash-cust-density {
    background: transparent;
    border: 0;
    padding: 2px 6px;
    color: var(--lux-ink-dim, var(--text-secondary));
    font-family: var(--font-mono, monospace);
    font-size: 0.6rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.dash-cust-density:not(:last-child) {
    border-right: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
}

.dash-cust-density:hover {
    color: var(--lux-ink, var(--text-color));
}

.dash-cust-density.is-active {
    background: color-mix(in srgb, var(--ch-signal, var(--primary-color)) 18%, transparent);
    color: var(--lux-ink, var(--text-color));
}

/* Eye / toggle button */
.dash-cust-eye, .dash-cust-arrow {
    background: transparent;
    border: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
    color: var(--lux-ink-mute, var(--text-muted));
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    cursor: pointer;
    flex: 0 0 26px;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.dash-cust-eye:hover, .dash-cust-arrow:hover {
    color: var(--lux-ink, var(--text-color));
    border-color: var(--lux-line-bold, var(--text-secondary));
}

.dash-cust-eye.is-on {
    color: var(--ch-signal, var(--primary-color));
    border-color: color-mix(in srgb, var(--ch-signal, var(--primary-color)) 50%, var(--lux-line, var(--border-color)));
}

.dash-cust-arrow.is-active {
    color: var(--ch-amber, var(--warning-color));
    border-color: color-mix(in srgb, var(--ch-amber, var(--warning-color)) 50%, var(--lux-line, var(--border-color)));
}

.dash-cust-arrow {
    font-family: var(--font-mono, monospace);
    font-size: 0.85rem;
    font-weight: 700;
}

/* Segmented controls (global options) */
.dash-cust-row .dash-cust-label {
    flex: 0 0 auto;
    font-family: var(--font-mono, monospace);
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--lux-ink-dim, var(--text-secondary));
    min-width: 80px;
}

.dash-cust-seg {
    display: inline-flex;
    border: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
    border-radius: 3px;
    overflow: hidden;
    flex: 1 1 auto;
}

.dash-cust-seg-btn {
    flex: 1 1 auto;
    background: transparent;
    border: 0;
    padding: 5px 8px;
    color: var(--lux-ink-dim, var(--text-secondary));
    font-family: var(--font-mono, monospace);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.dash-cust-seg-btn:not(:last-child) {
    border-right: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
}

.dash-cust-seg-btn:hover {
    color: var(--lux-ink, var(--text-color));
}

.dash-cust-seg-btn.is-active {
    background: color-mix(in srgb, var(--ch-signal, var(--primary-color)) 18%, transparent);
    color: var(--lux-ink, var(--text-color));
}

/* Mini selects (perf cell options).
 * The project's components.css applies `select { width: 100%; padding: 9px 12px }`
 * globally — we override both with higher specificity so the selects size to
 * their content rather than blowing the row out past the panel edge. */
.dash-cust-panel select.dash-cust-mini-select {
    width: auto;
    background: var(--lux-bg-1, var(--card-bg));
    border: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
    color: var(--lux-ink, var(--text-color));
    font-family: var(--font-mono, monospace);
    font-size: 0.66rem;
    padding: 3px 18px 3px 6px;
    border-radius: 3px;
    cursor: pointer;
    flex: 1 1 auto;
    min-width: 0;
    height: 24px;
    line-height: 1;
}

.dash-cust-panel select.dash-cust-mini-select:focus {
    outline: none;
    border-color: var(--ch-signal, var(--primary-color));
}

/* Two-line perf-cell row.
 * Top line carries the label + reorder + visibility controls so the cell
 * name is *always* readable. Bottom line carries the per-cell options
 * (mode / window / scale) labelled with tiny mono captions. */
.dash-cust-cell-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px;
}

.dash-cust-cell-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-cust-cell-opts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.dash-cust-cell-opt {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.dash-cust-cell-opt-k {
    font-family: var(--font-mono, monospace);
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--lux-ink-mute, var(--text-muted));
    flex: 0 0 auto;
}

/* Help / actions */
.dash-cust-help {
    margin: 0;
    font-size: 0.65rem;
    color: var(--lux-ink-mute, var(--text-muted));
    font-style: italic;
}

.dash-cust-actions {
    border-top: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
    padding-top: 14px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.dash-cust-actions .btn {
    font-size: 0.7rem;
    padding: 6px 12px;
}

/* Width-mode hooks: applied to dashboard-content, not the panel */
#dashboard-content[data-layout-width="centered"] {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

#dashboard-content[data-layout-width="narrow"] {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

#dashboard-content[data-layout-anim="off"] *,
#dashboard-content[data-layout-anim="off"] *::before,
#dashboard-content[data-layout-anim="off"] *::after {
    animation-duration: 0ms !important;
    transition-duration: 0ms !important;
}

#dashboard-content[data-layout-anim="reduced"] *,
#dashboard-content[data-layout-anim="reduced"] *::before,
#dashboard-content[data-layout-anim="reduced"] *::after {
    animation-duration: 60ms !important;
    transition-duration: 80ms !important;
}

/* Density variants per section */
.dashboard-section[data-density="compact"] .dashboard-section-content {
    gap: 10px;
}

.dashboard-section[data-density="compact"] .dashboard-section-header {
    margin-bottom: 10px;
    padding-bottom: 6px;
}

.dashboard-section[data-density="dense"] .dashboard-section-content {
    gap: 6px;
}

.dashboard-section[data-density="dense"] .dashboard-section-header {
    margin-bottom: 6px;
    padding-bottom: 4px;
    font-size: 0.72rem;
}

.dashboard-section[data-density="dense"] .dashboard-target {
    padding: 8px 10px;
}

/* Mobile collapse */
@media (max-width: 720px) {
    .dash-cust-panel {
        top: 56px;
        width: 100vw;
        max-width: 100vw;
    }
}
