.card-content {
    margin-bottom: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
    padding-top: 12px;
    border-top: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
    align-items: center;
}

.card-actions .btn-icon {
    padding: 7px 10px;
    min-width: 36px;
    font-size: 0.95rem;
}

.btn {
    padding: 9px 18px;
    border: var(--lux-hairline, 1px) solid transparent;
    border-radius: var(--lux-r-sm, var(--radius-sm));
    cursor: pointer;
    font-family: var(--font-mono, inherit);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease, filter 0.15s ease;
    flex: 1 1 auto;
    min-width: 100px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn:hover {
    filter: brightness(1.08);
}

.btn:active:not(:disabled) {
    transform: scale(0.97);
    transition-duration: 0.06s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--ch-signal, var(--primary-color));
    color: var(--lux-bg-0, var(--primary-contrast));
    border-color: var(--ch-signal, var(--primary-color));
    box-shadow: 0 0 14px color-mix(in srgb, var(--ch-signal, var(--primary-color)) 30%, transparent);
}

.btn-danger {
    background: var(--ch-coral, var(--danger-color));
    color: #fff;
    border-color: var(--ch-coral, var(--danger-color));
    box-shadow: 0 0 14px color-mix(in srgb, var(--ch-coral, var(--danger-color)) 30%, transparent);
}

.btn-secondary {
    background: var(--lux-bg-2, var(--border-color));
    color: var(--lux-ink-dim, var(--text-color));
    border-color: var(--lux-line-bold, var(--border-color));
}

.btn-secondary:hover {
    color: var(--lux-ink, var(--text-color));
    background: var(--lux-bg-3, var(--border-color));
}

/* Transparent hairline variant — used for low-emphasis actions like
   "Revert" inside the per-section save bar. */
.btn-ghost {
    background: transparent;
    color: var(--lux-ink-dim, var(--text-color));
    border-color: var(--lux-line, var(--border-color));
}
.btn-ghost:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.05));
    color: var(--lux-ink, var(--text-color));
    border-color: var(--lux-line-bold, var(--border-color));
}

.btn-icon {
    min-width: auto;
    padding: 7px 10px;
    font-size: 1rem;
    flex: 0 0 auto;
    border: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
    background: transparent;
    color: var(--lux-ink-dim, var(--text-color));
    transition: color 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.btn-icon:hover {
    transform: none;
    opacity: 1;
    color: var(--lux-ink, var(--text-color));
    background: var(--lux-bg-2, var(--bg-secondary));
    border-color: color-mix(in srgb, var(--ch-signal, var(--primary-color)) 35%, var(--lux-line-bold, var(--border-color)));
    filter: none;
    box-shadow: 0 0 8px color-mix(in srgb, var(--ch-signal, var(--primary-color)) 18%, transparent);
}

/* Variant: warning / success for enable/disable action buttons. Keep
   flat hairline borders; just shift the color + hover glow. */
.btn-icon.btn-warning {
    color: var(--ch-amber, var(--warning-color));
    border-color: color-mix(in srgb, var(--ch-amber, var(--warning-color)) 35%, transparent);
    background: transparent;
    box-shadow: none;
}
.btn-icon.btn-warning:hover {
    background: color-mix(in srgb, var(--ch-amber, var(--warning-color)) 12%, transparent);
    color: var(--ch-amber, var(--warning-color));
    border-color: color-mix(in srgb, var(--ch-amber, var(--warning-color)) 50%, transparent);
    box-shadow: 0 0 10px color-mix(in srgb, var(--ch-amber, var(--warning-color)) 25%, transparent);
}

.btn-icon.btn-success {
    color: var(--ch-signal, var(--primary-color));
    border-color: color-mix(in srgb, var(--ch-signal, var(--primary-color)) 40%, transparent);
    background: transparent;
    box-shadow: none;
}
.btn-icon.btn-success:hover {
    background: color-mix(in srgb, var(--ch-signal, var(--primary-color)) 14%, transparent);
    color: var(--ch-signal, var(--primary-color));
    border-color: color-mix(in srgb, var(--ch-signal, var(--primary-color)) 55%, transparent);
    box-shadow: 0 0 12px color-mix(in srgb, var(--ch-signal, var(--primary-color)) 30%, transparent);
}

.btn-icon:active:not(:disabled) {
    transform: scale(0.92);
    transition-duration: 0.06s;
}

.form-group {
    margin-bottom: 15px;
}

.settings-toggle-group {
    display: flex;
    flex-direction: column;
}

.settings-toggle {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
    cursor: pointer;
    margin-top: 4px;
}

.settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.settings-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-color);
    border-radius: 9px;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    /* Was cubic-bezier(0.34, 1.56, 0.64, 1) (spring overshoot). Unified to
       --ease-out to match buttons/modals. The --ease-spring var is kept in
       base.css for easy revert. */
    transition: transform 0.3s var(--ease-out);
}

