/* Auto-concatenated component styles — DO NOT add @import rules, add content directly */

/* ==========================================================================
   Buttons — .av-btn base + variants (primary, secondary, danger, ghost) + sizes
   ========================================================================== */
.av-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: var(--touch-target);
    padding: 10px var(--space-lg);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    font-family: var(--font-family);
    font-size: var(--font-sm);
    font-weight: 500;
    letter-spacing: -0.005em;
    cursor: pointer;
    transition: background-color var(--transition-base),
                border-color var(--transition-base),
                box-shadow var(--transition-base),
                color var(--transition-base),
                opacity var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.4;
}

.av-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.av-btn-primary {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}
.av-btn-primary:hover:not(:disabled) {
    background: var(--ink-2);
    border-color: var(--ink-2);
}

.av-btn-secondary {
    background: var(--bg-hover-subtle);
    color: var(--text-primary);
    border-color: var(--border);
}
.av-btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover-medium);
    border-color: var(--border-hover);
}

.av-btn-danger {
    background: var(--danger-dim);
    color: var(--danger);
    border-color: var(--border-danger);
}
.av-btn-danger:hover:not(:disabled) {
    background: oklch(0.58 0.17 25 / 0.10);
    border-color: var(--danger);
}

.av-btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--line);
    padding: 10px var(--space-md);
}
.av-btn-ghost:hover:not(:disabled) {
    border-color: var(--ink);
    background: transparent;
}

.av-btn-sm {
    min-height: 36px;
    padding: 6px var(--space-md);
    font-size: var(--font-xs);
}

.av-btn-xs {
    min-height: 28px;
    padding: 4px var(--space-sm);
    font-size: var(--font-xs);
}

.av-btn-icon {
    width: var(--touch-target);
    height: var(--touch-target);
    padding: 0;
    border-radius: var(--radius-md);
}

.av-btn-icon.av-btn-sm {
    width: 36px;
    height: 36px;
}

/* Touch device overrides — enlarge small buttons for coarse pointers */
@media (pointer: coarse) {
    .av-btn-sm {
        min-height: 44px;
    }

    .av-btn-xs {
        min-height: 36px;
    }

    .av-btn-icon.av-btn-sm {
        width: 44px;
        height: 44px;
    }
}

/* ==========================================================================
   Cards — .av-card, .av-stat-card, .av-stats-grid
   ========================================================================== */
.av-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-width: 0;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.av-card:hover {
    border-color: var(--ink-2);
}

.av-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.av-card-title {
    font-size: var(--font-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.av-card-body {
    padding: var(--space-lg);
}

.av-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-light);
}

/* Stat card */
.av-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.av-stat-card-value {
    font-size: var(--font-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    line-height: var(--line-height-tight);
}

.av-stat-card-label {
    font-size: var(--font-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: var(--font-weight-semibold);
}

.av-stat-card-change {
    font-size: var(--font-xs);
    font-weight: var(--font-weight-semibold);
}

.av-stat-card-change.is-positive { color: var(--success); }
.av-stat-card-change.is-negative { color: var(--danger); }

/* Stats grid */
.av-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

@media (min-width: 768px) {
    .av-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: var(--space-lg);
    }
}

/* ==========================================================================
   Display Card — .av-display-card + preview, meta, actions, overflow menu
   ========================================================================== */
.av-display-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    position: relative;
}

.av-display-card:hover {
    border-color: var(--ink-2);
    box-shadow: var(--shadow-sm);
}

.av-display-card.is-selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-primary) 55%, transparent);
}

