/* ===== CSP-SAFE UTILITY CLASSES ===== */
.flex-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.grow-min-width {
  min-width: 0;
}

.hidden-email {
  display: none;
}

.message-header {
  font-weight: 600;
}

.error-message {
  padding: 8px;
}

.no-messages {
  padding: 8px;
}

/* Date line with attachment icon */
.date-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.attachment-icon {
  width: 14px;
  height: 14px;
  opacity: 0.7;
  color: var(--muted);
}

.attachment-icon:hover {
  opacity: 1;
}

/* Star button styling */
.btn-star.starred svg {
  fill: #fbbf24 !important; /* Golden yellow */
}

.btn-star:hover svg {
  fill: #f59e0b !important; /* Slightly darker on hover */
}

.btn-star.starred:hover svg {
  fill: #f59e0b !important; /* Darker golden on hover when starred */
}

/* Dark theme star styling */
body.theme-dark .btn-star.starred svg {
  fill: #fbbf24 !important; /* Same golden color for dark theme */
}

body.theme-dark .btn-star:hover svg {
  fill: #f59e0b !important; 
}

/* Mobile navigation utility classes */
.body-no-scroll {
  overflow: hidden;
}

.list-pane-visible {
  display: flex !important;
}

/* Composer layout utility classes */
.composer-grid {
  display: grid;
  grid-template-columns: minmax(300px,420px) 1fr 336px;
  align-items: stretch;
}

.composer-grid-narrow {
  display: grid;
  grid-template-columns: minmax(280px,360px) 1fr;
  column-gap: 12px;
}

.composer-host-block {
  display: block;
  grid-column: 1 / span 2;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--border);
}

.composer-host-full {
  display: block;
  grid-column: 1 / -1;
}

.ads-block {
  display: block;
  grid-column: 3;
  min-width: 336px;
  max-width: 336px;
  width: 336px;
}

.ads-none {
  display: none;
}

.reset-styles {
  display: '';
  grid-template-columns: '';
  align-items: '';
  grid-column: '';
  min-width: '';
  min-height: '';
  border-right: '';
  column-gap: '';
}
.btn-edit-draft .i use{
    scale: 1.13;
    transform: translate(2px, 3px);
}

@media screen and (min-width: 769px) {
html{
    overflow-y: hidden;
    height: 97%;
  }
}

html{
    /* overflow-y: auto; */
  }

  #btnNew {
    background: #267CB5;
    color: white;
    border: 0;
    padding: 10px;
}
.newButton__icon{
    display: inline-block;
    width: 22px;
    height: 22px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' id='Layer_1' style='enable-background:new 0 0 128 128;' version='1.1' viewBox='0 0 128 128' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%23267CB5;%7D .st1%7Bfill:%23FFFFFF;%7D%0A%3C/style%3E%3Ccircle class='st0' cx='64' cy='64' r='64'/%3E%3Cg%3E%3Cpath class='st1' d='M100.3,37.6c0.4-0.4,0.4-1,0-1.4l-8.5-8.5c-0.4-0.4-1-0.4-1.4,0l-9.9,9.9l9.9,9.9L100.3,37.6z'/%3E%3Cpath class='st1' d='M50.1,76.6c-0.3,0.8,0.5,1.5,1.3,1.3l13-4.4l23.1-23.1l-9.9-9.9L54.5,63.6L50.1,76.6z'/%3E%3Cpath class='st1' d='M100,64H88c-0.6,0-1,0.4-1,1v22H41V41h22c0.6,0,1-0.4,1-1V28c0-0.6-0.4-1-1-1H28c-0.6,0-1,0.4-1,1v72 c0,0.6,0.4,1,1,1h72c0.6,0,1-0.4,1-1V65C101,64.4,100.6,64,100,64z'/%3E%3C/g%3E%3C/svg%3E");
    background-size: contain;
}
.paperclip__icon{
    display: inline-block;
    width: 18px;
    height: 18px;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' style='&%2310;'%3E%3Cg clip-path='url(%23clip0_1651_6721)'%3E%3Cpath d='M17.6943 3.61763C16.4843 2.50847 14.6154 2.54907 13.4547 3.70974L4.45005 12.7144C2.49902 14.6654 2.50319 17.8386 4.45741 19.7928C6.41163 21.747 9.58481 21.7512 11.5358 19.8002L22.0003 9.33571L23.4145 10.7499L12.95 21.2144C10.2148 23.9497 5.77527 23.9391 3.04319 21.207L2.33609 20.4999L2.38621 20.4498C0.330457 17.7081 0.540855 13.7952 3.03584 11.3002L12.0405 2.29553C13.9583 0.377699 17.0464 0.310605 19.0457 2.14332L19.7829 2.81904L19.7163 2.89168C21.1592 4.86465 21.0019 7.66258 19.2047 9.45975L10.2074 18.457C8.98846 19.676 7.01215 19.676 5.79319 18.457L5.08609 17.7499L5.20179 17.6342C4.62442 16.4673 4.82155 15.0145 5.79319 14.0428L15.0003 4.83571L16.4145 6.24992L7.20741 15.457C6.76951 15.8949 6.76951 16.6049 7.20741 17.0428C7.64531 17.4807 8.35529 17.4807 8.7932 17.0428L17.7905 8.04553C19.0247 6.81128 18.981 4.7971 17.6943 3.61763Z' fill='black' style='&%2310; fill: %23b0aaaa;&%2310;'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_1651_6721'%3E%3Crect width='24' height='24' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
}
.tleft,.tright{
    display: flex;
}

  #settingsMenu{
    display: flex;
    flex-flow: column;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    width: 320px;
    border-radius: 16px;
    text-align: left;
    padding: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 8px 25px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(20px);
    z-index: 999;
    overflow: hidden;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  #settingsMenu:not(.hidden) {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  #settingsMenu .dd-row{
    display: flex;
    align-items: center;
    padding: 14px 16px;
    margin: 2px 0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-weight: 500;
    font-size: 14px;
    color: #374151;
  }

  #settingsMenu .dd-row:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  }

  #settingsMenu .dd-row:active {
    transform: translateX(2px) scale(0.98);
  }

  #settingsMenu button {
    background: transparent;
    border: 0;
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    font-weight: 500;
    font-size: 14px;
    color: #374151;
  }

  #settingsMenu .dd-row.danger {
    color: #dc2626;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  }

  #settingsMenu .dd-row.danger:hover {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    color: #b91c1c;
  }

  /* Checkbox styling */
  #settingsMenu input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    accent-color: #667eea;
    cursor: pointer;
  }

  /* Add subtle divider */
  #settingsMenu .dd-row:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.05) 50%, transparent 100%);
  }
#folders .left .i {
    width: 28px !important;
    height: 16px !important;
}
.list.narrow{
    height: calc(100vh - 56px);
}

/* Custom scrollbar styles for .list.narrow */
.list.narrow::-webkit-scrollbar {
    width: 2px;
}

.list.narrow::-webkit-scrollbar-track {
    background: transparent;
}

.list.narrow::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 1px;
}

