/* Design tokens (--color-*, --shadow-*, --font-family-base, --color-brand-gradient,
   --color-progress-*, etc.) are defined in css/colors_and_type.css which loads
   BEFORE this file. Only legacy keys not yet ported live here. */

:root              { color-scheme: light; }
:root[data-theme='dark'] {
    color-scheme: dark;
    /* Override only the two shadows the legacy app.css used differently
       (deeper black tint vs the design system's neutral-slate tint). */
    --shadow-sm: 0 12px 30px rgba(2, 6, 23, 0.6);
    --shadow-lg: 0 40px 60px rgba(2, 6, 23, 0.8);
    /* Legacy aliases kept in case any rule still references them. */
    --color-progress-success: #34d399;
    --color-progress-warning: #fbbf24;
    --color-progress-error: #f87171;
}

/* Legacy progress aliases (light) — kept until callers migrate to --color-success etc. */
:root, :root[data-theme='light'] {
    --color-progress-success: #10b981;
    --color-progress-warning: #fb923c;
    --color-progress-error: #ef4444;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    font-family: var(--font-family-base);
    background-color: var(--color-app-bg);
    color: var(--color-text-primary);
    min-height: 100vh;
    line-height: 1.6;
    scroll-padding-top: 4.5rem;
}

body {
    margin: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a,
.btn-link {
    color: var(--color-link);
    transition: color 0.25s ease, opacity 0.25s ease;
}

a:hover,
.btn-link:hover {
    color: var(--color-link-hover);
}

.btn {
    border-radius: 999px;
    font-weight: 600;
    padding: 0.65rem 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/*
 * ── Button Hierarchy ──
 *
 * PRIMARY  (.btn-primary)          – Brand gradient, shadow, hover lift.
 *                                    Use for the single most important action
 *                                    on a page (Start Upload, Register, Search).
 *
 * SECONDARY (.btn-outline-secondary) – Ghost / outline style, no fill.
 *                                    Use for supporting actions (Cancel, Back,
 *                                    secondary navigation).
 *
 * SUCCESS  (.btn-success)          – Solid green for confirmations / positive
 *                                    outcomes.
 *
 * Keep exactly ONE primary CTA per distinct view / card to preserve hierarchy.
 */

.btn-primary {
    background: var(--color-brand-gradient);
    border: none;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.30);
}

.btn-primary:hover {
    background: linear-gradient(120deg, #1d4ed8 0%, #0891b2 70%);
    border: none;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.35);
}

.btn-primary:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-outline-secondary {
    border-color: var(--color-border-strong);
    color: var(--color-text-primary);
    background-color: transparent;
}

.btn-outline-secondary:hover {
    border-color: var(--color-text-secondary);
    color: var(--color-text-primary);
    background-color: rgba(148, 163, 184, 0.1);
}

.btn-outline-secondary:active {
    transform: scale(0.97);
}

.btn-success {
    background-color: #16a34a;
    border-color: #16a34a;
}

.btn-success:hover {
    background-color: #15803d;
    border-color: #15803d;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem rgba(255, 255, 255, 0.3), 0 0 0 0.25rem var(--color-brand-accent);
}

h1:focus {
    outline: none;
}

.content {
    padding-top: 1.1rem;
}

.card {
    border-radius: 24px;
    border: 1px solid var(--color-border);
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    border-color: var(--color-brand-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.alert {
    border-radius: 18px;
    border: none;
    box-shadow: var(--shadow-sm);
}

/* ─── Page fade-in & hover-lift utilities ─────────────────────────────────── */

@keyframes page-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page-fade-in {
    animation: page-fade-in 300ms ease forwards;
}

.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ─── Standardised empty state ────────────────────────────────────────────── */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3.5rem 1.5rem;
    gap: 0.5rem;
}

.empty-state__icon {
    font-size: 64px;
    line-height: 1;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

.empty-state__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.empty-state__body {
    color: var(--color-text-secondary);
    max-width: 360px;
    line-height: 1.6;
    margin: 0;
}

.empty-state__cta {
    margin-top: 1rem;
}

/* ─── Reduced-motion overrides ────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .page-fade-in,
    .hover-lift,
    .hover-lift:hover,
    .card,
    .card:hover,
    .stat-card,
    .stat-card:hover,
    .btn-primary:active,
    .btn-outline-secondary:active {
        animation: none !important;
        transform: none !important;
        transition: none !important;
    }
}

/* ─────────────────────────────────────────────────────────────────────────── */

.home-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 1.5rem 5rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    animation: page-fade-in 300ms ease forwards;
}

@media (prefers-reduced-motion: reduce) {
    .home-wrapper {
        animation: none;
    }
}

.hero-section {
    background: var(--color-surface);
    border-radius: 32px;
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
}

.hero-eyebrow {
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    color: var(--color-brand-accent);
    font-weight: 600;
}

.hero-section h1 {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    font-weight: 700;
    color: var(--color-brand-deep);
    margin-bottom: 1.5rem;
}

.hero-section p {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    max-width: 34rem;
}

.home-hero-search {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 3rem 2rem;
}

.home-hero-search__title {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    margin-bottom: 1.5rem;
}

.home-hero-search__form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
    max-width: 600px;
}

.home-hero-search__form .form-control {
    flex: 1;
    min-width: 0;
}

@media (max-width: 768px) {
    .home-hero-search {
        padding: 2rem 1rem;
    }

    .home-hero-search__form {
        flex-direction: column;
    }

    .home-hero-search__form .search-button {
        min-width: unset;
    }
}

.cta-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 1.5rem;
}

.hero-card {
    background: var(--color-surface-muted);
    border-radius: 24px;
    padding: 1.75rem;
    border: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.hero-card--glow {
    background: linear-gradient(125deg, rgba(37, 99, 235, 0.08), rgba(6, 182, 212, 0.12)), var(--color-surface);
    border: 1px solid rgba(37, 99, 235, 0.15);
    box-shadow: 0 25px 55px rgba(15, 23, 42, 0.12);
}

:root[data-theme='dark'] .hero-card--glow {
    background: linear-gradient(125deg, rgba(37, 99, 235, 0.2), rgba(6, 182, 212, 0.2)), rgba(15, 23, 42, 0.85);
    border-color: rgba(148, 163, 184, 0.25);
    box-shadow: 0 25px 55px rgba(0, 0, 0, 0.45);
}

.hero-card h5 {
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.hero-card strong {
    font-size: 2.25rem;
    display: block;
    color: var(--color-brand-deep);
    margin: 0.5rem 0;
}

.hero-card__list {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
}

.hero-card__list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-secondary);
}

.hero-card__list .badge {
    border-radius: 999px;
    font-size: 0.75rem;
    padding: 0.2rem 0.65rem;
}

.mailbox-detail-wrapper {
    gap: 2.5rem;
}