.av-display-card-select {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    z-index: 2;
    width: var(--touch-target);
    height: var(--touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: oklch(0.18 0.012 255 / 0.55);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.av-display-card-select:hover,
.av-display-card-select:focus-within {
    background: oklch(0.18 0.012 255 / 0.72);
}

.av-card-check {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.av-display-card-preview {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Empty preview slot: drops the 16:9 footprint to a thin strip so a list of
   idle/offline displays stays scannable. The favorite pin moves up so it
   keeps a visible target without the iframe area. */
.av-display-card-preview--empty {
    aspect-ratio: auto;
    height: 4px;
    background: linear-gradient(90deg,
        var(--border-light, #e5e7eb) 0%,
        var(--bg-secondary, #f9fafb) 50%,
        var(--border-light, #e5e7eb) 100%);
    border-bottom: none;
}
.av-display-card-preview--empty .av-favorite-pin {
    top: 8px;
    right: 8px;
}

/* Card name acts as a primary affordance to the display detail page; styled
   as plain text by default, underline only on hover/focus so the row stays
   visually calm but discoverable. */
.av-display-card-name-link {
    color: inherit;
    text-decoration: none;
    border-radius: 4px;
}
.av-display-card-name-link:hover,
.av-display-card-name-link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 2px;
}
.av-display-card-name-link:focus-visible {
    outline: 2px solid var(--accent-primary, #2563eb);
    outline-offset: 2px;
}

/* Base preview iframe (shared between card and mini-preview) */
.av-preview-iframe {
    border: none;
    pointer-events: none;
}

.av-display-card-preview .av-preview-iframe {
    width: 100%;
    height: 100%;
}

/* Clickable overlay turning the preview thumbnail into an "open fullscreen" button.
   Sits above the pointer-events:none iframe but below the favorite pin (z-index:1). */
.av-display-card-preview-open {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: zoom-in;
    z-index: 0;
}

.av-display-card-preview-open:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
}

/* Template preview (16:9 thumbnail in template cards) */
.av-template-preview {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    overflow: hidden;
    background: var(--bg-secondary);
}

.av-template-preview .av-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.av-template-preview--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: var(--font-xs);
    padding: var(--space-md);
    text-align: center;
}

.av-display-card-body {
    padding: var(--space-md);
}

.av-display-card-name {
    font-size: var(--font-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.av-display-card-meta {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

.av-display-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md) var(--space-md);
    align-items: stretch;
}

.av-display-card-actions > .av-btn,
.av-display-card-actions > .av-display-card-overflow {
    flex: 1 1 auto;
    min-width: 0;
}

.av-display-card-actions .av-btn {
    min-height: 38px;
}

.av-display-card-overflow {
    position: relative;
}

.av-display-card-overflow > .av-display-card-overflow-trigger {
    width: 100%;
}

.av-display-card-overflow-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    min-width: 190px;
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    display: none;
}

.av-display-card-overflow.is-open .av-display-card-overflow-menu {
    display: grid;
    gap: 2px;
}

.av-display-card-overflow-item {
    width: 100%;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    font-size: var(--font-xs);
    padding: 8px var(--space-sm);
    cursor: pointer;
}

.av-display-card-overflow-item:hover:not(:disabled) {
    background: var(--bg-hover-subtle);
}

.av-display-card-overflow-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Favorite pin */
.av-favorite-pin {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: var(--touch-target);
    height: var(--touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    background: oklch(0.18 0.012 255 / 0.52);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-base), background-color var(--transition-base);
    font-size: 1rem;
    z-index: 1;
}

.av-favorite-pin:hover,
.av-favorite-pin.is-active {
    color: var(--accent-secondary);
    background: oklch(0.72 0.14 70 / 0.14);
}

/* Hero display card (single display user) */
.av-display-card--hero {
    border: 1px solid var(--border);
}

.av-display-card--hero .av-display-card-preview {
    aspect-ratio: 16 / 10;
}

/* Display card grid */
.av-display-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

@media (min-width: 480px) {
    .av-display-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .av-display-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* ==========================================================================
   Badges — .av-badge variants (success, warning, danger, info, muted) + status dots
   ========================================================================== */
.av-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.4;
    white-space: nowrap;
    border: 1px solid transparent;
}

.av-badge-success {
    background: oklch(0.62 0.13 155 / 0.10);
    color: var(--success-strong);
    border-color: oklch(0.62 0.13 155 / 0.22);
}

.av-badge-warning {
    background: oklch(0.72 0.14 70 / 0.10);
    color: var(--warning-strong);
    border-color: var(--border-warning);
}

.av-badge-danger {
    background: oklch(0.58 0.17 25 / 0.06);
    color: var(--danger-strong);
    border-color: oklch(0.58 0.17 25 / 0.18);
}

.av-badge-info {
    background: var(--accent-soft);
    color: var(--accent-ink);
    border-color: oklch(0.48 0.14 265 / 0.20);
}

.av-badge-muted {
    background: var(--line-3);
    color: var(--muted);
    border-color: var(--line);
}

/* Status dot */
.av-status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.av-status-dot.is-online { background: var(--success); }
.av-status-dot.is-degraded { background: var(--warning); }
.av-status-dot.is-offline { background: var(--text-muted); }

/* ==========================================================================
   Tables — .av-table with mobile card-stack layout, bulk selection checkbox
   ========================================================================== */
.av-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* Mobile: card-stack layout */
.av-table thead {
    display: none;
}

.av-table tbody {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.av-table tr {
    display: grid;
    grid-template-columns: 1fr;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    gap: var(--space-xs);
}

.av-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) 0;
    font-size: var(--font-sm);
    color: var(--text-primary);
}

.av-table td::before {
    content: attr(data-label);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    font-size: var(--font-xs);
    min-width: 100px;
}

/* Bulk selection checkbox */
.av-table-check {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

@media (min-width: 768px) {
    .av-table thead {
        display: table-header-group;
    }

    .av-table tbody {
        display: table-row-group;
    }

    .av-table tr {
        display: table-row;
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
    }

    .av-table th {
        padding: var(--space-sm) var(--space-md);
        font-size: var(--font-xs);
        font-weight: var(--font-weight-semibold);
        color: var(--text-muted);
        text-align: left;
        border-bottom: 1px solid var(--border);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        white-space: nowrap;
        user-select: none;
    }

    .av-table th.is-sortable {
        cursor: pointer;
    }

    .av-table th.is-sortable:hover {
        color: var(--text-primary);
    }

    .av-table td {
        display: table-cell;
        padding: var(--space-md);
        border-bottom: 1px solid var(--border-light);
        vertical-align: middle;
    }

    .av-table td::before {
        display: none;
    }

    .av-table tr:hover td {
        background: var(--line-3);
    }
}

/* ==========================================================================
   Modals — .av-modal-overlay, .av-modal-panel, header/body/footer, sm variant
   ========================================================================== */
.av-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end; /* bottom-sheet on mobile */
    justify-content: center;
    padding: 0;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.av-modal-panel {
    width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpModal 0.25s ease;
}

@keyframes slideUpModal {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.av-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.av-modal-title {
    font-size: var(--font-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.av-modal-close {
    width: var(--touch-target);
    height: var(--touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color var(--transition-base), color var(--transition-base);
}

.av-modal-close:hover {
    background: var(--bg-hover-subtle);
    color: var(--text-primary);
}

.av-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    overscroll-behavior: contain;
}

.av-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

/* Small modal variant */
.av-modal-panel--sm {
    max-width: 500px;
}

/* Large modal variant — used for the Quick-Send wizard which carries a
   stepper, a multi-section target picker, and a preview pane. The default
   640 px max-width forced its display tree into a cramped column; 760 px
   gives the content room to breathe without stretching the wizard so wide
   it stops feeling like a focused dialog. */
.av-modal-panel--lg {
    max-width: 760px;
}

@media (min-width: 768px) {
    .av-modal-overlay {
        align-items: center; /* centered on desktop */
        padding: var(--space-xl);
    }

    .av-modal-panel {
        width: 90%;
        max-width: 640px;
        border-radius: var(--radius-2xl);
        animation: scaleIn 0.2s ease;
    }

    /* Re-assert the large-variant width inside the desktop media query;
       without this the later .av-modal-panel rule above wins on tied
       specificity and the wizard ends up at 640 px again. */
    .av-modal-panel.av-modal-panel--lg {
        max-width: 760px;
    }

    @keyframes scaleIn {
        from { transform: scale(0.95); opacity: 0; }
        to   { transform: scale(1); opacity: 1; }
    }
}

/* ==========================================================================
   Toasts — .av-toast-container, individual toast, icon, message, close button
   ========================================================================== */
.av-toast-container {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
    max-width: min(420px, calc(100vw - 32px));
}

.av-toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-size: var(--font-sm);
    pointer-events: auto;
    animation: toastIn 0.3s ease;
}

.av-toast.is-leaving {
    animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(100%); opacity: 0; }
}

.av-toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.av-toast-message {
    flex: 1;
    min-width: 0;
}

.av-toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Typed toast variants — coloured left border accent so success/error/warn/info
   are distinguishable at a glance even if the emoji isn't. */
.av-toast.is-success { border-left: 4px solid var(--success, #22c55e); }
.av-toast.is-error   { border-left: 4px solid var(--danger,  #ef4444); }
.av-toast.is-warning { border-left: 4px solid var(--warning, #eab308); }
.av-toast.is-info    { border-left: 4px solid var(--primary, #3b82f6); }

/* ==========================================================================
   Forms — .av-form-group, .av-label, .av-input, .av-textarea, .av-select,
           .av-hint, checkbox groups
   ========================================================================== */
.av-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.av-label {
    font-size: var(--font-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
}

.av-input,
.av-select,
.av-textarea {
    width: 100%;
    padding: 10px var(--space-md);
    min-height: var(--touch-target);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-base);
    font-family: var(--font-family);
    transition: border-color var(--transition-base);
}

.av-input::placeholder,
.av-textarea::placeholder {
    color: var(--text-muted);
}

.av-input:focus,
.av-select:focus,
.av-textarea:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.av-input:focus-visible,
.av-select:focus-visible,
.av-textarea:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.av-input:disabled,
.av-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.av-input-invalid,
.av-input.av-input-invalid {
    border-color: var(--danger, oklch(0.58 0.17 25));
    box-shadow: 0 0 0 3px oklch(0.58 0.17 25 / 0.15);
}

.av-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%237f95a7'%3E%3Cpath d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.av-textarea {
    min-height: 120px;
    resize: vertical;
    line-height: var(--line-height-relaxed);
}

.av-hint {
    font-size: var(--font-xs);
    color: var(--text-muted);
}

/* JSON editor */
.av-json-editor {
    display: grid;
    gap: var(--space-xs);
}

.av-json-editor-shell {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    overflow: hidden;
}

.av-json-editor.is-invalid .av-json-editor-shell {
    border-color: var(--danger, #ef4444);
}

.av-json-editor.is-valid .av-json-editor-shell {
    border-color: var(--success, #22c55e);
}

.av-json-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-wrap: wrap;
}

.av-json-editor-kicker {
    font-size: var(--font-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0;
}

.av-json-editor-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.av-json-editor-field {
    display: grid;
    grid-template-columns: minmax(42px, auto) 1fr;
    min-height: 160px;
}

.av-json-editor-lines,
.av-json-editor-input {
    min-height: inherit;
    margin: 0;
    border: 0;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: var(--font-sm);
    line-height: 1.55;
    tab-size: 2;
}

.av-json-editor-lines {
    padding: 10px 8px;
    overflow: hidden;
    user-select: none;
    text-align: right;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
}

.av-json-editor-input {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    resize: vertical;
    background: transparent;
    color: var(--text-primary);
    outline: none;
    white-space: pre;
}

.av-json-editor-input:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
}

.av-json-editor-status {
    margin: 0;
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.av-json-editor-status.is-ok {
    color: var(--success, #22c55e);
}

.av-json-editor-status.is-warn {
    color: var(--warning, #eab308);
}

.av-json-editor-status.is-bad {
    color: var(--danger, #ef4444);
}

/* Guided flat JSON builder */
.av-slot-editor-tabs {
    display: flex;
    gap: var(--space-xs, 4px);
    flex-wrap: wrap;
    align-items: center;
}

.av-slot-editor-tabs .is-active {
    background: var(--accent-primary, #2563eb);
    color: white;
    border-color: transparent;
}

.av-slot-builder {
    display: grid;
    gap: var(--space-sm, 8px);
    padding: var(--space-sm, 8px);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    background: var(--surface-subtle, #f8fafc);
}

.av-builder-intro {
    margin: 0;
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.av-builder-row {
    display: grid;
    grid-template-columns: minmax(140px, 1.1fr) minmax(120px, 0.7fr) minmax(160px, 1.4fr) auto;
    gap: var(--space-xs, 6px);
    align-items: start;
    padding: 8px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    background: var(--bg-input);
}

.av-builder-row.is-invalid {
    border-color: var(--danger, #ef4444);
    background: var(--danger-dim, rgba(239, 68, 68, 0.1));
}

.av-builder-cell {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.av-builder-label {
    font-size: var(--font-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
}

.av-builder-key {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.av-builder-key,
.av-builder-type,
.av-builder-value {
    font-size: var(--font-sm);
}

.av-builder-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(32px, 1fr));
    gap: 4px;
    align-self: end;
}

.av-builder-actions .av-btn {
    min-width: 32px;
    min-height: 32px;
    padding: 4px 6px;
}

.av-builder-actions .av-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.av-builder-row-error {
    min-height: 16px;
    font-size: var(--font-xs);
    color: var(--danger, #ef4444);
}

.av-builder-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm, 8px);
    flex-wrap: wrap;
}

.av-builder-status {
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.av-builder-status.is-ok {
    color: var(--success, #22c55e);
}

.av-builder-status.is-bad {
    color: var(--danger, #ef4444);
}

@media (max-width: 640px) {
    .av-builder-row {
        grid-template-columns: 1fr;
    }

    .av-builder-actions {
        grid-template-columns: repeat(4, minmax(32px, 1fr));
        width: 100%;
    }
}

/* Checkbox / toggle group */
.av-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.av-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: var(--touch-target);
    font-size: var(--font-sm);
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    transition: background var(--transition-base);
}

.av-checkbox-label:hover {
    background: var(--bg-hover-subtle);
}

.av-checkbox-label input[type="checkbox"] {
    accent-color: var(--accent-primary);
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Tabs — .av-tabs, .av-tab, active state
   ========================================================================== */
.av-tabs {
    display: flex;
    gap: var(--space-xs);
    border-bottom: 1px solid var(--border-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.av-tabs::-webkit-scrollbar {
    display: none;
}

.av-tab {
    padding: var(--space-sm) var(--space-md);
    min-height: var(--touch-target);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: var(--font-sm);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family);
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--transition-base), border-bottom-color var(--transition-base);
    -webkit-tap-highlight-color: transparent;
}

.av-tab:hover {
    color: var(--text-primary);
}

.av-tab.is-active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* ==========================================================================
   Toolbar — .av-toolbar, spacer, search input with icon, focus states
   ========================================================================== */
.av-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.av-toolbar-spacer {
    flex: 1;
}

/* Search input */
.av-search {
    position: relative;
    flex: 1;
    min-width: 180px;
    max-width: 360px;
}

.av-search input {
    width: 100%;
    padding: 8px var(--space-md) 8px 36px;
    min-height: 40px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-sm);
    font-family: var(--font-family);
}

.av-search input::placeholder {
    color: var(--text-muted);
}

.av-search input:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.av-search input:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.av-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

/* ==========================================================================
   Pagination — .av-pagination, button variants
   ========================================================================== */
.av-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-lg) 0;
}

.av-pagination-btn {
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--font-sm);
    cursor: pointer;
    transition: background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base);
    font-family: var(--font-family);
}

.av-pagination-btn:hover:not(:disabled) {
    background: var(--bg-hover-subtle);
    color: var(--text-primary);
}

.av-pagination-btn.is-active {
    background: var(--accent-primary-dim);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.av-pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ==========================================================================
   Empty State — .av-empty-state, icon/title/body layout
   ========================================================================== */
.av-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    gap: var(--space-md);
}

.av-empty-state-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.av-empty-state-title {
    font-size: var(--font-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
}

.av-empty-state-desc {
    font-size: var(--font-sm);
    color: var(--text-muted);
    max-width: 400px;
    line-height: var(--line-height-relaxed);
}

/* ==========================================================================
   Bulk Actions — floating toolbar for selection actions (.av-bulk-bar)
   ========================================================================== */
.av-bulk-bar {
    position: fixed;
    bottom: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-overlay);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
    background: var(--ink);
    border: 1px solid var(--ink-2);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    animation: bulkBarIn 0.25s var(--transition-spring);
}

@keyframes bulkBarIn {
    from { transform: translateX(-50%) translateY(100%); opacity: 0; }
    to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.av-bulk-bar-count {
    font-size: var(--font-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--bg);
    white-space: nowrap;
}

/* Inverted button styling — the bulk-bar paints over the dark `--ink`
   surface, so the default light-surface button tokens lose all contrast
   (a primary button matches the bar background; secondary/ghost text
   becomes invisible). These overrides keep the button shapes legible
   while still distinguishing primary / secondary / danger / ghost
   semantics. Hover/focus mirrors the same contrast inversion. */
.av-bulk-bar .av-btn {
    border-radius: 999px;
}

.av-bulk-bar .av-btn-primary {
    background: var(--bg);
    color: var(--ink);
    border-color: var(--bg);
}
.av-bulk-bar .av-btn-primary:hover:not(:disabled),
.av-bulk-bar .av-btn-primary:focus-visible {
    background: color-mix(in srgb, var(--bg) 88%, var(--ink) 12%);
    border-color: var(--bg);
}

.av-bulk-bar .av-btn-secondary {
    background: transparent;
    color: var(--bg);
    border-color: color-mix(in srgb, var(--bg) 35%, transparent);
}
.av-bulk-bar .av-btn-secondary:hover:not(:disabled),
.av-bulk-bar .av-btn-secondary:focus-visible {
    background: color-mix(in srgb, var(--bg) 12%, transparent);
    border-color: color-mix(in srgb, var(--bg) 60%, transparent);
    color: var(--bg);
}

.av-bulk-bar .av-btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 60%, transparent);
}
.av-bulk-bar .av-btn-danger:hover:not(:disabled),
.av-bulk-bar .av-btn-danger:focus-visible {
    background: color-mix(in srgb, var(--danger) 18%, transparent);
    border-color: var(--danger);
    color: var(--danger);
}

.av-bulk-bar .av-btn-ghost {
    background: transparent;
    color: var(--bg);
    border-color: transparent;
    padding: 8px 10px;
    line-height: 1;
    font-size: 18px;
}
.av-bulk-bar .av-btn-ghost:hover:not(:disabled),
.av-bulk-bar .av-btn-ghost:focus-visible {
    background: color-mix(in srgb, var(--bg) 14%, transparent);
    border-color: transparent;
    color: var(--bg);
}

.av-bulk-bar .av-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--bg) 35%, transparent);
}

/* Adjust for mobile bottom bar */
@media (max-width: 767px) {
    .av-bulk-bar {
        bottom: calc(var(--mobile-bottom-nav-height) + var(--space-md));
    }

    .av-bulk-bar .av-btn {
        flex-shrink: 0;
    }
}

/* ==========================================================================
   Command Palette — .av-command-palette, groups, items, shortcuts (.av-kbd)
   ========================================================================== */
.av-command-palette {
    position: fixed;
    inset: 0;
    z-index: var(--z-command-palette);
    display: flex;
    justify-content: center;
    padding-top: 20vh;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.1s ease;
}

.av-command-palette-box {
    width: 90%;
    max-width: 560px;
    max-height: 420px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scaleIn 0.15s ease;
    align-self: flex-start;
}

.av-command-palette-input {
    padding: var(--space-md) var(--space-lg);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: var(--font-lg);
    font-family: var(--font-family);
    width: 100%;
}

.av-command-palette-input::placeholder {
    color: var(--text-muted);
}

.av-command-palette-input:focus {
    outline: none;
}

.av-command-palette-input:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
}

.av-command-palette-results {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
}

.av-command-palette-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: var(--font-sm);
}

.av-command-palette-item:hover,
.av-command-palette-item.is-selected {
    background: var(--bg-hover-subtle);
    color: var(--text-primary);
}

.av-command-palette-item-icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.av-command-palette-item-label {
    flex: 1;
}

.av-command-palette-item-hint {
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.av-command-palette-empty {
    padding: var(--space-xl);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-sm);
}

/* Kbd hint */
.av-kbd {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background: var(--bg-warm);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: var(--radius-xs);
    font-size: var(--font-2xs);
    font-family: var(--font-mono);
    color: var(--text-muted);
    line-height: 1.4;
}

/* ==========================================================================
   Details — .av-details + summary, collapsible body (progressive disclosure)
   ========================================================================== */
.av-details {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    overflow: hidden;
}

.av-details summary {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    cursor: pointer;
    font-size: var(--font-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    transition: color var(--transition-base);
    list-style: none;
    user-select: none;
}

.av-details summary::-webkit-details-marker {
    display: none;
}

.av-details summary::before {
    content: '\25B6'; /* right arrow */
    font-size: 0.65em;
    transition: transform var(--transition-base);
    color: var(--text-muted);
}

.av-details[open] summary::before {
    transform: rotate(90deg);
}

.av-details summary:hover {
    color: var(--text-primary);
    background: var(--bg-hover-subtle);
}

.av-details-body {
    padding: 0 var(--space-md) var(--space-md);
}

/* ==========================================================================
   Onboarding — .av-onboarding checklist with steps and gradient background
   ========================================================================== */
.av-onboarding {
    background: var(--accent-soft);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.av-onboarding-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.av-onboarding-title {
    font-size: var(--font-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.av-onboarding-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
}

.av-onboarding-step {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

.av-onboarding-step.is-done {
    color: var(--text-muted);
    text-decoration: line-through;
}

.av-onboarding-step-check {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.7rem;
    margin-top: 1px;
}

.av-onboarding-step.is-done .av-onboarding-step-check {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--text-inverse);
}

/* ==========================================================================
   Spinner — .av-spinner base + sm/lg sizes, .av-loading container
   ========================================================================== */
.av-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent-primary);
    border-radius: var(--radius-full);
    animation: spin 0.7s linear infinite;
}

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

.av-spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.av-spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* Loading state for containers */
.av-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: var(--font-sm);
}

/* ==========================================================================
   Quick-Send Dialog — .av-quick-send selection options for quick actions
   ========================================================================== */
.av-quick-send {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.av-quick-send-options {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.av-quick-send-option {
    flex: 1;
    min-width: 120px;
    padding: var(--space-md);
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-base), color var(--transition-base);
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

.av-quick-send-option:hover,
.av-quick-send-option.is-active {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.av-quick-send-option-icon {
    font-size: 1.5rem;
    margin-bottom: var(--space-xs);
    display: block;
}

/* ==========================================================================
   Timeline — .av-timeline with hourly labels and priority entry blocks
   ========================================================================== */
.av-timeline {
    position: relative;
    height: 100px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.av-timeline-hours {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-2xs);
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
}

.av-timeline-track {
    position: relative;
    height: 100%;
    padding: var(--space-xs) var(--space-sm);
}

.av-timeline-entry {
    position: absolute;
    height: 24px;
    border-radius: var(--radius-xs);
    font-size: var(--font-2xs);
    font-weight: var(--font-weight-semibold);
    display: flex;
    align-items: center;
    padding: 0 var(--space-xs);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: opacity var(--transition-base);
}

.av-timeline-entry:hover {
    opacity: 0.85;
}

.av-timeline-entry.is-prio-0 {
    background: var(--line-2);
    color: var(--text-muted);
}

.av-timeline-entry.is-prio-10 {
    background: var(--accent-primary-dim);
    color: var(--accent-primary);
}

.av-timeline-entry.is-prio-20 {
    background: var(--accent-secondary-dim);
    color: var(--accent-secondary);
}

.av-timeline-now {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--danger);
    z-index: 1;
}

/* ==========================================================================
   Drop Zone — .av-drop-zone drag-and-drop upload area
   ========================================================================== */
.av-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-base), background-color var(--transition-base), border-style var(--transition-base);
    background: var(--bg);
}

.av-drop-zone:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary-dim);
}

.av-drop-zone.is-active {
    border-color: var(--accent-primary);
    background: var(--accent-primary-dim);
    border-style: solid;
}

.av-drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    pointer-events: none;
}

.av-drop-zone-icon {
    color: var(--text-muted);
    opacity: 0.5;
    transition: color var(--transition-base), opacity var(--transition-base);
}

.av-drop-zone:hover .av-drop-zone-icon,
.av-drop-zone.is-active .av-drop-zone-icon {
    color: var(--accent-primary);
    opacity: 1;
}

.av-drop-zone-text {
    font-size: var(--font-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
}

.av-drop-zone:hover .av-drop-zone-text {
    color: var(--text-primary);
}

.av-drop-zone-hint {
    font-size: var(--font-xs);
    color: var(--text-muted);
    max-width: 360px;
    line-height: var(--line-height-relaxed);
}

/* ==========================================================================
   Mobile Overrides — cross-component responsive rules (max-width: 768px / 374px)
   Comprehensive mobile-first improvements for smartphone users.
   ========================================================================== */
@media (max-width: 768px) {

    /* --- Toolbar: stack search + actions vertically --- */
    .av-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
    }

    .av-toolbar-spacer {
        display: none;
    }

    .av-search {
        max-width: none;
        min-width: 0;
    }

    .av-toolbar .av-view-toggle {
        display: none; /* cards view only on mobile — table is auto-handled */
    }

    .av-toolbar-actions,
    .av-toolbar > .av-btn {
        width: 100%;
    }

    /* Stack toolbar buttons horizontally with equal width */
    .av-toolbar-buttons {
        display: flex;
        gap: var(--space-sm);
        width: 100%;
    }

    .av-toolbar-buttons .av-btn {
        flex: 1;
        text-align: center;
    }

    /* --- Page header: smaller on mobile --- */
    .av-page-header {
        margin-bottom: var(--space-md);
    }

    .av-page-title {
        font-size: var(--font-lg);
        flex-wrap: wrap;
    }

    /* --- Display cards: 2-button mobile action row --- */
    .av-display-card-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-sm);
        padding: var(--space-sm) var(--space-md) var(--space-md);
    }

    .av-display-card-actions .av-btn {
        width: 100%;
        min-height: 40px;
        justify-content: center;
    }

    .av-display-card-overflow {
        grid-column: 1 / -1;
        justify-self: stretch;
    }

    .av-display-card-overflow .av-display-card-overflow-trigger {
        width: 100%;
    }

    .av-display-card-overflow-menu {
        left: 0;
        right: 0;
        min-width: 0;
    }

    /* --- Status filter chips: horizontal scroll --- */
    .av-status-filter {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
        white-space: nowrap;
        padding-bottom: var(--space-xs);
    }

    .av-status-filter::-webkit-scrollbar {
        display: none;
    }

    /* --- Page header: stack vertically on mobile (overrides inline flex) --- */
    .av-page-header:not(.av-page-header--with-actions) {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    /* --- Tabs: scroll hint fade --- */
    .av-tabs {
        position: relative;
        padding-right: var(--space-xl);
    }

    .av-tab {
        padding: var(--space-sm) var(--space-md);
        font-size: var(--font-xs);
    }

    /* --- Modal: ensure bottom-sheet has padding for safe area --- */
    .av-modal-panel {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .av-modal-footer {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .av-modal-footer .av-btn {
        width: 100%;
        justify-content: center;
    }

    /* --- Bulk action bar: compact on mobile --- */
    .av-bulk-bar {
        left: var(--space-md);
        right: var(--space-md);
        transform: none;
        gap: var(--space-sm);
        padding: var(--space-sm) var(--space-md);
        border-radius: var(--radius-lg);
    }

    @keyframes bulkBarIn {
        from { transform: translateY(100%); opacity: 0; }
        to   { transform: translateY(0); opacity: 1; }
    }

    /* --- Schedule timeline: taller on mobile for readability --- */
    .av-timeline {
        height: 80px;
    }

    .av-timeline-hours {
        font-size: 0.55rem;
        padding: 2px var(--space-xs);
    }

    /* --- Drop zone: reduce padding on mobile --- */
    .av-drop-zone {
        padding: var(--space-lg) var(--space-md);
    }

    .av-drop-zone-hint {
        font-size: var(--font-2xs);
    }

    /* --- Command palette: full-width on mobile --- */
    .av-command-palette {
        padding-top: var(--space-md);
    }

    .av-command-palette-box {
        width: 95%;
        max-height: 80vh;
        max-height: 80dvh; /* dvh fallback: accounts for mobile browser chrome */
    }

    /* --- Settings form: full width inputs --- */
    .av-settings-form .av-form-row {
        flex-direction: column;
    }

    /* --- Stats grid: 2 columns on mobile --- */
    .av-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }

    .av-stat-card {
        padding: var(--space-md);
    }

    .av-stat-card-value {
        font-size: var(--font-xl);
    }

    /* --- Onboarding: compact padding --- */
    .av-onboarding {
        padding: var(--space-md);
        margin-bottom: var(--space-md);
    }

    /* --- Toast: center on mobile, below topbar --- */
    .av-toast-container {
        top: auto;
        bottom: calc(var(--mobile-bottom-nav-height) + var(--space-md));
        right: var(--space-sm);
        left: var(--space-sm);
        max-width: none;
        align-items: stretch;
    }

    /* --- Quick-send options: stack vertically --- */
    .av-quick-send-options {
        flex-direction: column;
    }

    .av-quick-send-option {
        min-width: 0;
    }

    /* --- Card header: allow wrapping --- */
    .av-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
}

/* Very small screens (< 375px) */
@media (max-width: 374px) {
    .av-stats-grid {
        grid-template-columns: 1fr;
    }

    .av-display-grid {
        grid-template-columns: 1fr;
    }

    .av-bottom-bar-label {
        font-size: 0.55rem;
    }
}

/* ==========================================================================
   Quick-Send Stepper — premium editorial dialog
   .av-qs-stepper        outer flex column inside .av-modal-panel
   .av-qs-progress       progress rail (4 numbered bubbles + connector lines)
   .av-qs-step-panel     scroll area for the active step
   .av-qs-target-section sectioned content (Displays / Tags / Gruppen)
   .av-qs-display-row    selectable row with checkbox + name + status badge
   .av-qs-tag-chip       toggle pill
   .av-qs-group-row      group checkbox row with nested displays
   .av-qs-tab            content-mode segmented control
   .av-qs-nav            sticky footer with Zurück / Weiter buttons
   ========================================================================== */
.av-qs-stepper {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    gap: 0;
}

/* ── Progress rail ───────────────────────────────────────────────────── */
.av-qs-progress {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    list-style: none;
    margin: 0 0 28px;
    padding: 0;
    position: relative;
}

.av-qs-progress-step {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    position: relative;
    padding-left: 2px;
}

/* Connector line between bubbles. */
.av-qs-progress-step + .av-qs-progress-step::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 14px;
    width: 12px;
    height: 1px;
    background: var(--line);
}

.av-qs-progress-step.is-done + .av-qs-progress-step::before,
.av-qs-progress-step.is-active + .av-qs-progress-step::before {
    background: var(--ink);
}

.av-qs-progress-bubble {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--muted);
    transition: background var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease),
                color var(--dur-fast) var(--ease);
    line-height: 1;
}

.av-qs-progress-step.is-active .av-qs-progress-bubble {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}

.av-qs-progress-step.is-done .av-qs-progress-bubble {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.av-qs-progress-step.is-done .av-qs-progress-bubble::before {
    /* swap the number for a checkmark on completed steps */
    content: "✓";
    font-family: var(--font-text);
    font-size: 13px;
}
.av-qs-progress-step.is-done .av-qs-progress-bubble {
    font-size: 0;
}
.av-qs-progress-step.is-done .av-qs-progress-bubble::before {
    font-size: 13px;
}

.av-qs-progress-label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1.2;
}

.av-qs-progress-step.is-active .av-qs-progress-label,
.av-qs-progress-step.is-done .av-qs-progress-label {
    color: var(--ink);
}

/* ── Step panel (scrollable middle) ──────────────────────────────────── */
.av-qs-step-panel {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 2px;
    scrollbar-gutter: stable;
}

/* ── Target step sections (Displays / Tags / Gruppen) ────────────────── */
.av-qs-target-section {
    margin-bottom: 26px;
}

.av-qs-target-section:last-child {
    margin-bottom: 0;
}

.av-qs-section-title {
    /* Bumped from 10.5 px caps to 13 px sentence-case so the heading actually
       reads as a heading, not a tag-line. The previous ramp made body text
       inside the section visually larger than its title. */
    margin: 0 0 10px;
    font-family: var(--font-display, var(--font-text));
    font-size: 13px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink, var(--text-primary));
    font-weight: 600;
    line-height: 1.3;
}

/* ── Display rows ────────────────────────────────────────────────────── */
.av-qs-display-list {
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
}

.av-qs-display-row {
    display: grid;
    grid-template-columns: 24px 1fr auto auto;
    gap: 14px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-2);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease);
    color: var(--ink);
    font-size: 14px;
}

.av-qs-display-row:last-child {
    border-bottom: 0;
}

.av-qs-display-row:hover:not(.is-disabled) {
    background: var(--line-3);
}

.av-qs-display-row.is-selected {
    background: var(--accent-soft);
}

.av-qs-display-row.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.av-qs-display-row.is-tag-selected:not(.is-disabled) {
    cursor: default;
}

.av-qs-display-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: inherit;
    margin: 0;
}

.av-qs-display-name {
    font-weight: 500;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.av-qs-status-badge,
.av-qs-display-row .av-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg-warm);
    color: var(--muted);
    line-height: 1.4;
    flex-shrink: 0;
}

.av-qs-display-row .av-badge-success {
    background: oklch(0.62 0.13 155 / 0.10);
    color: var(--success-strong);
    border-color: oklch(0.62 0.13 155 / 0.22);
}

/* ── Tag chips (toggle pills) ────────────────────────────────────────── */
.av-qs-tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.av-qs-tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink-2);
    font-size: 13px;
    font-family: var(--font-text);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease),
                color var(--dur-fast) var(--ease);
}

.av-qs-tag-chip:hover {
    border-color: var(--ink-2);
    color: var(--ink);
}

.av-qs-tag-chip.is-active {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}

/* ── Group tree rows ─────────────────────────────────────────────────── */
.av-qs-group-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.av-qs-group-node {
    min-width: 0;
}

.av-qs-group-row {
    display: grid;
    grid-template-columns: 22px 1fr;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease);
    font-size: 14px;
    color: var(--ink);
}