.settings-toggle input:checked + .settings-toggle-slider {
    background: var(--primary-color);
}

.settings-toggle input:checked + .settings-toggle-slider::after {
    transform: translateX(16px);
}

label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="text"],
input[type="url"],
input[type="number"],
input[type="password"],
select {
    width: 100%;
    padding: 9px 12px;
    border: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
    border-radius: var(--lux-r-sm, var(--radius-sm));
    background: var(--lux-bg-0, var(--bg-color));
    color: var(--lux-ink, var(--text-color));
    font-size: 0.95rem;
    font-family: var(--font-body, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

/* Numeric fields use mono for alignment */
input[type="number"] {
    font-family: var(--font-mono, monospace);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

input[type="text"]:hover,
input[type="url"]:hover,
input[type="number"]:hover,
input[type="password"]:hover,
select:hover {
    border-color: var(--lux-line-bold, var(--border-color));
}

input[type="number"]:disabled,
input[type="password"]:disabled,
select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

input[type="range"] {
    width: 100%;
    margin: 8px 0;
    accent-color: var(--primary-color);
}

/* Better password field appearance */
input[type="password"] {
    letter-spacing: 0.15em;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--ch-signal, var(--primary-color));
    box-shadow:
        0 0 0 3px color-mix(in srgb, var(--ch-signal, var(--primary-color)) 18%, transparent),
        0 0 16px color-mix(in srgb, var(--ch-signal, var(--primary-color)) 20%, transparent);
    background: var(--lux-bg-1, var(--bg-color));
}

/* Inline validation states */
input.field-invalid,
select.field-invalid {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger-color) 15%, transparent);
}

.field-error-msg {
    display: block;
    color: var(--danger-color);
    font-size: 0.78rem;
    margin-top: 4px;
    line-height: 1.3;
}

/* Remove browser autofill styling */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-color) inset;
    -webkit-text-fill-color: var(--text-color);
    transition: background-color 5000s ease-in-out 0s;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading-spinner::after {
    content: '';
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Modal body loading overlay — hides form while data loads */
.modal-body-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    gap: 12px;
}

.modal-body-loading .loading-spinner {
    padding: 0;
}

.modal-body-loading-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Full-page overlay spinner */
.overlay-spinner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: var(--z-overlay-spinner);
    backdrop-filter: blur(4px);
}

.overlay-spinner .progress-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.overlay-spinner .progress-ring {
    transform: rotate(-90deg);
}

.overlay-spinner .progress-ring-circle {
    transition: stroke-dashoffset 0.1s linear;
    stroke: var(--primary-color);
    stroke-width: 4;
    fill: transparent;
}

.overlay-spinner .progress-ring-bg {
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 4;
    fill: transparent;
}

.overlay-spinner .progress-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.overlay-spinner .progress-percentage {
    color: white;
    font-size: 28px;
    font-weight: 600;
}

.overlay-spinner .spinner-text {
    margin-top: 24px;
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.overlay-spinner-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    transition: color 0.15s;
}

.overlay-spinner-close:hover {
    color: white;
}

.overlay-preview-img {
    max-width: 80vw;
    max-height: 50vh;
    border-radius: var(--radius-md);
    margin-top: 16px;
    object-fit: contain;
}

.overlay-preview-stats {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
}

.toast {
    --toast-ch: var(--primary-color);
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 22px;
    border-radius: var(--lux-r-lg, var(--radius-md, 10px));
    color: var(--lux-ink, #fff);
    font-weight: 600;
    font-size: 14.5px;
    letter-spacing: 0.01em;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: var(--z-toast);
    background: linear-gradient(180deg,
        var(--lux-bg-1, var(--card-bg)) 0%,
        var(--lux-bg-2, var(--card-bg)) 100%);
    border: var(--lux-hairline, 1px) solid color-mix(in srgb,
        var(--toast-ch) 35%, var(--lux-line-bold, var(--border-color)));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.02),
        0 14px 40px rgba(0, 0, 0, 0.5),
        0 0 26px color-mix(in srgb, var(--toast-ch) 22%, transparent);
    min-width: 300px;
    max-width: min(560px, calc(100vw - 32px));
    text-align: center;
    overflow: hidden;
}

/* Top accent stripe — matches modals/bulk-toolbar so the channel language
   is consistent across every floating surface. */