.list.narrow::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* For Firefox */
.list.narrow {
    scrollbar-width: none;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

/* Dark theme fixes */
body.theme-dark .tright .iconbtn {
    color: white !important;
}

body.theme-dark .tright .btn-label {
    color: white !important;
}

body.theme-dark .tright .iconbtn svg {
    fill: white !important;
}

/* Sidebar icons should be white in dark theme */
body.theme-dark .folders svg.i {
    fill: white !important;
}

body.theme-dark .folder-row svg.i {
    fill: white !important;
}

/* Unread messages darker hover background */
.list-body .msg-row.unread:hover {
    background: rgba(0, 0, 0, 0.08) !important;
}

body.theme-dark .list-body .msg-row.unread:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Search bar styling */
.list-search .searchBar {
    background: transparent !important;
    border: 1px solid var(--border) !important;
    color: var(--ink) !important;
}

.list-search .searchBar::placeholder {
    color: var(--muted) !important;
    opacity: 1;
}

.list-search .searchBar:focus {
    outline: none;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(11, 95, 255, 0.1);
}


/* Settings dropdown dark theme */
body.theme-dark #settingsMenu {
    background: rgba(30, 41, 59, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 8px 25px rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(20px) !important;
}

body.theme-dark #settingsMenu .dd-row {
    color: #e2e8f0 !important;
}

body.theme-dark #settingsMenu .dd-row:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%) !important;
    transform: translateX(4px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

body.theme-dark #settingsMenu .dd-row.danger {
    color: #fca5a5 !important;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%) !important;
}

body.theme-dark #settingsMenu .dd-row.danger:hover {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.2) 0%, rgba(220, 38, 38, 0.1) 100%) !important;
    color: #f87171 !important;
}

body.theme-dark #settingsMenu button {
    color: #e2e8f0 !important;
}

body.theme-dark #settingsMenu input[type="checkbox"] {
    accent-color: #667eea !important;
}

body.theme-dark #settingsMenu .dd-row:not(:last-child)::after {
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.05) 50%, transparent 100%) !important;
}

/* Additional modern touches for settings menu */
#settingsMenu::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 16px;
    height: 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
    z-index: -1;
}

body.theme-dark #settingsMenu::before {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Add icons to menu items */
#settingsMenu .dd-row[data-icon]::before {
    content: attr(data-icon);
    margin-right: 12px;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Smooth entrance animation */
@keyframes settingsMenuSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#settingsMenu:not(.hidden) {
    animation: settingsMenuSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ripple effect on click */
#settingsMenu .dd-row {
    position: relative;
    overflow: hidden;
}

#settingsMenu .dd-row::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
    pointer-events: none;
}

#settingsMenu .dd-row:active::before {
    width: 200px;
    height: 200px;
}

/* Newsletter Switch Styles */
.newsletter-switch-container {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin: 2px 0;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.newsletter-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    position: relative;
    width: 100%;
    padding: 0;
    border-radius: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.newsletter-switch:hover {
    background: transparent;
}

.newsletter-switch-container:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.newsletter-switch input[type="checkbox"] {
    display: none;
}

.switch-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.switch-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.newsletter-switch input[type="checkbox"]:checked + .switch-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: inset 0 2px 4px rgba(102, 126, 234, 0.3);
}

.newsletter-switch input[type="checkbox"]:checked + .switch-slider::before {
    transform: translateX(20px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.switch-label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}

/* Dark theme for newsletter switch */
body.theme-dark .newsletter-switch:hover {
    background: transparent;
}

body.theme-dark .newsletter-switch-container:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

body.theme-dark .switch-slider {
    background: #4a5568;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

body.theme-dark .switch-slider::before {
    background: #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

body.theme-dark .newsletter-switch input[type="checkbox"]:checked + .switch-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: inset 0 2px 4px rgba(102, 126, 234, 0.3);
}

body.theme-dark .newsletter-switch input[type="checkbox"]:checked + .switch-slider::before {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

body.theme-dark .switch-label {
    color: #e2e8f0;
}

/* Animation for switch toggle */
.newsletter-switch input[type="checkbox"]:checked + .switch-slider::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-120%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    animation: checkmarkFadeIn 0.2s ease-in-out 0.1s forwards;
}

@keyframes checkmarkFadeIn {
    to {
        opacity: 1;
    }
}

/* Modern Modal Overlays */
.modal-backdrop {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(12px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop:not(.hidden) {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
}

.modal {
    background: white !important;
    border-radius: 24px !important;
    min-width: 420px !important;
    max-width: 520px !important;
    width: 90% !important;
    max-height: 90vh !important;
    overflow: hidden !important;
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.25), 0 16px 40px rgba(0, 0, 0, 0.15) !important;
    transform: translateY(30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    position: relative !important;
    padding: 0 !important;
}

.modal-backdrop:not(.hidden) .modal {
    transform: translateY(0) scale(1);
}

/* Modal Header */
.modal h3 {
    margin: 0;
    padding: 28px 32px 20px 32px;
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    position: relative;
    border-bottom: 1px solid #e5e7eb;
}

.modal h3::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 32px;
    right: 32px;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

/* Modal Content */
.modal .row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 24px 32px;
    position: relative;
}

.modal label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    display: block;
}

.modal input,
.modal textarea {
    padding: 16px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fafbfc;
    color: #1f2937;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

.modal input:focus,
.modal textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.modal textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
    line-height: 1.6;
}

/* Modal Actions */
.modal .actions {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    padding: 24px 32px 32px 32px;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
}

.modal .btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-width: 100px;
}

.modal .btn:not(.btn-primary) {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.modal .btn:not(.btn-primary):hover {
    background: #e5e7eb;
    color: #374151;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.modal .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.modal .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
}

.modal .btn:active {
    transform: translateY(-1px);
}

/* Modal Messages */
.modal .muted {
    padding: 16px 20px;
    margin: 0 32px 20px 32px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 12px;
    color: #0369a1;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 0;
    overflow: hidden;
}

/* Show message when it has content */
.modal .muted:not(:empty) {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: 100px;
    margin-bottom: 20px;
}

/* Enhanced message animations */
.modal .muted {
    animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 100px;
    }
}

/* Message fade out animation */
.modal .muted.fade-out {
    animation: messageFadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes messageFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 100px;
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
}

.modal .muted.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.modal .muted.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #16a34a;
}

/* Dark Theme for Modals */
body.theme-dark .modal-backdrop {
    background: rgba(0, 0, 0, 0.8);
}

body.theme-dark .modal {
    background: #1f2937 !important;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.6), 0 16px 40px rgba(0, 0, 0, 0.4);
}

body.theme-dark .modal h3 {
    color: #f9fafb;
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    border-bottom-color: #4b5563;
}