.av-qs-group-row:hover {
    border-color: var(--ink-2);
    background: var(--line-3);
}

.av-qs-group-row.is-selected {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.av-qs-group-row.is-partial {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent-soft) 58%, var(--panel));
}

.av-qs-group-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: inherit;
    margin: 0;
}

.av-qs-group-row-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.av-qs-group-name {
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.av-qs-group-count {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.av-qs-group-display-list {
    display: flex;
    flex-direction: column;
    margin-left: 18px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 var(--r-md) var(--r-md);
    overflow: hidden;
}

.av-qs-group-display-row {
    padding-left: 18px;
    background: var(--bg);
}

.av-qs-group-empty {
    margin-left: 18px;
    padding: 12px 14px;
    border: 1px dashed var(--line);
    border-top: 0;
    border-radius: 0 0 var(--r-md) var(--r-md);
    background: var(--bg-warm);
    color: var(--muted);
    font-size: 13px;
}

/* ── Empty inside the modal ─────────────────────────────────────────── */
.av-qs-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 16px;
    background: var(--bg-warm);
    border: 1px dashed var(--line);
    border-radius: var(--r-md);
    color: var(--muted);
    text-align: center;
    font-size: 14px;
}

/* ── Content tabs (Step 2 — Vorlage / HTML / URL / Datei) ─────────────── */
.av-qs-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--line);
    margin: 0 0 22px;
}