.toast::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 1.5px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--toast-ch) 20%,
        var(--toast-ch) 80%,
        transparent 100%);
    box-shadow: 0 0 12px color-mix(in srgb, var(--toast-ch) 55%, transparent);
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    animation: toastBounceIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastBounceIn {
    0%   { transform: translateX(-50%) translateY(60px); opacity: 0; }
    50%  { transform: translateX(-50%) translateY(-4px); opacity: 1; }
    70%  { transform: translateX(-50%) translateY(2px); }
    100% { transform: translateX(-50%) translateY(0); }
}

.toast.success { --toast-ch: var(--primary-color); }
.toast.error   { --toast-ch: var(--danger-color); }
.toast.info    { --toast-ch: var(--info-color); }

/* Toast with undo action */
.toast-with-action {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-message {
    flex: 1;
}

.toast-undo-btn {
    background: color-mix(in srgb, var(--toast-ch) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--toast-ch) 50%, transparent);
    color: var(--lux-ink, #fff);
    padding: 5px 14px;
    border-radius: var(--lux-r-sm, var(--radius-sm));
    font-weight: var(--weight-semibold, 600);
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.toast-undo-btn:hover {
    background: color-mix(in srgb, var(--toast-ch) 32%, transparent);
    border-color: var(--toast-ch);
    box-shadow: 0 0 14px color-mix(in srgb, var(--toast-ch) 35%, transparent);
}

.toast-timer {
    width: 100%;
    height: 2px;
    position: absolute;
    bottom: 0;
    left: 0;
    border-radius: 0 0 var(--lux-r-lg, var(--radius-md)) var(--lux-r-lg, var(--radius-md));
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--toast-ch) 70%, transparent) 0%,
        var(--toast-ch) 50%,
        color-mix(in srgb, var(--toast-ch) 70%, transparent) 100%);
    box-shadow: 0 0 8px color-mix(in srgb, var(--toast-ch) 60%, transparent);
    transform-origin: left;
    animation: toastTimer var(--toast-duration, 5s) linear forwards;
}

@keyframes toastTimer {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ── Card Tags ──────────────────────────────────────────── */

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    margin-bottom: 4px;
}

.card-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 12%, var(--bg-secondary));
    border: 1px solid color-mix(in srgb, var(--primary-color) 25%, transparent);
    padding: 1px 7px;
    border-radius: var(--radius-md);
    white-space: nowrap;
    line-height: 1.4;
}

/* ── Tag Input (chip-based input with autocomplete) ──── */

.tag-input-wrap {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-color);
    cursor: text;
    min-height: 38px;
    transition: border-color 0.15s;
}
.tag-input-wrap:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 12%, var(--bg-secondary));
    border: 1px solid color-mix(in srgb, var(--primary-color) 25%, transparent);
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
    line-height: 1.3;
}

.tag-chip-remove {
    background: none;
    border: none;
    color: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.tag-chip-remove:hover {
    opacity: 1;
}

.tag-input-field {
    flex: 1 1 60px;
    min-width: 60px;
    border: none !important;
    outline: none !important;
    background: none !important;
    padding: 2px 0 !important;
    font-size: 0.85rem;
    color: var(--text-color);
    box-shadow: none !important;
}

.tag-input-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px var(--shadow-color);
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity var(--duration-fast) ease-out,
                transform var(--duration-fast) var(--ease-out);
}
.tag-input-dropdown.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.tag-dropdown-item {
    padding: 6px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.1s;
}
.tag-dropdown-item:hover,
.tag-dropdown-item.tag-dropdown-active {
    background: var(--bg-secondary);
}

/* ── Focus-visible indicators for keyboard navigation ── */

.btn:focus-visible,
.btn-icon:focus-visible,
.card-remove-btn:focus-visible,
.card-autostart-btn:focus-visible,
.card-power-btn:focus-visible,
.card-tutorial-btn:focus-visible,
.hint-toggle:focus-visible,
.modal-close-btn:focus-visible,
.modal-header-btn:focus-visible,
.tab-btn:focus-visible,
.stream-tab-btn:focus-visible,
.header-btn:focus-visible,
.tutorial-trigger-btn:focus-visible,
.tutorial-close-btn:focus-visible,
.dashboard-action-btn:focus-visible,
.btn-expand-collapse:focus-visible,
.btn-filter-action:focus-visible,
.settings-toggle:focus-visible,
.discovery-item:focus-visible,
.tag-chip-remove:focus-visible,
.cs-filter-reset:focus-visible,
.graph-filter-clear:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