.page-hero {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 32px;
    padding: 2.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .page-hero {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.page-hero h1 {
    margin-bottom: 0.75rem;
}

.detail-hero {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .detail-hero {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
}

.detail-back {
    border-radius: 999px;
    margin-bottom: 1rem;
}

.detail-hero h1 {
    font-size: clamp(2rem, 3vw, 2.8rem);
    margin-bottom: 0.3rem;
}

.detail-hero__right {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: flex-start;
}

.detail-meta {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.95rem;
    color: var(--color-text-secondary);
}

.detail-meta strong {
    color: var(--color-text-primary);
    margin-left: 0.35rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
}

.status-pill--success {
    background: color-mix(in srgb, var(--color-progress-success) 15%, transparent);
    color: var(--color-progress-success);
}

.status-pill--processing {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.status-pill--danger {
    background: color-mix(in srgb, var(--color-progress-error) 15%, transparent);
    color: var(--color-progress-error);
}

.status-pill--neutral {
    background: rgba(148, 163, 184, 0.2);
    color: var(--color-text-secondary);
}

.modern-card {
    border-radius: 28px;
    border: 1px solid var(--color-border);
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
}

.empty-state-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3.5rem 1.5rem;
    gap: 0.5rem;
}

.empty-state-card i,
.empty-state-card .empty-state-card__icon {
    font-size: 64px;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

.table-card {
    border: 1px solid var(--color-border);
    border-radius: 32px;
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
}

.table-card__header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .table-card__header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.table-card__controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.table-card__controls .badge {
    background-color: rgba(15, 23, 42, 0.06);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    padding: 0.4rem 0.8rem;
}

:root[data-theme='dark'] .table-card__controls .badge {
    background-color: rgba(148, 163, 184, 0.15);
    color: var(--color-text-primary);
    border-color: rgba(148, 163, 184, 0.4);
}

.data-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.data-table thead th {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background-color: var(--color-surface-muted);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

.data-table tbody td {
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

.data-table tbody tr:hover {
    background-color: rgba(15, 23, 42, 0.02);
}

:root[data-theme='dark'] .data-table tbody tr:hover {
    background-color: rgba(148, 163, 184, 0.08);
}

.action-pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.action-pill {
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: transparent;
    padding: 0.3rem 0.9rem;
    font-size: 0.85rem;
    color: var(--color-text-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
}

.action-pill:hover {
    border-color: var(--color-brand-accent);
    color: var(--color-brand-accent);
}

.action-pill.danger {
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

:root[data-theme='dark'] .action-pill {
    border-color: rgba(148, 163, 184, 0.4);
}

.table-pagination {
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-pagination span {
    color: var(--color-text-secondary);
}

:root[data-theme='dark'] .table-pagination span {
    color: var(--color-text-primary);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.detail-card {
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 1.75rem;
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.detail-dl {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
}

.detail-dl div {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}

.detail-dl dt {
    color: var(--color-text-secondary);
    font-weight: 500;
}

.detail-dl dd {
    margin: 0;
    font-weight: 600;
    color: var(--color-text-primary);
}

.progress-card {
    border: 1px solid var(--color-border);
    border-radius: 28px;
    padding: 2rem;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.usage-progress.large {
    height: 18px;
}

.usage-progress.large .progress-bar {
    transition: width 0.3s ease;
}

.modern-alert {
    border-radius: 18px;
    border: none;
    box-shadow: var(--shadow-sm);
}

.modal-backdrop.show {
    opacity: 1;
    background: rgba(2, 6, 23, 0.75);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
    color: var(--color-text-primary);
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 26px;
    box-shadow: 0 35px 90px rgba(15, 23, 42, 0.35);
}

:root[data-theme='dark'] .modal-content {
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.9));
    border: 1px solid rgba(6, 182, 212, 0.25);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 25px rgba(6, 182, 212, 0.2);
}

.glass-panel {
    border-radius: 32px;
    padding: 0;
}

.modal-header,
.modal-footer {
    border-color: rgba(148, 163, 184, 0.25);
}

.modal-title {
    font-weight: 600;
    color: var(--color-text-primary);
}

.modal-body label,
.modal-body .form-check-label {
    color: var(--color-text-primary);
}

.modal-body .form-control {
    background-color: var(--color-surface-muted);
    border-color: var(--color-border);
    color: var(--color-text-primary);
}

:root[data-theme='dark'] .modal-body .form-control {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(148, 163, 184, 0.4);
    color: var(--color-text-primary);
}

:root[data-theme='dark'] .modal-body .table {
    color: var(--color-text-primary);
}

:root[data-theme='dark'] .modal-body .table th {
    color: var(--color-text-secondary);
    border-color: rgba(148, 163, 184, 0.2);
}

:root[data-theme='dark'] .modal-body .table td {
    color: var(--color-text-primary);
    border-color: rgba(148, 163, 184, 0.15);
}

/* Comparison table — onboarding protection-level modal */
.comparison-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.comparison-table thead th {
    padding: 1rem 1rem 0.75rem;
    text-align: center;
    vertical-align: bottom;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
    border-bottom: 2px solid var(--color-border-strong);
    background: var(--color-surface-muted);
}

.comparison-table thead th:first-child {
    text-align: left;
}

.comparison-table__feature-col {
    width: 22%;
}

.comparison-table__plan-name {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-primary);
    letter-spacing: 0;
}

.comparison-table__badge {
    display: inline-block;
    margin-top: 0.35rem;
    padding: 0.15rem 0.55rem;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    background: var(--color-brand-gradient);
    border-radius: 999px;
}

.comparison-table tbody td {
    padding: 0.7rem 1rem;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    text-align: center;
}

.comparison-table tbody td:first-child {
    text-align: left;
}

.comparison-table .comparison-table__feature-label {
    font-weight: 500;
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.comparison-table tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.02);
}

.comparison-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.04);
}

.comparison-table .comparison-table__highlight-row {
    background: rgba(37, 99, 235, 0.06) !important;
    border-top: 2px solid var(--color-border-strong);
}

.comparison-table__icon--yes {
    color: #10b981;
    margin-right: 0.3rem;
}

.comparison-table__icon--no {
    color: #ef4444;
    margin-right: 0.3rem;
}

.comparison-table__icon--neutral {
    color: var(--color-text-secondary);
    margin-right: 0.3rem;
}

.comparison-table__icon--warn {
    color: #fb923c;
    margin-right: 0.3rem;
}

/* Dark theme overrides for comparison table */
:root[data-theme='dark'] .comparison-table thead th {
    background: rgba(15, 23, 42, 0.6);
    border-bottom-color: rgba(148, 163, 184, 0.25);
    color: var(--color-text-secondary);
}

:root[data-theme='dark'] .comparison-table tbody td {
    color: var(--color-text-primary);
    border-bottom-color: rgba(148, 163, 184, 0.12);
}

:root[data-theme='dark'] .comparison-table .comparison-table__feature-label {
    color: var(--color-text-secondary);
}

:root[data-theme='dark'] .comparison-table tbody tr:nth-child(even) {
    background: rgba(148, 163, 184, 0.04);
}

:root[data-theme='dark'] .comparison-table tbody tr:hover {
    background: rgba(6, 182, 212, 0.06);
}

:root[data-theme='dark'] .comparison-table .comparison-table__highlight-row {
    background: rgba(6, 182, 212, 0.08) !important;
    border-top-color: rgba(148, 163, 184, 0.2);
}

:root[data-theme='dark'] .comparison-table__icon--yes {
    color: #34d399;
}

:root[data-theme='dark'] .comparison-table__icon--no {
    color: #f87171;
}

:root[data-theme='dark'] .comparison-table__icon--warn {
    color: #fbbf24;
}

.alert-warning {
    background-color: rgba(250, 204, 21, 0.2);
    border: 1px solid rgba(217, 119, 6, 0.3);
    color: #9a5b00;
}

:root[data-theme='dark'] .alert-warning {
    background-color: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.25);
    color: #fcd34d;
    box-shadow: none;
}

.subtle-warning {
    border-radius: 16px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.stat-card {
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 1.75rem;
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card h3 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-text-secondary);
}

.emails-wrapper {
    gap: 2rem;
}

.tight-hero {
    padding-bottom: 1.5rem;
}

.search-panel {
    border: 1px solid var(--color-border);
    border-radius: 32px;
    padding: 2.5rem 2rem;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.search-primary {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    padding-bottom: 0.15rem;
}

.search-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-row .search-field {
    flex: 1;
}

.search-field--with-icons {
    position: relative;
    display: flex;
    align-items: center;
}

.search-field--with-icons .form-control {
    padding-right: 120px;
}

.search-field__icons {
    position: absolute;
    right: 0.5rem;
    display: flex;
    gap: 0.35rem;
}

.search-field--hero {
    flex: 1;
}

.search-field__lead-icon {
    position: absolute;
    left: 1rem;
    color: var(--color-text-secondary);
    font-size: 1.05rem;
    pointer-events: none;
    z-index: 1;
    transition: color 200ms ease;
}

.search-field--hero:focus-within .search-field__lead-icon {
    color: var(--color-brand-primary);
}

.search-field--with-icons.search-field--hero .form-control {
    padding-left: 2.75rem;
    padding-right: 152px;
    min-height: 52px;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.search-field--with-icons.search-field--hero .form-control:focus {
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    outline: none;
}

:root[data-theme='dark'] .search-field--with-icons.search-field--hero .form-control {
    background-color: var(--color-surface-muted);
    color: var(--color-text-primary);
    border-color: var(--color-border-strong);
}

:root[data-theme='dark'] .search-field--with-icons.search-field--hero .form-control:focus {
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 4px rgba(122, 184, 255, 0.15);
}


.search-clear-btn {
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 200ms ease;
}

.search-clear-btn--hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .search-clear-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

.icon-button--ghost {
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    padding: 0.35rem;
    border-radius: 999px;
}

.icon-button--ghost:hover {
    color: var(--color-brand-primary);
    background: rgba(37, 99, 235, 0.08);
}

.icon-button--active {
    border: 1px solid var(--color-brand-primary);
    color: var(--color-brand-primary);
    background: rgba(37, 99, 235, 0.12);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.search-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
}

.sort-toggle {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.15rem;
    background: var(--color-surface-muted);
    gap: 0.25rem;
}

.sort-toggle__btn {
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    transition: background 0.2s ease, color 0.2s ease;
}

.sort-toggle__btn--active {
    background: var(--color-brand-primary);
    color: #fff;
    box-shadow: var(--shadow-xs);
}

.search-button {
    min-width: 140px;
}

.search-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.25rem;
}

.search-meta__left {
    position: relative;
    margin-top: 0.3rem;
}

.scope-pill {
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: transparent;
    font-weight: 600;
    color: var(--color-brand-primary);
    display: inline-flex;
    align-items: center;
}

.scope-pill:hover {
    border-color: var(--color-brand-primary);
    background: rgba(37, 99, 235, 0.08);
}

.scope-pill__toggle {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem 0.35rem 0.85rem;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.scope-pill__toggle:last-child {
    padding-right: 0.85rem;
}

.scope-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: auto;
    right: 0;
    width: 260px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    z-index: 6;
}

/* ArchiveScopeSelector component */
.archive-scope-selector {
    position: relative;
    display: inline-flex;
}

.scope-pill--active {
    background: rgba(37, 99, 235, 0.08);
    border-color: var(--color-brand-primary);
}

.scope-pill__label {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
}

.scope-pill__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    margin-right: 0.375rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 0.65rem;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
    line-height: 1;
}

.scope-pill__clear:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--color-text-primary);
}

.scope-pill__chevron {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.scope-pill__chevron--open {
    transform: rotate(180deg);
}

/* Enhanced dropdown */
.scope-dropdown--enhanced {
    padding: 0.5rem;
    min-width: 300px;
    max-height: 360px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.scope-dropdown__search {
    position: relative;
    margin-bottom: 0.375rem;
    flex-shrink: 0;
}

.scope-dropdown__search-icon {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    pointer-events: none;
}

.scope-dropdown__search-input {
    width: 100%;
    padding: 0.45rem 2rem 0.45rem 1.875rem;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface-muted);
    color: var(--color-text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.scope-dropdown__search-input:focus {
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.scope-dropdown__search-clear {
    position: absolute;
    right: 0.375rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 0.15rem;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    line-height: 1;
}

.scope-dropdown__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.scope-dropdown__empty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 0.75rem;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

/* Archive list items */
.archive-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: none;
    background: transparent;
    text-align: left;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
    min-height: 48px;
    flex-shrink: 0;
}

.archive-item:hover,
.archive-item--focused {
    background: var(--color-surface-muted);
}

.archive-item--selected {
    background: rgba(37, 99, 235, 0.07);
}

.archive-item--selected:hover,
.archive-item--selected.archive-item--focused {
    background: rgba(37, 99, 235, 0.12);
}

.archive-item__icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--color-surface-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.archive-item--selected .archive-item__icon,
.archive-item__icon--all {
    color: var(--color-brand-primary);
    background: rgba(37, 99, 235, 0.1);
}

.archive-item__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.archive-item__name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.archive-item__count {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.archive-item__check {
    color: var(--color-brand-primary);
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* Archive status pills */
.archive-status-pill {
    font-size: 0.67rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    text-transform: capitalize;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

.archive-status-pill--completed {
    background: rgba(16, 185, 129, 0.12);
    color: rgb(5, 150, 105);
}

.archive-status-pill--processing {
    background: rgba(37, 99, 235, 0.1);
    color: var(--color-brand-primary);
}

.archive-status-pill--failed {
    background: rgba(239, 68, 68, 0.1);
    color: rgb(220, 38, 38);
}

.archive-status-pill--queued,
.archive-status-pill--pending,
.archive-status-pill--default {
    background: rgba(161, 161, 170, 0.15);
    color: var(--color-text-secondary);
}

.archive-status-pill--encrypted {
    background: rgba(168, 85, 247, 0.12);
    color: rgb(147, 51, 234);
}

/* Mobile drawer handle */
.scope-drawer__handle {
    display: none;
}

/* Mobile: bottom drawer */
@media (max-width: 640px) {
    .archive-drawer-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        z-index: 100;
        cursor: pointer; /* iOS Safari requires cursor:pointer to fire click on first tap */
    }

    .scope-dropdown--enhanced {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100% !important;
        min-width: unset;
        max-height: 60vh;
        border-radius: 24px 24px 0 0;
        z-index: 101;
        padding: 0 0.75rem 1.5rem;
        animation: drawer-slide-up 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .scope-drawer__handle {
        display: block;
        width: 36px;
        height: 4px;
        background: var(--color-border);
        border-radius: 2px;
        margin: 0.75rem auto 0.875rem;
        flex-shrink: 0;
    }

    @keyframes drawer-slide-up {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
}

/* Desktop: transparent backdrop + absolute dropdown */
@media (min-width: 641px) {
    .archive-drawer-backdrop {
        position: fixed;
        inset: 0;
        background: transparent;
        z-index: 5;
        cursor: pointer;
    }

    .scope-dropdown--enhanced {
        z-index: 6;
    }

    .scope-drawer__handle {
        display: none !important;
    }
}

.date-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    width: 300px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    z-index: 7;
}

.date-popover input[type="date"] {
    color-scheme: light;
}

:root[data-theme='dark'] .date-popover input[type="date"] {
    color-scheme: dark;
}

.date-popover__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.date-popover__body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-control-xl,
.form-select-lg,
.btn-xl {
    height: 60px;
    font-size: 1rem;
    border-radius: 16px;
}

.form-select-modern {
    border-radius: 14px;
    border: 1px solid rgba(37, 99, 235, 0.25);
    padding: 0.55rem 2.5rem 0.55rem 0.85rem;
    font-weight: 500;
    color: var(--color-text-primary);
    background-color: var(--color-surface);
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%231D4ED8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 12px;
    appearance: none;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.form-select-modern:focus {
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: none;
}

.search-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.search-hints .hint {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 0.82rem;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.search-hints .hint:hover {
    border-color: var(--color-brand-primary);
    color: var(--color-brand-primary);
    background: rgba(37, 99, 235, 0.08);
}

.search-hints-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.search-hints-row .search-hints {
    flex: 1;
    min-width: 240px;
}

.search-hints.subtle {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.search-hints.subtle span {
    display: inline-flex;
    align-items: center;
}

.search-meta.compact-gap {
    margin-top: 0.45rem;
}

.advanced-filters-panel {
    margin-top: 0.5rem;
    padding: 1.5rem;
    border-radius: 28px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-muted);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.advanced-section+.advanced-section {
    border-top: 1px solid var(--color-border);
    padding-top: 1.5rem;
}

.advanced-section__header h4 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--color-brand-deep);
}

.advanced-section__header p {
    margin: 0.15rem 0 0;
    color: var(--color-text-secondary);
}

.advanced-section__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.filter-field {
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 1rem 1.25rem;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    box-shadow: var(--shadow-xs);
}

.filter-field--full {
    grid-column: 1 / -1;
}

.filter-field__label {
    font-weight: 600;
    color: var(--color-brand-deep);
    font-size: 0.95rem;
}

.filter-field__hint {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.85rem;
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 32px;
    padding: 0 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.filter-pill.soft {
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
}

.filter-pill--active {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--color-brand-primary);
    color: var(--color-brand-primary);
}

.filter-clear-all {
    font-size: 0.8rem;
}

.search-context-strip {
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    min-height: 44px;
    padding: 0.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-context-strip__scope {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.search-context-strip__divider {
    width: 1px;
    height: 18px;
    background: var(--color-border);
    flex-shrink: 0;
}

.search-context-strip__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    flex: 1;
}

.emails-results {
    border: 1px solid var(--color-border);
    border-radius: 28px;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
}

.emails-results__header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-summary {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-end;
}

.search-summary__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.email-list {
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    overflow: hidden;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    margin-top: 1.25rem;
}

.email-card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text-primary);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.email-card:last-child {
    border-bottom: none;
}

.email-card:hover,
.email-card:focus-within {
    background: rgba(37, 99, 235, 0.04);
}

.email-card--unread {
    background: rgba(37, 99, 235, 0.05);
}

.email-card--active {
    border-left: 4px solid var(--color-brand-primary);
    background: rgba(37, 99, 235, 0.08);
    padding-left: calc(1.75rem - 4px);
}

.email-card--compact.email-card--active {
    padding-left: calc(1.1rem - 4px);
}

.email-card--cozy.email-card--active {
    padding-left: calc(2rem - 4px);
}

.email-card--cozy {
    padding: 1.65rem 2rem;
    gap: 0.85rem;
}

.email-card--compact {
    padding: 0.9rem 1.1rem;
    gap: 0.35rem;
}

.email-card--compact .email-card__subject-line {
    font-size: 0.95rem;
}

.email-card--compact .email-card__from-line,
.email-card--compact .email-card__snippet {
    font-size: 0.9rem;
}

.email-card--compact .match-chip,
.email-card--compact .match-summary {
    font-size: 0.8rem;
}

.email-card__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.email-card__subject-line {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    font-size: 1rem;
}

.match-strength {
    display: inline-flex;
    gap: 0.2rem;
    align-items: center;
}

.match-strength span {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: var(--color-border);
    opacity: 0.6;
}

.match-strength--high span {
    background: #16a34a;
    opacity: 1;
}

.match-strength--medium span {
    background: #f59e0b;
    opacity: 0.9;
}

.match-strength--low span {
    background: #f97316;
    opacity: 0.8;
}

.match-strength--unknown span {
    background: var(--color-border);
    opacity: 0.5;
}

.email-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.email-card__actions {
    display: inline-flex;
    gap: 0.35rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.email-card:hover .email-card__actions,
.email-card:focus-within .email-card__actions,
.email-card--active .email-card__actions {
    opacity: 1;
}

.icon-button {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.icon-button:hover {
    color: var(--color-brand-primary);
    border-color: rgba(37, 99, 235, 0.4);
    background: rgba(37, 99, 235, 0.1);
}

.email-card__from-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.email-card__from-name {
    font-weight: 600;
    color: var(--color-text-primary);
}

.match-summary {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-brand-primary);
}

.attachment-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.attachment-pill-row .attachment-pill {
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
}

.attachment-pill--more {
    border: 1px dashed var(--color-border);
    background: transparent;
}

.email-card__snippet {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.email-card__snippet mark {
    background: rgba(250, 204, 21, 0.4);
    border-radius: 4px;
    padding: 0 0.15rem;
}

.result-group-label {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin: 1.25rem 0 0.35rem;
}

.density-toggle {
    display: inline-flex;
    gap: 0.4rem;
}

.density-toggle .btn {
    border-radius: 999px;
    font-weight: 600;
    padding: 0.35rem 0.9rem;
}

.saved-filters-panel {
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 1.5rem;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.pinned-threads-panel {
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 1.25rem 1.5rem;
    background: var(--color-surface);
    box-shadow: var(--shadow-xs);
    margin-bottom: 1.25rem;
}

.pinned-threads-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pinned-threads-stack {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.85rem;
}

.pinned-thread-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    background: var(--color-surface-muted);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.pinned-thread-card:hover,
.pinned-thread-card:focus-visible {
    border-color: var(--color-brand-primary);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.pinned-thread-card__stack {
    display: flex;
    align-items: flex-start;
}

.stack-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: var(--color-brand-primary);
    font-weight: 600;
}

.stack-indicator--multi span {
    font-size: 0.85rem;
}

.pinned-thread-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pinned-thread-card__title {
    font-weight: 600;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.pinned-thread-card__meta {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    overflow-wrap: anywhere;
}

.pinned-thread-card__snippet {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow-wrap: anywhere;
}

.pinned-thread-card__actions {
    display: flex;
    align-items: flex-start;
}

.saved-filters__header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.saved-filters__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.saved-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    padding: 0.45rem 0.9rem;
    background: var(--color-surface-muted);
    font-weight: 600;
    color: var(--color-text-primary);
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.saved-filter-chip:hover,
.saved-filter-chip:focus-visible {
    border-color: var(--color-brand-primary);
    color: var(--color-brand-primary);
    background: rgba(37, 99, 235, 0.08);
}

.saved-filter-chip--active {
    border-color: var(--color-brand-primary);
    color: var(--color-brand-primary);
    background: rgba(37, 99, 235, 0.12);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.15);
}

.saved-filter-chip__delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
}

.saved-filter-chip__delete:hover {
    color: var(--color-brand-primary);
}

.saved-filter-chip__delete i {
    pointer-events: none;
}

.saved-filters-empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.75rem 0;
}

.saved-filters-empty__icon {
    font-size: 24px;
    color: var(--color-text-secondary);
    margin-bottom: 0.25rem;
}

.saved-filters-empty__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.saved-filters-empty__body {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin: 0;
    max-width: 340px;
    line-height: 1.5;
}

.emails-results--loading .email-card {
    pointer-events: none;
}

.loading-summary {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.email-list--skeleton {
    background: var(--color-surface-muted);
}

.email-card--skeleton {
    border-bottom: 1px solid var(--color-border);
    background: transparent;
    gap: 0.5rem;
}

.skeleton-line,
.skeleton-chip {
    position: relative;
    overflow: hidden;
    border-radius: 999px;
    background: var(--color-border);
}

.skeleton-line {
    height: 0.85rem;
}

.skeleton-line--wide {
    width: 80%;
}

.skeleton-line--long {
    width: 60%;
}

.skeleton-line--medium {
    width: 40%;
}

.skeleton-line--short {
    width: 30%;
}

.skeleton-chip-row {
    display: flex;
    gap: 0.45rem;
    margin-top: 0.35rem;
}

.skeleton-chip {
    width: 90px;
    height: 0.75rem;
}

.skeleton-chip--sm {
    width: 60px;
}

.skeleton-line::after,
.skeleton-chip::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: skeleton-shimmer 1.4s infinite;
}

@keyframes skeleton-shimmer {
    100% {
        transform: translateX(100%);
    }
}

.email-row {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text-primary);
    transition: background 0.2s ease;
}

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

.email-row:hover {
    background: rgba(37, 99, 235, 0.06);
}

.email-row--unread {
    background: rgba(37, 99, 235, 0.04);
}

.email-row__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.4rem;
}

.email-row__subject-line {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1rem;
}

.email-row__signals {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.match-chip {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-weight: 600;
}

.email-row__meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.email-row__from {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.email-row__from-name {
    font-weight: 600;
}

.email-row__address {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
}

.email-row__attachment {
    margin-left: 0.6rem;
    color: var(--color-text-secondary);
}

.email-row__attachment-btn {
    margin-left: 0.6rem;
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    padding: 0;
}

.email-row__snippet {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.email-row__snippet mark {
    background: rgba(250, 204, 21, 0.4);
    color: var(--color-text-primary);
    border-radius: 6px;
    padding: 0 0.2rem;
}

.email-row__date {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.match-navigator-floating {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    border-radius: 999px;
    padding: 0.65rem 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 1020;
}

:root[data-theme='dark'] .match-navigator-floating {
    box-shadow: 0 30px 60px rgba(2, 6, 23, 0.8);
}

.email-body-toolbar {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1rem;
    width: 100%;
    margin-bottom: 1.5rem;
}

.keyword-jump {
    white-space: nowrap;
}

.email-body-card mark.search-hit {
    background: rgba(250, 204, 21, 0.4);
    color: var(--color-text-primary);
    border-radius: 4px;
    padding: 0 0.15rem;
}

.emails-pagination {
    margin-top: 1.5rem;
}

.secondary-grid {
    margin-top: 2rem;
}

.stat-card.compact {
    padding: 1.25rem 1.5rem;
}

.settings-wrapper {
    gap: 2.5rem;
}

.settings-pill-stack {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.75rem;
}

.twofactor-setup {
    border: 1px dashed var(--color-border);
    border-radius: 24px;
    padding: 1.5rem;
    background: var(--color-surface-muted);
}

.twofactor-setup__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    align-items: center;
}

.twofactor-setup__qr {
    width: 160px;
    height: 160px;
    border-radius: 16px;
    border: 1px solid var(--color-border);
    padding: 0.5rem;
    background: var(--color-app-bg);
    object-fit: contain;
}

.search-preferences {
    align-items: stretch;
}

.pref-group .btn {
    min-width: 140px;
    border-radius: 999px;
    font-weight: 600;
}

.pref-group .btn+.btn {
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-card {
    border: 1px solid var(--color-border);
    border-radius: 32px;
    padding: 2rem;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings-card span.status-pill {
    align-self: flex-start;
}

.settings-card .hero-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.settings-card h2 {
    margin-bottom: 0.35rem;
}

.settings-roadmap,
.settings-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.settings-roadmap li,
.settings-list li {
    border: 1px solid var(--color-border);
    border-radius: 18px;
    padding: 1rem 1.25rem;
    background: var(--color-surface-muted);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.settings-roadmap small {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
}

.email-detail-wrapper {
    gap: 2rem;
}

.email-hero .detail-back {
    margin-bottom: 1rem;
}

.email-address-rows {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.email-address-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.email-address-label {
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    min-width: 56px;
}

.email-address-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.email-address-pill {
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-muted);
    padding: 0.25rem 0.9rem;
    font-size: 0.85rem;
}

.email-hero-meta {
    display: flex;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.email-info-grid {
    gap: 1.5rem;
}

.email-meta-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
}

.email-meta-list dt {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
}

.email-meta-list dd {
    margin: 0;
    color: var(--color-text-primary);
}

.metadata-value-truncate {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}

.email-snippet-card,
.email-attachments-card {
    border-radius: 28px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
}

.email-attachments-card {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.attachment-pill {
    border-radius: 18px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-muted);
    padding: 0.8rem 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    text-align: left;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.attachment-pill:hover {
    border-color: var(--color-brand-accent);
    color: var(--color-brand-accent);
}

.email-body-card {
    border-radius: 32px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.email-body-toggle .btn.active,
.email-body-toggle .btn:focus {
    background: var(--color-brand-primary);
    color: #fff;
}

.email-body-html {
    border-radius: 24px;
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    min-height: 280px;
    background: var(--color-surface);
}

.email-body-text {
    border-radius: 24px;
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    background: var(--color-surface-muted);
    font-family: 'JetBrains Mono', 'Fira Mono', monospace;
    white-space: pre-wrap;
    min-height: 280px;
    margin: 0;
}

.email-body-empty {
    border-radius: 24px;
    border: 1px dashed var(--color-border);
    padding: 1.5rem;
    text-align: center;
}

.email-hero .action-pill-group {
    margin-top: 1rem;
}

.email-body-card .hero-eyebrow {
    letter-spacing: 0.2em;
}

.settings-card.span-2 {
    grid-column: span 2;
}

@media (max-width: 992px) {
    .settings-card.span-2 {
        grid-column: span 1;
    }
}

.settings-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

/* Storage add-on section */
.storage-bar { height: 10px; border-radius: 5px; background: var(--color-surface-muted); overflow: hidden; }
.storage-bar__fill { height: 100%; border-radius: 5px; min-width: 2px; }
.storage-addon-stepper { display: inline-flex; align-items: center; border: 1px solid var(--color-border); border-radius: 10px; overflow: hidden; background: var(--color-surface); }
.storage-addon-stepper .btn { border: none; border-radius: 0; min-width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; }
.storage-addon-stepper__value { min-width: 40px; text-align: center; font-weight: 600; font-size: 0.95rem; border-left: 1px solid var(--color-border); border-right: 1px solid var(--color-border); padding: 0 0.5rem; line-height: 36px; }
.storage-grandfathered-notice { display: flex; align-items: center; padding: 0.75rem 1rem; border-radius: 12px; background: linear-gradient(135deg, rgba(37,99,235,0.06), rgba(6,182,212,0.06)); border: 1px solid rgba(37,99,235,0.12); font-size: 0.9rem; }
:root[data-theme='dark'] .storage-grandfathered-notice { background: linear-gradient(135deg, rgba(122,184,255,0.08), rgba(93,225,214,0.08)); border-color: rgba(122,184,255,0.15); }
@keyframes skeleton-pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 0.8; } }
@media (max-width: 768px) { .storage-addon-purchase .btn-primary { width: 100%; } }

.status-pill--pending {
    background: color-mix(in srgb, var(--color-progress-warning) 15%, transparent);
    color: var(--color-progress-warning);
}

.detail-dl.compact dt {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.detail-dl.compact dd {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.mono {
    font-family: 'JetBrains Mono', 'Fira Mono', monospace;
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    word-break: break-all;
}

.auth-wrapper {
    max-width: 1100px;
    width: 100%;
    box-sizing: border-box;
}

.auth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 2.5rem;
    align-items: start;
}

.auth-hero {
    gap: 1rem;
}

.auth-hero-card {
    border: 1px solid var(--color-border);
    border-radius: 36px;
    padding: 2rem;
    background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.15), transparent 55%), var(--color-surface);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 420px;
}

.auth-hero-card__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.3em;
    font-size: 0.8rem;
    color: var(--color-brand-accent);
}

.auth-hero-card--gradient {
    color: var(--color-text-primary);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(6, 182, 212, 0.08)), var(--color-surface);
}

:root[data-theme='dark'] .auth-hero-card--gradient {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(6, 182, 212, 0.15)), rgba(15, 23, 42, 0.85);
}

.auth-pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.auth-pill {
    border-radius: 999px;
    border: 1px solid rgba(37, 99, 235, 0.35);
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    background: rgba(37, 99, 235, 0.06);
    color: var(--color-brand-primary);
}

:root[data-theme='dark'] .auth-pill {
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(148, 163, 184, 0.08);
    color: #e0f2fe;
}

.auth-pill strong {
    font-weight: 700;
    margin-right: 0.3rem;
}

.auth-highlights {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    color: var(--color-text-secondary);
}

.auth-highlights li {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    font-size: 0.95rem;
    line-height: 1.4;
}

.auth-highlights i {
    color: var(--color-brand-accent);
    font-size: 1rem;
    margin-top: 0.15rem;
}

.auth-card {
    border: 1px solid var(--color-border);
    border-radius: 36px;
    padding: 2.5rem;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-card__header h2 {
    margin-bottom: 0.35rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-field label {
    font-weight: 600;
}

.form-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.modern-input {
    border-radius: 18px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-muted);
    padding: 0.85rem 1rem;
    color: var(--color-text-primary);
}

.modern-input:focus {
    border-color: var(--color-brand-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    background: var(--color-surface);
}

.auth-alert {
    border-radius: 16px;
    margin-bottom: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.auth-social {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.social-btn {
    border-radius: 999px;
    border: 1px solid var(--color-border);
    padding: 0.85rem 1rem;
    background: transparent;
    color: var(--color-text-primary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
    position: relative;
    overflow: hidden;
}

.social-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.15);
}

.social-btn--google {
    border-color: rgba(0, 0, 0, 0.1);
    background: #ffffff;
    color: #1f1f1f;
}

.social-btn--google:hover {
    border-color: rgba(66, 133, 244, 0.55);
    color: #174ea6;
    box-shadow: 0 10px 30px rgba(66, 133, 244, 0.18);
}

:root[data-theme='dark'] .social-btn--google {
    background: rgba(248, 250, 252, 0.08);
    border-color: rgba(248, 250, 252, 0.15);
    color: #e2e8f0;
}

:root[data-theme='dark'] .social-btn--google:hover {
    background: rgba(66, 133, 244, 0.15);
    border-color: rgba(66, 133, 244, 0.6);
    color: #dbeafe;
    box-shadow: 0 14px 32px rgba(66, 133, 244, 0.28);
}

.social-btn--microsoft {
    border-color: rgba(37, 99, 235, 0.5);
    background: rgba(37, 99, 235, 0.05);
    color: var(--color-brand-primary);
}

.social-btn--microsoft:hover {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.8);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.2);
}

.social-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    pointer-events: none;
}

.social-btn:focus-visible,
.auth-primary-button:focus-visible {
    outline: 3px solid rgba(93, 225, 214, 0.45);
    outline-offset: 3px;
}

.auth-primary-button {
    border-radius: 18px;
    font-size: 1.05rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 35px rgba(37, 99, 235, 0.25);
}

.auth-footer {
    text-align: center;
    font-size: 0.95rem;
    color: var(--color-text-secondary);
}

.auth-link {
    color: var(--color-brand-primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

.upload-wrapper {
    container-type: inline-size;
    gap: 2rem;
}

.upload-hero__meta,
.upload-hero-stats {
    display: flex;
    gap: 0.6rem;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-end;
}

.upload-hero__meta .airy-metric,
.upload-hero-stats div {
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 0.85rem 1.1rem;
    text-align: left;
    background: var(--color-surface);
    box-shadow: none;
    flex: 0 1 auto;
    min-width: 0;
}

.upload-hero__meta .airy-metric {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.upload-hero__meta .airy-metric--wide {
    min-width: min(280px, 100%);
}

@media (max-width: 992px) {
    .upload-hero__meta,
    .upload-hero-stats {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .upload-hero__meta .airy-metric,
    .upload-hero-stats div {
        flex: 0 1 auto;
        min-width: 120px;
    }
}

.upload-hero__meta .airy-metric__value,
.upload-hero-stats span {
    display: block;
    font-weight: 600;
}

.upload-hero__meta .airy-metric__label {
    color: var(--color-text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.upload-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.upload-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
    gap: 2rem;
    align-items: start;
}

@media (max-width: 992px) {
    .upload-grid {
        grid-template-columns: 1fr;
    }
}

.upload-dropzone {
    border: 2px dashed color-mix(in oklch, var(--color-brand-primary) 25%, var(--color-border));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: clamp(320px, 40vh, 460px);
    padding: 3.5rem 2rem;
    text-align: center;
    background: color-mix(in oklch, var(--color-brand-primary) 2%, var(--color-surface));
    position: relative;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    overflow: hidden;
    cursor: pointer;
}

.upload-dropzone__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.upload-dropzone__content {
    pointer-events: none;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.upload-dropzone--drag {
    border-color: var(--color-brand-primary);
    background: color-mix(in oklch, var(--color-brand-primary) 5%, var(--color-surface));
    transform: translateY(-1px);
}

.upload-dropzone--selected {
    border-color: rgba(16, 185, 129, 0.6);
    background: rgba(16, 185, 129, 0.08);
}

.airy-dropzone__ico {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in oklch, var(--color-brand-primary) 8%, var(--color-surface));
    color: var(--color-brand-primary);
    font-size: 1.5rem;
    margin-bottom: 0.4rem;
}

.airy-dropzone__title {
    color: var(--color-text-primary);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.5;
}

.airy-dropzone__title .mono {
    color: var(--color-text-secondary);
    font-family: var(--font-family-mono, ui-monospace, monospace);
    font-size: 0.9rem;
    white-space: nowrap;
}

.airy-dropzone__hint {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
}

.airy-dropzone__lock {
    color: var(--color-text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    margin-top: 0.4rem;
}

.upload-filechip {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-surface);
    gap: 1rem;
    pointer-events: auto;
}

.upload-filechip__remove {
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    pointer-events: auto;
}

.upload-meta {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.upload-radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.upload-radio {
    display: flex;
    gap: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 0.85rem 1rem;
    align-items: center;
    background: var(--color-surface-muted);
}

.upload-radio input {
    margin-top: 0.15rem;
}

.upload-radio span {
    display: block;
    color: var(--color-text-secondary);
    font-size: 0.85rem;
}

.upload-plan-card {
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: 20px;
    padding: 1rem 1.25rem;
    background: rgba(37, 99, 235, 0.05);
}

.upload-note {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    margin: 0;
}

.upload-faq.export-guide {
    border: 0;
    border-radius: 0;
    overflow: visible;
}

.upload-faq .export-guide__toggle.faq-row {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    color: var(--color-text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    text-align: left;
    width: 100%;
}

.upload-faq .export-guide__toggle.faq-row:hover {
    background: var(--color-surface);
    border-color: color-mix(in oklch, var(--color-brand-primary) 40%, var(--color-border));
}

.upload-faq .faq-row__chev {
    margin-left: auto;
    transition: transform 0.25s ease;
}

.upload-faq .faq-row.is-open .faq-row__chev {
    transform: rotate(180deg);
}

.upload-faq .export-guide__content {
    background: transparent;
    padding: 0.85rem 1rem 0;
}

.upload-faq .export-guide__tabs {
    background: var(--color-surface-muted);
}

.airy-note {
    background: transparent;
    border-top: 1px solid var(--color-border);
    border-radius: 0;
    padding: 1.25rem 0 0;
}

.airy-note .eyebrow {
    margin: 0 0 0.5rem;
}

.airy-note__big {
    color: var(--color-text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin: 0.3rem 0 0.2rem;
}

.airy-note__muted {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    margin: 0;
}

.sec-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sec-opt {
    align-items: center;
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    font-size: 0.85rem;
    gap: 0.6rem;
    min-height: 44px;
    padding: 0.5rem 0.2rem;
    position: relative;
}

.sec-opt input {
    height: 1px;
    opacity: 0;
    position: absolute;
    width: 1px;
}

.sec-opt__dot {
    border: 1.5px solid var(--color-border);
    border-radius: 999px;
    flex-shrink: 0;
    height: 16px;
    position: relative;
    transition: border-color 0.15s ease, background 0.15s ease;
    width: 16px;
}

.sec-opt.is-sel .sec-opt__dot {
    background: var(--color-brand-primary);
    border-color: var(--color-brand-primary);
    box-shadow: inset 0 0 0 3px var(--color-surface);
}

.sec-opt:focus-within .sec-opt__dot {
    outline: 3px solid rgba(93, 225, 214, 0.35);
    outline-offset: 2px;
}

.sec-opt__body {
    min-width: 0;
}

.sec-opt__title {
    color: var(--color-text-primary);
    font-weight: 600;
}

.sec-opt__sub {
    color: var(--color-text-muted);
}

.sec-opt.is-disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.btn-upload {
    align-items: center;
    border: 0 !important;
    display: inline-flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.85rem 1rem !important;
    width: 100%;
}

.btn-upload:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none !important;
}

.zero-access-upload-panel {
    margin-top: 0.25rem;
}

@container (max-width: 720px) {
    .upload-hero {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.9rem;
    }

    .upload-hero--airy h1 {
        font-size: clamp(1.9rem, 12cqw, 2.5rem);
        max-width: 100%;
    }

    .upload-hero--airy .text-muted {
        max-width: 100%;
    }

    .upload-hero__meta {
        flex-wrap: wrap;
        justify-content: flex-start;
        margin-top: 0;
    }

    .upload-hero__meta .airy-metric {
        align-items: baseline;
        border-radius: 999px;
        display: inline-flex;
        flex-direction: row;
        gap: 0.35rem;
        max-width: 100%;
        padding: 0.42rem 0.65rem;
    }

    .upload-hero__meta .airy-metric__value {
        font-size: 0.82rem;
        white-space: normal;
    }

    .upload-hero__meta .airy-metric__label {
        font-size: 0.72rem;
        white-space: nowrap;
    }

    .upload-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .upload-main,
    .upload-aside {
        min-width: 0;
    }

    .upload-dropzone {
        min-height: 280px;
        padding: 2rem 1rem;
    }

    .airy-dropzone__title {
        font-size: 0.94rem;
        max-width: 30ch;
    }

    .sec-opt {
        align-items: flex-start;
    }

    .sec-opt__sub {
        display: block;
        margin-top: 2px;
    }
}

.zero-access-card {
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 24px;
    background: rgba(249, 250, 251, 0.6);
}

.mailbox-detail-wrapper .zero-access-card {
    background: var(--color-surface);
    border: 1px solid rgba(148, 163, 184, 0.28);
}

.zero-access-toggle .form-check-input {
    width: 3rem;
    height: 1.6rem;
}

.zero-access-toggle .form-check-input:checked {
    background-color: var(--color-brand-primary);
    border-color: var(--color-brand-primary);
}

.zero-access-toggle .form-check-label {
    font-weight: 600;
    margin-left: 0.75rem;
}

.zero-access-keybundle {
    border: 1px solid var(--color-border);
    border-radius: 18px;
    padding: 1.25rem;
    background: var(--color-surface);
}

.zero-access-keybundle__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.zero-access-keybundle__value {
    display: block;
    word-break: break-all;
    font-size: 0.85rem;
    padding: 0.65rem;
    border-radius: 0.75rem;
    background: var(--color-surface-muted);
    border: 1px dashed rgba(148, 163, 184, 0.5);
}

.zero-access-keybundle__actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.zero-access-keybundle__meta {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.zero-access-keybundle__meta .label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
}

.zero-access-keybundle__meta .value {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.85rem;
    word-break: break-all;
}

.zero-access-detail__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.zero-access-detail__grid .label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
}

.zero-access-detail__grid .value {
    display: block;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.upload-progress-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: radial-gradient(circle at 25% 25%, rgba(37, 99, 235, 0.12), transparent 55%), var(--color-surface);
    box-shadow: 0 25px 55px rgba(15, 23, 42, 0.2);
}

.upload-progress-card button {
    align-self: flex-start;
}

.usage-progress.jumbo {
    height: 22px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.25);
    padding: 0.2rem;
}

.usage-progress.jumbo .progress-bar {
    border-radius: 999px;
    background: linear-gradient(120deg, #2563eb 0%, #06b6d4 70%);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.35);
    transition: width 0.25s ease;
    height: 100%;
}

.success-card {
    border: 1px solid rgba(16, 185, 129, 0.4);
    background: radial-gradient(circle at 30% 20%, rgba(16, 185, 129, 0.2), transparent 60%), rgba(16, 185, 129, 0.08);
    animation: success-card-enter 300ms ease-out;
    max-width: 560px;
    margin: 0 auto;
}

.success-card__countdown {
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    transition: value 1s linear;
}

@keyframes success-card-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subtle-card {
    background: var(--color-surface-muted);
    border-radius: 24px;
    border: 1px dashed rgba(148, 163, 184, 0.4);
}

.extra-small {
    font-size: 0.75rem;
}

@media (max-width: 768px) {
    .auth-card {
        padding: 1.75rem;
        order: -1;
    }

    .auth-hero-card {
        padding: 1.5rem;
        border-radius: 24px;
        max-width: none;
    }

    .auth-hero-card h1 {
        font-size: 1.25rem;
    }

    .auth-hero-card .auth-highlights {
        display: none;
    }

    .auth-wrapper {
        padding-left: 0;
        padding-right: 0;
        padding-top: 1.5rem;
        padding-bottom: 2rem;
    }

    .auth-grid {
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .auth-card,
    .auth-hero-card {
        border-radius: 24px;
    }

    .auth-grid {
        gap: 1rem;
    }

    .auth-hero-card {
        display: none;
    }
}

@media (max-width: 992px) {
    .search-primary {
        grid-template-columns: 1fr;
    }

    .form-control-xl,
    .form-select-lg,
    .btn-xl {
        height: 56px;
    }
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-brand-deep);
}

.stat-trend {
    font-size: 0.9rem;
    color: var(--color-progress-success);
}

.resource-panel {
    border: 1px solid var(--color-border);
    border-radius: 28px;
    padding: 2.5rem;
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.resource-panel h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--color-brand-deep);
}

.usage-row {
    margin-bottom: 1.25rem;
}

.usage-row:last-child {
    margin-bottom: 0;
}

.usage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    color: var(--color-text-secondary);
    font-weight: 600;
}

.usage-progress {
    height: 12px;
    border-radius: 999px;
    background-color: var(--color-surface-muted);
    overflow: hidden;
}

.usage-progress .progress-bar {
    background: var(--color-brand-gradient);
    border-radius: 999px;
}

.getting-started {
    border-radius: 28px;
    padding: 2.5rem;
    background-color: var(--color-surface-muted);
    border: 1px solid var(--color-border);
}

.getting-started ol {
    list-style: none;
    counter-reset: steps;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.getting-started li {
    counter-increment: steps;
    background-color: var(--color-surface);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.getting-started li::before {
    content: counter(steps);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-weight: 600;
    color: #fff;
    background: var(--color-brand-gradient);
    margin-bottom: 0.75rem;
}

.roadmap {
    border: 1px solid var(--color-border);
    border-radius: 32px;
    padding: 2.5rem;
    box-shadow: var(--shadow-sm);
    background-color: var(--color-surface);
}

.roadmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.75rem;
}

.roadmap-column h4 {
    font-size: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
}

.roadmap-item {
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background-color: var(--color-surface-muted);
}

.roadmap-item strong {
    display: block;
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
    color: var(--color-brand-deep);
}

.roadmap-item span {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.theme-toggle {
    border-radius: 999px;
    border: 1px solid var(--color-border-strong);
    background-color: var(--color-surface);
    color: var(--color-text-primary);
    width: auto;
    padding: 0.35rem 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}

.theme-toggle:hover {
    border-color: var(--color-brand-accent);
    color: var(--color-brand-accent);
}

@media (max-width: 640.98px) {
    .theme-toggle__label {
        display: none;
    }

    .theme-toggle {
        padding: 0.3rem 0.55rem;
    }
}

/* Public landing page – hamburger menu button (mobile only) */
.public-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--color-border-strong);
    border-radius: 999px;
    color: var(--color-text-primary);
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    padding: 0;
    cursor: pointer;
}

.public-hamburger:hover {
    border-color: var(--color-brand-accent);
    color: var(--color-brand-accent);
}

/* Public landing page – mobile nav dropdown */
.public-mobile-nav {
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
    padding: 0.5rem 0 0;
}

.public-mobile-nav--open {
    display: flex;
}

/* Relax pill border-radius when mobile nav is open so content isn't clipped */
.top-row--guest:has(.public-mobile-nav--open) {
    border-radius: 20px;
}

.public-mobile-nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-align: center;
}

.public-mobile-nav a:hover {
    background: rgba(148, 163, 184, 0.12);
    color: var(--color-brand-primary);
}

/* Public landing page – floating theme toggle (mobile only, bottom-right) */
.public-theme-toggle-floating {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 50;
}

.public-theme-toggle-floating .theme-toggle {
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.15);
}

:root[data-theme='dark'] .public-theme-toggle-floating .theme-toggle {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.evermail-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    text-transform: lowercase;
    color: #49d9c9;
    letter-spacing: 0.04em;
    font-size: 1rem;
}

.evermail-logo__mark {
    width: 42px;
    height: auto;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

@media (max-width: 768px) {
    .hero-section {
        padding: 2rem;
    }

    .home-wrapper {
        padding: 3rem 1rem 4rem;
    }

    .cta-group {
        flex-direction: column;
        align-items: stretch;
    }

    .email-address-row {
        flex-direction: column;
    }

    .email-hero-meta {
        flex-direction: column;
        gap: 0.75rem;
    }

}

/* Onboarding wizard — legacy rules superseded by auth-styles.css design system.
   Kept as comments for reference. */


.wizard-step-list {
    border: none;
    gap: 0.75rem;
}

.wizard-step {
    border: 1px solid var(--color-border);
    border-radius: 18px;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    background-color: var(--color-surface-muted);
    padding: 1rem 1.25rem;
}

.wizard-step.active {
    border-color: var(--color-brand-primary);
    background-color: rgba(37, 99, 235, 0.08);
}

.wizard-step__index {
    font-weight: 600;
    color: var(--color-brand-primary);
    font-size: 0.9rem;
}

.onboarding-values {
    padding: 2.25rem;
    border-radius: 32px;
}

.onboarding-value-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.onboarding-value-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    height: 100%;
}

.onboarding-value-card h3 {
    margin-bottom: 0.75rem;
}

.onboarding-value-card p {
    margin-bottom: 0;
}

.onboarding-plans__intro {
    max-width: 640px;
    margin: 0 auto;
}

.onboarding-plans__grid {
    margin-top: 2rem;
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.plan-grid--readonly {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.plan-card {
    border-radius: 24px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.plan-card:hover {
    border-color: var(--color-border-strong);
    transform: translateY(-2px);
}

.plan-card--current {
    border-color: var(--color-brand-primary);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--color-brand-primary);
}

.plan-card--current:hover {
    border-color: var(--color-brand-primary);
}

[data-theme='dark'] .plan-card--current {
    box-shadow: var(--shadow-lg), 0 0 30px rgba(37, 99, 235, 0.15);
}

.plan-card--recommended {
    position: relative;
    border-color: var(--color-brand-primary);
    box-shadow: var(--shadow-lg);
}

[data-theme='dark'] .plan-card--recommended {
    box-shadow: var(--shadow-lg), 0 0 24px rgba(37, 99, 235, 0.12);
}

.plan-card__badge {
    position: absolute;
    top: -0.7rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-brand-primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.85rem;
    border-radius: 999px;
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.plan-price {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.plan-price small {
    font-size: 0.85rem;
    font-weight: 400;
}

.onboarding-progress__readonly {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.plan-feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.plan-feature-list .bi-check2 {
    color: var(--color-brand-accent);
}

.plan-price,
.wizard-plan__price {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.plan-price strong,
.wizard-plan__price strong {
    font-size: 1.35rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.plan-price--inline {
    margin-top: 0.35rem;
}

.billing-toggle {
    display: inline-flex;
    padding: 0.4rem;
    border-radius: 999px;
    background-color: var(--color-surface-muted);
    gap: 0.25rem;
    justify-content: center;
    margin: 0 auto;
    width: -moz-fit-content;
    width: fit-content;
}

.billing-toggle--inline {
    align-items: center;
    justify-content: center;
    width: 100%;
}

.billing-toggle--compact {
    justify-content: center;
    width: fit-content;
    background: transparent;
    padding: 0;
}

.billing-toggle__option {
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-weight: 500;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.billing-toggle__option span {
    font-size: 0.8rem;
}

.billing-toggle__option.is-active {
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
    color: var(--color-brand-primary);
}

.plan-price__strike {
    text-decoration: line-through;
    color: var(--color-text-secondary);
    margin-right: 0.5rem;
    white-space: nowrap;
}

.plan-price__save {
    color: var(--color-success);
    font-weight: 600;
    margin-left: 0.5rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.annual-upsell-callout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(37, 99, 235, 0.06));
    border: 1px solid rgba(16, 185, 129, 0.2);
    font-size: 0.9rem;
}

.annual-upsell-callout .bi-piggy-bank {
    color: var(--color-success);
    font-size: 1.1rem;
    flex-shrink: 0;
}

[data-theme='dark'] .annual-upsell-callout {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(37, 99, 235, 0.08));
    border-color: rgba(16, 185, 129, 0.25);
}

.wizard-selection-summary {
    background-color: var(--color-surface-muted);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
}

.wizard-plan-summary-card {
    border: 1px solid var(--color-border);
    border-radius: 22px;
    padding: 1.5rem;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.upload-checklist {
    list-style: none;
    padding: 0;
    margin: 2rem auto 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
    color: var(--color-text-secondary);
}

.security-step .alert {
    border-radius: 24px;
}

/* billing-summary-card styles moved to auth-styles.css */

.billing-step-content {
    max-width: 640px;
}

.security-key-setup {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

[data-theme='dark'] .security-key-setup {
    border-top-color: rgba(31, 41, 55, 0.5);
}

.onboarding-readonly {
    padding: 2.5rem;
    border-radius: 32px;
    border: 1px dashed var(--color-border);
    background-color: var(--color-surface-muted);
}

.hero-identity {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
    align-items: center;
}

.hero-identity__pill {
    background: var(--color-surface-muted);
    border-radius: 999px;
    padding: 0.45rem 1rem;
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    color: var(--color-text);
}

.hero-identity__provider {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
}

.security-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.security-choice {
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 1.5rem;
    background: var(--color-surface-muted);
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    cursor: pointer;
}

.security-choice:hover {
    border-color: var(--color-border-strong);
    transform: translateY(-2px);
}

.security-choice.is-selected {
    border-color: var(--color-brand-primary);
    box-shadow: var(--shadow-md);
    background: var(--color-surface);
}

.security-choice.is-selected:hover {
    border-color: var(--color-brand-primary);
}

[data-theme='dark'] .security-choice.is-selected {
    box-shadow: var(--shadow-md), 0 0 20px rgba(37, 99, 235, 0.1);
}

.security-choice__badge {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--color-brand-primary);
}

.security-choice__features {
    list-style: none;
    padding: 0;
    margin: 0 0 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.security-choice__features li {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
}

.security-choice__features li i {
    color: var(--color-brand-accent);
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.security-choice__features li i.bi-shield-exclamation {
    color: var(--color-warning, #d97706);
}

.key-mgmt-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
}

.key-mgmt-option {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 1.25rem;
    background: var(--color-surface-muted);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.key-mgmt-option h5 {
    font-size: 0.9rem;
    margin: 0;
}

.key-mgmt-option.is-selected {
    border-color: var(--color-brand-primary);
    box-shadow: var(--shadow-sm);
    background: var(--color-surface);
}

[data-theme='dark'] .key-mgmt-option.is-selected {
    box-shadow: var(--shadow-sm), 0 0 16px rgba(37, 99, 235, 0.08);
}

.key-mgmt-option .btn {
    margin-top: auto;
    align-self: flex-start;
}

.security-step__links .btn-link {
    color: var(--color-text-secondary);
}

.billing-step {
    border-radius: 22px;
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    background: var(--color-surface-muted);
}

.billing-step__card {
    border-radius: 18px;
    border: 1px solid var(--color-border);
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--color-surface);
}

.billing-step__price strong {
    font-size: 1.3rem;
    display: block;
}

.inline-byok {
    border-radius: 20px;
    border: 1px dashed var(--color-border);
    background: var(--color-surface-muted);
}

.inline-byok__form .form-text {
    font-size: 0.8rem;
}

.inline-byok__preview {
    max-height: 220px;
    overflow-y: auto;
    background: var(--color-code-bg);
    border-radius: 12px;
    padding: 0.75rem;
}

.inline-byok__result {
    border-radius: 18px;
    border: 1px solid var(--color-border);
    padding: 1rem;
    background: var(--color-surface);
}

.inline-byok-panel {
    border: 1px dashed var(--color-border);
    border-radius: 18px;
    padding: 1rem;
    background: var(--color-surface-muted);
}

.onboarding-dev-reset {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid rgba(220, 38, 38, 0.28);
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(220, 38, 38, 0.08), rgba(245, 158, 11, 0.06)),
        var(--color-surface);
}

.onboarding-dev-reset h2 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
}

.onboarding-dev-reset p:last-child {
    margin-bottom: 0;
    color: var(--color-text-secondary);
}

.onboarding-modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
}

.onboarding-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
}

.onboarding-modal__panel {
    position: relative;
    width: min(900px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--color-surface);
    border-radius: 32px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

[data-theme='dark'] .onboarding-modal__panel {
    background: var(--color-surface);
}

.wizard-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 2rem 0 1.5rem;
}

.wizard-plan {
    border: 1px solid var(--color-border);
    border-radius: 22px;
    padding: 1.25rem 1.5rem;
    text-align: left;
    background: var(--color-surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 260px;
}

.wizard-plan.is-selected {
    border-color: var(--color-brand-primary);
    box-shadow: var(--shadow-md);
}

.wizard-plan__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.wizard-plan__header h5 {
    margin-bottom: 0;
}

.wizard-plan__description {
    min-height: 48px;
}

.wizard-plan__price {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 1.05rem;
}

.wizard-plan__features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    margin-top: auto;
}

@media (max-width: 768px) {
    .onboarding-wrapper {
        padding-inline: 1rem;
    }

    .upload-checklist {
        grid-template-columns: 1fr;
    }

    .plan-grid {
        grid-template-columns: 1fr;
    }

    .onboarding-readonly,
    .onboarding-values {
        padding: 1.5rem;
    }

    .onboarding-modal__panel {
        width: 100%;
        max-height: none;
        min-height: 100vh;
        border-radius: 0;
        padding: 1.75rem;
    }

    .onboarding-dev-reset {
        align-items: stretch;
        flex-direction: column;
    }

    .wizard-plan-grid {
        display: flex;
        overflow-x: auto;
        gap: 1rem;
        margin: 1.5rem 0 1rem;
        scroll-snap-type: x mandatory;
        padding-bottom: 0.5rem;
    }

    .wizard-plan {
        min-width: 260px;
        scroll-snap-align: start;
        flex: 0 0 82vw;
    }

    .wizard-flow {
        flex-direction: column;
    }
}

.wizard-flow li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-secondary);
}

.wizard-flow {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1.5rem;
    padding: 0;
}

.wizard-flow li span {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-muted);
    font-weight: 600;
}

.wizard-flow li.is-active span {
    background: var(--color-brand-primary);
    color: #fff;
}

.wizard-flow li.is-complete span {
    background: var(--color-success);
    color: #fff;
}

/* ─── Landing page (guest view) ─── */

.landing {
    max-width: 100%;
    overflow-x: hidden;
    background-color: var(--color-app-bg);
    color: var(--color-text-primary);
}

.landing-hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 1.5rem 5rem;
    text-align: center;
}

.landing-hero__inner {
    max-width: 780px;
    margin: 0 auto;
}

.landing-hero__headline {
    font-size: clamp(2.4rem, 5vw, 3.8rem);
    font-weight: 700;
    line-height: 1.15;
    color: var(--color-brand-deep);
    margin-bottom: 1.5rem;
}

.landing-hero__sub {
    font-size: 1.15rem;
    line-height: 1.65;
    color: var(--color-text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.landing-hero__hint {
    font-size: 0.8125rem;
    color: var(--color-text-secondary, #64748b);
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.landing-hero .cta-group {
    justify-content: center;
}

.landing-trust-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2.5rem;
}

.landing-trust-pill {
    border-radius: 999px;
    border: 1px solid var(--color-border);
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-primary);
    background: var(--color-surface);
    font-family: 'JetBrains Mono', 'Fira Mono', monospace;
}

.landing-trust-pill--muted {
    font-family: var(--font-family-base);
    color: var(--color-text-secondary);
    border-color: transparent;
    background: transparent;
}

.landing-trust-divider {
    width: 1px;
    background: var(--color-border);
    align-self: stretch;
    margin: 0 0.25rem;
}

/* Shared landing section */

.landing-section {
    padding: 5rem 1.5rem;
}

.landing-section--muted {
    background: var(--color-surface-muted);
}

.landing-section__inner {
    max-width: 1100px;
    margin: 0 auto;
}

.landing-section__heading {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    color: var(--color-brand-deep);
    margin-bottom: 1rem;
    text-align: center;
}

.landing-section__sub {
    font-size: 1.05rem;
    color: var(--color-text-secondary);
    text-align: center;
    max-width: 620px;
    margin: 0 auto 2.5rem;
}

/* Pain section */

.landing-pain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.landing-pain-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.landing-pain-card__icon {
    font-size: 1.5rem;
    color: var(--color-brand-accent);
    display: block;
    margin-bottom: 1rem;
}

.landing-pain-card p {
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* How it works steps */

.landing-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    margin-top: 2.5rem;
}

.landing-step {
    text-align: center;
    padding: 1.5rem;
}

.landing-step__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-brand-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
}

.landing-step h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-brand-deep);
}

.landing-step p {
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* Supported formats */

.landing-formats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-top: 2rem;
}

.landing-format-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.landing-format-card__ext {
    display: inline-block;
    font-family: 'JetBrains Mono', 'Fira Mono', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-brand-primary);
    margin-bottom: 0.75rem;
}

.landing-format-card strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--color-brand-deep);
}

.landing-format-card p {
    color: var(--color-text-secondary);
    font-size: 0.88rem;
    margin: 0;
    line-height: 1.5;
}

/* Features grid */

.landing-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.75rem;
    margin-top: 2.5rem;
}

.landing-features-grid > :last-child:nth-child(3n + 1) {
    grid-column: 2;
}

.landing-feature-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.landing-feature-card:hover {
    border-color: var(--color-brand-primary);
    transform: translateY(-2px);
}

.landing-feature-card i {
    font-size: 1.5rem;
    color: var(--color-brand-accent);
    display: block;
    margin-bottom: 1rem;
}

.landing-feature-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: var(--color-brand-deep);
}

.landing-feature-card p {
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Security section */

.landing-security-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.landing-security-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.landing-security-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-brand-primary);
}

.landing-security-card h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
    color: var(--color-brand-deep);
}

.landing-security-card p {
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.6;
    font-size: 0.95rem;
    flex: 1;
}

.landing-security-card__rec {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-brand-accent);
}

.landing-security-footer {
    text-align: center;
    color: var(--color-text-secondary);
    margin-top: 2rem;
    font-size: 0.95rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* Use cases */

.landing-usecases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.landing-usecase-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.landing-usecase-card i {
    font-size: 1.4rem;
    color: var(--color-brand-accent);
    margin-bottom: 0.5rem;
}

.landing-usecase-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--color-brand-deep);
}

.landing-usecase-card p {
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.6;
    font-size: 0.95rem;
    flex: 1;
}

.landing-usecase-card__cta {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-brand-primary);
    text-decoration: none;
    margin-top: 0.5rem;
}

.landing-usecase-card__cta:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

/* Pricing */

.landing-pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.landing-pricing-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: relative;
}

.landing-pricing-card--recommended {
    border-color: var(--color-brand-primary);
    box-shadow: var(--shadow-lg);
}

.landing-pricing-card__badge {
    position: absolute;
    top: -0.7rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-brand-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.85rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.landing-pricing-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--color-brand-deep);
}

.landing-pricing-card__audience {
    font-size: 0.88rem;
    color: var(--color-text-secondary);
    margin: 0 0 1.25rem;
}

.landing-pricing-card__price {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    margin-bottom: 1.5rem;
}

.landing-pricing-card__price strong {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--color-brand-deep);
}

