/* ═════════════════════════════════════════════════════════════════
   admin-email-v9.css — Boîte email admin ElectroCAD v9 (premium)
   ─────────────────────────────────────────────────────────────────
   Layout 3 panneaux Gmail/Outlook/Proton. Glass morphism + rouge Suisse.
   Scope : appliqué uniquement à `.email-app` (zone admin Emails).
   ═════════════════════════════════════════════════════════════════ */

/* ═══ TOKENS ═══ */
.email-app {
    --ec-red: #DC2626;
    --ec-red-soft: rgba(220, 38, 38, 0.10);
    --ec-red-line: rgba(220, 38, 38, 0.35);
    --ec-red-glow: 0 8px 28px rgba(220, 38, 38, 0.32);

    --ec-bg: #060A14;
    --ec-bg2: #0B1220;
    --ec-pane: rgba(15, 23, 42, 0.55);
    --ec-pane-solid: #0F172A;
    --ec-line: rgba(255, 255, 255, 0.06);
    --ec-line-strong: rgba(255, 255, 255, 0.12);
    --ec-text: #F1F5F9;
    --ec-text2: #94A3B8;
    --ec-text3: #64748B;
    --ec-hover: rgba(255, 255, 255, 0.04);
    --ec-active: rgba(220, 38, 38, 0.08);

    --ec-yellow: #FCD34D;
    --ec-green: #10B981;
    --ec-amber: #F59E0B;
    --ec-radius: 14px;
    --ec-radius-sm: 8px;

    /* Layout */
    display: grid;
    grid-template-columns: 240px 380px 1fr;
    grid-template-rows: 100%;
    height: calc(100vh - 100px);
    min-height: 540px;
    max-height: calc(100vh - 80px);
    background: linear-gradient(180deg, #060A14 0%, #0B1220 100%);
    color: var(--ec-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 14px;
    border-radius: var(--ec-radius);
    border: 1px solid var(--ec-line);
    overflow: hidden;
    position: relative;
    isolation: isolate;
}
.email-app::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 200px;
    background: radial-gradient(ellipse 80% 100% at 50% 0%, rgba(220, 38, 38, 0.10), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ═══ PANELS ═══ */
.email-sidebar,
.email-list-panel,
.email-reading-pane {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}
.email-sidebar {
    background: var(--ec-pane);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border-right: 1px solid var(--ec-line);
    padding: 16px 12px;
    overflow-y: auto;
    overflow-x: hidden;
}
.email-list-panel {
    background: rgba(11, 18, 32, 0.65);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--ec-line);
    overflow: hidden;
}
.email-reading-pane {
    background: rgba(15, 23, 42, 0.40);
    overflow: hidden;
}

/* ═══ SIDEBAR ═══ */
.email-app .btn.btn-primary {
    background: linear-gradient(135deg, var(--ec-red) 0%, #B91C1C 100%);
    color: #fff;
    border: 0;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
    cursor: pointer;
    min-height: 36px;
}
.email-app .btn.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--ec-red-glow);
    filter: brightness(1.05);
}
.email-app .btn.btn-primary:active { transform: translateY(0); }

.email-app .btn.btn-outline {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--ec-line-strong);
    color: var(--ec-text);
    font-weight: 500;
    border-radius: 10px;
    padding: 9px 13px;
    transition: background .15s, border-color .15s, color .15s;
    cursor: pointer;
    min-height: 36px;
}
.email-app .btn.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--ec-red-line);
    color: var(--ec-text);
}
.email-app .btn.btn-sm2 { padding: 6px 12px; font-size: 12.5px; min-height: 32px; }

.email-folder-section-label {
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.08em;
    color: var(--ec-text3);
    font-weight: 700;
    padding: 12px 10px 6px;
}
.email-folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--ec-text2);
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s ease, color .15s ease, transform .15s ease;
    min-height: 36px;
    position: relative;
}
.email-folder-item:hover {
    background: var(--ec-hover);
    color: var(--ec-text);
}
.email-folder-item i { width: 16px; text-align: center; font-size: 13px; opacity: 0.85; }
.email-folder-item.email-folder-active {
    background: var(--ec-red-soft);
    color: #FCA5A5;
    font-weight: 600;
}
.email-folder-item.email-folder-active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--ec-red);
    box-shadow: 0 0 12px var(--ec-red-line);
}
.email-folder-item.email-folder-active i { color: var(--ec-red); opacity: 1; }
.email-folder-badge {
    margin-left: auto;
    background: var(--ec-red);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.40);
}
.email-folder-item.email-folder-active .email-folder-badge { background: #fff; color: var(--ec-red); }

/* ═══ LIST PANEL — header ═══ */
.email-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ec-line);
    background: rgba(6, 10, 20, 0.50);
    flex-shrink: 0;
    min-height: 56px;
}
.email-list-header > div:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
#email-folder-title {
    font-weight: 700;
    font-size: 14.5px;
    color: var(--ec-text);
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.email-refresh-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--ec-line-strong);
    color: var(--ec-text2);
    cursor: pointer;
    transition: background .15s, color .15s, transform .3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.email-refresh-btn:hover {
    background: var(--ec-red-soft);
    color: var(--ec-red);
    border-color: var(--ec-red-line);
}
.email-refresh-btn:active { transform: rotate(180deg); }