/* WS device connection URL */
.ws-url-row {
    display: flex;
    gap: 6px;
}
.ws-url-row input { flex: 1; }
.ws-url-row .btn { padding: 4px 10px; min-width: 0; flex: 0 0 auto; }
.endpoint-label { display: block; font-weight: 600; margin-bottom: 2px; opacity: 0.7; font-size: 0.8em; }

/* Scene target selector — patch-bay channel slots, paired with the
   .ds-section[data-ch="cyan"] panel in scene-preset-editor.html.
   Each item reads like a numbered channel: index · icon plate · name +
   type chip · remove. Slot indices are rendered via a CSS counter so
   DOM reorders don't need JS renumbering. */
.scene-target-list {
    --st-ch: var(--ch-cyan, var(--info-color, #00d8ff));
    counter-reset: st-slot;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
}
.scene-target-list:empty::before {
    content: attr(data-empty);
    display: block;
    padding: 14px 12px;
    font-size: 0.78rem;
    color: var(--lux-ink-dim, var(--text-secondary));
    border: 1px dashed color-mix(in srgb, var(--st-ch) 40%, var(--lux-line, var(--border-color)));
    border-radius: var(--lux-r-md, 6px);
    background:
        repeating-linear-gradient(135deg,
            color-mix(in srgb, var(--st-ch) 4%, transparent) 0 6px,
            transparent 6px 12px);
    text-align: center;
    letter-spacing: 0.04em;
}

.scene-target-item {
    counter-increment: st-slot;
    position: relative;
    display: grid;
    grid-template-columns: 26px 32px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 6px;
    border: 1px solid var(--lux-line, var(--border-color));
    border-radius: var(--lux-r-md, 6px);
    background:
        linear-gradient(180deg,
            color-mix(in srgb, var(--st-ch) 3%, var(--lux-bg-2, var(--bg-secondary))) 0%,
            color-mix(in srgb, var(--lux-bg-1, var(--card-bg)) 70%, transparent) 100%);
    font-size: 0.85rem;
    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        box-shadow 0.15s ease;
}
.scene-target-item:hover {
    border-color: color-mix(in srgb, var(--st-ch) 55%, var(--lux-line, var(--border-color)));
    box-shadow:
        inset 2px 0 0 color-mix(in srgb, var(--st-ch) 80%, transparent),
        0 1px 0 color-mix(in srgb, var(--st-ch) 14%, transparent);
}
.scene-target-item::before {
    content: counter(st-slot, decimal-leading-zero);
    grid-column: 1;
    justify-self: center;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: color-mix(in srgb, var(--st-ch) 75%, var(--lux-ink-dim, var(--text-secondary)));
    opacity: 0.85;
}

.scene-target-icon {
    grid-column: 2;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--st-ch);
    background: color-mix(in srgb, var(--st-ch) 9%, transparent);
    border: 1px solid color-mix(in srgb, var(--st-ch) 22%, transparent);
    border-radius: 5px;
    flex-shrink: 0;
}
.scene-target-icon svg,
.scene-target-icon .icon { width: 18px; height: 18px; }

.scene-target-id {
    grid-column: 3;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.scene-target-name {
    font-weight: 600;
    color: var(--lux-ink, var(--text-color));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.25;
}
.scene-target-type {
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: color-mix(in srgb, var(--st-ch) 70%, var(--lux-ink-dim, var(--text-secondary)));
    padding: 1px 5px;
    border: 1px solid color-mix(in srgb, var(--st-ch) 28%, transparent);
    border-radius: 2px;
    line-height: 1.2;
}

.scene-target-remove {
    grid-column: 4;
    background: none;
    border: 1px solid transparent;
    color: var(--lux-ink-dim, var(--text-secondary));
    width: 26px;
    height: 26px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.7;
    transition:
        opacity 0.15s ease,
        color 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease;
}
.scene-target-remove:hover,
.scene-target-remove:focus-visible {
    opacity: 1;
    color: var(--ch-coral, var(--danger-color, #ff5e5e));
    background: color-mix(in srgb, var(--ch-coral, var(--danger-color, #ff5e5e)) 10%, transparent);
    border-color: color-mix(in srgb, var(--ch-coral, var(--danger-color, #ff5e5e)) 35%, transparent);
    outline: none;
}
.scene-target-remove .icon,
.scene-target-remove svg { width: 14px; height: 14px; }

/* Add-target slot — full-width dashed cyan channel, reads like an
   empty patch-bay slot waiting for an insertion. */
.scene-target-add-slot {
    --st-ch: var(--ch-cyan, var(--info-color, #00d8ff));
    margin-top: 8px;
    width: 100%;
    padding: 9px 12px;
    background:
        repeating-linear-gradient(135deg,
            color-mix(in srgb, var(--st-ch) 5%, transparent) 0 6px,
            transparent 6px 12px);
    border: 1px dashed color-mix(in srgb, var(--st-ch) 50%, var(--lux-line, var(--border-color)));
    border-radius: var(--lux-r-md, 6px);
    color: color-mix(in srgb, var(--st-ch) 80%, var(--lux-ink, var(--text-color)));
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}
.scene-target-add-slot::before {
    content: '+';
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
}
.scene-target-add-slot:hover:not(:disabled) {
    background:
        repeating-linear-gradient(135deg,
            color-mix(in srgb, var(--st-ch) 12%, transparent) 0 6px,
            transparent 6px 12px);
    border-color: color-mix(in srgb, var(--st-ch) 75%, transparent);
    color: var(--st-ch);
}
.scene-target-add-slot:active:not(:disabled) {
    transform: translateY(1px);
}
.scene-target-add-slot:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ── Icon Select (reusable type picker) ──────────────────────── */

.icon-select-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.15s;
    text-align: left;
}
.icon-select-trigger:hover {
    border-color: var(--primary-color);
}
.icon-select-trigger-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.icon-select-trigger-icon .icon {
    width: 18px;
    height: 18px;
}
.icon-select-trigger-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.icon-select-trigger-arrow {
    flex-shrink: 0;
    font-size: 0.8rem;
    opacity: 0.5;
    margin-left: auto;
}

/* Hide empty icon/label slots so flex gaps don't reserve unused space.
   Used by minimal items like the locale picker (2-letter code only). */
.icon-select-trigger-icon:empty,
.icon-select-trigger-label:empty,
.icon-select-cell-icon:empty,
.icon-select-cell-label:empty {
    display: none;
}

.icon-select-popup {
    position: fixed;
    z-index: var(--z-lightbox);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
    transition: opacity var(--duration-fast) ease-out,
                transform var(--duration-normal) var(--ease-out);
    pointer-events: none;
}
.icon-select-popup.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    overflow-y: auto;
    pointer-events: auto;
}

.icon-select-search {
    width: calc(100% - 12px);
    padding: 8px 12px;
    margin: 6px 6px 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-color);
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
}
.icon-select-search::placeholder {
    color: var(--text-secondary);
}
.icon-select-search:focus {
    border-color: var(--primary-color);
}

.icon-select-grid {
    display: grid;
    grid-auto-rows: 1fr;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-color);
}

.icon-select-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    text-align: center;
}
.icon-select-cell:hover {
    border-color: var(--primary-color);
    transform: scale(1.03);
}
.icon-select-cell.active {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 12%, var(--bg-secondary));
}
/* ── MiniSelect (icon-less compact dropdown) ── */
.mini-select-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    min-height: 28px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}
.mini-select-trigger:hover,
.mini-select-trigger:focus-visible {
    border-color: var(--primary-color);
}
.mini-select-trigger-arrow {
    opacity: 0.6;
    font-size: 0.75em;
}
.mini-select-popup {
    position: fixed;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    z-index: 9999;
    overflow-y: auto;
    display: none;
    padding: 4px;
    min-width: 120px;
}
.mini-select-popup.open { display: block; }
.mini-select-popup:focus,
.mini-select-popup:focus-visible {
    outline: none;
}
.mini-select-option {
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.85rem;
    user-select: none;
}
.mini-select-option:hover {
    background: color-mix(in srgb, var(--primary-color) 14%, transparent);
}
.mini-select-option.active {
    color: var(--primary-color);
    font-weight: 600;
}
.mini-select-option.focused {
    background: color-mix(in srgb, var(--primary-color) 20%, transparent);
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary-color) 45%, transparent);
}

.icon-select-cell.focused {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 30%, transparent);
}
/* When the keyboard cursor lands on the currently-selected cell, intensify
   the focus ring so the combined active+focused state is unambiguous. */
.icon-select-cell.active.focused {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 55%, transparent);
}
.icon-select-popup:focus,
.icon-select-popup:focus-visible {
    outline: none;
}

.icon-select-cell-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-select-cell-icon .icon {
    width: 24px;
    height: 24px;
}
.icon-select-cell.active .icon-select-cell-icon .icon {
    stroke: var(--primary-color);
}
.icon-select-cell-label {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
}
.icon-select-cell-desc {
    font-size: 0.72rem;
    opacity: 0.6;
    line-height: 1.3;
}

/* Hide descriptions on narrow screens */
@media (max-width: 480px) {
    .icon-select-cell-desc { display: none; }
    .icon-select-cell { padding: 8px 4px; }
    .icon-select-grid { gap: 4px; padding: 4px; }
}

/* ── Type Picker Overlay ─────────────────────────────────── */

.type-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-command-palette);
    display: flex;
    justify-content: center;
    padding-top: 15vh;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    transition: background 0.2s, backdrop-filter 0.2s;
}
.type-picker-overlay.open {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}
.type-picker-dialog {
    align-self: flex-start;
    width: min(680px, 90vw);
    max-height: 70vh;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px var(--shadow-color);
    padding: 16px;
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
    transition: opacity 0.2s, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.type-picker-overlay.open .type-picker-dialog {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.type-picker-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-align: center;
}
.type-picker-filter {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-color);
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
}
.type-picker-filter::placeholder {
    color: var(--text-secondary);
}
.type-picker-filter:focus {
    border-color: var(--primary-color);
}
.type-picker-dialog .icon-select-grid {
    border: none;
    background: none;
    padding: 0;
    /* Override inline columns — use responsive auto-fill */
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
}
.icon-select-popup .icon-select-cell.disabled,
.type-picker-dialog .icon-select-cell.disabled {
    opacity: 0.25;
    pointer-events: none;
}