.landing-pricing-card__price span {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
}

.landing-pricing-card__price {
    flex-wrap: wrap;
}

.landing-pricing-card__price-note {
    width: 100%;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

.landing-pricing-card__features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.landing-pricing-card__features li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    color: var(--color-text-secondary);
}

.landing-pricing-card__features li i {
    color: var(--color-brand-accent);
    font-size: 1rem;
}

.landing-pricing-annual {
    text-align: center;
    color: var(--color-text-secondary);
    margin-top: 1.5rem;
    font-size: 0.95rem;
}

/* Founder trust */

.landing-founder {
    text-align: center;
    max-width: 680px;
    margin: 0 auto;
}

.landing-founder p {
    color: var(--color-text-secondary);
    line-height: 1.7;
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}

.landing-founder__contact {
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    color: var(--color-brand-primary);
    text-decoration: none;
    font-size: 1rem;
}

.landing-founder__contact:hover {
    text-decoration: underline;
    color: var(--color-link-hover);
}

/* Final CTA */

.landing-final-cta {
    background: var(--color-brand-gradient);
    padding: 5rem 1.5rem;
    text-align: center;
}

.landing-final-cta__inner {
    max-width: 640px;
    margin: 0 auto;
}

.landing-final-cta h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
}

.landing-final-cta p {
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.landing-final-cta .btn-primary {
    background: #fff;
    color: var(--color-brand-primary);
    border-color: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.landing-final-cta .btn-primary:hover {
    background: rgba(255, 255, 255, 0.92);
    transform: translateY(-1px);
}

.landing-final-cta__btn {
    background: #fff;
    color: var(--color-brand-primary);
    border: 2px solid #fff;
    font-weight: 600;
    padding: 0.875rem 2.5rem;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    transition: all 200ms ease;
}

.landing-final-cta__btn:hover {
    background: rgba(255, 255, 255, 0.92);
    color: var(--color-brand-primary);
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

/* Footer */

.landing-footer {
    background: var(--color-brand-deep);
    padding: 3rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
}

:root[data-theme='dark'] .landing-footer {
    background: #020617;
}

.landing-footer__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.landing-footer__brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    color: #fff;
    font-size: 1rem;
}

.landing-footer__logo {
    width: 32px;
    height: auto;
}

.landing-footer__links {
    display: flex;
    gap: 1.5rem;
}

.landing-footer__links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.9rem;
}

.landing-footer__links a:hover {
    color: #fff;
}

.landing-footer__copy {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
    width: 100%;
    text-align: center;
    margin-top: 1rem;
}

.landing-footer__nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.landing-footer__nav strong {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}

.landing-footer__nav a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.82rem;
    transition: color 0.15s;
}

