:root {
    --bg-color: #f6f8fc;
    --sidebar-bg: #f6f8fc;
    --main-bg: #ffffff;
    --text-primary: #1f1f1f;
    --text-secondary: #444746;
    --accent-color: #0b57d0;
    /* Google Blue */
    --accent-hover: #0842a0;
    --selected-bg: #d3e3fd;
    --hover-bg: #f2f6fc;
    --border-color: #e7e7e7;
    --font-family: 'Outfit', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

/* Dark Mode */
:root.dark-mode {
    --bg-color: #0f172a;
    --sidebar-bg: #1e293b;
    --main-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --selected-bg: #1e40af;
    --hover-bg: #334155;
    --border-color: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Sidebar */
.sidebar {
    width: 256px;
    background-color: var(--sidebar-bg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.logo-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%;
}

.compose-btn {
    background-color: #c2e7ff;
    color: #001d35;
    border: none;
    padding: 16px 24px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.compose-btn:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    background-color: #b3d7ff;
}

.access-btn {
    background-color: var(--main-bg);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 12px 24px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.access-btn:hover {
    background-color: var(--accent-color);
    color: white;
}

.access-btn ion-icon {
    font-size: 20px;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    margin-top: auto;
}

.theme-toggle-btn:hover {
    background-color: var(--hover-bg);
    border-color: var(--accent-color);
}

.theme-toggle-btn ion-icon {
    font-size: 18px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--main-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: var(--hover-bg);
}

.modal-close ion-icon {
    font-size: 24px;
    color: var(--text-secondary);
}

.modal-body {
    padding: 24px;
}

.modal-description {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--hover-bg);
    transition: all 0.2s;
}

.input-group:focus-within {
    border-color: var(--accent-color);
    background-color: var(--main-bg);
}

.input-group ion-icon {
    font-size: 20px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.input-group input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: var(--font-family);
}

.input-group input::placeholder {
    color: var(--text-secondary);
}

.modal-hint {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.btn-secondary,
.btn-primary {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

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

.btn-primary {
    background-color: var(--accent-color);
    border: none;
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-primary ion-icon {
    font-size: 18px;
}


.nav-menu {
    margin-top: 8px;
}

.nav-menu ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    padding: 8px 16px 8px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 0 20px 20px 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    cursor: pointer;
}

.nav-item ion-icon {
    font-size: 20px;
}

.nav-item.active {
    background-color: var(--selected-bg);
    color: var(--accent-color);
    font-weight: 600;
}

.nav-item:hover:not(.active) {
    background-color: var(--hover-bg);
}

/* Main Content Structure */
.main-content {
    flex: 1;
    background-color: var(--main-bg);
    margin: 12px 12px 12px 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Header inside Main */
.main-header {
    height: 64px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 8px;
    transition: all 0.3s ease;
}

.search-bar {
    background-color: var(--hover-bg);
    border-radius: 24px;
    padding: 10px 20px;
    width: 100%;
    max-width: 600px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.search-bar:focus-within {
    background-color: var(--main-bg);
    border: 1px solid var(--accent-color);
}

.search-bar ion-icon {
    color: var(--text-secondary);
    font-size: 20px;
    flex-shrink: 0;
}

.search-bar input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: var(--font-family);
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

.current-email-display {
    font-weight: 500;
    color: var(--text-primary);
    background: var(--selected-bg);
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    word-break: break-all;
}

.current-email-display:hover {
    background: var(--accent-color);
    color: white;
}

/* Header Actions Container */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Custom Domain Selector */
.custom-domain-selector {
    position: relative;
    min-width: 160px;
}

.selector-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--main-bg);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.selector-trigger:hover,
.custom-domain-selector.active .selector-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(11, 87, 208, 0.1);
}

.selector-trigger ion-icon[name="globe-outline"] {
    font-size: 18px;
    color: var(--accent-color);
}

.selector-trigger span {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.dropdown-arrow {
    font-size: 16px;
    color: var(--accent-color);
    transition: transform 0.2s ease;
}

.custom-domain-selector.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown list */
.selector-options {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--main-bg);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    padding: 6px;
    z-index: 1000;
    display: none;
    transform-origin: top right;
    animation: scaleIn 0.2s ease forwards;
}

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

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.custom-domain-selector.active .selector-options {
    display: block;
}

.selector-option {
    padding: 10px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.1s;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.selector-option:hover {
    background-color: var(--hover-bg);
}

.selector-option.selected {
    background-color: var(--accent-color);
    color: white;
    font-weight: 600;
}



/* Main Body Layout */
.main-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    flex-direction: row;
}

/* Email List (Takes full width by default) */
.email-list-container {
    flex: 1;
    /* Takes all available space */
    border-right: none;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-color: var(--main-bg);
    width: 100%;
    /* Reset max/min width from previous split layout */
    max-width: none;
    min-width: 0;
}

.email-row {
    display: grid;
    grid-template-columns: 220px 1fr 100px;
    gap: 20px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.15s ease;
    align-items: center;
    background-color: var(--main-bg);
}

.email-row:hover {
    background-color: var(--hover-bg);
    box-shadow: inset 1px 0 0 var(--border-color), inset -1px 0 0 var(--border-color),
        0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    z-index: 2;
}

.email-row-header {
    display: none;
}

.sender-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.email-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    min-width: 0;
}

.email-subject-snippet {
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.email-body-snippet {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
    font-weight: 500;
}

/* Email Detail Overlay (Hidden by default, covers list) */
.email-detail-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--main-bg);
    z-index: 20;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    overflow: hidden;
}

.email-detail-view.active {
    display: flex;
}

#detailContent {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}


/* Remove Placeholder styles */
.detail-placeholder {
    display: none !important;
}

/* Detail Header Styles */
.detail-header {
    padding: 24px 32px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--hover-bg);
}

.detail-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.detail-subject {
    font-size: 1.375rem;
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1.4;
    letter-spacing: 0;
    flex: 1;
}

.detail-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-date {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 400;
}

.detail-meta {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 0;
    background-color: transparent;
    border-radius: 0;
}

.sender-avatar {
    width: 40px;
    height: 40px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 400;
    flex-shrink: 0;
    text-transform: uppercase;
}

.sender-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.sender-info-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.sender-info-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.4;
}

.sender-info-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-family);
    line-height: 1.4;
}