.type-picker-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}
.type-picker-tab {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid var(--border-color, #333);
    border-radius: 6px;
    background: var(--surface-2, #1e1e2e);
    color: var(--text-secondary, #999);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.type-picker-tab:hover {
    background: var(--surface-3, #2a2a3e);
    color: var(--text-primary, #e0e0e0);
}
.type-picker-tab.active {
    background: var(--primary-color, #63b3ed);
    color: #fff;
    border-color: var(--primary-color, #63b3ed);
}

/* ── Entity Palette (command-palette style selector) ─────── */

.entity-palette-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: var(--z-lightbox);
    background: rgba(0, 0, 0, 0);
    justify-content: center;
    align-items: flex-start;
    padding-top: min(20vh, 120px);
    pointer-events: none;
    opacity: 0;
    backdrop-filter: blur(0px);
    transition: background var(--duration-fast) ease-out,
                opacity var(--duration-fast) ease-out,
                backdrop-filter var(--duration-fast) ease-out;
}
.entity-palette-overlay.open {
    opacity: 1;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}
.entity-palette {
    width: min(500px, 90vw);
    max-height: 60vh;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
    transition: opacity var(--duration-normal) var(--ease-out),
                transform var(--duration-normal) var(--ease-out);
}
.entity-palette-overlay.open .entity-palette {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.entity-palette-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
}
.entity-palette-search-row .icon {
    width: 18px;
    height: 18px;
    opacity: 0.5;
    flex-shrink: 0;
}
.entity-palette-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 0;
}
.entity-palette-list {
    overflow-y: auto;
    padding: 4px 0;
}
.entity-palette-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.entity-palette-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.1s;
}
.entity-palette-item:hover,
.entity-palette-item.ep-highlight {
    background: var(--bg-secondary);
}
.entity-palette-item.ep-current {
    border-left: 3px solid var(--primary-color);
    padding-left: 11px;
}
.ep-item-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.ep-item-icon .icon {
    width: 18px;
    height: 18px;
}
.ep-item-label {
    flex: 1;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ep-item-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40%;
}

/* Section header rows in EntityPalette (non-selectable, used for grouping). */
.entity-palette-header {
    padding: 6px 14px 2px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    cursor: default;
    user-select: none;
}

/* Entity Select trigger (replaces <select>) */
.entity-select-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    font-size: 1rem;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s;
}
.entity-select-trigger:hover {
    border-color: var(--primary-color);
}
.es-trigger-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.es-trigger-icon .icon {
    width: 16px;
    height: 16px;
}
.es-trigger-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.es-trigger-none {
    color: var(--text-secondary);
}
.es-trigger-arrow {
    flex-shrink: 0;
    opacity: 0.5;
    font-size: 0.9rem;
}

/* ── Timezone picker (Settings modal) ──────────────────────
   Refined "instrument readout" trigger that matches the lux
   sectional design language used in the rest of the modal:
   - hairline border, deeper bg, monospaced offset chip
   - region icon stenciled in --ch-cyan to echo section dots
   - subtle hover glow on the channel hue, not the primary green */

.tz-picker-wrap {
    position: relative;
    display: block;
    isolation: isolate;
}

.tz-picker-wrap .entity-select-trigger {
    --tz-ch: var(--ch-cyan, var(--primary-color));
    background: var(--lux-bg-1, var(--bg-color));
    border: var(--lux-hairline, 1px) solid var(--lux-line, var(--border-color));
    border-radius: var(--lux-r-md, 6px);
    padding: 10px 12px;
    gap: 12px;
    font-feature-settings: "ss01", "tnum";
    font-variant-numeric: tabular-nums;
    color: var(--lux-ink, var(--text-color));
    transition:
        border-color 180ms var(--ease-out, ease-out),
        background 180ms var(--ease-out, ease-out),
        box-shadow 220ms var(--ease-out, ease-out);
}

.tz-picker-wrap .entity-select-trigger::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    background: linear-gradient(
        to bottom,
        color-mix(in srgb, var(--tz-ch) 80%, transparent),
        color-mix(in srgb, var(--tz-ch) 0%, transparent) 70%
    );
    border-radius: var(--lux-r-md, 6px) 0 0 var(--lux-r-md, 6px);
    opacity: 0.75;
    pointer-events: none;
    transition: opacity 220ms var(--ease-out, ease-out);
}

.tz-picker-wrap .entity-select-trigger:hover {
    border-color: color-mix(in srgb, var(--tz-ch) 55%, var(--lux-line-bold, var(--border-color)));
    background: var(--lux-bg-2, var(--bg-secondary));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--tz-ch) 18%, transparent),
                0 8px 24px -10px color-mix(in srgb, var(--tz-ch) 30%, transparent);
}