.av-qs-tab {
    padding: 10px 16px;
    background: transparent;
    border: 0;
    border-bottom: 1.5px solid transparent;
    margin-bottom: -1px;
    font-family: var(--font-text);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease);
}

.av-qs-tab:hover {
    color: var(--ink);
}

.av-qs-tab.is-active {
    color: var(--ink);
    border-bottom-color: var(--ink);
}

.av-qs-dropzone {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 132px;
    padding: var(--space-lg);
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--muted);
    text-align: center;
    overflow: hidden;
}

.av-qs-dropzone:hover,
.av-qs-dropzone.is-drag-over {
    border-color: var(--ink);
    color: var(--ink);
    background: var(--surface-hover);
}

.av-qs-dropzone-label {
    pointer-events: none;
    font-size: var(--font-sm);
    font-weight: 600;
}

/* ── Preview + confirmation ─────────────────────────────────────────── */
.av-qs-preview-section,
.av-qs-confirm-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.av-qs-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.av-qs-source-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-secondary);
    color: var(--ink-2);
    font-size: var(--font-xs);
    font-weight: 600;
    white-space: nowrap;
}

.av-qs-preview-targets {
    margin: 0;
}

.av-qs-preview-shell {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.av-qs-preview-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-bottom: 1px solid var(--line-2);
    background: var(--surface-secondary);
}