.sender-info-to {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

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

.to-recipient {
    color: var(--text-primary);
    font-weight: 400;
}

/* Email Body */
.detail-body {
    flex: 1;
    width: 100%;
    padding: 32px 40px;
    /* More padding for paper-like feel */
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.65;
    color: var(--text-primary);
    font-size: 0.95rem;
    /* Slightly larger font */
    position: relative;
    clear: both;
    background-color: var(--main-bg);
    /* Explicit background for body */
}



.detail-body p {
    margin: 0 0 16px 0;
}

.detail-body p:last-child {
    margin-bottom: 0;
}

.detail-body a {
    color: var(--accent-color);
    text-decoration: none;
}

.detail-body a:hover {
    text-decoration: underline;
}

/* Back Button */
.back-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.back-btn:hover {
    background-color: var(--hover-bg);
}

.back-btn ion-icon {
    font-size: 20px;
}


/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    color: var(--text-secondary);
    text-align: center;
    padding: 48px 24px;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    fill: var(--border-color);
    display: block;
}

.empty-state p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Always show back button now */
.back-btn {
    display: inline-block;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    margin-right: 16px;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.back-btn:hover {
    background-color: var(--hover-bg);
}

/* Mobile Media Query Override (Detail view is already absolute, just ensure behavior) */
@media (max-width: 768px) {
    .email-row {
        grid-template-columns: 140px 1fr 80px;
        gap: 12px;
        padding: 12px 16px;
    }

    .sender-name {
        font-size: 0.9rem;
    }

    .email-subject-snippet {
        font-size: 0.9rem;
    }

    .email-body-snippet {
        font-size: 0.8rem;
    }
}

.detail-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    font-family: sans-serif;
    line-height: 1.6;
}