.tz-picker-wrap .entity-select-trigger:hover::before {
    opacity: 1;
}

.tz-picker-wrap .entity-select-trigger:focus-visible {
    outline: none;
    border-color: var(--tz-ch);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--tz-ch) 25%, transparent);
}

.tz-picker-wrap .es-trigger-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--lux-r-sm, 3px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--tz-ch) 12%, transparent);
    border: var(--lux-hairline, 1px) solid color-mix(in srgb, var(--tz-ch) 25%, transparent);
    color: var(--tz-ch);
}

.tz-picker-wrap .es-trigger-icon .icon {
    width: 14px;
    height: 14px;
}

.tz-picker-wrap .es-trigger-label {
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--lux-ink, var(--text-color));
}

/* Render the offset segment after the city in monospaced "panel-meter" type */
.tz-picker-wrap .es-trigger-label {
    /* Allow ellipsis to keep the trigger compact in narrow layouts. */
    min-width: 0;
}

.tz-picker-wrap .es-trigger-arrow {
    color: var(--lux-ink-mute, var(--text-secondary));
    opacity: 0.7;
    transform: translateY(-1px);
    transition: transform 220ms var(--ease-out, ease-out), color 180ms ease;
}

.tz-picker-wrap:hover .es-trigger-arrow {
    color: var(--tz-ch);
    opacity: 1;
    transform: translateY(0);
}