body.theme-dark .modal h3::before {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

body.theme-dark .modal label {
    color: #d1d5db;
}

body.theme-dark .modal input,
body.theme-dark .modal textarea {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

body.theme-dark .modal input:focus,
body.theme-dark .modal textarea:focus {
    background: #4b5563;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

body.theme-dark .modal .actions {
    background: #374151;
    border-top-color: #4b5563;
}

body.theme-dark .modal .btn:not(.btn-primary) {
    background: #4b5563;
    color: #d1d5db;
    border-color: #6b7280;
}

body.theme-dark .modal .btn:not(.btn-primary):hover {
    background: #6b7280;
    color: #f9fafb;
}

body.theme-dark .modal .muted {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

body.theme-dark .modal .muted.error {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
    color: #f87171;
}

body.theme-dark .modal .muted.success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

/* Ripple effect for buttons */
.modal .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
    pointer-events: none;
}

.modal .btn:active::before {
    width: 300px;
    height: 300px;
}

/* Specific styling for password overlay */
#pwOverlay .modal {
    max-width: 480px;
}

#pwOverlay .modal h3::before {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

/* Specific styling for signature overlay */
#sigOverlay .modal {
    max-width: 600px;
}

#sigOverlay .modal h3::before {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

/* Animation for modal entrance */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-backdrop:not(.hidden) .modal {
    animation: modalSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced input field styling */
.modal input[type="password"] {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    letter-spacing: 0.5px;
}

.modal input[type="password"]::placeholder {
    font-family: inherit;
    letter-spacing: normal;
}

/* Success animation for save buttons */
.modal .btn-primary.saved {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    animation: successPulse 0.6s ease-in-out;
}

@keyframes successPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Error animation for validation */
.modal input.error,
.modal textarea.error {
    border-color: #ef4444;
    animation: errorShake 0.5s ease-in-out;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Loading states */
.modal .btn.loading {
    position: relative;
    color: transparent;
}

.modal .btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced focus states */
.modal input:focus + .password-strength {
    background: #f3f4f6;
}

/* Modal close button enhancement */
.modal .btn:not(.btn-primary) {
    position: relative;
}

.modal .btn:not(.btn-primary)::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.1) 100%);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal .btn:not(.btn-primary):hover::after {
    opacity: 1;
}

/* Force modal backdrop to be on top and clickable */
#pwOverlay,
#sigOverlay {
    z-index: 999999 !important;
    pointer-events: auto !important;
}

#pwOverlay .modal,
#sigOverlay .modal {
    pointer-events: auto !important;
    z-index: 1000000 !important;
}

/* Additional modern touches for modals */
.modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    pointer-events: none;
    z-index: 1;
}

body.theme-dark .modal::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
}

/* Modal content positioning */
.modal .row,
.modal .actions {
    position: relative;
    z-index: 2;
}

/* Enhanced input animations */
.modal input,
.modal textarea {
    position: relative;
}

.modal input:focus,
.modal textarea:focus {
    position: relative;
    z-index: 3;
}

/* Floating label effect */
.modal .row {
    position: relative;
}

.modal .row label {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left top;
}

.modal input:focus + label,
.modal textarea:focus + label {
    transform: scale(0.95);
    color: #667eea;
}

/* Modal backdrop click animation */
.modal-backdrop {
    cursor: pointer;
}

.modal-backdrop:active {
    background: rgba(0, 0, 0, 0.7);
}

/* Enhanced button states */
.modal .btn {
    position: relative;
    z-index: 2;
}

.modal .btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Modal size variations */
#pwOverlay .modal {
    min-width: 400px;
    max-width: 480px;
}

#sigOverlay .modal {
    min-width: 500px;
    max-width: 600px;
}

/* Enhanced typography */
.modal h3 {
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.modal .btn {
    letter-spacing: 0.3px;
}

/* Subtle glow effect for active modals */
.modal-backdrop:not(.hidden) .modal {
    filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.1));
}

/* Enhanced spacing and rhythm */
.modal .row {
    margin-bottom: 8px;
}

.modal .row:last-of-type {
    margin-bottom: 0;
}

/* Improved message styling */
.modal .muted {
    font-weight: 500;
    letter-spacing: 0.2px;
    line-height: 1.5;
}

/* Enhanced accessibility */
.modal input:focus,
.modal textarea:focus,
.modal .btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Smooth transitions for all interactive elements */
.modal * {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced visual hierarchy */
.modal h3 {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

body.theme-dark .modal h3 {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Sender name and email styling */
.sender-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--ink);
    line-height: 1.3;
    margin-bottom: 2px;
    display: block;
    width: 200px;
    white-space: break-spaces;
}

.sender-email {
    color: var(--muted);
    font-size: 0.9em;
    margin-left: 4px;
}

.sender-email::before {
    content: " <";
    color: var(--muted);
}

.sender-email::after {
    content: ">";
    color: var(--muted);
}

/* Subject styling - now smaller and muted like sender was */
.subject {
    font-weight: 400;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.4;
    margin-top: 2px;
}

/* Dark theme for sender elements */
body.theme-dark .sender-name {
    color: white;
}

body.theme-dark .sender-email {
    color: var(--muted);
}

body.theme-dark .sender-email::before,
body.theme-dark .sender-email::after {
    color: var(--muted);
}

/* Dark theme for subject */
body.theme-dark .subject {
    color: var(--muted);
}

/* ===== MODERN PAGINATION STYLING ===== */

/* Pagination container */
.pager {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--panel);
    border-top: 1px solid var(--border);
    margin-top: 12px;
}

/* Pagination buttons */
.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 50%;
    color: var(--ink);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.prevBtn__icon{
    width: 22px;
    height: 22px;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='32px' id='Layer_1' style='enable-background:new 0 0 32 32;' version='1.1' viewBox='0 0 32 32' width='32px' xml:space='preserve'%3E%3Cpath d='M28,14H8.8l4.62-4.62C13.814,8.986,14,8.516,14,8c0-0.984-0.813-2-2-2c-0.531,0-0.994,0.193-1.38,0.58l-7.958,7.958 C2.334,14.866,2,15.271,2,16s0.279,1.08,0.646,1.447l7.974,7.973C11.006,25.807,11.469,26,12,26c1.188,0,2-1.016,2-2 c0-0.516-0.186-0.986-0.58-1.38L8.8,18H28c1.104,0,2-0.896,2-2S29.104,14,28,14z'/%3E%3C/svg%3E");
}
.theme-dark .prevBtn__icon{
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='32px' id='Layer_1' style='enable-background:new 0 0 32 32;fill: %23b0aaaa;' version='1.1' viewBox='0 0 32 32' width='32px' xml:space='preserve'%3E%3Cpath d='M28,14H8.8l4.62-4.62C13.814,8.986,14,8.516,14,8c0-0.984-0.813-2-2-2c-0.531,0-0.994,0.193-1.38,0.58l-7.958,7.958 C2.334,14.866,2,15.271,2,16s0.279,1.08,0.646,1.447l7.974,7.973C11.006,25.807,11.469,26,12,26c1.188,0,2-1.016,2-2 c0-0.516-0.186-0.986-0.58-1.38L8.8,18H28c1.104,0,2-0.896,2-2S29.104,14,28,14z'/%3E%3C/svg%3E");
}
.nextBtn__icon{
    width: 22px;
    height: 22px;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='22px' id='Layer_1' style='enable-background:new 0 0 512 512;' version='1.1' viewBox='0 0 512 512' width='22px' xml:space='preserve'%3E%3Cpath d='M322.7,128.4L423,233.4c6,5.8,9,13.7,9,22.4c0,8.7-3,16.5-9,22.4L322.7,383.6c-11.9,12.5-31.3,12.5-43.2,0 c-11.9-12.5-11.9-32.7,0-45.2l48.2-50.4h-217C93.7,288,80,273.7,80,256c0-17.7,13.7-32,30.6-32h217l-48.2-50.4 c-11.9-12.5-11.9-32.7,0-45.2C291.4,115.9,310.7,115.9,322.7,128.4z'/%3E%3C/svg%3E");
}
.theme-dark .nextBtn__icon{
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='22px' id='Layer_1' style='enable-background:new 0 0 512 512;fill: %23b0aaaa;' version='1.1' viewBox='0 0 512 512' width='22px' xml:space='preserve'%3E%3Cpath d='M322.7,128.4L423,233.4c6,5.8,9,13.7,9,22.4c0,8.7-3,16.5-9,22.4L322.7,383.6c-11.9,12.5-31.3,12.5-43.2,0 c-11.9-12.5-11.9-32.7,0-45.2l48.2-50.4h-217C93.7,288,80,273.7,80,256c0-17.7,13.7-32,30.6-32h217l-48.2-50.4 c-11.9-12.5-11.9-32.7,0-45.2C291.4,115.9,310.7,115.9,322.7,128.4z'/%3E%3C/svg%3E");
}
/* Pagination button hover effects */
.pagination-btn:hover:not(:disabled) {
    background: var(--hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(11, 95, 255, 0.15);
}

/* Pagination button active state */
.pagination-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(11, 95, 255, 0.2);
}