/* ═══ LIST PANEL — search + bulk ═══ */
.email-search-wrap {
    padding: 10px 12px;
    border-bottom: 1px solid var(--ec-line);
    background: rgba(6, 10, 20, 0.30);
    flex-shrink: 0;
    position: relative;
}
.email-search-input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--ec-line-strong);
    border-radius: 10px;
    color: var(--ec-text);
    font-size: 13px;
    font-family: inherit;
    transition: background .15s, border-color .15s;
}
.email-search-input::placeholder { color: var(--ec-text3); }
.email-search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--ec-red-line);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
.email-search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ec-text3);
    font-size: 13px;
    pointer-events: none;
}
.email-search-clear {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 0;
    color: var(--ec-text3);
    cursor: pointer;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}
.email-search-clear.visible { display: inline-flex; }
.email-search-clear:hover { background: rgba(255, 255, 255, 0.10); color: var(--ec-text); }

.email-bulk-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(220, 38, 38, 0.08);
    border-bottom: 1px solid var(--ec-red-line);
    flex-shrink: 0;
    animation: ec-slide-down 0.25s ease;
}
@keyframes ec-slide-down {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.email-bulk-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--ec-red);
    margin-right: auto;
}
.email-item-action {
    background: none;
    border: 0;
    color: var(--ec-text2);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    font-size: 12.5px;
}
.email-item-action:hover { background: rgba(255, 255, 255, 0.08); color: var(--ec-text); }
.email-item-action.action-delete:hover { background: rgba(220, 38, 38, 0.18); color: var(--ec-red); }

/* ═══ LIST PANEL — items ═══ */
#email-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
#email-list::-webkit-scrollbar { width: 8px; }
#email-list::-webkit-scrollbar-track { background: transparent; }
#email-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.10);
    border-radius: 4px;
}
#email-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.20); }

.email-item {
    position: relative;
    display: block;
    padding: 12px 14px 12px 16px;
    border-bottom: 1px solid var(--ec-line);
    cursor: pointer;
    transition: background .12s ease;
    user-select: none;
}
.email-item:hover { background: var(--ec-hover); }
.email-item.email-item-selected {
    background: var(--ec-active);
    border-left: 3px solid var(--ec-red);
    padding-left: 13px;
}
.email-item.email-item-selected::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px var(--ec-red-line);
}
.email-item.email-item-unread .email-item-from,
.email-item.email-item-unread .email-item-subject {
    font-weight: 700;
    color: var(--ec-text);
}
.email-item.email-item-unread::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ec-red);
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.65);
}
.email-item-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}
.email-item-check {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--ec-line-strong);
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    background: transparent;
    margin-top: 2px;
    transition: background .12s, border-color .12s;
    position: relative;
    opacity: 0;
}
.email-item:hover .email-item-check,
.email-item.has-check .email-item-check,
.email-item-check:checked,
.email-bulk-bar .email-item-check,
.email-list-header .email-item-check {
    opacity: 1;
}
.email-item-check:hover { border-color: var(--ec-red); }
.email-item-check:checked {
    background: var(--ec-red);
    border-color: var(--ec-red);
}
.email-item-check:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 0;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.email-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #475569, #1E293B);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
    user-select: none;
}
.email-item-content { flex: 1; min-width: 0; }
.email-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}
.email-item-from {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ec-text2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.email-item-date {
    font-size: 11.5px;
    color: var(--ec-text3);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.email-item.email-item-unread .email-item-date { color: var(--ec-red); font-weight: 600; }

.email-item-subject {
    font-size: 13px;
    color: var(--ec-text2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.email-item-thread-count {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ec-text2);
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    flex-shrink: 0;
}
.email-item-attachment {
    color: var(--ec-text3);
    font-size: 11px;
    flex-shrink: 0;
}
.email-item-snippet {
    font-size: 12px;
    color: var(--ec-text3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}
.email-item-snippet mark {
    background: rgba(252, 211, 77, 0.30);
    color: #FCD34D;
    padding: 0 2px;
    border-radius: 2px;
}
.email-item-actions {
    display: none;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    gap: 2px;
    background: rgba(15, 23, 42, 0.95);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--ec-line-strong);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.40);
    backdrop-filter: blur(8px);
}
.email-item:hover .email-item-actions { display: flex; }
.email-item.email-item-flagged .email-item-actions .fa-star { color: var(--ec-yellow); }

/* Skeleton loading */
.email-skel {
    padding: 12px 16px;
    border-bottom: 1px solid var(--ec-line);
    display: flex;
    gap: 10px;
}
.email-skel-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.04) 100%);
    background-size: 200% 100%;
    animation: ec-skel 1.4s linear infinite;
    flex-shrink: 0;
}
.email-skel-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.email-skel-line {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.04) 100%);
    background-size: 200% 100%;
    animation: ec-skel 1.4s linear infinite;
}
@keyframes ec-skel {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.email-empty {
    padding: 60px 24px;
    text-align: center;
    color: var(--ec-text3);
}
.email-empty i { font-size: 3rem; opacity: 0.4; margin-bottom: 12px; display: block; }
.email-empty-title { font-size: 14px; color: var(--ec-text2); margin: 6px 0 4px; font-weight: 600; }
.email-empty-msg { font-size: 12.5px; color: var(--ec-text3); }

/* ═══ READING PANE ═══ */
.email-reading-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    color: var(--ec-text3);
    gap: 12px;
}
.email-reading-empty i { font-size: 3.5rem; opacity: 0.3; }
.email-reading-empty p { font-size: 13.5px; margin: 0; }
.email-reading-empty .ec-shortcut-tip {
    font-size: 11.5px;
    color: var(--ec-text3);
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--ec-line);
    padding: 8px 12px;
    border-radius: 8px;
    line-height: 1.7;
    text-align: left;
}
.email-reading-empty kbd {
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid var(--ec-line-strong);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10.5px;
    color: var(--ec-text);
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.20);
}