/* When the value is the system default (empty string), dim the label slightly
   so users can see it is in the "no override" state at a glance. */
.tz-picker-wrap .entity-select-trigger:has(.es-trigger-none) {
    border-style: dashed;
}

/* ── Scroll-to-top button ── */

.scroll-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 90;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px var(--shadow-color, rgba(0,0,0,0.2));
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s, color 0.15s, background 0.15s;
}

.scroll-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.scroll-to-top:hover {
    color: var(--primary-text-color);
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.scroll-to-top .icon {
    width: 18px;
    height: 18px;
}

/* ── Schedule time picker (value sources) ── */
.schedule-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.schedule-time-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    transition: border-color var(--duration-fast) ease;
}
.schedule-time-wrap:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}
.schedule-time-wrap input[type="number"] {
    width: 2.4ch;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-family: inherit;
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-color);
    padding: 4px 2px;
    -moz-appearance: textfield;
    transition: border-color var(--duration-fast) ease,
                background var(--duration-fast) ease;
}
.schedule-time-wrap input[type="number"]::-webkit-inner-spin-button,
.schedule-time-wrap input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.schedule-time-wrap input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 8%, var(--bg-secondary));
}
.schedule-time-colon {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1;
    padding: 0 1px;
    user-select: none;
}
.schedule-value {
    flex: 1;
    min-width: 60px;
}
.schedule-value-display {
    min-width: 2.5ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ── BindableScalarWidget ── */

.bindable-slider-row,
.bindable-vs-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bindable-slider-row input[type="range"] {
    flex: 1;
    min-width: 0;
}

.bindable-vs-row select,
.bindable-vs-row .entity-select-btn {
    flex: 1;
    min-width: 0;
}

.bindable-value {
    min-width: 3.5ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.bindable-toggle {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    padding: 3px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.bindable-toggle:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.bindable-toggle--active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-color);
}

.bindable-toggle--active:hover {
    opacity: 0.85;
    color: var(--bg-color);
}

.bindable-toggle .icon-xs {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* ── Pair Device Modal ──────────────────────────────────────────
   Reusable handshake UI for drivers that require a physical pairing
   action (Nanoleaf, Tuya, Twinkly, …). See `features/pairing-flow.ts`
   and `modals/pair-device.html`. The instructions stay visible across
   states, dimming during pairing so the user remains oriented while
   the progress ring takes focal point. */

.pair-instructions {
    color: var(--lux-ink-dim, var(--text-secondary));
    font-size: 0.92rem;
    line-height: 1.5;
    margin: 0 0 18px 0;
    transition: opacity 0.25s ease;
}

.pair-states[data-pair-state="pairing"] ~ .pair-instructions,
.pair-states[data-pair-state="pairing"] .pair-instructions {
    /* Selector kept for posterity — actual dimming is applied via the
       parent attribute below. */
}

.modal-body:has(.pair-states[data-pair-state="pairing"]) .pair-instructions {
    opacity: 0.6;
}

.pair-states {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 8px 0 4px;
    min-height: 200px;
}

.pair-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    width: 100%;
    animation: pairFade 0.28s ease both;
}

@keyframes pairFade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}