.landing-footer__nav a:hover {
    color: #fff;
}

/* FAQ list */

.landing-faq-list {
    display: grid;
    gap: 1.5rem;
}

.landing-faq-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 1.5rem 2rem;
}

.landing-faq-item h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.landing-faq-item p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

.landing-faq-item a {
    color: var(--color-brand-primary);
    text-decoration: none;
}

.landing-faq-item a:hover {
    text-decoration: underline;
}

:root[data-theme='dark'] .landing-faq-item {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

/* Format specs table */

.format-specs {
    margin-top: 2rem;
}

.format-specs h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.format-specs__table {
    width: 100%;
    max-width: 600px;
    border-collapse: collapse;
}

.format-specs__table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.format-specs__table td:first-child {
    font-weight: 600;
    color: var(--color-text);
    width: 40%;
}

:root[data-theme='dark'] .format-specs__table td {
    border-color: rgba(255, 255, 255, 0.08);
}

/* Format cross-links */

.format-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.format-link {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.format-link:hover {
    border-color: var(--color-brand-primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
    color: var(--color-brand-primary);
}

:root[data-theme='dark'] .format-link {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme='dark'] .format-link:hover {
    border-color: var(--color-brand-accent);
    color: var(--color-brand-accent);
}

/* ── Scroll-reveal animations ── */

[data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-reveal].is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Hero gets a quicker fade-in from slightly above */
[data-reveal="hero"] {
    transform: translateY(-12px);
}

[data-reveal="hero"].is-revealed {
    transform: translateY(0);
}

/* Staggered children (cards, steps, etc.) */
[data-reveal-children] > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

[data-reveal-children] > .is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Scale-up variant for callout / CTA sections */
[data-reveal="scale"] {
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-reveal="scale"].is-revealed {
    opacity: 1;
    transform: scale(1);
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    [data-reveal],
    [data-reveal-children] > * {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* Landing mobile */

@media (max-width: 768px) {
    .landing-hero {
        padding: 4rem 1rem 3rem;
    }

    .landing-hero .cta-group {
        flex-direction: column;
        align-items: stretch;
    }

    .landing-trust-bar {
        gap: 0.35rem;
    }

    .landing-trust-divider {
        display: none;
    }

    .landing-section {
        padding: 3rem 1rem;
    }

    .landing-formats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .landing-pricing-grid {
        grid-template-columns: 1fr;
        max-width: 380px;
        margin-left: auto;
        margin-right: auto;
    }

    .landing-footer__inner {
        flex-direction: column;
        text-align: center;
    }

    .landing-footer__links {
        justify-content: center;
    }

    .landing-footer__nav {
        align-items: center;
    }

    .landing-faq-item {
        padding: 1.2rem 1.4rem;
    }

    .format-specs__table td:first-child {
        width: auto;
    }

    .format-links {
        flex-direction: column;
        align-items: center;
    }

    .landing-final-cta {
        padding: 3.5rem 1rem;
    }
}

/* ── Legal pages (Terms, Privacy) ── */

.legal-wrapper {
    max-width: 820px;
    padding-top: 2rem;
    padding-bottom: 4rem;
}

.legal-document {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 2.5rem 3rem;
    box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
    .legal-document {
        padding: 1.5rem 1.25rem;
        border-radius: 16px;
    }
}

.legal-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.legal-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.legal-meta {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.legal-section {
    margin-bottom: 2rem;
}

.legal-section h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--color-text-primary);
}

.legal-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-primary);
}

.legal-section p {
    margin-bottom: 0.75rem;
    line-height: 1.7;
    color: var(--color-text-secondary);
}

.legal-section ul {
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.legal-section li {
    margin-bottom: 0.4rem;
    line-height: 1.7;
    color: var(--color-text-secondary);
}

.legal-section a {
    color: var(--color-link);
    text-decoration: none;
}

.legal-section a:hover {
    text-decoration: underline;
    color: var(--color-link-hover);
}

.legal-contact {
    font-style: normal;
    padding: 1rem 1.25rem;
    background: var(--color-surface-muted);
    border-radius: 12px;
    border: 1px solid var(--color-border);
    margin-bottom: 0.75rem;
    line-height: 1.8;
}

.legal-table-wrapper {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.legal-table th,
.legal-table td {
    text-align: left;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

.legal-table th {
    font-weight: 600;
    color: var(--color-text-primary);
    background: var(--color-surface-muted);
}

.legal-table tr:last-child td {
    border-bottom: none;
}

/* ── Terms checkbox on Register ── */

.terms-acceptance {
    margin-bottom: 0.25rem;
}

.terms-check {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    line-height: 1.5;
}

.terms-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--color-brand-primary);
    cursor: pointer;
}

.terms-check a {
    color: var(--color-link);
    text-decoration: none;
    font-weight: 600;
}

.terms-check a:hover {
    text-decoration: underline;
}

/* ── Site footer ── */

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1.25rem 2rem;
    /* Extra right padding keeps the Sign out link clear of the fixed feedback widget (~110px wide + 1.5rem right offset = ~134px; 10rem = 160px gives comfortable clearance) */
    padding-right: 10rem;
    font-size: 0.825rem;
    color: var(--color-text-secondary);
    border-top: 1px solid var(--color-border);
    margin-top: auto;
}

@media (max-width: 480px) {
    .site-footer {
        flex-direction: column;
        align-items: flex-start;
        padding-right: 2rem;
    }

    .site-footer__links {
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
    }
}

.site-footer__links {
    display: flex;
    gap: 1.5rem;
}

.site-footer__links a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.site-footer__links a:hover {
    color: var(--color-link);
}

.site-footer__signout {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    color: inherit;
    border-left: 1px solid var(--color-border);
    padding-left: 1.5rem;
    cursor: pointer;
}

.site-footer__signout:hover {
    color: var(--color-link);
}

/* FAQ page */

.faq-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-item h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.faq-item p,
.faq-item ul,
.faq-item ol {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Feedback widget */

.feedback-widget {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1050;
}

.feedback-widget__trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.feedback-widget__trigger:hover {
    transform: translateY(-1px);
    border-color: var(--color-border-strong);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.feedback-widget__panel {
    width: 320px;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.feedback-widget__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.feedback-widget__header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.feedback-widget__success {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--color-success, #16a34a);
}

.feedback-widget__success i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

:root[data-theme='dark'] .feedback-widget__panel {
    background: var(--color-surface, #1e1e2e);
}

:root[data-theme='dark'] .feedback-widget__trigger {
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
    border-color: var(--color-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ── Cookie Consent Banner ── */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--color-surface, #fff);
    border-top: 1px solid var(--color-border, #e2e8f0);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    padding: 1rem 1.5rem;
}

.cookie-consent-content {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.cookie-consent-content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text-muted, #64748b);
}

.cookie-consent-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

:root[data-theme='dark'] .cookie-consent-banner {
    background: var(--color-surface, #1e1e2e);
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* ── OAuth loading overlay (Login.razor) ──────────────────────── */
.oauth-loading {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ── Blazor reconnection modal ─────────────────────────────────── */
#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.7) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex !important;
}

#components-reconnect-modal.components-reconnect-hide {
    display: none !important;
}

/* Backdrop div is now a no-op visual layer (kept for markup compat) */
.reconnect-backdrop {
    display: none;
}

/* Card */
.reconnect-card {
    position: relative;
    z-index: 1;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 1.5rem;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.22);
    padding: 2.5rem 3rem;
    text-align: center;
    max-width: 380px;
    width: 90vw;
    animation: reconnect-card-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes reconnect-card-in {
    from { opacity: 0; transform: scale(0.9) translateY(12px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* Logo + ring */
.reconnect-logo-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    margin-bottom: 1.5rem;
}

.reconnect-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    position: relative;
    z-index: 1;
    animation: reconnect-logo-pulse 2.4s ease-in-out infinite;
}

@keyframes reconnect-logo-pulse {
    0%, 100% { transform: scale(1);     opacity: 1; }
    50%       { transform: scale(1.09); opacity: 0.8; }
}

/* Spinning gradient ring */
.reconnect-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--color-brand-primary, #2563eb);
    border-right-color: var(--color-brand-accent, #06b6d4);
    animation: reconnect-ring-spin 1.2s linear infinite;
}

@keyframes reconnect-ring-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Failed / rejected: stop animation, show error tint */
#components-reconnect-modal.components-reconnect-failed .reconnect-ring,
#components-reconnect-modal.components-reconnect-rejected .reconnect-ring {
    animation: none;
    border-top-color: var(--color-danger, #ef4444);
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-left-color: transparent;
    opacity: 0.5;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-logo,
#components-reconnect-modal.components-reconnect-rejected .reconnect-logo {
    animation: none;
    opacity: 0.55;
}

/* State text blocks */
.reconnect-state {
    display: none;
}

#components-reconnect-modal.components-reconnect-show    .reconnect-state--show,
#components-reconnect-modal.components-reconnect-failed  .reconnect-state--failed,
#components-reconnect-modal.components-reconnect-rejected .reconnect-state--rejected {
    display: block;
}

.reconnect-headline {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text-primary, #0f172a);
    margin: 0 0 0.4rem;
    letter-spacing: -0.01em;
}

.reconnect-copy {
    font-size: 0.875rem;
    color: var(--color-text-secondary, #475569);
    margin: 0;
    line-height: 1.65;
}

.reconnect-copy a {
    color: var(--color-link, #2563eb);
    text-decoration: underline;
    font-weight: 500;
}

.reconnect-copy a:hover {
    color: var(--color-link-hover, #1d4ed8);
}

@media (prefers-reduced-motion: reduce) {
    /* Collapse animation to a single instant frame — the element still
       appears correctly but without sustained motion, satisfying the OS
       preference without making the modal look broken/static. */
    .reconnect-card {
        animation-duration: 0.001ms;
        animation-iteration-count: 1;
    }

    .reconnect-logo {
        animation-duration: 0.001ms;
        animation-iteration-count: 1;
    }

    .reconnect-ring {
        animation-duration: 0.001ms;
        animation-iteration-count: 1;
    }
}

/* ── API Keys page ── */

.apikeys-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.apikeys-empty__icon {
    font-size: 3rem;
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
    display: block;
}

.apikeys-upgrade-cta {
    max-width: 800px;
}

.apikeys-plan-compare {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.apikeys-plan-card {
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 1.5rem;
    background: var(--color-surface-muted);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.apikeys-plan-card h3 {
    margin: 0;
    font-size: 1.1rem;
}

.apikeys-plan-price strong {
    font-size: 1.5rem;
}

.apikeys-plan-price span {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.apikeys-plan-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.apikeys-plan-card ul li {
    color: var(--color-text-secondary);
}

.apikey-reveal-block {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 1rem;
    background: var(--color-surface-muted);
}

.apikey-reveal-block label {
    display: block;
    margin-bottom: 0.5rem;
    letter-spacing: 0.08em;
}

.apikey-reveal-value {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.apikey-reveal-value code,
.apikey-reveal-value pre {
    flex: 1;
    word-break: break-all;
    white-space: pre-wrap;
    background: transparent;
}

.apikeys-table-desktop {
    display: block;
}

.apikeys-card-mobile {
    display: none;
}

.apikeys-mobile-card {
    border: 1px solid var(--color-border);
    border-radius: 18px;
    padding: 1rem 1.25rem;
    background: var(--color-surface-muted);
}

.apikeys-mobile-card + .apikeys-mobile-card {
    margin-top: 0.75rem;
}

@media (max-width: 480px) {
    .apikeys-table-desktop {
        display: none;
    }

    .apikeys-card-mobile {
        display: block;
    }
}

/* ── Promo Code ── */

.promo-code-section {
    padding: 0.25rem 0;
}

.promo-code-toggle {
    font-size: 0.9rem;
    color: var(--color-link);
    text-decoration: none;
}

.promo-code-toggle:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

.promo-code-form {
    max-width: 400px;
}

.promo-code-form .form-control {
    border-color: var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.promo-code-form .form-control:focus {
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

.promo-feedback {
    font-size: 0.85rem;
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
}

.promo-feedback--valid {
    color: var(--color-success, #16a34a);
}

.promo-feedback--invalid {
    color: var(--color-danger, #ef4444);
}

/* ── Export Guide ─────────────────────────────────────────────── */

.export-guide {
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.export-guide:hover {
    border-color: var(--color-border-strong);
}

.export-guide__toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.export-guide__toggle:hover {
    background: var(--color-border);
}

.export-guide__toggle:focus-visible {
    outline: 2px solid var(--color-brand-primary);
    outline-offset: -2px;
}

.export-guide__content {
    padding: 1rem 1.25rem 1.25rem;
    background: var(--color-surface);
}

.export-guide__tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    background: var(--color-surface-muted);
    border-radius: 8px;
    padding: 3px;
}

.export-guide__tab {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-guide__tab:hover {
    color: var(--color-text-primary);
}

.export-guide__tab:focus-visible {
    outline: 2px solid var(--color-brand-primary);
    outline-offset: 1px;
}

.export-guide__tab--active {
    background: var(--color-surface);
    color: var(--color-brand-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-weight: 600;
}

.export-guide__steps ol {
    padding-left: 1.25rem;
    margin: 0;
}

.export-guide__steps li {
    padding: 0.35rem 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-text-primary);
}

.export-guide__steps li + li {
    border-top: 1px solid var(--color-border);
}

.export-guide__steps a {
    color: var(--color-brand-primary);
    font-weight: 500;
}

@media (max-width: 480px) {
    .export-guide__tabs {
        flex-direction: column;
    }
}

/* ── First-Run Experience ── */

.first-run-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 8rem);
    padding: 3rem 1.5rem;
    text-align: center;
}

.first-run-empty__inner {
    max-width: 520px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.first-run-empty__icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--color-surface-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    border: 1px solid var(--color-border);
}

.first-run-empty__icon i {
    font-size: 2rem;
    color: var(--color-primary);
}

.first-run-empty__heading {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--color-text);
    margin-bottom: 0.75rem;
}

.first-run-empty__sub {
    font-size: 1rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    max-width: 420px;
    margin-bottom: 2rem;
}

.first-run-empty__cta {
    padding: 0.875rem 2rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.first-run-empty__guide-link {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    text-decoration: none;
}

.first-run-empty__guide-link:hover {
    color: var(--color-link);
}

/* Upload panel */

.first-run-upload {
    max-width: 680px;
    margin: 3rem auto;
    padding: 2rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
}

.first-run-upload__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.first-run-upload__title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.first-run-upload__sub {
    font-size: 0.9rem;
    margin-bottom: 0;
}

.first-run-upload__close {
    flex-shrink: 0;
    margin-top: 0.25rem;
}

/* Quota meter */

.first-run-quota__label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    margin-bottom: 0.375rem;
    color: var(--color-text-secondary);
}

/* Upload progress */

.first-run-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 8rem);
    padding: 3rem 1.5rem;
}

.first-run-progress__inner {
    max-width: 540px;
    width: 100%;
    text-align: center;
}

/* Processing state */

.first-run-processing-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 8rem);
    padding: 3rem 1.5rem;
    text-align: center;
}

.first-run-processing-state__inner {
    max-width: 560px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.first-run-processing-state__icon {
    margin-bottom: 1.75rem;
}

.first-run-processing-state__heading {
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.first-run-processing-state__sub {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    max-width: 440px;
}

/* First-search overlay */

.first-search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.25s ease;
}

.first-search-overlay__card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 2rem;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.first-search-overlay__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.first-search-overlay__header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0;
    letter-spacing: -0.02em;
}

.first-search-overlay__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.first-search-overlay__chip {
    padding: 0.375rem 0.875rem;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: 2rem;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.first-search-overlay__chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-muted, rgba(var(--color-primary-rgb, 99 102 241) / 0.08));
}

/* Dark mode adjustments */

:root[data-theme='dark'] .first-run-upload {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

:root[data-theme='dark'] .first-search-overlay {
    background: rgba(0, 0, 0, 0.65);
}

:root[data-theme='dark'] .first-search-overlay__card {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

@media (max-width: 575px) {
    .first-run-upload {
        margin: 1rem;
        padding: 1.25rem;
        border-radius: 12px;
    }

    .first-run-empty {
        padding: 2rem 1rem;
    }

    /* Hide the fixed feedback widget while the upload panel is open so it
       cannot overlap the export guide accordion or action buttons regardless
       of scroll position. :has() is supported in all modern browsers. */
    body:has(.first-run-upload) .feedback-widget {
        display: none;
    }
}

.archive-card-grid {
    display: grid;
    gap: 1rem;
}

.archive-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem 1.5rem;
    align-items: center;
}

.archive-card__info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.archive-card__name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.archive-card__name:hover {
    color: var(--color-brand-primary);
}

.archive-card__filename {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.archive-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.25rem;
}

.archive-card__meta-item {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

.archive-card__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.archive-card__cta {
    white-space: nowrap;
}

.archive-card__manage {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

@media (max-width: 640px) {
    .archive-card {
        grid-template-columns: 1fr;
    }

    .archive-card__actions {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
    }
}

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

/* ══════════════════════════════════════════════════════════════
   MOBILE UX OVERHAUL — EVE-3400
   Touch targets, safe areas, body scroll lock, bottom drawers
   ══════════════════════════════════════════════════════════════ */

/* Body scroll lock when the mobile sidebar is open.
   Uses CSS :has() — supported in all modern browsers. */
body:has(.navbar-toggler:checked) {
    overflow: hidden;
}

/* Body scroll lock when a bottom drawer is open on mobile */
@media (max-width: 640.98px) {
    body:has(.search-backdrop) {
        overflow: hidden;
    }
}

/* Safe area insets for fixed bottom elements (iOS notch / home indicator) */
.public-theme-toggle-floating {
    bottom: max(1.25rem, calc(0.75rem + env(safe-area-inset-bottom, 0px)));
    right: max(1.25rem, calc(0.75rem + env(safe-area-inset-right, 0px)));
}

#blazor-error-ui {
    padding-bottom: max(0.7rem, env(safe-area-inset-bottom, 0px));
}

/* Site footer: extra breathing room for iOS home indicator */
.site-footer {
    padding-bottom: max(1.25rem, calc(0.5rem + env(safe-area-inset-bottom, 0px)));
}

/* ── Backdrop for mobile bottom drawers ── */
.search-backdrop {
    display: none; /* hidden on desktop; shown via media query below */
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1035;
    animation: backdrop-fade 0.2s ease forwards;
}

@keyframes backdrop-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slide-up-drawer {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ══════════════════════════════════════════
   MOBILE — max-width: 640.98px
   ══════════════════════════════════════════ */

@media (max-width: 640.98px) {

    /* ── Backdrop: visible on mobile ── */
    .search-backdrop {
        display: block;
    }

    /* ── Touch targets: all interactive elements ≥ 44 × 44px ── */
    .icon-button {
        width: 44px;
        height: 44px;
    }

    .icon-button--ghost {
        min-width: 44px;
        min-height: 44px;
        padding: 0.6rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Sort toggle buttons */
    .sort-toggle__btn {
        min-height: 44px;
        padding: 0.5rem 0.85rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Scope pill */
    .scope-pill {
        min-height: 44px;
        padding: 0.5rem 1rem;
        display: inline-flex;
        align-items: center;
    }

    /* ── Search panel: compact padding on mobile ── */
    .search-panel {
        padding: 1.25rem 1rem;
        border-radius: 20px;
        gap: 1rem;
    }

    .home-wrapper.emails-wrapper {
        padding: 1rem 0.75rem;
        padding-bottom: max(3rem, calc(2rem + env(safe-area-inset-bottom, 0px)));
        gap: 1.25rem;
    }

    /* ── Search row: stack vertically ── */
    .search-row {
        flex-direction: column;
        gap: 0.65rem;
        align-items: stretch;
    }

    .search-row .search-field {
        width: 100%;
    }

    /* ── Search input: 52px tall, full-width ── */
    .form-control-xl,
    .btn-xl {
        height: 52px;
    }

    .search-button {
        width: 100%;
        min-width: unset;
        justify-content: center;
    }

    /* Reduce icon padding area so text doesn't overlap icons at narrow widths */
    .search-field--with-icons .form-control {
        padding-right: 96px;
    }

    /* ── Sort toggle: stretch full-width ── */
    .sort-toggle {
        width: 100%;
    }

    .sort-toggle__btn {
        flex: 1;
    }

    /* ── Search meta: stack on mobile ── */
    .search-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
    }

    .search-meta__left {
        margin-top: 0;
    }

    /* ── Date popover: full-width bottom sheet ── */
    .date-popover {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        max-width: 100%;
        border-radius: 28px 28px 0 0;
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
        z-index: 1050;
        box-shadow: 0 -20px 60px rgba(2, 6, 23, 0.3);
        animation: slide-up-drawer 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    .date-popover::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--color-border-strong);
        margin: 0 auto 1rem;
        flex-shrink: 0;
    }

    :root[data-theme='dark'] .date-popover {
        box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
    }

    /* ── Scope dropdown: full-width bottom sheet ── */
    .scope-dropdown {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        max-width: 100%;
        border-radius: 28px 28px 0 0;
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
        z-index: 1045;
        box-shadow: 0 -20px 60px rgba(2, 6, 23, 0.3);
        animation: slide-up-drawer 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    .scope-dropdown::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--color-border-strong);
        margin: 0 auto 1rem;
    }

    :root[data-theme='dark'] .scope-dropdown {
        box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
    }

    /* ── Advanced filters: full-width bottom drawer ── */
    .advanced-filters-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        border-radius: 28px 28px 0 0;
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
        max-height: 80vh;
        overflow-y: auto;
        z-index: 1040;
        box-shadow: 0 -20px 60px rgba(2, 6, 23, 0.3);
        margin-top: 0;
        animation: slide-up-drawer 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    .advanced-filters-panel::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--color-border-strong);
        margin: 0 auto 1rem;
        flex-shrink: 0;
    }

    :root[data-theme='dark'] .advanced-filters-panel {
        box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
    }

    /* ── Advanced section grid: single column on mobile ── */
    .advanced-section__grid {
        grid-template-columns: 1fr;
    }

    /* ── Email cards: tighter padding to avoid 360px overflow ── */
    .email-card {
        padding: 1rem;
    }

    .email-card--compact {
        padding: 0.75rem 1rem;
    }

    .email-card--cozy {
        padding: 1.25rem 1rem;
    }

    .email-card--active {
        padding-left: calc(1rem - 4px);
    }

    .email-card--compact.email-card--active,
    .email-card--cozy.email-card--active {
        padding-left: calc(1rem - 4px);
    }

    /* Actions: always visible on touch (no hover state on mobile) */
    .email-card__actions {
        opacity: 1;
    }

    /* Subject line: minimum 16px (1rem) to stay readable */
    .email-card__subject-line {
        font-size: 1rem;
        flex-wrap: wrap;
    }

    /* Density toggle: hide on mobile — not useful on small screens */
    .density-toggle {
        display: none;
    }

    /* ── Emails results header: compact ── */
    .emails-results__header {
        align-items: center;
    }

    /* ── Scroll padding for virtual keyboard compensation ── */
    .emails-wrapper {
        scroll-padding-bottom: 280px;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════
   Contacts page  (/contacts)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Contacts header: match the design-file flat header treatment. ── */
.contacts-page {
    gap: 1.15rem;
}

.contacts-page .contacts-hero {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    gap: 1rem;
}

.contacts-page .contacts-hero .hero-eyebrow {
    display: none;
}

.contacts-page .contacts-hero h1 {
    margin: 0 0 0.35rem;
    font-size: clamp(1.45rem, 2.2vw, 1.9rem);
    line-height: 1.12;
    letter-spacing: -0.035em;
    color: var(--color-text-primary);
}

.contacts-page .contacts-hero .text-muted {
    margin: 0;
    max-width: 620px;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.contacts-page .contacts-segments {
    margin: 0;
}

.contacts-page .contacts-filterbar {
    margin: 0 0 1.65rem;
}

.contacts-hero-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1.25rem;
    flex-shrink: 0;
    align-self: flex-start;
    padding-top: 0.2rem;
}

.contacts-hero-right .view-toggle {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
}

.contacts-hero-right .view-toggle__btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0 0.35rem;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
    min-height: 28px;
}

.contacts-hero-right .view-toggle__btn:hover:not(:disabled) {
    color: var(--color-text-primary);
}

.contacts-hero-right .view-toggle__btn.is-active,
.contacts-hero-right .view-toggle__btn--active,
.contacts-hero-right .view-toggle__btn[aria-selected="true"] {
    background: transparent;
    color: var(--color-brand-primary);
    border-bottom-color: var(--color-brand-primary);
    box-shadow: none;
}

.contacts-hero-right .view-toggle__btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.contacts-hero-right .view-toggle__label {
    font-size: 0.8rem;
}

/* ── Zero-access unavailable state ── */
.contacts-zero-access {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 4rem 2rem;
    gap: 0.75rem;
}

.contacts-zero-access__icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    font-size: 2rem;
    color: var(--color-text-secondary);
}

:root[data-theme='dark'] .contacts-zero-access__icon {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.contacts-zero-access__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
}

.contacts-zero-access__body {
    color: var(--color-text-secondary);
    max-width: 420px;
    line-height: 1.6;
    margin: 0 0 0.75rem;
}

/* ── Contacts header row ── */
.contacts-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.contacts-count {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.contacts-count strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

/* ── Search + filter bar ── */
.contacts-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    max-width: 480px;
}

.search-field--contacts {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.search-field--contacts .search-field__lead-icon {
    position: absolute;
    left: 0.875rem;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1;
}

.search-field--contacts .form-control {
    padding-left: 2.4rem;
    padding-right: 2.4rem;
    border-radius: 12px;
    height: 44px;
}

.search-field--contacts .icon-button {
    position: absolute;
    right: 0.25rem;
}

/* ── Filter panel ── */
.contacts-filters-panel {
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: panel-slide-down 150ms ease forwards;
}

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

.contacts-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.contacts-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contacts-filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin: 0;
}

.contacts-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.filter-chip {
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    min-height: 32px;
}

.filter-chip:hover {
    border-color: var(--color-brand-primary);
    color: var(--color-brand-primary);
}

.filter-chip--active,
.filter-chip--active:hover {
    background: var(--color-brand-primary);
    border-color: var(--color-brand-primary);
    color: #ffffff;
}

/* Dark mode: primary is light (#7ab8ff) — dark text needed for contrast */
:root[data-theme='dark'] .filter-chip--active,
:root[data-theme='dark'] .filter-chip--active:hover {
    color: #0f172a;
}

@media (max-width: 640.98px) {
    .filter-chip {
        min-height: 44px;
        padding: 0.5rem 0.875rem;
    }
}

.contacts-clear-filters {
    font-size: 0.825rem;
    color: var(--color-text-secondary);
    text-decoration: underline;
    cursor: pointer;
    align-self: flex-start;
    border: none;
    background: none;
    padding: 0;
    transition: color 0.15s ease;
}

.contacts-clear-filters:hover {
    color: var(--color-text-primary);
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-brand-primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 2px;
}

/* ── Contact list ── */
.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    max-height: 60vh;
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 0.5rem;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    min-height: 64px;
    border-bottom: 1px solid var(--color-border);
    position: relative;
}

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

.contact-row:hover {
    background: var(--color-surface-muted);
}

.contact-row:focus-visible {
    outline: 2px solid var(--color-brand-primary);
    outline-offset: 2px;
}

.contact-row--skeleton {
    pointer-events: none;
}

/* ── Avatar ── */
.contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    flex-shrink: 0;
    letter-spacing: -0.01em;
}

/* ── Row info ── */
.contact-row__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.contact-row__name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-row__email {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Company chip ── */
.contact-company-chip {
    display: none;
    align-items: center;
    padding: 0.2rem 0.6rem;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

@media (min-width: 480px) {
    .contact-company-chip {
        display: flex;
    }
}

/* ── Relationship score bar ── */
.contact-row__score {
    width: 60px;
    flex-shrink: 0;
    display: none;
}

@media (min-width: 768px) {
    .contact-row__score {
        display: block;
    }
}

.relationship-bar {
    height: 6px;
    border-radius: 999px;
    background: var(--color-border);
    overflow: hidden;
    width: 100%;
}

.relationship-bar--lg {
    height: 8px;
}

.relationship-bar__fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.score--strong .relationship-bar__fill,
.relationship-bar__fill.score--strong {
    background: #10b981;
}

.score--moderate .relationship-bar__fill,
.relationship-bar__fill.score--moderate {
    background: #f59e0b;
}

.score--weak .relationship-bar__fill,
.relationship-bar__fill.score--weak {
    background: #94a3b8;
}

/* ── Last seen ── */
.contact-row__last-seen {
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    display: none;
    flex-shrink: 0;
}

@media (min-width: 600px) {
    .contact-row__last-seen {
        display: block;
    }
}

/* ── Row chevron ── */
.contact-row__chevron {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.contact-row:hover .contact-row__chevron {
    opacity: 1;
    transform: translateX(2px);
}

/* ── Load more ── */
.contacts-load-more {
    display: flex;
    justify-content: center;
    padding: 1.25rem 0 0.25rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Contact detail drawer
   ═══════════════════════════════════════════════════════════════════════════ */

.contact-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 200;
    backdrop-filter: blur(2px);
    animation: backdrop-in 200ms ease forwards;
}

@keyframes backdrop-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

:root[data-theme='dark'] .contact-drawer-backdrop {
    background: rgba(2, 6, 23, 0.65);
}

.contact-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: min(400px, 100vw);
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    z-index: 201;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1);
}

.contact-drawer--open {
    transform: translateX(0);
}

.contact-drawer__header {
    display: flex;
    justify-content: flex-end;
    padding: 1rem 1rem 0;
    flex-shrink: 0;
}

.contact-drawer__close {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 0.9rem;
}

.contact-drawer__close:hover {
    background: var(--color-border);
    color: var(--color-text-primary);
}

.contact-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.contact-drawer__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 1rem;
}

/* ── Identity block ── */
.contact-drawer__identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    padding-bottom: 1.25rem;
}

.contact-drawer__avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
    flex-shrink: 0;
}

.contact-drawer__name-block {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
}

.contact-drawer__name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
    line-height: 1.3;
}

.contact-drawer__email {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin: 0;
    word-break: break-all;
}

.contact-domain-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.7rem;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

/* ── Divider ── */
.contact-drawer__divider {
    height: 1px;
    background: var(--color-border);
    margin: 0.75rem 0;
    flex-shrink: 0;
}

/* ── Sections ── */
.contact-drawer__section {
    padding: 0.875rem 0;
}

.contact-drawer__section--ai {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.04) 0%, rgba(6, 182, 212, 0.04) 100%);
    border: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 12px;
    padding: 0.875rem 1rem;
    margin: 0.5rem 0;
}

:root[data-theme='dark'] .contact-drawer__section--ai {
    background: linear-gradient(135deg, rgba(122, 184, 255, 0.06) 0%, rgba(93, 225, 214, 0.06) 100%);
    border-color: rgba(122, 184, 255, 0.15);
}

.contact-drawer__section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-secondary);
    margin: 0 0 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.contact-drawer__ai-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.4rem;
    background: var(--color-brand-gradient);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

/* ── Relationship section ── */
.contact-drawer__relationship {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.contact-drawer__score-label {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.contact-drawer__score-label.score--strong { color: #10b981; }
.contact-drawer__score-label.score--moderate { color: #f59e0b; }
.contact-drawer__score-label.score--weak { color: var(--color-text-secondary); }

/* ── Detail rows (AI fields) ── */
.contact-drawer__detail-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    padding: 0.25rem 0;
}

.contact-drawer__detail-row i {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

/* ── Stats ── */
.contact-drawer__stats-line {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin: 0 0 0.75rem;
    line-height: 1.5;
}

.contact-drawer__email-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.contact-drawer__email-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface-muted);
    color: var(--color-text-primary);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
    min-height: 36px;
}

.contact-drawer__email-btn:hover {
    border-color: var(--color-brand-primary);
    background: var(--color-surface);
    color: var(--color-brand-primary);
    text-decoration: none;
}

/* ── Aliases ── */
.contact-drawer__aliases-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
}

.contact-drawer__aliases-toggle:hover .contact-drawer__section-label {
    color: var(--color-text-primary);
}

.contact-drawer__aliases {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
    animation: panel-slide-down 150ms ease forwards;
}

.contact-alias-chip {
    padding: 0.2rem 0.6rem;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    word-break: break-all;
}

/* ── Footer: hide link ── */
.contact-drawer__footer {
    margin-top: auto;
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
}

.contact-drawer__hide-btn {
    border: none;
    background: none;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-size: 0.825rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.15s ease, background 0.15s ease;
    min-height: 36px;
}

.contact-drawer__hide-btn:hover:not(:disabled) {
    color: var(--color-progress-error);
    background: rgba(239, 68, 68, 0.06);
}

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

.contact-drawer__delete-btn {
    border: none;
    background: none;
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    opacity: 0.7;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
    min-height: 30px;
}

.contact-drawer__delete-btn:hover:not(:disabled) {
    color: var(--color-progress-error);
    background: rgba(239, 68, 68, 0.06);
    opacity: 1;
}

.contact-drawer__delete-btn:focus-visible {
    outline: 2px solid var(--color-progress-error);
    outline-offset: 2px;
}

.contact-drawer__delete-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Enrich section in drawer ── */
.contact-drawer__section--enrich {
    padding: 0.75rem 0;
}

.contact-drawer__enrich-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, var(--color-brand-primary) 0%, #7c3aed 100%);
    color: #fff;
    transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    width: 100%;
    justify-content: center;
}

.contact-drawer__enrich-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.contact-drawer__enrich-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.contact-drawer__enriched-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.enriched-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(124, 58, 237, 0.12) 100%);
    color: var(--color-brand-primary);
    border: 1px solid rgba(99, 102, 241, 0.25);
    flex-shrink: 0;
}

:root[data-theme='dark'] .enriched-chip {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.35);
}

.contact-drawer__re-enrich-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.65rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.contact-drawer__re-enrich-btn:hover:not(:disabled) {
    color: var(--color-brand-primary);
    border-color: var(--color-brand-primary);
    background: rgba(99, 102, 241, 0.05);
}

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

.contact-drawer__enrich-error {
    margin: 0.5rem 0 0;
    font-size: 0.8rem;
    color: var(--color-progress-error);
    line-height: 1.4;
}

/* ── Batch select toolbar ── */
.contacts-select-all-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem 0.5rem 0.6rem;
    border-bottom: 1px solid var(--color-border);
}

.contacts-select-all-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.contact-row-checkbox {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
}

.contact-row-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-brand-primary);
}

