/* =============================================
   Mail Client Styles
   ============================================= */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.5;
}

/* --- Login Page --- */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-card h1 {
    margin: 0 0 24px;
    font-size: 24px;
    color: #1a1a2e;
    text-align: center;
}

/* --- Layout --- */
.container {
    display: flex;
    height: 100vh;
    position: relative;
}

/* Sidebar toggle button */
.sidebar-toggle {
    background: transparent;
    color: inherit;
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    margin-right: 8px;
    flex-shrink: 0;
    transition: background 0.15s;
}
.sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
}
html.dark .sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.main-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 100;
    background: #1a1a2e;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 16px;
}
.main-toggle:hover {
    background: #2a2a4e;
}
body.sidebar-collapsed .main-toggle {
    display: flex;
}
body:not(.sidebar-collapsed) .main-toggle {
    display: none;
}

aside {
    width: 240px;
    background: #1a1a2e;
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    z-index: 999;
}

body.sidebar-collapsed aside {
    transform: translateX(-100%);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    opacity: 0;
    pointer-events: none;
}
body.sidebar-collapsed aside.sidebar-hover {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}


/* Hover trigger zone on left edge */
body.sidebar-collapsed .sidebar-hover-zone {
    position: fixed;
    top: 0;
    left: 0;
    width: 8px;
    height: 100%;
    z-index: 998;
}

main {
    flex-grow: 1;
    padding: 24px;
    padding-top: 48px;
    background: #f0f2f5;
    overflow-y: auto;
    min-width: 0;
    position: relative;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* --- Sidebar --- */
#sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
    position: relative;
}

.sidebar-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h2 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 600;
    color: #e0e0e0;
}

.sidebar-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    z-index: 10;
}

.sidebar-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.15);
}

.sidebar-user {
    width: 100%;
    font-size: 12px;
    color: #888;
    margin-top: -16px;
    margin-bottom: 12px;
}

.btn-compose {
    background: #0f3460;
    border: none;
    color: white;
    padding: 12px;
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 24px;
    transition: background 0.2s;
}

.btn-compose:hover {
    background: #1a4a7a;
}

.sidebar-user {
    display: block;
    font-size: 11px;
    color: #8899aa;
    margin-top: -12px;
    margin-bottom: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.folder-list li {
    margin: 2px 0;
}

.folder-list a {
    display: block;
    color: #b0b0c0;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.15s;
}

.folder-list a:hover,
.folder-list a.active {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #b0b0c0;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    width: 100%;
}

.btn-logout:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

/* --- Inbox --- */
.inbox-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 20px;
}

.inbox-header h2 {
    margin: 0;
    font-size: 22px;
}

.email-count {
    color: #666;
    font-size: 13px;
}

.email-list {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.email-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s;
}

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

.email-item:hover {
    background: #f8f9fb;
}

.email-item.unread {
    background: #f0f7ff;
}

.email-item.unread .email-sender,
.email-item.unread .email-subject {
    font-weight: 600;
}

.email-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0f3460;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    margin-right: 12px;
}

.email-details {
    flex: 1;
    min-width: 0;
}