.email-reading-header {
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--ec-line);
    background: rgba(6, 10, 20, 0.40);
    flex-shrink: 0;
}
.email-reading-subject {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--ec-text);
    letter-spacing: -0.015em;
    line-height: 1.35;
}
.email-reading-meta { font-size: 13px; color: var(--ec-text2); }
.email-reading-from {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}
.email-reading-from .email-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #475569, #1E293B);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 12px rgba(0, 0, 0, 0.30);
    text-transform: uppercase;
    flex-shrink: 0;
}
.email-reading-from strong { color: var(--ec-text); font-size: 14px; }
.email-reading-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.email-reading-actions .btn { font-size: 12.5px; }

.email-reading-body {
    flex: 1;
    overflow-y: auto;
    padding: 22px 24px 100px;
    color: var(--ec-text);
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.email-reading-body img { max-width: 100%; height: auto; border-radius: 6px; }
.email-reading-body a { color: #60A5FA; text-decoration: underline; text-decoration-color: rgba(96, 165, 250, 0.40); text-underline-offset: 2px; }
.email-reading-body a:hover { color: #93C5FD; }
.email-reading-body blockquote {
    border-left: 3px solid var(--ec-line-strong);
    margin: 0 0 12px;
    padding: 4px 0 4px 14px;
    color: var(--ec-text2);
}
.email-reading-body pre {
    background: rgba(255, 255, 255, 0.04);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 12.5px;
}

/* ═══ ATTACHMENTS ═══ */
.email-attachments-grid {
    margin-top: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--ec-line);
    border-radius: var(--ec-radius-sm);
    font-size: 13px;
}
.email-attachments-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--ec-text2);
    font-size: 12px;
    font-weight: 600;
}
.email-attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.email-attachment-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.60);
    border: 1px solid var(--ec-line-strong);
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .15s;
    text-decoration: none;
    color: var(--ec-text);
    max-width: 240px;
}
.email-attachment-card:hover {
    background: var(--ec-red-soft);
    border-color: var(--ec-red-line);
    transform: translateY(-1px);
}
.email-attachment-card i.fa-file,
.email-attachment-card i[class*="fa-file"] { font-size: 18px; color: var(--ec-text2); }
.email-attachment-card:hover i[class*="fa-file"] { color: var(--ec-red); }
.email-attachment-info { min-width: 0; }
.email-attachment-name {
    font-weight: 500;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.email-attachment-size { font-size: 10.5px; color: var(--ec-text3); }

.email-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    margin: 2px 4px 2px 0;
    background: rgba(220, 38, 38, 0.10);
    color: var(--ec-text);
    font-size: 12px;
    border-radius: 999px;
    border: 1px solid var(--ec-red-line);
}
.email-attachment-chip i { color: var(--ec-red); font-size: 11px; }
.email-attachment-chip .remove-attachment {
    cursor: pointer;
    color: var(--ec-text3);
    margin-left: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.email-attachment-chip .remove-attachment:hover { background: var(--ec-red); color: #fff; }

/* ═══ COMPOSE INLINE / MODAL ═══ */
.email-compose-full {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 22px 26px;
    overflow-y: auto;
    gap: 8px;
}
.email-compose-full input[type="text"],
.email-compose-full input[type="email"] {
    padding: 11px 13px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--ec-line-strong);
    border-radius: 10px;
    color: var(--ec-text);
    font-family: inherit;
    font-size: 13.5px;
    transition: border-color .15s, background .15s;
}
.email-compose-full input:focus,
.compose-modal input:focus,
.compose-modal [contenteditable]:focus {
    outline: none;
    border-color: var(--ec-red-line);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.email-toolbar {
    display: flex;
    gap: 3px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--ec-line-strong);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    flex-wrap: wrap;
    align-items: center;
}
.email-tb-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--ec-text2);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
    transition: background .12s, color .12s, border-color .12s;
    flex-shrink: 0;
}
.email-tb-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ec-text);
}
.email-tb-btn.active { background: var(--ec-red-soft); color: var(--ec-red); }
.email-tb-select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--ec-line-strong);
    color: var(--ec-text2);
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11.5px;
    min-height: 28px;
}
.email-tb-color {
    width: 26px;
    height: 26px;
    border: 1px solid var(--ec-line-strong);
    border-radius: 6px;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

[contenteditable]#email-body,
[contenteditable]#reply-body,
[contenteditable]#fwd-body,
[contenteditable]#modal-body,
[contenteditable]#nl-body,
[contenteditable]#sig-editor {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--ec-line-strong);
    border-top: none;
    border-radius: 0 0 10px 10px;
    color: var(--ec-text);
    font-family: inherit;
    line-height: 1.6;
    transition: border-color .15s, background .15s;
}
[contenteditable]:focus { outline: none; }

/* Compose modal premium override */
.compose-modal {
    background: rgba(15, 23, 42, 0.96) !important;
    backdrop-filter: blur(24px);
    border: 1px solid var(--ec-line-strong) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.60), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}
.compose-modal-overlay {
    background: rgba(2, 6, 18, 0.78) !important;
    backdrop-filter: blur(8px);
}