.contact-row--selected {
    background: rgba(99, 102, 241, 0.06) !important;
}

:root[data-theme='dark'] .contact-row--selected {
    background: rgba(99, 102, 241, 0.1) !important;
}

.contacts-batch-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.07) 0%, rgba(124, 58, 237, 0.07) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    animation: slideDown 0.18s ease;
}

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

@media (prefers-reduced-motion: reduce) {
    .contacts-batch-toolbar { animation: none; }
    .contacts-batch-toolbar__enrich-btn:hover:not(:disabled) { transform: none; }
}

.contacts-batch-toolbar__count {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-brand-primary);
    flex-shrink: 0;
}

.contacts-batch-toolbar__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.contacts-batch-toolbar__enrich-btn {
    background: linear-gradient(135deg, var(--color-brand-primary) 0%, #7c3aed 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.contacts-batch-toolbar__enrich-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.contacts-batch-error {
    width: 100%;
    margin: 0;
    font-size: 0.8rem;
    color: var(--color-progress-error);
}

/* ── Mobile: full-width drawer ── */
@media (max-width: 600px) {
    .contact-drawer {
        width: 100vw;
        border-left: none;
        border-top: 1px solid var(--color-border);
        border-radius: 20px 20px 0 0;
        top: auto;
        bottom: 0;
        height: 85dvh;
        transform: translateY(100%);
        transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1);
    }

    .contact-drawer--open {
        transform: translateY(0);
    }
}