.email-sender {
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-subject {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 12px;
}

.starred {
    color: #f1c40f;
    font-size: 16px;
}

.email-date {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

/* --- Pagination --- */
.thread-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--banner-bg, #eef4fb);
    color: #555;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light, #eee);
}

.thread-banner a {
    color: #0f3460;
    font-weight: 600;
    text-decoration: none;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    padding: 12px;
}

.page-link {
    text-decoration: none;
    color: #0f3460;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 14px;
    border: 1px solid #d0d0d0;
    transition: all 0.15s;
}

.page-link:hover {
    background: #0f3460;
    color: white;
    border-color: #0f3460;
}

.page-info {
    font-size: 13px;
    color: #666;
}

/* --- Email View --- */
.email-view {
    background: white;
    border-radius: 10px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.email-view h2 {
    margin: 0 0 16px;
    font-size: 20px;
}

.email-meta .meta-row {
    font-size: 14px;
    margin-bottom: 4px;
    color: #444;
    overflow-wrap: anywhere;
}

.email-body {
    padding: 16px 0;
    line-height: 1.7;
    font-size: 15px;
}

.action-buttons {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.action-button {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.action-button:hover {
    background: #f0f2f5;
    border-color: #aaa;
}

.move-form {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.move-form select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
}

.move-select-inline {
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid var(--border, #d0d0d0);
    font-size: 12px;
    background: var(--bg-card, white);
    color: inherit;
}

/* --- Compose --- */
.compose-form {
    background: white;
    border-radius: 10px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    max-width: 700px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #0f3460;
    box-shadow: 0 0 0 3px rgba(15, 52, 96, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 200px;
}

/* --- Buttons --- */
.btn-primary {
    background: #0f3460;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
    display: inline-block;
    text-decoration: none;
}

.btn-primary:hover {
    background: #1a4a7a;
}

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    aside {
        width: 100%;
        height: auto;
    }

    #sidebar {
        padding: 12px 16px;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }

    .sidebar-header h2 {
        margin: 0;
        font-size: 16px;
    }

    .btn-compose {
        width: auto;
        margin: 0 0 0 auto;
        padding: 8px 16px;
    }

    .folder-list {
        display: flex;
        gap: 4px;
        width: 100%;
        margin-top: 8px;
        overflow-x: auto;
    }

    .folder-list li {
        margin: 0;
    }

    .folder-list a {
        padding: 6px 10px;
        font-size: 13px;
        white-space: nowrap;
    }

    .sidebar-footer {
        display: none;
    }

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

    .compose-form {
        max-width: 100%;
    }
}

/* =============================================
   SPA Styles
   ============================================= */

/* --- Inbox Toolbar --- */
.inbox-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 8px 0;
}

.inbox-toolbar-left {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-shrink: 0;
}

.folder-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
}

.inbox-toolbar-center {
    flex: 1;
}

.search-box input {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box input:focus {
    outline: none;
    border-color: #0f3460;
    box-shadow: 0 0 0 3px rgba(15, 52, 96, 0.1);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 6px;
}

.advanced-search {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    background: var(--bg-card, #fff);
    margin-top: 6px;
    max-width: 640px;
}

.advanced-search input[type="text"],
.advanced-search input[type="date"] {
    padding: 6px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 13px;
    background: transparent;
    color: inherit;
    min-width: 90px;
}

.advanced-search .adv-check {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    white-space: nowrap;
}

.adv-range {
    font-size: 12px;
    color: #888;
    margin-left: 6px;
    white-space: nowrap;
}

.adv-range-btn {
    padding: 3px 10px;
    font-size: 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.adv-range-btn:hover {
    background: var(--bg-hover, #f1f3f5);
}

html.dark .adv-range {
    color: #999;
}

html.dark .adv-range-btn {
    border-color: #4a4a4a;
}

html.dark .adv-range-btn:hover {
    background: #3a3a3a;
}

.settings-form {
    padding: 0 16px 16px;
    max-width: 480px;
}

.settings-form .form-group {
    margin-bottom: 14px;
}

.settings-form .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.settings-form .form-group input[type="text"],
.settings-form .form-group input[type="password"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 13px;
    background: transparent;
    color: inherit;
}

.settings-form .form-hint {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}


.inbox-toolbar-right {
    flex-shrink: 0;
}

/* --- Inbox View --- */
.inbox-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* --- Split Pane --- */
.inbox-split {
    display: flex;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

.email-list-pane {
    width: 420px;
    min-width: 350px;
    max-width: 500px;
    background: white;
    border-radius: 10px;
    overflow-y: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.email-reader-pane {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

/* --- Email Items (SPA) --- */
.email-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s;
    gap: 10px;
}

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

.email-item:hover {
    background: #f5f7fa;
}

.email-item.unread {
    background: #f0f7ff;
}

.email-item.unread .email-sender,
.email-item.unread .email-subject {
    font-weight: 600;
}

.email-item.selected {
    background: #e8f0fe;
}

/* --- Checkbox in Email List --- */
.checkbox-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
}

.checkbox-wrap input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.email-item .email-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
    flex-shrink: 0;
}

.email-item .email-details {
    flex: 1;
    min-width: 0;
}

.email-item .email-sender {
    font-size: 13px;
    margin-bottom: 1px;
}

.email-item .email-subject {
    font-size: 12px;
}

.email-item .email-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.attach-indicator {
    font-size: 12px;
    opacity: 0.6;
}

/* --- Email View (Reader) --- */
.email-view {
    background: white;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.email-view-header {
    margin-bottom: 16px;
}

.email-view-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.email-view-actions .btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
    background: white;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.email-view-actions .btn:hover {
    background: #f0f2f5;
    border-color: #aaa;
}

.email-view-actions .btn.active {
    background: #fff8e1;
    border-color: #f1c40f;
    color: #f39c12;
}

.email-subj {
    margin: 0 0 12px;
    font-size: 18px;
    line-height: 1.3;
}

.email-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.email-meta-row .email-avatar {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.email-sender-info {
    flex: 1;
}

.email-sender-info strong {
    display: block;
    font-size: 14px;
}

.email-addr {
    color: #666;
    font-size: 12px;
}

.email-date-full {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

.email-recipients {
    font-size: 12px;
    color: #666;
    margin-left: 46px;
}

.email-recipients span {
    display: block;
    margin-bottom: 2px;
}

/* --- Attachments --- */
.attachments {
    margin: 16px 0;
    padding: 12px 16px;
    background: #f8f9fb;
    border-radius: 8px;
    border: 1px solid #eef0f2;
}

.attachments h4 {
    margin: 0 0 8px;
    font-size: 13px;
    color: #555;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    font-size: 12px;
    transition: all 0.15s;
}

.attachment-item:hover {
    border-color: #0f3460;
    color: #0f3460;
}

.attachment-icon {
    font-size: 14px;
}

.attachment-size {
    color: #888;
    font-size: 11px;
}

/* --- Email Body --- */
.email-body {
    padding: 16px 0;
    line-height: 1.7;
    font-size: 14px;
    border-top: 1px solid #eef0f2;
}

.email-iframe {
    width: 100%;
    min-height: 400px;
    border: none;
    border-radius: 6px;
}

.email-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
}

.loading-state,
.error-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 14px;
}

.error-state {
    color: #b91c1c;
}

/* --- Bulk Action Bar --- */
.bulk-bar {
    position: fixed;
    bottom: 0;
    left: 240px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    background: white;
    border-top: 2px solid #0f3460;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.bulk-bar button {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
    background: white;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.bulk-bar button:hover {
    background: #f0f2f5;
    border-color: #aaa;
}

#bulk-count {
    font-size: 13px;
    font-weight: 600;
    color: #0f3460;
}

/* --- Compose View --- */
.compose-view {
    max-width: 700px;
}

.compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.compose-header h2 {
    margin: 0;
    font-size: 20px;
}

.compose-header .btn {
    padding: 6px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 16px;
}

.compose-options {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.btn-link {
    background: none;
    border: none;
    color: #0f3460;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 0;
}

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

.compose-toolbar {
    display: flex;
    gap: 4px;
    padding: 6px 0;
    border-bottom: 1px solid #e0e0e0;
}

.compose-toolbar button {
    padding: 4px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.1s;
}

.compose-toolbar button:hover {
    background: #f0f2f5;
}

.compose-body {
    min-height: 250px;
    padding: 12px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.compose-body:focus {
    border-color: #0f3460;
    box-shadow: 0 0 0 3px rgba(15, 52, 96, 0.1);
}

.compose-footer {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* --- Toast Notifications --- */
#toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    pointer-events: auto;
    max-width: 380px;
}

.toast-show {
    transform: translateX(0);
}

.toast-info {
    background: #0f3460;
}

.toast-success {
    background: #166534;
}

.toast-error {
    background: #b91c1c;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    min-width: 320px;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal h3 {
    margin: 0 0 16px;
    font-size: 16px;
}

.modal select {
    width: 100%;
    padding: 10px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* --- Unread Badges on Sidebar --- */
.unread-badge {
    background: #e74c3c;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 8px;
    float: right;
    line-height: 1.6;
}

/* --- Dark Mode --- */
:root {
    --bg-body: #f0f2f5;
    --bg-card: white;
    --bg-sidebar: #1a1a2e;
    --text-primary: #1a1a2e;
    --text-secondary: #555;
    --text-muted: #888;
    --border: #d0d0d0;
    --border-light: #f0f0f0;
    --hover: #f5f7fa;
    --unread-bg: #f0f7ff;
    --selected-bg: #e8f0fe;
}

html.dark {
    --bg-body: #111827;
    --bg-card: #1f2937;
    --bg-sidebar: #0f172a;
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border: #374151;
    --border-light: #2d3748;
    --hover: #374151;
    --unread-bg: #1e3a5f;
    --selected-bg: #1e293b;
}

html.dark body {
    background: var(--bg-body);
    color: var(--text-primary);
}

html.dark .email-list-pane,
html.dark .email-view,
html.dark .modal,
html.dark .search-box input,
html.dark .form-group input,
html.dark .form-group textarea,
html.dark .form-group select,
html.dark .compose-body,
html.dark .email-item {
    background: var(--bg-card);
    color: var(--text-primary);
}

html.dark .email-item {
    border-bottom-color: var(--border-light);
}

html.dark .email-item:hover {
    background: var(--hover);
}

html.dark .email-item.unread {
    background: var(--unread-bg);
}

html.dark .email-item.selected {
    background: var(--selected-bg);
}

html.dark .search-box input {
    border-color: var(--border);
    color: var(--text-primary);
}

html.dark .folder-title {
    color: var(--text-primary);
}

html.dark .email-subject {
    color: var(--text-secondary);
}

html.dark .email-count,
html.dark .email-date,
html.dark .email-date-full,
html.dark .email-addr,
html.dark .email-recipients {
    color: var(--text-muted);
}

html.dark .inbox-toolbar .btn,
html.dark .email-view-actions .btn,
html.dark .bulk-bar button,
html.dark .page-link,
html.dark .compose-header .btn,
html.dark .compose-toolbar button {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

html.dark .inbox-toolbar .btn:hover,
html.dark .email-view-actions .btn:hover,
html.dark .bulk-bar button:hover,
html.dark .page-link:hover,
html.dark .compose-toolbar button:hover {
    background: var(--hover);
}

html.dark .pagination {
    border-top-color: var(--border-light);
}

html.dark .attachments {
    background: var(--hover);
    border-color: var(--border);
}

html.dark .attachment-item {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

html.dark .attachment-item:hover {
    border-color: #3b82f6;
    color: #60a5fa;
}

html.dark .email-text {
    color: var(--text-primary);
}

html.dark .compose-body {
    border-color: var(--border);
    color: var(--text-primary);
}

html.dark .form-group label {
    color: var(--text-secondary);
}

html.dark .bulk-bar {
    background: var(--bg-card);
    border-top-color: #3b82f6;
    color: var(--text-primary);
}

html.dark .modal select {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

html.dark .btn-primary {
    background: #2563eb;
}

html.dark .btn-primary:hover {
    background: #3b82f6;
}

html.dark .btn-link {
    color: #60a5fa;
}

/* --- SPA Responsive --- */
@media (max-width: 900px) {
    .inbox-split {
        flex-direction: column;
        flex: none;
    }

    .email-list-pane {
        width: 100%;
        min-width: 0;
        max-width: none;
        max-height: 300px;
    }

    .email-reader-pane {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .inbox-toolbar {
        flex-wrap: wrap;
    }

    .inbox-toolbar-center {
        order: 3;
        width: 100%;
    }

    .search-box input {
        max-width: 100%;
    }

    .bulk-bar {
        left: 0;
        padding: 10px 16px;
        flex-wrap: wrap;
    }
}

/* =============================================
   Phase 4 — Compose Modal
   ============================================= */

.compose-modal-overlay {
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.compose-modal-overlay.modal-open {
    opacity: 1;
}

.compose-modal {
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    resize: both;
    transition: width 0.2s, max-width 0.2s, max-height 0.2s, height 0.2s;
}
.compose-modal.fullscreen {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    resize: none;
}

.compose-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #e0e0e0);
    flex-shrink: 0;
}

.compose-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.compose-modal-header .header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

#compose-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.compose-field {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 20px;
    border-bottom: 1px solid var(--border-light, #f0f0f0);
    flex-shrink: 0;
}

.compose-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted, #888);
    width: 50px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.compose-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 6px 0;
    font-size: 14px;
    background: transparent;
    color: inherit;
    font-family: inherit;
}

.compose-input::placeholder {
    color: var(--text-muted, #aaa);
}

/* --- Autocomplete --- */
.autocomplete-wrap {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.autocomplete-input {
    width: 100%;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card, white);
    border: 1px solid var(--border, #d0d0d0);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 180px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.autocomplete-dropdown.open {
    display: block;
}

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.1s;
}

.autocomplete-item:hover,
.autocomplete-item.ac-active {
    background: var(--hover, #f0f2f5);
}

.ac-email {
    color: var(--text-muted, #888);
    font-size: 12px;
    margin-left: 8px;
}

/* --- Compose Options Row (CC/BCC/Signature) --- */
.compose-options-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 20px;
    flex-shrink: 0;
    font-size: 12px;
}

.compose-spacer {
    flex: 1;
}

.sig-label {
    font-size: 12px;
    color: var(--text-muted, #888);
}

.sig-select {
    border: 1px solid var(--border, #d0d0d0);
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 12px;
    background: var(--bg-card, white);
    color: inherit;
    max-width: 180px;
}

/* --- Toolbar within modal --- */
#compose-form .compose-toolbar {
    padding: 6px 20px;
    border-bottom: 1px solid var(--border-light, #f0f0f0);
    flex-shrink: 0;
}

/* --- Body within modal --- */
.compose-body-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
}

#compose-form .compose-body {
    min-height: 200px;
    border: none;
    padding: 12px 0;
}

#compose-form .compose-body:focus {
    box-shadow: none;
}

/* --- Attachment row in modal --- */
.compose-attachments-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 20px;
    border-top: 1px solid var(--border-light, #f0f0f0);
    flex-shrink: 0;
}

.btn-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border, #d0d0d0);
    border-radius: 6px;
    background: var(--bg-card, white);
    cursor: pointer;
    font-size: 12px;
    color: var(--text-primary, #333);
    width: auto;
}

.btn-file:hover {
    background: var(--hover, #f0f2f5);
}

.attachment-queue {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--hover, #f0f2f5);
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 6px;
    font-size: 12px;
}

.chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    color: var(--text-muted, #888);
    line-height: 1;
}

.chip-remove:hover {
    color: #b91c1c;
}

/* --- Compose footer within modal --- */
.compose-modal-footer {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid var(--border, #e0e0e0);
    flex-shrink: 0;
}

/* --- Signature block in compose body --- */
.compose-signature {
    opacity: 0.8;
    font-size: 13px;
    border-top: 1px solid var(--border-light, #eee);
    margin-top: 8px;
    padding-top: 8px;
}

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

.toast-undo {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s;
}

.toast-undo:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* --- Attachment Preview (inline images) --- */
.attachment-item .attachment-preview {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.attachment-item .attachment-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Dark mode additions for Phase 4 --- */
html.dark .compose-modal {
    background: var(--bg-card);
}

html.dark .compose-field {
    border-bottom-color: var(--border-light);
}

html.dark .compose-input {
    color: var(--text-primary);
}

html.dark .autocomplete-dropdown {
    background: var(--bg-card);
    border-color: var(--border);
}

html.dark .autocomplete-item:hover,
html.dark .autocomplete-item.ac-active {
    background: var(--hover);
}

html.dark .sig-select {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

html.dark .attachment-chip {
    background: var(--hover);
    border-color: var(--border);
}

html.dark .btn-file {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

html.dark .btn-file:hover {
    background: var(--hover);
}

html.dark .compose-modal-header,
html.dark .compose-modal-footer,
html.dark .compose-attachments-row {
    border-color: var(--border);
}

@media (max-width: 600px) {
    .compose-modal {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .compose-field {
        padding: 6px 12px;
    }

    #compose-form .compose-toolbar {
        padding: 6px 12px;
    }

    .compose-body-wrap {
        padding: 0 12px;
    }

    .compose-attachments-row {
        padding: 8px 12px;
    }

    .compose-modal-footer {
        padding: 12px;
    }
}

/* =============================================
   Phase 5 — Skeletons, Threading, Swipe
   ============================================= */

/* --- Skeleton Loading --- */
.skeleton-pulse {
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 6px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-line {
    height: 12px;
    margin: 6px 0;
    border-radius: 4px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

.w-60 { width: 60%; }
.w-80 { width: 80%; }
.w-20 { width: 20%; }

.skeleton-block {
    height: 200px;
    border-radius: 8px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

html.dark .skeleton-pulse,
html.dark .skeleton-line,
html.dark .skeleton-block {
    background: linear-gradient(90deg, #2d3748 25%, #374151 50%, #2d3748 75%);
    background-size: 200% 100%;
}

/* --- Threading --- */
.email-item-thread {
    cursor: pointer;
}

.email-item-thread-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #e8f0fe;
    color: #0f3460;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.email-item-thread-count:hover {
    background: #d0e2ff;
}

html.dark .email-item-thread-count {
    background: #1e3a5f;
    color: #93c5fd;
}

html.dark .email-item-thread-count:hover {
    background: #2d4a7a;
}

.thread-msg-count {
    font-size: 11px;
    font-weight: 600;
    color: #0f3460;
    background: #e8f0fe;
    padding: 1px 6px;
    border-radius: 8px;
}

html.dark .thread-msg-count {
    color: #93c5fd;
    background: #1e3a5f;
}

/* --- Swipe Indicators --- */
.email-item {
    touch-action: pan-y;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.email-item::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80px;
    opacity: 0;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    pointer-events: none;
}

@media (hover: none) and (pointer: coarse) {
    .email-item:active::after {
        opacity: 1;
    }
}

/* --- Favicon (no visual styles needed, canvas-based) --- */

/* --- Mobile Responsive Additions --- */
@media (max-width: 600px) {
    .inbox-toolbar-right .btn {
        padding: 4px 8px;
        font-size: 11px;
    }

    .email-list-pane {
        max-height: 250px;
    }
}

/* =============================================
   Settings View
   ============================================= */

.settings-view {
    max-width: 700px;
    margin: 0 auto;
}

.settings-header h2 {
    margin: 0 0 20px;
    font-size: 22px;
}

.settings-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border, #e0e0e0);
    margin-bottom: 20px;
}

.settings-tab {
    padding: 8px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary, #555);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.settings-tab:hover {
    color: var(--text-primary, #1a1a2e);
}

.settings-tab.active {
    color: #0f3460;
    border-bottom-color: #0f3460;
    font-weight: 600;
}

html.dark .settings-tab.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.settings-panel-header h3 {
    margin: 0;
    font-size: 16px;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card, white);
    border: 1px solid var(--border-light, #f0f0f0);
    border-radius: 8px;
    transition: background 0.1s;
}

.settings-list-item:hover {
    background: var(--hover, #f8f9fb);
}

.settings-item-info {
    flex: 1;
    min-width: 0;
}

.settings-item-info strong {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
}

.settings-item-sub {
    font-size: 12px;
    color: var(--text-muted, #888);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 12px;
}

.version-number {
    font-family: monospace;
    font-size: 15px;
    font-weight: 700;
    color: #0f3460;
    background: var(--version-chip-bg, #eef4fb);
    padding: 4px 10px;
    border-radius: 999px;
    flex-shrink: 0;
    margin-left: 12px;
}

html.dark .version-number {
    color: #8fc3ff;
}

.btn-sm {
    padding: 4px 12px;
    border-radius: 5px;
    border: 1px solid var(--border, #d0d0d0);
    background: var(--bg-card, white);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.btn-sm:hover {
    background: var(--hover, #f0f2f5);
}

.btn-danger {
    color: #b91c1c;
    border-color: #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
}

.btn-danger-bg {
    background: #b91c1c;
    border-color: #b91c1c;
}

.btn-danger-bg:hover {
    background: #dc2626;
}

html.dark .btn-danger-bg {
    background: #dc2626;
    border-color: #dc2626;
}

html.dark .btn-danger-bg:hover {
    background: #ef4444;
}

.cache-clear-section {
    background: var(--bg-card, white);
    border: 1px solid var(--border-light, #f0f0f0);
    border-radius: 10px;
    padding: 24px;
}

.cache-description {
    font-size: 14px;
    color: var(--text-secondary, #555);
    margin: 0 0 16px;
    line-height: 1.6;
}

html.dark .btn-danger {
    color: #fca5a5;
    border-color: #7f1d1d;
}

html.dark .btn-danger:hover {
    background: #7f1d1d;
}

/* Settings Modal */
.settings-modal {
    min-width: 400px;
}

.settings-modal .form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* --- Settings Sidebar Button --- */
.btn-settings {
    display: block;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #b0b0c0;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    width: 100%;
    text-align: center;
    text-decoration: none;
}

.btn-settings:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

/* --- Language Selection --- */
.lang-item {
    cursor: pointer;
}

.lang-item.active {
    border-color: #0f3460;
    background: #e8f0fe;
}

html.dark .lang-item.active {
    border-color: #60a5fa;
    background: #1e3a5f;
}

.check-mark {
    color: #0f3460;
    font-weight: 700;
    font-size: 18px;
}

html.dark .check-mark {
    color: #60a5fa;
}

/* =============================================
   Email Print Stylesheet
   ============================================= */

@media print {
    body {
        background: white !important;
        color: black !important;
    }
    aside,
    .inbox-toolbar,
    .email-list-pane,
    .email-view-actions,
    .bulk-bar,
    .sidebar-footer,
    .btn-settings,
    .btn-logout,
    .btn-compose,
    #toast-container,
    .modal-overlay,
    .compose-modal-overlay {
        display: none !important;
    }
    .container {
        display: block !important;
        height: auto !important;
    }
    main {
        padding: 0 !important;
        background: white !important;
    }
    .email-view {
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 20px !important;
    }
    .email-body {
        border-top: 1px solid #ccc !important;
    }
    .email-iframe {
        min-height: auto !important;
        height: auto !important;
        border: none !important;
    }
    .email-view-header h2 {
        font-size: 18pt !important;
    }
    .email-meta-row {
        font-size: 10pt !important;
    }
    .email-recipients {
        font-size: 9pt !important;
    }
    .inbox-split {
        display: block !important;
        height: auto !important;
    }
    .email-reader-pane {
        overflow: visible !important;
    }
    .attachments {
        break-inside: avoid;
    }
}

/* =============================================
   Loading Overlay
   ============================================= */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.loading-box {
    background: white;
    border-radius: 12px;
    padding: 32px 40px;
    min-width: 320px;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

html.dark .loading-box {
    background: #1f2937;
    color: #e5e7eb;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #0f3460;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

html.dark .loading-spinner {
    border-color: #374151;
    border-top-color: #60a5fa;
}

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

.loading-message {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a1a2e;
}

html.dark .loading-message {
    color: #e5e7eb;
}

.loading-progress-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin: 12px 0 8px;
}

html.dark .loading-progress-bar {
    background: #374151;
}

.loading-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0f3460, #3b82f6);
    border-radius: 3px;
    transition: width 0.3s ease;
    background-size: 200% 100%;
}

.loading-progress-fill.indeterminate {
    width: 30%;
    animation: loading-indeterminate 1.5s ease-in-out infinite;
}

@keyframes loading-indeterminate {
    0% { transform: translateX(-100%); width: 30%; }
    50% { width: 30%; }
    100% { transform: translateX(400%); width: 30%; }
}

.loading-detail {
    font-size: 12px;
    color: #888;
    min-height: 1.2em;
}

html.dark .loading-detail {
    color: #9ca3af;
}

/* =============================================
   Dark Mode Additions for Settings
   ============================================= */

html.dark .settings-list-item {
    background: var(--bg-card);
    border-color: var(--border-light);
}

html.dark .settings-list-item:hover {
    background: var(--hover);
}

html.dark .btn-sm {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

html.dark .btn-sm:hover {
    background: var(--hover);
}

html.dark .settings-modal .form-group textarea {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

/* =============================================
   Raw Source Modal
   ============================================= */

.raw-modal {
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.raw-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border, #e0e0e0);
    flex-shrink: 0;
}

.raw-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.raw-source-text {
    margin: 0;
    padding: 16px 20px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
    flex: 1;
    background: #f8f9fb;
    color: #1a1a2e;
}

html.dark .raw-source-text {
    background: #1a1a2e;
    color: #e5e7eb;
}

.raw-struct-details {
    flex-shrink: 0;
    border-bottom: 1px solid var(--border, #e0e0e0);
}

.raw-struct-details summary {
    padding: 8px 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #666);
    background: var(--bg-secondary, #f0f2f5);
}

.raw-struct-details summary:hover {
    background: var(--hover, #e5e7eb);
}

.raw-struct {
    margin: 0;
    padding: 10px 20px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 11px;
    line-height: 1.5;
    white-space: pre;
    background: var(--bg-card, #fff);
    color: var(--text-primary, #1a1a2e);
    max-height: 200px;
    overflow: auto;
}

html.dark .raw-struct-details summary {
    background: #1e1e2e;
    color: #9ca3af;
}

html.dark .raw-struct-details summary:hover {
    background: #2a2a3e;
}

html.dark .raw-struct {
    background: #16162a;
    color: #e5e7eb;
}