/* Disabled state */
.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--hover);
    border-color: var(--border);
    transform: none;
    box-shadow: none;
}

/* Pagination icons */
.pagination-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
    transition: transform 0.2s ease;
}

/* Icon animations on hover */
.pagination-btn:hover:not(:disabled) .pagination-icon {
    transform: scale(1.1);
}

.pagination-prev:hover:not(:disabled) .pagination-icon {
    transform: translateX(-2px) scale(1.1);
}

.pagination-next:hover:not(:disabled) .pagination-icon {
    transform: translateX(2px) scale(1.1);
}

/* Pagination info */
.pagination-info {
    color: var(--muted);
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
    background: var(--hover);
    border-radius: 8px;
    border: 1px solid var(--border);
    min-width: 100px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Ripple effect for pagination buttons */
.pagination-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(11, 95, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    pointer-events: none;
}

.pagination-btn:active:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

/* Dark theme for pagination */
body.theme-dark .pagination-btn {
    background: var(--panel);
    border-color: var(--border);
    color: var(--ink);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.theme-dark .pagination-btn:hover:not(:disabled) {
    background: var(--hover);
    border-color: var(--accent);
    box-shadow: 0 8px 25px rgba(95, 176, 255, 0.2);
}

body.theme-dark .pagination-btn:disabled {
    background: var(--hover);
    border-color: var(--border);
}

body.theme-dark .pagination-info {
    background: var(--hover);
    border-color: var(--border);
    color: var(--muted);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Focus states for accessibility */
.pagination-btn:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(11, 95, 255, 0.1);
}

body.theme-dark .pagination-btn:focus {
    box-shadow: 0 0 0 3px rgba(95, 176, 255, 0.2);
}

/* Responsive design */
@media (max-width: 768px) {
    .pager {
        gap: 12px;
        padding: 16px 20px;
    }
    
    .pagination-btn {
        width: 44px;
        height: 44px;
    }
    
    .pagination-icon {
        width: 20px;
        height: 20px;
    }
    
    .pagination-info {
        font-size: 13px;
        padding: 6px 12px;
        min-width: 100px;
    }
}

/* Animation for page transitions */
@keyframes paginationSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pager {
    animation: paginationSlideIn 0.4s ease-out;
}

/* ===== MODERN THEME SWITCH ===== */

/* Theme switch container */
.theme-switch-container {
    display: flex;
    align-items: center;
    margin-right: 12px;
}

/* Theme switch label */
.theme-switch {
    position: relative;
    display: inline-block;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Switch track (background) */
.switch-track {
    position: relative;
    width: 64px;
    height: 32px;
    background: #111;
    border-radius: 16px;
    border: 1px solid #334155;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Switch track when checked (dark theme) */
.theme-switch input:checked + .switch-track {
    background: #111;
    border-color: #334155;
    box-shadow: 
        0 2px 8px rgba(15, 23, 42, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Switch thumb (sliding element) */
.switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Switch thumb when checked (moved to right) */
.theme-switch input:checked + .switch-track .switch-thumb {
    transform: translateX(32px);
    background: #fff;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.2),
        0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Switch icons */
.switch-icon {
    position: absolute;
    width: 16px;
    height: 16px;
    fill: currentColor;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sun icon (visible in light theme) */
.sun-icon {
    color: #f59e0b;
    opacity: 1;
    transform: scale(1) rotate(0deg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' data-name='Layer 1' id='Layer_1' viewBox='0 0 64 64' style='&%2310; width: 22px;&%2310; height: 22px;&%2310;'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23efcc00;%7D.cls-2%7Bfill:none;stroke:%23efcc00;stroke-linecap:round;stroke-miterlimit:10;stroke-width:3px;%7D%3C/style%3E%3C/defs%3E%3Ctitle/%3E%3Ccircle class='cls-1' cx='32' cy='32' r='17'/%3E%3Cline class='cls-2' x1='32' x2='32' y1='5' y2='11'/%3E%3Cline class='cls-2' x1='32' x2='32' y1='53' y2='59'/%3E%3Cline class='cls-2' x1='59' x2='53' y1='32' y2='32'/%3E%3Cline class='cls-2' x1='11' x2='5' y1='32' y2='32'/%3E%3Cline class='cls-2' x1='51.09' x2='46.85' y1='12.91' y2='17.15'/%3E%3Cline class='cls-2' x1='17.15' x2='12.91' y1='46.85' y2='51.09'/%3E%3Cline class='cls-2' x1='51.09' x2='46.85' y1='51.09' y2='46.85'/%3E%3Cline class='cls-2' x1='17.15' x2='12.91' y1='17.15' y2='12.91'/%3E%3C/svg%3E");
    background-size: contain;
}

.theme-switch input:checked + .switch-track .sun-icon {
    opacity: 0;
    transform: scale(0.8) rotate(180deg);
}

/* Moon icon (visible in dark theme) */
.moon-icon {
    color: #1e293b;
    opacity: 0;
    transform: scale(0.8) rotate(-180deg);
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' data-name='Layer 1' id='Layer_1' viewBox='0 0 64 64' style='&%2310; width: 22px;&%2310; height: 22px;&%2310;'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23efcc00;%7D%3C/style%3E%3C/defs%3E%3Ctitle/%3E%3Cpath class='cls-1' d='M44.54,41.47A23,23,0,0,1,24.49,11.73,1,1,0,0,0,23,10.59,23,23,0,1,0,54.41,42a1,1,0,0,0-1.14-1.47A23.06,23.06,0,0,1,44.54,41.47Z'/%3E%3C/svg%3E");
}

.theme-switch input:checked + .switch-track .moon-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Hover effects */
.theme-switch:hover .switch-track {
    transform: scale(1.05);
    box-shadow: 
        0 4px 12px rgba(251, 191, 36, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.theme-switch input:checked:hover + .switch-track {
    box-shadow: 
        0 4px 12px rgba(15, 23, 42, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.theme-switch:hover .switch-thumb {
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Active state */
.theme-switch:active .switch-track {
    transform: scale(0.98);
}

/* Focus state for accessibility */
.theme-switch input:focus + .switch-track {
    outline: none;
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.3),
        0 2px 8px rgba(251, 191, 36, 0.3);
}

.theme-switch input:checked:focus + .switch-track {
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.3),
        0 2px 8px rgba(15, 23, 42, 0.4);
}

/* Animation keyframes */
@keyframes switchSlide {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(32px);
    }
}

@keyframes switchSlideBack {
    0% {
        transform: translateX(32px);
    }
    100% {
        transform: translateX(0);
    }
}

@keyframes iconFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.8) rotate(180deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes iconFadeOut {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) rotate(180deg);
    }
}

/* Ripple effect on click */
.theme-switch::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    pointer-events: none;
    z-index: 1;
}

.theme-switch:active::before {
    width: 80px;
    height: 80px;
}

/* Dark theme adjustments */
body.theme-dark .theme-switch-container {
    /* Additional dark theme specific styles if needed */
}

/* Responsive design */
@media (max-width: 768px) {
    .theme-switch-container {
        margin-right: 8px;
    }
    
    .switch-track {
        width: 56px;
        height: 28px;
    }
    
    .switch-thumb {
        width: 20px;
        height: 20px;
    }
    
    .theme-switch input:checked + .switch-track .switch-thumb {
        transform: translateX(28px);
    }
    
    .switch-icon {
        width: 14px;
        height: 14px;
    }
}

/* Fix inbox icon color in dark theme */
body.theme-dark .folders .folder-row svg.i {
    fill: white !important;
}

body.theme-dark .folder-row svg.i {
    fill: white !important;
}
.list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    border-radius: 0 0 0 0;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
    margin-bottom: 12px;
    border: none;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* Add a subtle overlay for depth */
.list-head::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    pointer-events: none;
}

/* Title styling */
.list-head .title {
    color: var(--ink);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

/* Hint text styling */
.list-head .muted {
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
    background: var(--hover);
    padding: 6px 12px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
}

/* Dark theme for list-head */
body.theme-dark .list-head {
    /* background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%); */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

body.theme-dark .list-head::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
}

body.theme-dark .list-head .title {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

body.theme-dark .list-head .muted {
    color: var(--muted);
    background: var(--hover);
    border: 1px solid var(--border);
}

/* Hover effects for interactive elements */
.list-head:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.theme-dark .list-head:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* Add a subtle animation on load */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.list-head {
    animation: slideInFromTop 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.list-body .muted{
    text-align: center;
    margin-top: 7px;
    font-weight: 700;
}
.list-search{
    /* margin-top: 10px; */
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}
.list-search .searchBar {
    width: 95%;
    margin: auto;
    height: 30px;
    border-radius: 6px;
    border: 1px solid #e8dddd;
    padding: 10px 15px;
}
.msg-row.unread{
    background: var(--hover);
}
.msg-row .date{
    font-size: 0.75em;
}
.msg-row .subject{
    width: 290px;
}
.msg-row .meta{
    display: flex;
        flex-flow: column;
        gap: 10px;
}

  .compose-wrap{
    position: relative;
  }
  #viewer .muted.noEmail__text{
    display: flex;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    transform: translateY(-15%);
    font-weight: 700;
  }
  .compose-wrap .editor{
    min-height: calc(100vh - 435px);
    max-height: calc(100vh - 435px);
    overflow-y: auto;
  }
  .grid-2 .row input{
    width: 98%;
    border: 1px solid rgb(128 128 128 / 15%);
  }
  .sendBtn__wrapper{
    display: flex;
    justify-content: end;
  }
  .editor{
    box-shadow: 0 8px 20px rgba(0,0,0,.06);
  }
  #btnSend{
    width: 32px;
    height: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80px' height='80px' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20.7639 12H10.0556M3 8.00003H5.5M4 12H5.5M4.5 16H5.5M9.96153 12.4896L9.07002 15.4486C8.73252 16.5688 8.56376 17.1289 8.70734 17.4633C8.83199 17.7537 9.08656 17.9681 9.39391 18.0415C9.74792 18.1261 10.2711 17.8645 11.3175 17.3413L19.1378 13.4311C20.059 12.9705 20.5197 12.7402 20.6675 12.4285C20.7961 12.1573 20.7961 11.8427 20.6675 11.5715C20.5197 11.2598 20.059 11.0295 19.1378 10.5689L11.3068 6.65342C10.2633 6.13168 9.74156 5.87081 9.38789 5.95502C9.0808 6.02815 8.82627 6.24198 8.70128 6.53184C8.55731 6.86569 8.72427 7.42461 9.05819 8.54246L9.96261 11.5701C10.0137 11.7411 10.0392 11.8266 10.0493 11.9137C10.0583 11.991 10.0582 12.069 10.049 12.1463C10.0387 12.2334 10.013 12.3188 9.96153 12.4896Z' stroke='%235bb450' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
  }
  .compose-wrap.theme-dark #btnSend{
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80px' height='80px' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20.7639 12H10.0556M3 8.00003H5.5M4 12H5.5M4.5 16H5.5M9.96153 12.4896L9.07002 15.4486C8.73252 16.5688 8.56376 17.1289 8.70734 17.4633C8.83199 17.7537 9.08656 17.9681 9.39391 18.0415C9.74792 18.1261 10.2711 17.8645 11.3175 17.3413L19.1378 13.4311C20.059 12.9705 20.5197 12.7402 20.6675 12.4285C20.7961 12.1573 20.7961 11.8427 20.6675 11.5715C20.5197 11.2598 20.059 11.0295 19.1378 10.5689L11.3068 6.65342C10.2633 6.13168 9.74156 5.87081 9.38789 5.95502C9.0808 6.02815 8.82627 6.24198 8.70128 6.53184C8.55731 6.86569 8.72427 7.42461 9.05819 8.54246L9.96261 11.5701C10.0137 11.7411 10.0392 11.8266 10.0493 11.9137C10.0583 11.991 10.0582 12.069 10.049 12.1463C10.0387 12.2334 10.013 12.3188 9.96153 12.4896Z' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
  #btnClose{
    position: absolute;
    right: 5px;
    top: 5px;
    width: 22px;
    height: 22px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80px' height='80px' viewBox='0 0 1024 1024' fill='%23fa0000' stroke='%23fa0000'%3E%3Cg id='SVGRepo_bgCarrier' stroke-width='0'/%3E%3Cg id='SVGRepo_tracerCarrier' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cg id='SVGRepo_iconCarrier'%3E%3Cpath fill='%23000000' d='M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    position: absolute;
    right: 5px;
    bottom: 5px;
  }
  .compose-wrap.theme-dark #btnClose{
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80px' height='80px' viewBox='0 0 1024 1024' fill='%23ffffff' stroke='%23ffffff'%3E%3Cg id='SVGRepo_bgCarrier' stroke-width='0'/%3E%3Cg id='SVGRepo_tracerCarrier' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cg id='SVGRepo_iconCarrier'%3E%3Cpath fill='%23ffffff' d='M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z'/%3E%3C/g%3E%3C/svg%3E");
  }
  .pager {
    text-align: center;
    margin: 15px 0;
}
  .pager #pgInfo {
    font-size: 12px;
    /* letter-spacing: -1px; */
    }

    /* Compose frame dark theme styles */
    .compose-wrap.theme-dark {
        background: var(--bg) !important;
        color: white !important;
    }

    .compose-wrap.theme-dark .grid-2 label {
        color: white !important;
    }

    .compose-wrap.theme-dark .grid-2 input {
        background: transparent !important;
        border: 1px solid rgb(128 128 128 / 15%) !important;
        color: white !important;
    }

    .compose-wrap.theme-dark .grid-2 input::placeholder {
        color: var(--muted) !important;
    }

    .compose-wrap.theme-dark .badge {
        background: var(--panel) !important;
        color: white !important;
        border: 1px solid var(--border) !important;
    }

    .compose-wrap.theme-dark .toolbar {
        background: var(--panel) !important;
        border-bottom: 1px solid var(--border) !important;
    }

    .compose-wrap.theme-dark .tbtn {
        background: var(--panel) !important;
        border: 1px solid var(--border) !important;
        color: white !important;
    }

    .compose-wrap.theme-dark .tbtn:hover {
        background: var(--hover) !important;
    }

    .compose-wrap.theme-dark .tsel {
        background: var(--panel) !important;
        border: 1px solid rgb(128 128 128 / 15%) !important;
        color: white !important;
    }

    .compose-wrap.theme-dark .tcol {
        background: var(--panel) !important;
        border: 1px solid var(--border) !important;
    }

    .compose-wrap.theme-dark .tsep {
        border-left: 1px solid var(--border) !important;
    }

    .compose-wrap.theme-dark .editor {
        background: transparent !important;
        border: 1px solid rgb(128 128 128 / 15%) !important;
        color: white !important;
    }

    /* .compose-wrap.theme-dark .btn {
        background: var(--panel) !important;
        border: 1px solid var(--border) !important;
        color: white !important;
    } */

    /* .compose-wrap.theme-dark .btn:hover {
        background: var(--hover) !important;
    } */

    /* .compose-wrap.theme-dark .btn.primary {
        background: var(--accent) !important;
        border-color: var(--accent) !important;
        color: white !important;
    } */

    /* .compose-wrap.theme-dark .btn.primary:hover {
        background: var(--accent) !important;
        opacity: 0.9;
    } */

    .compose-wrap.theme-dark .chips {
        background: var(--panel) !important;
        border: 1px solid var(--border) !important;
    }

    .compose-wrap.theme-dark .status {
        color: var(--muted) !important;
    }

    .compose-wrap.theme-dark .small.muted {
        color: var(--muted) !important;
    }

    /* Viewer dark theme styles */
    body.theme-dark .viewer {
        background: var(--bg) !important;
        color: white !important;
    }

    body.theme-dark .viewer-head {
        border-bottom: 1px solid var(--border) !important;
        color: white !important;
    }

    body.theme-dark .viewer-head .meta h1 {
        color: white !important;
    }

    body.theme-dark .viewer-head .meta-line {
        color: var(--muted) !important;
    }

    body.theme-dark .viewer-actions {
        background: transparent !important;
    }

    body.theme-dark .viewer-actions .btn {
        background: var(--panel) !important;
        border: 1px solid var(--border) !important;
        color: white !important;
    }

    body.theme-dark .viewer-actions .btn:hover {
        background: var(--hover) !important;
    }

    body.theme-dark .viewer-actions .btn.danger {
        background: #dc2626 !important;
        border-color: #dc2626 !important;
        color: white !important;
    }

    body.theme-dark .viewer-actions .btn.danger:hover {
        background: #b91c1c !important;
    }

    body.theme-dark .viewer-body {
        background: transparent !important;
        color: white !important;
    }

    body.theme-dark .att-head {
        color: white !important;
    }

    body.theme-dark .att-head svg {
        fill: white !important;
    }

    body.theme-dark .att-chip {
        background: var(--hover) !important;
        border: 1px solid var(--border) !important;
        color: white !important;
    }

    body.theme-dark .att-chip .btns .btn {
        background: var(--accent) !important;
        border-color: var(--accent) !important;
        color: white !important;
    }

    body.theme-dark .att-chip .btns .btn:hover {
        background: var(--accent) !important;
        opacity: 0.9;
    }

    body.theme-dark .toggle {
        color: white !important;
    }

    body.theme-dark .toggle .muted {
        color: var(--muted) !important;
    }

    body.theme-dark .toggle .btn {
        background: var(--panel) !important;
        border: 1px solid var(--border) !important;
        color: white !important;
    }

    body.theme-dark .toggle .btn:hover {
        background: var(--hover) !important;
    }

    body.theme-dark .toggle .btn:focus {
        background: var(--accent) !important;
        border-color: var(--accent) !important;
    }

    body.theme-dark .iframe-mail {
        background: var(--bg) !important;
        border: 1px solid var(--border) !important;
    }

    body.theme-dark .muted {
        color: var(--muted) !important;
    }

    body.theme-dark .muted.noEmail__text {
        color: var(--muted) !important;
    }

    /* Message content styling */
    body.theme-dark .viewer-body pre {
        background: var(--panel) !important;
        border: 1px solid var(--border) !important;
        color: white !important;
    }

    body.theme-dark .viewer-body code {
        background: var(--panel) !important;
        color: white !important;
    }

    body.theme-dark .viewer-body blockquote {
        border-left: 3px solid var(--accent) !important;
        background: var(--panel) !important;
        color: white !important;
    }

    body.theme-dark .viewer-body a {
        color: var(--accent) !important;
    }

    body.theme-dark .viewer-body a:hover {
        color: var(--accent) !important;
        opacity: 0.8;
    }

    .compose-wrap.theme-dark .grid-2 label{
        color: white !important;
    }

/* ===== RESPONSIVE DESIGN & MOBILE NAVIGATION ===== */

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 12px;
}

.mobile-menu-btn:hover {
    background: var(--hover);
    transform: scale(1.05);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

.mobile-menu-btn svg {
    fill: currentColor;
    stroke: currentColor;
    transition: all 0.2s ease;
}

.close-icon{
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80px' height='80px' viewBox='0 0 1024 1024' fill='%23fa0000' stroke='%23fa0000'%3E%3Cg id='SVGRepo_bgCarrier' stroke-width='0'/%3E%3Cg id='SVGRepo_tracerCarrier' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cg id='SVGRepo_iconCarrier'%3E%3Cpath fill='%23000000' d='M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/* Mobile Back Button */
.mobile-back-btn {
    /* display: none; */
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 12px;
}

.mobile-back-btn:hover {
    background: var(--hover);
    transform: scale(1.05);
}

.mobile-back-btn svg {
    fill: currentColor;
    stroke: currentColor;
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Header */
.sidebar-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--ink);
}

/* Responsive utilities */
.desktop-only {
    display: inline;
}

.mobile-only {
    display: none;
}

/* Mobile view states */
.mobile-view-list {
    /* Default state - showing list */
}

.mobile-view-viewer {
    /* Viewing an email */
}

.mobile-view-composer {
    /* Composing an email */
}

/* ===== BREAKPOINTS ===== */

/* Large tablets and small desktops (1024px and down) */
@media (max-width: 1024px) {
    .app {
        font-size: 14px;
    }
    
    .topbar {
        padding: 0 16px;
    }
    
    .layout {
        flex-direction: row;
    }
    
    .sidebar {
        width: 280px;
        min-width: 280px;
    }
    
    .content {
        flex: 1;
        min-width: 0;
    }
    
    .list.narrow {
        width: 350px;
        min-width: 350px;
    }
    
    /* Hide ads on tablet for better space usage */
    .ads {
        display: none;
    }
}

/* Tablets (768px and down) */
@media (max-width: 768px) {
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex;
    }
    
    /* Hide desktop button labels, show mobile versions */
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: inline;
    }
    
    /* Topbar adjustments */
    .topbar {
        height: 64px;
        padding: 0 12px;
        position: relative;
        z-index: 1000;
    }
    
    .iconbtn {
        padding: 8px 12px;
    }
    
    .iconbtn .btn-label {
        font-size: 13px;
    }
    
    /* Layout changes */
    .layout {
        position: relative;
        display: flex;
        overflow: hidden;
        height: calc(100vh - 64px);
    }
    
    /* Sidebar becomes overlay */
    .sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        bottom: 0;
        width: 75%;
        max-width: 320px;
        background: var(--panel);
        border-right: 1px solid var(--border);
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-header {
        display: flex;
    }
    
    .mobile-overlay {
        display: block;
    }
    
    /* Content takes full width */
    .content {
        width: 100%;
        margin-left: 0;
        display: flex !important;
        flex-direction: column;
        height: 100%;
    }
    
    /* List adjustments */
    .list.narrow {
        width: 100%;
        min-width: auto;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .list-head {
        padding: 16px 20px;
        border-radius: 0;
        flex-shrink: 0;
    }
    
    .list-head .title {
        font-size: 18px;
    }
    
    .list-body {
        flex: 1;
        overflow-y: auto;
    }
    
    /* Viewer adjustments */
    .viewer {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg);
        z-index: 997;
        padding: 16px;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .viewer.active {
        transform: translateX(0);
    }
    .viewer.active.hidden {
        display: block !important;
    }
    
    /* Composer adjustments */
    .composer-host {
        position: fixed !important;
        top: 64px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: calc(100vh - 64px) !important;
        z-index: 996;
        background: var(--bg);
        border: none !important;
        border-radius: 0 !important;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .composer-host.active {
        transform: translateX(0);
        overflow-y: hidden;     /* Todo */
    }
    
    .compose-iframe {
        width: 100% !important;
        height: 100% !important;
        border: none !important;
    }
    
    /* Hide ads on mobile */
    .ads {
        display: none !important;
    }
    
    /* Settings dropdown */
    #settingsMenu {
        right: 12px;
        left: auto;
        width: 280px;
        max-width: calc(100vw - 24px);
    }
    
    /* Mobile navigation states */
    .mobile-view-viewer .list {
        display: none;
    }
    
    .mobile-view-composer .list,
    .mobile-view-composer .viewer {
        display: none;
    }
    
    /* Mobile navigation button visibility is controlled by JavaScript */
    /* The .hidden class is added/removed dynamically */
}

/* Mobile phones (480px and down) */
@media (max-width: 480px) {
    /* Topbar */
    .topbar {
        position: fixed;
        top: 0;
        width: 100%;
        height: 56px;
        padding: 0 8px;
    }
    
    .layout {
        height: calc(100vh - 56px);
        padding-top: 56px;
    }
    
    .mobile-menu-btn,
    .mobile-back-btn {
        width: 40px;
        height: 40px;
        margin-right: 8px;
    }
    
    .iconbtn {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .iconbtn .btn-label {
        display: none;
    }
    
    /* Theme switch */
    .theme-switch-container {
        margin-right: 8px;
    }
    
    .switch-track {
        width: 56px;
        height: 28px;
    }
    
    .switch-thumb {
        width: 20px;
        height: 20px;
    }
    
    .theme-switch input:checked + .switch-track .switch-thumb {
        transform: translateX(28px);
    }
    
    .switch-icon {
        width: 14px;
        height: 14px;
    }
    
    /* Sidebar */
    .sidebar {
        top: 56px;
        width: 80%;
        max-width: 300px;
    }
    
    .sidebar-header {
        padding: 12px 16px;
    }
    
    .sidebar-title {
        font-size: 16px;
    }
    
    /* List */
    .list-head {
        margin-bottom: 0;
        padding: 12px 16px;
    }
    
    .list-head .title {
        font-size: 16px;
    }
    
    .list-search {
        padding: 8px 16px;
    }
    
    .searchBar {
        height: 40px;
        font-size: 14px;
    }
    
    /* Message rows */
    .msg-row {
        padding: 12px 16px;
    }
    
    .msg-row .from {
        font-size: 14px;
    }
    
    .msg-row .subject {
        font-size: 13px;
    }
    
    .msg-row .date {
        font-size: 12px;
    }
    
    /* Pagination */
    .pager {
        padding: 16px 16px;
        gap: 12px;
    }
    
    .pagination-btn {
        width: 44px;
        height: 44px;
    }
    
    .pagination-info {
        font-size: 13px;
        padding: 6px 12px;
        min-width: 80px;
    }
    
    /* Viewer */
    .viewer {
        top: 56px;
        padding: 12px;
    }
    
    .viewer-head {
        padding: 12px 0;
    }
    
    .viewer-head .subject {
        font-size: 18px;
    }
    
    /* Composer */
    .composer-host {
        top: 56px !important;
        height: calc(100vh - 56px) !important;
    }
    
    /* Settings dropdown */
    #settingsMenu {
        right: 8px;
        width: 260px;
        max-width: calc(100vw - 16px);
    }
    .compose-wrap .grid-2 input{
        font-size: 16px;
        padding: 4px 8px;
        width: 92%;
    }
    .compose-wrap .editor{
        min-height: calc(100vh - 535px);
        max-height: calc(100vh - 535px);
        font-size: 16px;
    }
    .toolbar{
        gap: 0;
        padding: 0 8px;
    }
    .tgroup{
        padding: 2px;
    }
    .composerBody{
        height: calc(100vh - 97px);
/* overflow-y: auto; */ /*Todo*/
    }
}

/* Extra small devices (360px and down) */
@media (max-width: 360px) {
    .topbar {
        padding: 0 4px;
    }
    
    .mobile-menu-btn,
    .mobile-back-btn {
        width: 36px;
        height: 36px;
        margin-right: 6px;
    }
    
    .iconbtn {
        padding: 4px 8px;
    }
    
    .sidebar {
        width: 85%;
        max-width: 280px;
    }
    
    .list-head {
        margin-top: 0;
        padding: 10px 12px;
    }
    
    .list-search {
        padding: 6px 12px;
    }
    
    .msg-row {
        padding: 10px 12px;
    }
    
    .viewer {
        padding: 10px;
    }
    
    #settingsMenu {
        right: 4px;
        width: 240px;
        max-width: calc(100vw - 8px);
    }
}

/* Landscape orientation adjustments for mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .topbar {
        height: 48px;
    }
    
    .layout {
        height: calc(100vh - 48px);
    }
    
    .sidebar {
        top: 48px;
    }
    
    .viewer {
        top: 48px;
    }
    
    .composer-host {
        top: 48px !important;
        height: calc(100vh - 48px) !important;
    }
    
    .sidebar-header {
        padding: 8px 16px;
    }
    
    .list-head {
        padding: 8px 16px;
    }
}

/* Dark theme responsive adjustments */
body.theme-dark .mobile-overlay {
    background: rgba(0, 0, 0, 0.7);
}

body.theme-dark .sidebar {
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

/* Accessibility improvements for mobile */
@media (max-width: 768px) {
    /* Larger touch targets */
    .folder-row {
        min-height: 48px;
        padding: 12px 16px;
    }
    #btnClose{
        display: none;
    }
    
    .msg-row {
        min-height: 56px;
    }
    
    /* Focus indicators for touch */
    .mobile-menu-btn:focus,
    .mobile-back-btn:focus,
    .sidebar-close-btn:focus {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }
}

/* ===== RESPONSIVE MODAL OVERLAYS ===== */

/* Tablet adjustments for modals */
@media (max-width: 1024px) {
    .modal {
        min-width: 380px !important;
        max-width: 480px !important;
        width: 85% !important;
    }
    
    .modal h3 {
        padding: 24px 28px 18px 28px;
        font-size: 22px;
    }
    
    .modal .row {
        margin: 20px 28px;
    }
    
    .modal .actions {
        padding: 20px 28px 28px 28px;
    }
    
    .modal .muted {
        margin: 0 28px 18px 28px;
    }
}

/* Mobile adjustments for modals */
@media (max-width: 768px) {
    .modal-backdrop {
        padding: 16px !important;
        align-items: flex-start !important;
        padding-top: 60px !important;
    }
    
    .modal {
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        max-height: calc(100vh - 120px) !important;
        overflow-y: auto !important;
        border-radius: 20px !important;
        margin: 0 !important;
    }
    
    .modal h3 {
        padding: 20px 24px 16px 24px;
        font-size: 20px;
        position: sticky;
        top: 0;
        background: inherit;
        z-index: 1;
    }
    
    .modal .row {
        margin: 16px 24px;
        gap: 10px;
    }
    
    .modal label {
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    .modal input,
    .modal textarea {
        padding: 14px 18px;
        font-size: 14px;
        border-radius: 12px;
    }
    
    .modal textarea {
        min-height: 100px;
        font-size: 14px;
    }
    
    .modal .actions {
        padding: 16px 24px 24px 24px;
        gap: 12px;
        position: sticky;
        bottom: 0;
        background: inherit;
        z-index: 1;
    }
    
    .modal .btn {
        padding: 12px 24px;
        font-size: 14px;
        min-width: 80px;
        flex: 1;
    }
    
    .modal .muted {
        margin: 0 24px 16px 24px;
        padding: 12px 16px;
        font-size: 13px;
    }
    
    /* Specific mobile adjustments for password overlay */
    #pwOverlay .modal {
        max-width: 100% !important;
    }
    
    /* Specific mobile adjustments for signature overlay */
    #sigOverlay .modal {
        max-width: 100% !important;
    }
    
    #sigOverlay .modal textarea {
        min-height: 120px;
        font-size: 14px;
        line-height: 1.5;
    }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
    .modal-backdrop {
        padding: 12px !important;
        padding-top: 50px !important;
    }
    
    .modal {
        border-radius: 16px !important;
        max-height: calc(100vh - 100px) !important;
    }
    
    .modal h3 {
        padding: 16px 20px 12px 20px;
        font-size: 18px;
    }
    
    .modal .row {
        margin: 12px 20px;
        gap: 8px;
    }
    
    .modal input,
    .modal textarea {
        padding: 12px 16px;
        font-size: 13px;
        border-radius: 10px;
    }
    
    .modal textarea {
        min-height: 80px;
    }
    
    .modal .actions {
        padding: 12px 20px 20px 20px;
        gap: 10px;
        flex-direction: column;
    }
    
    .modal .btn {
        padding: 14px 20px;
        font-size: 13px;
        width: 100%;
        min-width: auto;
    }
    
    .modal .muted {
        margin: 0 20px 12px 20px;
        padding: 10px 14px;
        font-size: 12px;
    }
}

/* Extra small mobile adjustments */
@media (max-width: 360px) {
    .modal-backdrop {
        padding: 8px !important;
        padding-top: 40px !important;
    }
    
    .modal {
        border-radius: 12px !important;
        max-height: calc(100vh - 80px) !important;
    }
    
    .modal h3 {
        padding: 14px 16px 10px 16px;
        font-size: 16px;
    }
    
    .modal .row {
        margin: 10px 16px;
    }
    
    .modal input,
    .modal textarea {
        padding: 10px 14px;
        font-size: 12px;
    }
    
    .modal .actions {
        padding: 10px 16px 16px 16px;
    }
    
    .modal .btn {
        padding: 12px 16px;
        font-size: 12px;
    }
    
    .modal .muted {
        margin: 0 16px 10px 16px;
        padding: 8px 12px;
        font-size: 11px;
    }
}

/* Landscape orientation adjustments for modals */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-backdrop {
        padding: 8px !important;
        padding-top: 20px !important;
        align-items: flex-start !important;
    }
    
    .modal {
        max-height: calc(100vh - 40px) !important;
        border-radius: 12px !important;
    }
    
    .modal h3 {
        padding: 12px 20px 8px 20px;
        font-size: 16px;
    }
    
    .modal .row {
        margin: 8px 20px;
    }
    
    .modal .actions {
        padding: 8px 20px 16px 20px;
    }
    
    .modal textarea {
        min-height: 60px;
    }
}

/* Dark theme responsive adjustments for modals */
@media (max-width: 768px) {
    body.theme-dark .modal {
        background: #1f2937 !important;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 8px 20px rgba(0, 0, 0, 0.6) !important;
    }
    
    body.theme-dark .modal h3 {
        background: linear-gradient(135deg, #374151 0%, #4b5563 100%) !important;
    }
    
    body.theme-dark .modal .actions {
        background: #374151 !important;
    }
}

/* Enhanced mobile modal animations */
@media (max-width: 768px) {
    .modal-backdrop:not(.hidden) .modal {
        animation: mobileModalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    @keyframes mobileModalSlideIn {
        from {
            opacity: 0;
            transform: translateY(30px) scale(0.95);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
}

/* Print styles */
@media print {
    .mobile-menu-btn,
    .mobile-back-btn,
    .mobile-overlay,
    .sidebar-header,
    .topbar,
    .pager,
    .modal-backdrop {
        display: none !important;
    }
    
    .sidebar {
        position: static;
        transform: none;
        box-shadow: none;
        border: none;
    }
    
    .layout {
        display: block;
    }
    
    .content {
        width: 100%;
    }
    
    .viewer {
        position: static;
        transform: none;
    }
}