.av-qs-preview-toolbar span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--line);
}

.av-qs-preview-frame-wrap {
    aspect-ratio: 16 / 9;
    min-height: 280px;
    max-height: 52vh;
    background: #fff;
}

.av-qs-preview-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.av-qs-confirm-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    overflow: hidden;
}

.av-qs-confirm-row {
    display: grid;
    grid-template-columns: minmax(120px, 0.35fr) 1fr;
    gap: var(--space-md);
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-2);
}

.av-qs-confirm-row:last-child {
    border-bottom: 0;
}

.av-qs-confirm-row > span {
    color: var(--muted);
    font-size: var(--font-xs);
    font-weight: 600;
}

.av-qs-confirm-row > strong {
    color: var(--ink);
    font-size: var(--font-sm);
    font-weight: 650;
}

.av-qs-confirm-targets .av-qs-target-summary {
    margin: 0;
}

.av-qs-confirm-btn {
    min-height: 48px;
    justify-content: center;
    font-size: var(--font-sm);
    box-shadow: var(--shadow-sm);
}

/* ── Content panels ─────────────────────────────────────────────────── */
.av-qs-tab-panel {
    display: none;
}

.av-qs-tab-panel.is-active {
    display: block;
}

/* ── Sticky nav footer ──────────────────────────────────────────────── */
.av-qs-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 0 4px;
    margin-top: 24px;
    border-top: 1px solid var(--line);
}