/* ── Hide view-toggle label on tiny screens ──
   Scoped (see .contacts-hero-right .view-toggle block above for rationale). */
@media (max-width: 400px) {
    .contacts-hero-right .view-toggle__label {
        display: none;
    }
}

/* ── Mobile: keep the graph/list toggle available and let it wrap under the hero copy. ── */
@media (max-width: 767px) {
    .contacts-hero-right--desktop-only {
        display: flex;
        width: 100%;
        margin-top: 0.75rem;
        justify-content: flex-start;
    }
}

/* ════════════════════════════════════════════════════════════
   § 7b — Contact drawer: Emails tab
   ════════════════════════════════════════════════════════════ */

/* ── Drawer tabs ── */
.contact-drawer__tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    margin: 1rem 0 0;
    flex-shrink: 0;
}

.contact-drawer__tab {
    position: relative;
    padding: 0.6rem 1rem;
    border: none;
    background: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.15s ease;
    white-space: nowrap;
}

.contact-drawer__tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-brand-primary);
    border-radius: 2px 2px 0 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.contact-drawer__tab:hover {
    color: var(--color-text-primary);
}

.contact-drawer__tab--active {
    color: var(--color-text-primary);
    font-weight: 600;
}

.contact-drawer__tab--active::after {
    opacity: 1;
}