/* Loader */
.loader {
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Action Toolbar */
.action-bar {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: #323232;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
}

.rotating {
    animation: rotation 1s linear infinite;
}

.custom-edit-btn {
    background: var(--hover-bg);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.custom-edit-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* --- Mobile Responsive Enhancements --- */
@media (max-width: 768px) {

    /* Layout Reset */
    body {
        flex-direction: column;
        height: 100vh;
        overflow-x: hidden;
    }

    /* Sidebar Drawer */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 260px;
        background: var(--sidebar-bg);
        z-index: 1200;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
        overflow-y: auto;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Menu Button */
    .mobile-menu-btn {
        display: flex !important;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        font-size: 24px;
        color: var(--text-secondary);
        cursor: pointer;
        flex-shrink: 0;
    }

    .mobile-menu-btn:active {
        background: var(--hover-bg);
    }

    /* Main Content */
    .main-content {
        width: 100%;
        height: 100vh;
        overflow-y: auto;
        margin: 0;
        border-radius: 0;
    }

    /* Header optimization */
    .main-header {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 8px;
        height: auto;
        min-height: 60px;
    }

    .search-bar {
        flex: 1;
        min-width: 0;
        margin: 0;
        order: 2;
        height: 40px;
        max-width: none;
    }

    .mobile-menu-btn {
        order: 1;
        margin-right: 4px;
    }

    /* Scrollable Actions Row */
    .header-actions {
        order: 3;
        width: 100%;
        display: flex;
        justify-content: flex-start;
        /* Align Left */
        align-items: center;
        margin-top: 8px;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
        /* Space for scrollbar if any */
        -webkit-overflow-scrolling: touch;
    }

    /* Hide scrollbar but keep functionality */
    .header-actions::-webkit-scrollbar {
        display: none;
    }

    /* Elements sizing */
    .current-email-display {
        flex-shrink: 0;
        font-size: 0.85rem;
        padding: 6px 12px;
        max-width: 160px;
    }

    .custom-edit-btn {
        flex-shrink: 0;
        width: 32px;
        height: 32px;
    }

    .custom-domain-selector {
        flex-shrink: 0;
        min-width: auto;
    }

    .selector-trigger {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    /* List Item */
    .email-row {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 12px 16px;
        border-bottom: 1px solid var(--border-color);
        grid-template-columns: initial;
        position: relative;
    }

    .sender-name {
        font-size: 0.95rem;
        font-weight: 600;
        width: calc(100% - 60px);
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
    }

    .email-time {
        position: absolute;
        top: 12px;
        right: 16px;
        font-size: 0.75rem;
        color: var(--text-secondary);
    }

    .email-content-wrapper {
        padding: 0;
        width: 100%;
    }

    .email-subject-snippet {
        font-size: 0.9rem;
        margin-bottom: 2px;
    }

    /* Detail View */
    .detail-header {
        padding: 16px;
    }

    .detail-title-row {
        flex-wrap: nowrap;
        align-items: center;
        gap: 12px;
        margin-bottom: 16px;
    }

    .back-btn {
        width: 32px;
        height: 32px;
        background: var(--hover-bg);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .detail-subject {
        font-size: 1.1rem;
        line-height: 1.3;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .detail-actions {
        margin-left: auto;
        position: relative;
    }

    .detail-body {
        padding: 16px;
        font-size: 0.9rem;
    }

    .detail-meta {
        flex-wrap: wrap;
    }

    .action-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .toast {
        bottom: 16px;
        left: 16px;
        right: 16px;
        max-width: calc(100% - 32px);
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .sidebar {
        width: 240px;
    }

    .main-header {
        min-height: 50px;
        padding: 8px 12px;
    }

    .search-bar {
        height: 36px;
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .header-actions {
        gap: 6px;
    }

    .current-email-display {
        font-size: 0.8rem;
        padding: 4px 10px;
        max-width: 140px;
    }

    .custom-edit-btn {
        width: 30px;
        height: 30px;
    }

    .selector-trigger {
        padding: 4px 10px;
        font-size: 0.8rem;
    }

    .email-row {
        padding: 10px 12px;
    }

    .sender-name {
        font-size: 0.9rem;
    }

    .email-subject-snippet {
        font-size: 0.85rem;
    }

    .email-body-snippet {
        font-size: 0.75rem;
    }

    .detail-subject {
        font-size: 1rem;
    }

    .detail-body {
        padding: 12px;
        font-size: 0.85rem;
    }
}