.av-qs-nav--sticky {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to bottom, transparent, var(--panel) 30%);
    padding-top: 22px;
}

.av-qs-back-btn,
.av-qs-next-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    font-family: var(--font-text);
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: -0.005em;
    border: 1px solid transparent;
    cursor: pointer;
    min-height: 36px;
    transition: background var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease),
                color var(--dur-fast) var(--ease),
                transform var(--dur-fast) var(--ease);
}

.av-qs-back-btn {
    background: transparent;
    color: var(--ink-2);
    border-color: var(--line);
}

.av-qs-back-btn:hover {
    border-color: var(--ink);
    color: var(--ink);
}

.av-qs-next-btn {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
    margin-left: auto;
}

.av-qs-next-btn:hover:not(:disabled):not(.is-disabled) {
    background: oklch(0.26 0.012 255);
    border-color: oklch(0.26 0.012 255);
}

.av-qs-next-btn:disabled,
.av-qs-next-btn.is-disabled {
    background: var(--bg-warm);
    color: var(--muted);
    border-color: var(--line);
    cursor: not-allowed;
}

.av-qs-back-btn:active,
.av-qs-next-btn:active:not(:disabled):not(.is-disabled) { transform: translateY(1px); }

/* When step 4 is active, the next-btn is hidden and the panel renders its
   own primary CTA. Make sure the back button still aligns left. */