/* Drag&drop overlay over body editor */
.email-dnd-active {
    position: relative;
}
.email-dnd-active::after {
    content: "Déposez les fichiers ici";
    position: absolute;
    inset: 0;
    background: rgba(220, 38, 38, 0.18);
    border: 2px dashed var(--ec-red);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    pointer-events: none;
    z-index: 5;
    backdrop-filter: blur(2px);
}

/* ═══ NEWSLETTER MODAL ═══ */
.nl-modal {
    background: rgba(15, 23, 42, 0.96) !important;
    backdrop-filter: blur(24px);
    border: 1px solid var(--ec-line-strong) !important;
}

/* ═══ MOBILE BARS ═══ */
.email-mobile-menu,
.email-mobile-back { display: none; }

.email-fab {
    display: none;
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ec-red), #B91C1C);
    color: #fff;
    border: 0;
    box-shadow: var(--ec-red-glow);
    z-index: 50;
    cursor: pointer;
    font-size: 18px;
    transition: transform .15s;
}
.email-fab:hover { transform: scale(1.05); }

/* ═══ ERROR BANNER ═══ */
.email-error-banner {
    padding: 10px 16px;
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.18), rgba(220, 38, 38, 0.08));
    border-bottom: 1px solid var(--ec-red-line);
    color: #FCA5A5;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: ec-slide-down 0.3s ease;
    flex-shrink: 0;
}
.email-error-banner i { color: var(--ec-red); }
.email-error-banner button {
    margin-left: auto;
    background: rgba(220, 38, 38, 0.20);
    border: 1px solid var(--ec-red);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    cursor: pointer;
    font-weight: 600;
}
.email-error-banner button:hover { background: var(--ec-red); }

/* Save indicator (compose) */
.email-save-status {
    margin-left: 8px;
    font-size: 11.5px;
    color: var(--ec-text3);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.email-save-status.saving { color: var(--ec-amber); }
.email-save-status.saved { color: var(--ec-green); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1280px) {
    .email-app { grid-template-columns: 220px 340px 1fr; }
}
@media (max-width: 1024px) {
    .email-app {
        grid-template-columns: 320px 1fr;
        height: calc(100vh - 90px);
    }
    .email-sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 240px;
        z-index: 30;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.40);
    }
    .email-app.folders-open .email-sidebar { transform: translateX(0); }
    .email-folders-overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.50);
        z-index: 25;
        display: none !important;
    }
    .email-app.folders-open .email-folders-overlay { display: block !important; }
    .email-mobile-menu {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: 0;
        color: var(--ec-text);
        width: 32px;
        height: 32px;
        border-radius: 8px;
        cursor: pointer;
        font-size: 14px;
    }
    .email-mobile-menu:hover { background: var(--ec-hover); }
}
@media (max-width: 768px) {
    .email-app {
        grid-template-columns: 1fr;
        height: calc(100vh - 80px);
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }
    .email-list-panel { display: flex; }
    .email-reading-pane {
        position: absolute;
        inset: 0;
        z-index: 20;
        transform: translateX(100%);
        transition: transform .25s ease;
        background: var(--ec-bg2);
    }
    .email-app.reading-active .email-reading-pane { transform: translateX(0); }
    .email-mobile-back {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: 0;
        color: var(--ec-text);
        width: 36px;
        height: 36px;
        border-radius: 8px;
        cursor: pointer;
        font-size: 14px;
        margin-right: 8px;
    }
    .email-mobile-back:hover { background: var(--ec-hover); }
    .email-fab { display: flex; align-items: center; justify-content: center; }
    .email-reading-actions { display: none; }
    .email-mobile-reply-bar {
        display: flex !important;
        gap: 6px;
        padding: 10px 14px;
        background: rgba(6, 10, 20, 0.92);
        border-top: 1px solid var(--ec-line);
        backdrop-filter: blur(12px);
        position: sticky;
        bottom: 0;
        z-index: 5;
    }
    .email-mobile-reply-bar .btn { flex: 1; }
}
@media (min-width: 769px) {
    .email-mobile-reply-bar { display: none !important; }
}

/* ═══ A11Y FOCUS ═══ */
.email-app *:focus-visible {
    outline: 2px solid var(--ec-red);
    outline-offset: 2px;
    border-radius: 6px;
}
.email-item:focus-visible { outline-offset: -2px; }

/* WCAG 2.5.8 — interactive targets >= 24x24 */
.email-tb-btn,
.email-item-action,
.email-refresh-btn,
.email-folder-item { min-height: 28px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .email-app *,
    .email-app *::before,
    .email-app *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══ TOAST OVERRIDE FOR EMAIL ═══ */
.toast.email-toast {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--ec-red-line);
}