.contact-drawer__tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    line-height: 1;
}

.contact-drawer__tab--active .contact-drawer__tab-count {
    background: rgba(var(--color-brand-primary-rgb, 37, 99, 235), 0.1);
    border-color: var(--color-brand-primary);
    color: var(--color-brand-primary);
}

.contact-drawer__tab-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ── Emails tab: role filter ── */
.contact-emails-role-filter {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    padding: 0.875rem 0 0.5rem;
    flex-shrink: 0;
}

.contact-emails-role-chip {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface-muted);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
    min-height: 30px;
    line-height: 1;
}

.contact-emails-role-chip:hover {
    border-color: var(--color-brand-primary);
    color: var(--color-text-primary);
}

.contact-emails-role-chip--active {
    border-color: var(--color-brand-primary);
    background: var(--color-brand-primary);
    color: #fff;
}

.contact-emails-role-chip--active:hover {
    color: #fff;
}

/* ── Email rows ── */
.contact-email-list {
    flex: 1;
    overflow-y: auto;
    margin: 0 -1.5rem;
    padding: 0;
}

.contact-email-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0.7rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: inherit;
    transition: background 0.12s ease;
    cursor: pointer;
}

.contact-email-row:hover {
    background: var(--color-surface-muted);
    text-decoration: none;
    color: inherit;
}