.av-qs-nav .av-qs-next-btn[hidden] { display: none; }

/* ── Mobile ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .av-qs-progress {
        gap: 8px;
    }

    /* On narrow viewports the four full labels (ZIEL / INHALT / ...) don't
       fit. Hide labels for inactive steps but keep the active step's label
       visible so the user always knows where they are in the flow. */
    .av-qs-progress-label {
        display: none;
    }

    .av-qs-progress-step.is-active .av-qs-progress-label {
        display: inline;
        font-size: 10.5px;
        white-space: nowrap;
    }

    .av-qs-progress-step {
        align-items: center;
    }

    .av-qs-progress-step + .av-qs-progress-step::before {
        left: -8px;
        width: 8px;
    }

    .av-qs-display-row {
        grid-template-columns: 24px 1fr;
        grid-template-rows: auto auto;
        row-gap: 4px;
        padding: 14px 14px;
    }

    .av-qs-display-row .av-badge,
    .av-qs-display-row .av-qs-status-badge {
        grid-column: 2 / -1;
        justify-self: flex-start;
    }

    .av-qs-group-display-list,
    .av-qs-group-empty {
        margin-left: 10px;
    }

    .av-qs-group-display-row {
        padding-left: 14px;
    }

    .av-qs-preview-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .av-qs-confirm-row {
        grid-template-columns: 1fr;
    }

    .av-qs-preview-frame-wrap {
        min-height: 220px;
        max-height: 46vh;
    }

    .av-qs-nav {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* ──────────────────────────────────────────────────────────────────────────
   Connect-Display — pair-step layout (post-create wizard view)
   ────────────────────────────────────────────────────────────────────────── */

.av-connect-pair-step {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.av-connect-pair-success {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--r-md, var(--radius-md));
    background: rgb(34 197 94 / 0.08);
    border: 1px solid rgb(34 197 94 / 0.25);
    color: var(--ink, var(--text-primary));
    font-size: var(--font-sm);
}

.av-connect-pair-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgb(34 197 94);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.av-connect-pair-step-item {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: var(--space-sm);
    align-items: start;
}

.av-connect-pair-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--ink, var(--text-primary));
    color: var(--bg, #fff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono, monospace);
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
}