/* ═══ KEYBOARD SHORTCUT PILL ═══ */
.email-kbd-help {
    position: fixed;
    bottom: 16px;
    right: 16px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--ec-line-strong);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--ec-text2);
    z-index: 100;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.40);
    display: none;
    max-width: 280px;
}
.email-kbd-help.visible { display: block; animation: ec-slide-down 0.25s ease; }
.email-kbd-help h4 { margin: 0 0 6px; font-size: 11.5px; color: var(--ec-text); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.email-kbd-help kbd {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--ec-line-strong);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: var(--ec-text);
    margin-right: 4px;
}
.email-kbd-help-row { display: flex; justify-content: space-between; align-items: center; padding: 2px 0; gap: 12px; }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE FIX 2026-05-02 — emailfix override
   Bugs corrigés sur screenshot user 375px Android Chrome :
   1. Liste + détail visibles simultanément (drawer ne masquait pas list)
   2. Subject énorme (28-32px) sur 3+ lignes
   3. Double reply bar (top + bottom sticky)
   4. FAB compose chevauchait reply bar bottom
   5. HWID/hash monospace overflow
   6. Padding excessif mobile
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
    /* Reading pane drawer fullscreen, masque tout derrière */
    .email-app.reading-active .email-list-panel,
    .email-app.reading-active .email-sidebar {
        display: none !important;
    }
    .email-app.reading-active .email-reading-pane {
        position: fixed !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100dvh !important;
        z-index: 100 !important;
        transform: none !important;
        background: var(--ec-bg2, #060A14) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important;
    }

    /* Subject : taille raisonnable mobile + truncate 4 lignes */
    .email-reading-pane .email-reading-subject,
    .email-reading-pane h2.email-reading-subject {
        font-size: clamp(1.05rem, 4vw, 1.3rem) !important;
        line-height: 1.35 !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
        margin: 0 !important;
        max-height: 5.5em;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        font-weight: 600 !important;
    }

    /* Header sticky : back arrow + subject row */
    .email-reading-pane .email-reading-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        background: rgba(6, 10, 20, 0.96) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
        padding: 10px 14px !important;
    }
    .email-reading-pane .email-mobile-back {
        flex-shrink: 0 !important;
        margin-right: 10px !important;
    }

    /* CACHER les actions inline (top), garder UNIQUEMENT la sticky bottom */
    .email-reading-pane .email-reading-actions {
        display: none !important;
    }
    .email-mobile-reply-bar {
        display: flex !important;
        gap: 6px;
        padding: 10px 14px;
        padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
        background: rgba(6, 10, 20, 0.96);
        border-top: 1px solid var(--ec-line);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        position: sticky;
        bottom: 0;
        z-index: 5;
        margin-top: auto;
    }
    .email-mobile-reply-bar .btn {
        flex: 1;
        min-height: 40px !important;
        font-size: 0.85rem !important;
    }

    /* CACHER FAB compose quand reading active (zone pouce + collision reply bar) */
    .email-app.reading-active .email-fab,
    .email-app.reading-active .compose-fab {
        display: none !important;
    }

    /* Word-break sur tous les contenus monospace longs (HWID, hash, IDs) */
    .email-reading-pane code,
    .email-reading-pane .email-mono,
    .email-reading-pane pre,
    .email-reading-pane .email-reading-body code,
    .email-reading-pane .email-reading-body pre {
        word-break: break-all !important;
        overflow-wrap: anywhere !important;
        max-width: 100% !important;
        white-space: pre-wrap !important;
        font-size: 0.78rem !important;
    }

    /* Padding mobile réduit body */
    .email-reading-pane .email-reading-meta,
    .email-reading-pane .email-reading-body {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }
    .email-reading-pane .email-reading-body {
        padding-top: 12px !important;
        font-size: 0.92rem !important;
        line-height: 1.5 !important;
    }

    /* Email body iframe / images responsive (anti-overflow horizontal) */
    .email-reading-pane .email-reading-body,
    .email-reading-pane .email-reading-body * {
        max-width: 100% !important;
    }
    .email-reading-pane .email-reading-body iframe,
    .email-reading-pane .email-reading-body img,
    .email-reading-pane .email-reading-body table {
        max-width: 100% !important;
        width: auto !important;
        height: auto !important;
    }
    .email-reading-pane .email-reading-body table {
        display: block !important;
        overflow-x: auto !important;
    }

    /* Avatar 32px max mobile + meta align */
    .email-reading-pane .email-avatar,
    .email-reading-from-avatar,
    .email-reading-pane .email-reading-from .email-avatar {
        width: 32px !important;
        height: 32px !important;
        font-size: 13px !important;
        flex-shrink: 0 !important;
    }
    .email-reading-pane .email-reading-from {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        flex-wrap: wrap !important;
    }
    .email-reading-pane .email-reading-from > div:not(.email-avatar) {
        min-width: 0 !important;
        flex: 1 !important;
        word-break: break-word !important;
    }

    /* Pièce jointe : full-width clean */
    .email-reading-pane .email-attachment-card,
    .email-reading-pane a[href*="attachment"] {
        width: 100% !important;
        margin: 6px 0 !important;
        word-break: break-all !important;
        overflow-wrap: anywhere !important;
    }

    /* Email list : transition smooth quand on bascule */
    .email-app:not(.reading-active) .email-reading-pane {
        transform: translateX(100%) !important;
        pointer-events: none !important;
    }
}

/* ═══ Tablet sweet-spot 768-1023 : layout column comme mobile ═══ */
@media (max-width: 1023px) and (min-width: 769px) {
    .email-app {
        grid-template-columns: 1fr !important;
    }
    .email-list-panel {
        display: flex !important;
    }
    .email-reading-pane {
        position: absolute !important;
        inset: 0 !important;
        z-index: 20 !important;
        transform: translateX(100%);
        transition: transform .25s ease;
        background: var(--ec-bg2);
    }
    .email-app.reading-active .email-reading-pane {
        transform: translateX(0);
    }
    .email-mobile-back {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        background: none;
        border: 0;
        color: var(--ec-text);
        width: 36px;
        height: 36px;
        border-radius: 8px;
        cursor: pointer;
        font-size: 14px;
    }
}