.contact-email-row--skeleton {
    padding: 0.875rem 1.5rem;
}

.contact-email-row__top {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    justify-content: space-between;
}

.contact-email-row__subject {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.contact-email-row__date {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.contact-email-row__bottom {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.contact-email-row__snippet {
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.contact-email-row__attach {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

/* Role badge */
.contact-email-role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.contact-email-role-badge--from {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.contact-email-role-badge--to {
    background: rgba(37, 99, 235, 0.1);
    color: var(--color-brand-primary);
}

.contact-email-role-badge--cc,
.contact-email-role-badge--bcc {
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

:root[data-theme='dark'] .contact-email-role-badge--from {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

:root[data-theme='dark'] .contact-email-role-badge--to {
    background: rgba(96, 165, 250, 0.15);
    color: #93c5fd;
}

/* Empty / error states */
.contact-emails-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 1rem;
    gap: 0.5rem;
}

.contact-emails-empty__icon {
    font-size: 2rem;
    color: var(--color-text-secondary);
    opacity: 0.5;
}

.contact-emails-empty__text {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin: 0;
}

.contact-emails-empty__subtext {
    font-size: 0.78rem;
    color: var(--color-text-tertiary, var(--color-text-secondary));
    opacity: 0.75;
    margin: 0;
}

/* Load more */
.contact-emails-load-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0 0.5rem;
}

/* ════════════════════════════════════════════════════════════
   § 8 — Rolodex: Graph View
   ════════════════════════════════════════════════════════════ */

.contact-graph-view {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    min-height: 600px;
}

/* ── Filter bar ── */
.contact-graph-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-muted);
}

.contact-graph-filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-graph-filter-group--dates {
    flex-wrap: wrap;
}

.contact-graph-filter-group--search {
    flex: 1;
    max-width: 220px;
}

.contact-graph-search {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.contact-graph-search-icon {
    position: absolute;
    left: 0.55rem;
    font-size: 0.7rem;
    color: var(--color-text-tertiary);
    pointer-events: none;
}

.contact-graph-search-input {
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-primary);
    font-size: 0.8rem;
    padding: 0.3rem 1.6rem 0.3rem 1.6rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.contact-graph-search-input:focus {
    border-color: var(--color-brand-primary);
}

.contact-graph-search-input::placeholder {
    color: var(--color-text-tertiary);
}

/* hide the native clear × that browsers add to type="search" */
.contact-graph-search-input::-webkit-search-cancel-button { display: none; }

.contact-graph-search-clear {
    position: absolute;
    right: 0.3rem;
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0.1rem 0.25rem;
    font-size: 0.8rem;
    line-height: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s ease, background 0.15s ease;
}

.contact-graph-search-clear:hover {
    color: var(--color-text-primary);
    background: var(--color-surface-hover);
}

.contact-graph-slider {
    -webkit-appearance: none;
    width: 120px;
    height: 4px;
    border-radius: 2px;
    background: var(--color-brand-primary);
    outline: none;
    cursor: pointer;
}

.contact-graph-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-brand-primary);
    border: 2px solid var(--color-surface);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.contact-graph-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.contact-graph-slider-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-primary);
    min-width: 36px;
}

.contact-graph-select {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-primary);
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    outline: none;
    cursor: pointer;
    max-width: 160px;
    transition: border-color 0.15s ease;
}

.contact-graph-select:focus {
    border-color: var(--color-brand-primary);
}

.contact-graph-date {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-primary);
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.contact-graph-date:focus {
    border-color: var(--color-brand-primary);
}

.contact-graph-filter-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

/* ── Legend ── */
.contact-graph-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    flex-wrap: wrap;
}

.cg-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.cg-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cg-legend-dot--star {
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    border-radius: 0;
    width: 12px;
    height: 12px;
}

/* ── Progress bar ── */
.contact-graph-progress-bar-wrap {
    height: 3px;
    background: var(--color-border);
    overflow: hidden;
    flex-shrink: 0;
}

.contact-graph-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-brand-primary), var(--color-brand-accent));
    transition: width 0.3s ease;
    border-radius: 0 2px 2px 0;
}

.contact-graph-loading-label {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    text-align: center;
    padding: 0.5rem 1rem;
    margin: 0;
}

/* ── Canvas ── */
.contact-graph-canvas {
    flex: 1;
    min-height: 520px;
    background: var(--color-surface-muted);
    position: relative;
}

.contact-graph-canvas--hidden {
    display: none;
}

/* ── Empty / error state ── */
.contact-graph-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    gap: 0.75rem;
}
/* ═══════════════════════════════════════════════════════════
   Contacts — SignalR live-status + progress banners (EVE-3515)
   ═══════════════════════════════════════════════════════════ */

/* ── Connection status ── */
.contacts-hub-status {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.contacts-hub-status--reconnecting {
    background: color-mix(in srgb, var(--color-warning, #d97706) 12%, transparent);
    color: var(--color-warning, #d97706);
    border: 1px solid color-mix(in srgb, var(--color-warning, #d97706) 25%, transparent);
}

.contacts-hub-status--offline {
    background: color-mix(in srgb, var(--color-text-secondary, #6b7280) 10%, transparent);
    color: var(--color-text-secondary, #6b7280);
    border: 1px solid color-mix(in srgb, var(--color-text-secondary, #6b7280) 20%, transparent);
}

/* ── Progress banner ── */
.contacts-progress-banner {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: color-mix(in srgb, var(--color-primary, #2563eb) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-primary, #2563eb) 20%, transparent);
    margin-bottom: 0.75rem;
}

.contacts-progress-banner--enrichment {
    background: color-mix(in srgb, #7c3aed 8%, transparent);
    border-color: color-mix(in srgb, #7c3aed 20%, transparent);
}

.contacts-progress-banner__info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.contacts-progress-banner__label {
    display: flex;
    align-items: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.contacts-progress-banner__count {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.contacts-progress-banner__track {
    flex: 1;
    height: 6px;
    background: color-mix(in srgb, var(--color-primary, #2563eb) 18%, transparent);
    border-radius: 99px;
    overflow: hidden;
    min-width: 80px;
}

.contacts-progress-banner--enrichment .contacts-progress-banner__track {
    background: color-mix(in srgb, #7c3aed 18%, transparent);
}

.contacts-progress-banner__fill {
    height: 100%;
    background: var(--color-primary, #2563eb);
    border-radius: 99px;
    transition: width 400ms ease;
}

.contacts-progress-banner__fill--enrichment {
    background: #7c3aed;
}

.contacts-progress-banner__pct {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    min-width: 2.5rem;
    text-align: right;
}

/* ── Dark mode overrides ── */
:root[data-theme='dark'] .contacts-hub-status--reconnecting {
    background: color-mix(in srgb, var(--color-warning, #f59e0b) 14%, transparent);
    color: var(--color-warning, #f59e0b);
    border-color: color-mix(in srgb, var(--color-warning, #f59e0b) 28%, transparent);
}

:root[data-theme='dark'] .contacts-hub-status--offline {
    background: color-mix(in srgb, var(--color-text-secondary, #9ca3af) 12%, transparent);
    border-color: color-mix(in srgb, var(--color-text-secondary, #9ca3af) 22%, transparent);
}