/* Fallback step bullet (manual code entry) — subordinate to numbered steps. */
.av-connect-pair-step-num--alt {
    background: transparent;
    color: var(--muted, var(--text-muted));
    border: 1px dashed var(--line, var(--border));
}

.av-connect-pair-step-title {
    font-size: var(--font-sm);
    margin-bottom: 6px;
}

.av-connect-pair-url {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-warm, var(--surface-secondary));
    border: 1px solid var(--line, var(--border));
    border-radius: var(--r-sm, var(--radius-sm));
    padding: 6px 10px;
}

.av-connect-pair-url code {
    flex: 1;
    font-size: var(--font-sm);
}

.av-connect-pair-code-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.av-connect-pair-code {
    flex: 1;
    font-size: var(--font-md);
    letter-spacing: 0.15em;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
}

.av-connect-pair-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-xs);
    color: var(--muted, var(--text-muted));
    padding: 8px 0;
}

.av-connect-pair-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgb(59 130 246);
    box-shadow: 0 0 0 0 rgb(59 130 246 / 0.6);
    animation: av-pair-pulse 1.6s ease-out infinite;
    flex-shrink: 0;
}

@keyframes av-pair-pulse {
    0%   { box-shadow: 0 0 0 0 rgb(59 130 246 / 0.55); }
    70%  { box-shadow: 0 0 0 10px rgb(59 130 246 / 0); }
    100% { box-shadow: 0 0 0 0 rgb(59 130 246 / 0); }
}

.av-connect-pair-detected-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--r-md, var(--radius-md));
    background: rgb(34 197 94 / 0.08);
    border: 1px solid rgb(34 197 94 / 0.3);
    margin-bottom: 6px;
}

.av-connect-pair-detected-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
    min-width: 0;
}

.av-connect-pair-detected-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgb(34 197 94);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.av-connect-pair-detected-title {
    font-weight: 600;
    font-size: var(--font-sm);
}

.av-connect-pair-detected-meta {
    font-size: var(--font-xs);
    color: var(--muted, var(--text-muted));
    font-family: var(--font-mono, monospace);
}

.av-connect-pair-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--line, var(--border));
}

/* ──────────────────────────────────────────────────────────────────────────
   Dashboard Tour — first-visit guided overlay
   ────────────────────────────────────────────────────────────────────────── */

.av-tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgb(15 23 42 / 0.45);
    pointer-events: auto;
    animation: av-tour-fade-in 180ms ease-out;
}

@keyframes av-tour-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.av-tour-highlight {
    position: absolute;
    border-radius: 12px;
    box-shadow:
        0 0 0 9999px rgb(15 23 42 / 0.45),
        0 0 0 3px rgb(255 255 255 / 0.9);
    pointer-events: none;
    transition: top 180ms ease, left 180ms ease, width 180ms ease, height 180ms ease;
}

.av-tour-tooltip {
    position: absolute;
    width: max-content;
    background: var(--panel, #fff);
    color: var(--ink, #0f172a);
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 14px;
    padding: 16px 18px 14px;
    box-shadow: 0 12px 28px rgb(15 23 42 / 0.18);
    transition: top 180ms ease, left 180ms ease;
}

.av-tour-tooltip-counter {
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--muted, #64748b);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.av-tour-tooltip-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 6px;
}

.av-tour-tooltip-body {
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted, #475569);
    margin: 0 0 12px;
    max-width: 32ch;
}

.av-tour-tooltip-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ──────────────────────────────────────────────────────────────────────────
   Quick-Send -- saved recipients rail (Step 1)
   ────────────────────────────────────────────────────────────────────────── */

.av-qs-recent-rail {
    margin-bottom: var(--space-md);
}

.av-qs-recent-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.av-qs-recent-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--bg-warm, var(--surface-secondary));
    border: 1px solid var(--line, var(--border));
    color: var(--ink, var(--text-primary));
    font: inherit;
    font-size: var(--font-xs);
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}

.av-qs-recent-chip:hover,
.av-qs-recent-chip:focus-visible {
    border-color: var(--ink, var(--text-primary));
    background: var(--panel, #fff);
    outline: none;
}

.av-qs-recent-chip-meta {
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    color: var(--muted, var(--text-muted));
}

/* ──────────────────────────────────────────────────────────────────────────
   Form -- required-marker + inline error
   ────────────────────────────────────────────────────────────────────────── */
.av-label-required {
    color: var(--danger, #dc2626);
    margin-left: 2px;
    font-weight: 600;
}

.av-input.is-invalid,
.av-input[aria-invalid="true"] {
    border-color: var(--danger, #dc2626);
    box-shadow: 0 0 0 1px var(--danger, #dc2626) inset;
}

.av-input-error {
    color: var(--danger, #dc2626);
    font-size: var(--font-xs);
    margin-top: 4px;
    line-height: 1.4;
}