/* light-theme override block (auto-generated) */
[data-theme="light"] {
    --ec-red-soft: rgba(220, 38, 38, 0.10);
    --ec-red-line: rgba(220, 38, 38, 0.32);
    --ec-red-glow: 0 8px 28px rgba(220, 38, 38, 0.22);
    --ec-bg: #FAF7EE;
    --ec-bg2: #F5F1E8;
    --ec-pane: rgba(255, 254, 248, 0.85);
    --ec-pane-solid: #FFFEF8;
    --ec-line: rgba(20, 18, 12, 0.08);
    --ec-line-strong: rgba(20, 18, 12, 0.16);
    --ec-text: #1A1A1F;
    --ec-text2: #6F6E6A;
    --ec-text3: #87796E;
    --ec-hover: rgba(20, 18, 12, 0.04);
    --ec-active: rgba(220, 38, 38, 0.08);
}


/* ═════════════════════════════════════════════════════════════════════════
   light-theme hardcoded overrides
   Avatars génériques (gradient #475569 → #1E293B) → ambré clair light.
   ═════════════════════════════════════════════════════════════════════════ */

[data-theme="light"] .email-app {
    background: linear-gradient(180deg, #FAF7EE 0%, #F5F1E8 100%);
}

[data-theme="light"] .email-list-panel {
    background: rgba(255, 254, 248, 0.85);
}

[data-theme="light"] .email-reading-pane {
    background: rgba(255, 254, 248, 0.65);
}

[data-theme="light"] .email-list-header {
    background: rgba(20, 18, 12, 0.04);
}

[data-theme="light"] .email-search-wrap {
    background: rgba(20, 18, 12, 0.025);
}

/* Avatar liste générique (était linear #475569 #1E293B) */
[data-theme="light"] .email-item-avatar {
    background: linear-gradient(135deg, #C8B89E, #87796E);
}

/* Floating actions on hover */
[data-theme="light"] .email-item-actions {
    background: rgba(255, 254, 248, 0.96);
    box-shadow: 0 6px 18px rgba(120, 80, 40, 0.22);
}

[data-theme="light"] .email-reading-empty kbd {
    background: rgba(20, 18, 12, 0.06);
    box-shadow: inset 0 -1px 0 rgba(20, 18, 12, 0.20);
}

[data-theme="light"] .email-reading-header {
    background: rgba(20, 18, 12, 0.035);
}

/* Avatar reading pane générique (était linear #475569 #1E293B) */
[data-theme="light"] .email-reading-from .email-avatar {
    background: linear-gradient(135deg, #C8B89E, #87796E);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.40), 0 4px 12px rgba(120, 80, 40, 0.20);
}

[data-theme="light"] .email-attachment-card {
    background: rgba(255, 254, 248, 0.85);
}

/* Compose & newsletter modals */
[data-theme="light"] .compose-modal,
[data-theme="light"] .nl-modal {
    background: rgba(255, 254, 248, 0.96) !important;
    box-shadow: 0 24px 80px rgba(120, 80, 40, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.60) !important;
}

[data-theme="light"] .compose-modal-overlay {
    background: rgba(20, 18, 12, 0.45) !important;
}

/* Mobile responsive overrides */
@media (max-width: 1023px) {
    [data-theme="light"] .email-sidebar {
        box-shadow: 8px 0 24px rgba(120, 80, 40, 0.22);
    }
    [data-theme="light"] .email-folders-overlay {
        background: rgba(20, 18, 12, 0.35);
    }
    [data-theme="light"] .email-mobile-reply-bar {
        background: rgba(255, 254, 248, 0.92);
    }
    [data-theme="light"] .email-app.reading-active .email-reading-pane {
        background: var(--ec-bg2, #FFFEF8) !important;
    }
    [data-theme="light"] .email-reading-pane .email-reading-header {
        background: rgba(255, 254, 248, 0.96) !important;
    }
}

/* Toast & kbd help */
[data-theme="light"] .toast.email-toast,
[data-theme="light"] .email-kbd-help {
    background: rgba(255, 254, 248, 0.96);
    box-shadow: 0 8px 24px rgba(120, 80, 40, 0.22);
}


/* light-theme override des variables LOCALES (scopées sur .email-app, pas :root) */
[data-theme="light"] .email-app {
    --ec-red-soft: rgba(220, 38, 38, 0.10);
    --ec-red-line: rgba(220, 38, 38, 0.32);
    --ec-red-glow: 0 8px 28px rgba(220, 38, 38, 0.22);
    --ec-bg: #FAF7EE;
    --ec-bg2: #F5F1E8;
    --ec-pane: rgba(255, 254, 248, 0.85);
    --ec-pane-solid: #FFFEF8;
    --ec-line: rgba(20, 18, 12, 0.08);
    --ec-line-strong: rgba(20, 18, 12, 0.16);
    --ec-text: #1A1A1F;
    --ec-text2: #6F6E6A;
    --ec-text3: #87796E;
    --ec-hover: rgba(20, 18, 12, 0.04);
    --ec-active: rgba(220, 38, 38, 0.08);
}

/* ═══════════════════════════════════════════════════════════════════════════
   scroll-x guard 2026-05-03
   Email tab : layout 3-pane (folders | threads | reader) qui devient 1-pane
   sur mobile via switching. On contient le shell racine seulement, sans
   toucher la mécanique scope-lock interne.
   ═══════════════════════════════════════════════════════════════════════════ */
.email-app,
.email-shell,
.email-pane,
.email-toolbar,
.email-thread-list,
.email-thread-item,
.email-thread-reader,
.email-composer {
    max-width: 100%;
    min-width: 0;
}
.email-app { overflow-x: hidden; }

/* Pre/code dans le reader (signatures, headers techniques) */
.email-thread-reader pre,
.email-thread-reader code {
    max-width: 100%;
    overflow-x: auto;
    word-break: break-word;
    white-space: pre-wrap;
}

/* Subjects/from longs */
.email-thread-item__subject,
.email-thread-item__from {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}


/* ═════════════════════════════════════════════════════════════════════════
   MODE EXPANDED (double-click email OU compose) — full width reading pane
   ═════════════════════════════════════════════════════════════════════════ */
.email-app.is-expanded {
    grid-template-columns: 1fr !important;
}
.email-app.is-expanded > .email-sidebar,
.email-app.is-expanded > .email-list-panel {
    display: none !important;
}
.email-back-to-list {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 7px 12px 7px 10px;
    margin-right: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--ec-line-strong);
    border-radius: 8px;
    color: var(--ec-text2);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    flex-shrink: 0;
}
.email-back-to-list:hover {
    background: rgba(220, 38, 38, 0.10);
    border-color: var(--ec-red-line);
    color: #fff;
}
.email-app.is-expanded .email-back-to-list { display: inline-flex; }
[data-theme="light"] .email-back-to-list {
    background: rgba(20, 18, 12, 0.04);
    color: #3B3B3D;
}
[data-theme="light"] .email-back-to-list:hover { color: #991B1B; }

/* compose pleine largeur quand expanded : padding plus généreux */
.email-app.is-expanded .email-compose-full {
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   design refresh 2026-05-03 — Newsletter dashboard + Emails sidebar polish
   Newsletter : refonte complete (stats grid + history + tips)
   Emails     : sidebar brand block, list-header search, modernisations
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── NEWSLETTER SHELL ─────────────────────────────────────────────────── */
.anl-shell {
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 0 40px;
}
.anl-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}
.anl-head__actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.anl-cta {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 18px;
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    color: #fff;
    border: 0;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
    letter-spacing: -0.005em;
    min-height: 42px;
    text-decoration: none;
    line-height: 1.2;
}
.anl-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(220, 38, 38, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    filter: brightness(1.06);
}
.anl-cta:active { transform: translateY(0); }
.anl-cta i { font-size: 13px; }

.anl-stats { margin-top: 4px; }
.anl-stats .aov-stat__hint {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--text3, #64748B);
    letter-spacing: 0.005em;
    line-height: 1.4;
}

/* ── CARDS ────────────────────────────────────────────────────────────── */
.anl-card {
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    overflow: hidden;
    isolation: isolate;
    position: relative;
}
.anl-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 90px;
    background: radial-gradient(ellipse 60% 100% at 0% 0%, rgba(220, 38, 38, 0.06), transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.anl-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(6, 10, 20, 0.30);
    position: relative;
    z-index: 1;
}
.anl-card__title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #F1F5F9);
    letter-spacing: -0.005em;
    display: inline-flex;
    align-items: center;
    gap: 9px;
}
.anl-card__title i {
    color: #DC2626;
    font-size: 13px;
    width: 18px;
    text-align: center;
}
.anl-card__sub {
    font-size: 12px;
    color: var(--text3, #64748B);
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ── HISTORY TABLE ───────────────────────────────────────────────────── */
.anl-table tbody td { vertical-align: middle; }
.anl-h-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--text, #F1F5F9);
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}
.anl-h-time {
    font-size: 11px;
    color: var(--text3, #64748B);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}
.anl-h-subject {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text, #F1F5F9);
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.anl-h-num {
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text2, #94A3B8);
    letter-spacing: 0.005em;
}

/* ── EMPTY STATE ─────────────────────────────────────────────────────── */
.anl-card--empty .anl-empty-state {
    padding: 56px 32px 64px;
    text-align: center;
    position: relative;
    z-index: 1;
}
.anl-empty-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.16), rgba(185, 28, 28, 0.06));
    border: 1px solid rgba(220, 38, 38, 0.30);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #DC2626;
    font-size: 28px;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.anl-empty-state h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text, #F1F5F9);
    letter-spacing: -0.01em;
}
.anl-empty-state p {
    margin: 0 auto 22px;
    color: var(--text2, #94A3B8);
    font-size: 13.5px;
    line-height: 1.55;
    max-width: 460px;
}

/* ── TIPS ────────────────────────────────────────────────────────────── */
.anl-tips__grid {
    padding: 20px 22px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    position: relative;
    z-index: 1;
}
.anl-tip {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.anl-tip:hover {
    background: rgba(220, 38, 38, 0.06);
    border-color: rgba(220, 38, 38, 0.22);
    transform: translateY(-1px);
}
.anl-tip > i {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 8px;
    background: rgba(220, 38, 38, 0.10);
    color: #DC2626;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.anl-tip > div { flex: 1; min-width: 0; }
.anl-tip strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text, #F1F5F9);
    margin-bottom: 2px;
    letter-spacing: -0.005em;
}
.anl-tip span {
    display: block;
    font-size: 12px;
    color: var(--text3, #64748B);
    line-height: 1.5;
}

/* ── SKELETONS ───────────────────────────────────────────────────────── */
.anl-skel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 10px;
}
.anl-skel {
    height: 130px;
    border-radius: 16px;
    background: linear-gradient(110deg, rgba(255, 255, 255, 0.03) 8%, rgba(255, 255, 255, 0.07) 18%, rgba(255, 255, 255, 0.03) 33%);
    background-size: 200% 100%;
    animation: anl-skel-pulse 1.4s linear infinite;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
@keyframes anl-skel-pulse {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ── EMAIL SIDEBAR — BRAND BLOCK ─────────────────────────────────────── */
.email-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px 16px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--ec-line, rgba(255, 255, 255, 0.06));
}
.email-brand__icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 11px;
    background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.email-brand__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}
.email-brand__title {
    font-family: Instrument Serif, Times New Roman, serif;
    font-size: 19px;
    color: var(--ec-text, #F1F5F9);
    letter-spacing: -0.012em;
    font-weight: 400;
}
.email-brand__sub {
    font-size: 11px;
    color: var(--ec-text3, #64748B);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.email-compose-cta { letter-spacing: -0.005em; }

/* ── EMAIL LIST HEADER — search + count ──────────────────────────────── */
.email-list-header__l {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}
.email-list-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ec-text, #F1F5F9);
    letter-spacing: -0.005em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.email-list-count {
    font-size: 11px;
    color: var(--ec-text3, #64748B);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    min-width: 22px;
    text-align: center;
}
.email-list-count:empty { display: none; }
.email-list-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.email-search-box {
    position: relative;
    display: flex;
    align-items: center;
}
.email-search-box i {
    position: absolute;
    left: 9px;
    color: var(--ec-text3, #64748B);
    font-size: 11px;
    pointer-events: none;
    z-index: 1;
}
.email-search-box input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--ec-line-strong, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    padding: 6px 10px 6px 28px;
    color: var(--ec-text, #F1F5F9);
    font-family: inherit;
    font-size: 12.5px;
    width: 170px;
    height: 32px;
    transition: width .25s ease, border-color .15s, background .15s, box-shadow .15s;
    outline: none;
}
.email-search-box input:focus {
    width: 220px;
    border-color: rgba(220, 38, 38, 0.40);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
.email-search-box input::placeholder { color: var(--ec-text3, #64748B); }

/* ── LIGHT THEME OVERRIDES ───────────────────────────────────────────── */
[data-theme="light"] .anl-card {
    background: rgba(255, 254, 248, 0.92);
    border-color: rgba(20, 18, 12, 0.10);
    box-shadow: 0 4px 18px rgba(120, 80, 40, 0.06);
}
[data-theme="light"] .anl-card::before {
    background: radial-gradient(ellipse 60% 100% at 0% 0%, rgba(220, 38, 38, 0.05), transparent 70%);
}
[data-theme="light"] .anl-card__head {
    background: rgba(250, 247, 238, 0.65);
    border-bottom-color: rgba(20, 18, 12, 0.08);
}
[data-theme="light"] .anl-card__title { color: #1A1A1F; }
[data-theme="light"] .anl-card__title i { color: #991B1B; }
[data-theme="light"] .anl-card__sub { color: #6F6E6A; }
[data-theme="light"] .anl-h-date { color: #1A1A1F; }
[data-theme="light"] .anl-h-time { color: #87796E; }
[data-theme="light"] .anl-h-subject { color: #1A1A1F; }
[data-theme="light"] .anl-h-num { color: #3B3B3D; }
[data-theme="light"] .anl-empty-state h3 { color: #1A1A1F; }
[data-theme="light"] .anl-empty-state p { color: #6F6E6A; }
[data-theme="light"] .anl-empty-icon {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.10), rgba(185, 28, 28, 0.04));
    border-color: rgba(220, 38, 38, 0.25);
    color: #991B1B;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.04);
}
[data-theme="light"] .anl-tip {
    background: rgba(250, 247, 238, 0.70);
    border-color: rgba(20, 18, 12, 0.08);
}
[data-theme="light"] .anl-tip:hover {
    background: rgba(220, 38, 38, 0.05);
    border-color: rgba(220, 38, 38, 0.18);
}
[data-theme="light"] .anl-tip > i {
    background: rgba(220, 38, 38, 0.08);
    color: #991B1B;
}
[data-theme="light"] .anl-tip strong { color: #1A1A1F; }
[data-theme="light"] .anl-tip span { color: #6F6E6A; }
[data-theme="light"] .anl-skel {
    background: linear-gradient(110deg, rgba(20, 18, 12, 0.04) 8%, rgba(20, 18, 12, 0.07) 18%, rgba(20, 18, 12, 0.04) 33%);
    background-size: 200% 100%;
    border-color: rgba(20, 18, 12, 0.08);
}
[data-theme="light"] .anl-cta {
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.20);
}
[data-theme="light"] .anl-stats .aov-stat__hint { color: #87796E; }

[data-theme="light"] .email-brand {
    border-bottom-color: rgba(20, 18, 12, 0.10);
}
[data-theme="light"] .email-brand__icon {
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.20);
}
[data-theme="light"] .email-brand__title { color: #1A1A1F; }
[data-theme="light"] .email-brand__sub { color: #87796E; }
[data-theme="light"] .email-list-title { color: #1A1A1F; }
[data-theme="light"] .email-list-count {
    background: rgba(20, 18, 12, 0.06);
    color: #6F6E6A;
}
[data-theme="light"] .email-search-box input {
    background: rgba(255, 254, 248, 0.85);
    border-color: rgba(20, 18, 12, 0.16);
    color: #1A1A1F;
}
[data-theme="light"] .email-search-box input:focus {
    background: #FFFEF8;
    border-color: rgba(220, 38, 38, 0.40);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
}
[data-theme="light"] .email-search-box i { color: #87796E; }
[data-theme="light"] .email-search-box input::placeholder { color: #87796E; }

/* end design refresh 2026-05-03 */