.pair-action {
    min-width: 180px;
    justify-content: center;
}

/* ── Idle visual: device-glyph with a soft pulse halo ────────── */

.pair-visual {
    position: relative;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pair-visual-glyph {
    width: 56px;
    height: 56px;
    color: var(--ch-signal, var(--primary-color));
    opacity: 0.85;
}

.pair-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        color-mix(in srgb, var(--ch-signal, var(--primary-color)) 28%, transparent),
        transparent 70%
    );
    animation: pairPulse 2.2s ease-in-out infinite;
}

@keyframes pairPulse {
    0%, 100% { transform: scale(0.85); opacity: 0.55; }
    50%      { transform: scale(1.08); opacity: 1; }
}

/* ── Pairing ring + countdown ────────────────────────────────── */

.pair-ring-wrap {
    position: relative;
    width: 140px;
    height: 140px;
}

.pair-ring {
    width: 100%;
    height: 100%;
    /* Rotate so the fill starts at 12 o'clock and progresses clockwise. */
    transform: rotate(-90deg);
}

.pair-ring-bg {
    stroke: color-mix(in srgb, var(--lux-line-bold, var(--border-color)) 60%, transparent);
}

.pair-ring-fg {
    stroke: var(--ch-signal, var(--primary-color));
    stroke-dasharray: 0 100;
    transition: stroke-dasharray 0.18s linear;
    filter: drop-shadow(0 0 8px color-mix(in srgb, var(--ch-signal, var(--primary-color)) 45%, transparent));
}

.pair-ring-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    pointer-events: none;
}

.pair-ring-count {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 1.9rem;
    font-weight: 500;
    color: var(--lux-ink, var(--text-color));
    letter-spacing: 0.02em;
    line-height: 1;
}

.pair-ring-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--lux-ink-dim, var(--text-secondary));
}

/* ── Status banners (not-ready / success / failed) ───────────── */

.pair-status {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--lux-line-bold, var(--border-color));
    background: color-mix(in srgb, var(--lux-bg-1, var(--card-bg)) 80%, transparent);
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--lux-ink, var(--text-color));
}

.pair-status .icon {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-top: 1px;
}

.pair-status-ok {
    border-color: color-mix(in srgb, var(--ch-signal, var(--primary-color)) 55%, transparent);
    background: color-mix(in srgb, var(--ch-signal, var(--primary-color)) 12%, transparent);
}
.pair-status-ok .icon { color: var(--ch-signal, var(--primary-color)); }

.pair-status-warn {
    border-color: color-mix(in srgb, var(--ch-amber, #d99a00) 55%, transparent);
    background: color-mix(in srgb, var(--ch-amber, #d99a00) 12%, transparent);
}
.pair-status-warn .icon { color: var(--ch-amber, #d99a00); }

.pair-status-err {
    border-color: color-mix(in srgb, var(--ch-coral, var(--danger-color)) 55%, transparent);
    background: color-mix(in srgb, var(--ch-coral, var(--danger-color)) 12%, transparent);
}
.pair-status-err .icon { color: var(--ch-coral, var(--danger-color)); }

@media (prefers-reduced-motion: reduce) {
    .pair-pulse,
    .pair-state { animation: none; }
    .pair-ring-fg { transition: none; }
}

