/* ============================================================
   Flow - Communication Management System
   Tailwind Compatible Styles (matching sumit-billing design)
   ============================================================ */

/* ── Sidebar ─────────────────────────────────────────────────── */
.flow-sidebar {
    width: 240px;
    min-height: 100vh;
    background: #031b4e;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.2s ease;
    z-index: 40;
}

.flow-sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: 0.75rem;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.flow-sidebar-item:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
}

.flow-sidebar-item.active {
    background: #ff3673;
    color: white;
    box-shadow: 0 4px 12px rgba(255,54,115,0.3);
}

.flow-sidebar-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.flow-sidebar-item.disabled:hover {
    background: transparent;
    color: rgba(255,255,255,0.4);
}

/* Mobile sidebar toggle */
.flow-sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 50;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #031b4e;
    color: white;
    border: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.flow-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 39;
}

@media (max-width: 1023px) {
    .flow-sidebar {
        position: fixed;
        right: 0;
        left: auto;
        top: 0;
        bottom: 0;
        transform: translateX(100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 41;
    }
    .flow-sidebar.open {
        transform: translateX(0);
    }
    .flow-sidebar.open ~ .flow-sidebar-overlay {
        display: block;
    }
    .flow-sidebar-toggle {
        display: flex;
    }
}

/* ── Grid Navigation Buttons (Sub-nav) ───────────────────────── */
.flow-grid-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 1.125rem;
    line-height: 1.75rem;
    font-weight: 600;
    color: #374151;
    border-radius: 0.75rem;
    background-color: white;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    text-decoration: none;
    transition: all 0.2s ease;
}

@media (min-width: 768px) {
    .flow-grid-button {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
    }
}

.flow-grid-button:hover {
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
}

.flow-grid-button > div {
    border: 1px solid #e5e7eb;
    padding: 0.4rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.flow-grid-button > p {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 768px) {
    .flow-grid-button > p {
        overflow: visible;
        text-overflow: unset;
    }
}

.flow-grid-button.active {
    background-color: #ff3673;
    color: white;
}

.flow-grid-button.active > div {
    border-color: rgba(255,255,255,0.3);
}

.flow-grid-button.active i {
    color: white !important;
}

/* ── Section Animations ──────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.flow-fade-in {
    animation: fadeIn 0.35s ease;
}

/* ── Toast Notifications ─────────────────────────────────────── */
.flow-toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 420px;
    width: calc(100% - 40px);
    pointer-events: none;
}

.flow-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    font-size: 14px;
    font-weight: 500;
    pointer-events: auto;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    direction: rtl;
    text-align: right;
    position: relative;
    overflow: hidden;
}

.flow-toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    height: 3px;
    background: rgba(255,255,255,0.4);
    animation: toastTimer 4s linear forwards;
}

.flow-toast.removing {
    animation: toastSlideOut 0.3s ease forwards;
}

.flow-toast-success { background: #059669; color: white; }
.flow-toast-error   { background: #dc2626; color: white; }
.flow-toast-warning { background: #d97706; color: white; }
.flow-toast-info    { background: #3b7ddd; color: white; }

.flow-toast .toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
}

.flow-toast .toast-close {
    margin-right: auto;
    margin-left: 0;
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
    line-height: 1;
    flex-shrink: 0;
}

.flow-toast .toast-close:hover { color: white; }

@keyframes toastSlideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-100%); opacity: 0; }
}

@keyframes toastTimer {
    from { width: 100%; }
    to { width: 0%; }
}

/* ── Spinner ─────────────────────────────────────────────────── */
.flow-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e2e8f0;
    border-top-color: #ff3673;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.flow-spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

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

/* ── Loading Overlay ─────────────────────────────────────────── */
.flow-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ── Modal ────────────────────────────────────────────────────── */
.flow-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: modalBgIn 0.2s ease;
}

.flow-modal-overlay.visible {
    display: flex;
}

@keyframes modalBgIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ── Toggle Switch ────────────────────────────────────────────── */
.flow-toggle {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    display: inline-block;
}

.flow-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.flow-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #cbd5e1;
    border-radius: 26px;
    transition: 0.2s ease;
}

.flow-toggle .slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.flow-toggle input:checked + .slider {
    background: #ff3673;
}

.flow-toggle input:checked + .slider::before {
    transform: translateX(22px);
}

/* ── Status Dot ──────────────────────────────────────────────── */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
    display: inline-block;
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.6);
    flex-shrink: 0;
}

.status-dot.error {
    background: #e8453c;
    box-shadow: 0 0 6px rgba(232, 69, 60, 0.6);
}

/* ── Tab Navigation ──────────────────────────────────────────── */
.flow-tab-btn {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.flow-tab-btn:hover {
    color: #031b4e;
}

.flow-tab-btn.active {
    color: #ff3673;
    border-bottom-color: #ff3673;
}

/* ── Drag and Drop Upload Zone ───────────────────────────────── */
.flow-upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.flow-upload-zone:hover,
.flow-upload-zone.dragover {
    border-color: #ff3673;
    background: rgba(255, 54, 115, 0.05);
}

/* ── Cross-browser Form Normalization ────────────────────────── */
select,
select.w-full {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    background-size: 12px;
    padding-left: 2rem;
}

input[type="date"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    min-height: 42px;
}

/* ── Email preview ───────────────────────────────────────────── */
.email-preview-frame {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
    background: white;
}

.email-preview-frame iframe {
    width: 100%;
    min-height: 300px;
    border: none;
}

/* ── Variable Chips ──────────────────────────────────────────── */
.flow-var-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: monospace;
    cursor: pointer;
    transition: all 0.15s ease;
    direction: ltr;
}

.flow-var-chip:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

/* ── Activity Tooltip ────────────────────────────────────────── */
.flow-activity-item {
    position: relative;
}

.flow-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    max-width: 300px;
    background: #031b4e;
    color: #fff;
    font-size: 0.75rem;
    line-height: 1.6;
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    z-index: 100;
    direction: rtl;
    text-align: right;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
}

.flow-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 20px;
    border-width: 6px;
    border-style: solid;
    border-color: #031b4e transparent transparent transparent;
}

.flow-activity-item:hover .flow-tooltip {
    visibility: visible;
    opacity: 1;
}

/* ============================================================
   Mailbox
   ============================================================ */

/* ── Layout ──────────────────────────────────────────────────── */
.mailbox-wrap {
    display: flex;
    height: calc(100vh - 240px);
    overflow: hidden;
    background: #fff;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    position: relative;
}
.mailbox-sidebar {
    width: 220px;
    min-width: 220px;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: #f9fafb;
}
.mailbox-list {
    flex: 1;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.mailbox-detail {
    flex: 1.2;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.mailbox-detail.hidden-pane { display: none; }
.mailbox-detail.fullpane {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: #fff;
    border: none;
    border-radius: 1rem;
    flex: 1;
}
.mailbox-detail #detailContent {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ── Sidebar Folders ─────────────────────────────────────────── */
.folder-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 0.5rem;
    margin: 0.125rem 0.5rem;
    transition: all 0.15s;
    font-size: 0.8125rem;
}
.folder-item:hover { background: #e5e7eb; }
.folder-item.active { background: #031b4e; color: #fff; }
.folder-item.active .folder-count { background: rgba(255,255,255,0.2); color: #fff; }
.folder-count {
    font-size: 0.7rem;
    background: #e5e7eb;
    color: #6b7280;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
    margin-right: auto;
}

/* ── Toolbar ─────────────────────────────────────────────────── */
.mailbox-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
    gap: 0.5rem;
}
.toolbar-right { display: flex; align-items: center; gap: 0.25rem; }
.toolbar-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    border-radius: 0.375rem;
}
.toolbar-checkbox:hover { background: #e5e7eb; }
.toolbar-checkbox input {
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 0.25rem;
    border: 1.5px solid #9ca3af;
    cursor: pointer;
    accent-color: #031b4e;
}
.toolbar-sep { width: 1px; height: 1.25rem; background: #d1d5db; margin: 0 0.25rem; }
.toolbar-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    background: none;
    color: #6b7280;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.1s;
}
.toolbar-btn:hover { background: #e5e7eb; color: #111827; }
.toolbar-btn-danger:hover { background: #fef2f2; color: #ef4444; }
.toolbar-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0 0.625rem;
    height: 2rem;
    transition: all 0.2s;
    min-width: 10rem;
}
.toolbar-search:focus-within {
    border-color: #031b4e;
    box-shadow: 0 0 0 2px rgba(3, 27, 78, 0.1);
    min-width: 14rem;
}
.toolbar-search i { color: #9ca3af; font-size: 0.75rem; flex-shrink: 0; }
.toolbar-search input { border: none; outline: none; background: none; font-size: 0.8125rem; width: 100%; padding: 0; }

/* ── Tooltips (data-tip) ─────────────────────────────────────── */
.toolbar-btn::after,
.row-actions button::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 50;
}
.toolbar-btn::before,
.row-actions button::before {
    content: '';
    position: absolute;
    top: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-bottom-color: #1f2937;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 50;
}
.toolbar-btn:hover::after, .toolbar-btn:hover::before,
.row-actions button:hover::after, .row-actions button:hover::before { opacity: 1; }

/* ── Email Rows ──────────────────────────────────────────────── */
.email-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.8125rem;
}
.email-row:hover { background: #f9fafb; }
.email-row.active { background: #eff6ff; }
.email-row.unread { font-weight: 700; }
.email-row .star-btn { color: #d1d5db; cursor: pointer; flex-shrink: 0; }
.email-row .star-btn.starred { color: #f59e0b; }
.email-row .email-sender { width: 140px; min-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-row .email-subject { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-row .email-snippet { color: #9ca3af; font-weight: 400; }
.email-row .email-date { font-size: 0.75rem; color: #6b7280; white-space: nowrap; flex-shrink: 0; }

/* Hover actions on email rows */
.email-row .row-actions { display: none; flex-shrink: 0; align-items: center; gap: 0.125rem; margin-right: auto; }
.email-row:hover .row-actions { display: flex; }
.email-row:hover .email-date { display: none; }
.row-actions button {
    position: relative;
    padding: 0.2rem 0.35rem;
    border-radius: 0.375rem;
    color: #6b7280;
    transition: all 0.1s;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8125rem;
    line-height: 1;
}
.row-actions button:hover { background: #e5e7eb; color: #111827; }
.row-actions button.act-delete:hover { color: #ef4444; }

/* ── Label Chips ─────────────────────────────────────────────── */
.label-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    color: #fff;
    font-weight: 600;
}

/* ── Compose Modal ───────────────────────────────────────────── */
.compose-modal {
    position: fixed;
    bottom: 0;
    left: 1rem;
    width: 520px;
    max-width: calc(100vw - 2rem);
    background: #fff;
    border-radius: 0.75rem 0.75rem 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    z-index: 100;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
    transition: all 0.25s ease;
}
.compose-modal.minimized { max-height: 44px; overflow: hidden; }
.compose-modal.fullscreen {
    left: 50%; top: 50%; bottom: auto;
    transform: translate(-50%, -50%);
    width: 80vw; max-width: 900px; max-height: 85vh;
    border-radius: 0.75rem;
}
.compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    background: #031b4e;
    color: #fff;
    border-radius: 0.75rem 0.75rem 0 0;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
}
.compose-body {
    padding: 0.75rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.compose-body input,
.compose-body select,
.compose-body textarea {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    outline: none;
    direction: rtl;
}
.compose-body input:focus,
.compose-body select:focus,
.compose-body textarea:focus { border-color: #031b4e; }
.compose-body input[dir="ltr"],
.compose-body textarea[dir="ltr"] { direction: ltr; text-align: left; }
.compose-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-top: 1px solid #e5e7eb;
    align-items: center;
}

/* From email group (input @ domain) */
.compose-body .from-email-group {
    display: flex;
    align-items: stretch;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}
.compose-body .from-email-group:focus-within { border-color: #031b4e; }
.compose-body .from-email-group input,
.compose-body .from-email-group button { border: none; border-radius: 0; padding: 0.5rem 0.75rem; }
.compose-body .from-email-group input:focus { border-color: transparent; }
.compose-body .from-email-group .from-at {
    background: #f3f4f6;
    color: #6b7280;
    font-family: monospace;
    padding: 0.5rem 0.4rem;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    border-left: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
}
.compose-body .from-email-group .from-domain-btn {
    background: #fff;
    text-align: left;
    cursor: pointer;
    position: relative;
    padding-right: 1.75rem;
    flex: 1;
    font-size: 0.8125rem;
    border-radius: 0 0.5rem 0.5rem 0;
}
.compose-body .from-email-group .from-local-input { flex: 1; border-radius: 0.5rem 0 0 0.5rem; }

/* Recipient mode buttons */
.compose-mode-btn {
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 0.375rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
    border: none;
    white-space: nowrap;
}
.compose-mode-btn.active { background: #fff; color: #031b4e; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.compose-mode-btn:hover:not(.active) { color: #374151; }

/* Variable insert buttons */
.compose-var-btn {
    padding: 0.1rem 0.4rem;
    font-size: 0.65rem;
    font-family: monospace;
    color: #2563eb;
    background: #eff6ff;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background 0.1s;
}
.compose-var-btn:hover { background: #dbeafe; }

/* Compose overlay */
.compose-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 99; }
.compose-modal.fullscreen + .compose-overlay,
.compose-overlay.active { display: block; }

/* ── Context Menu ────────────────────────────────────────────── */
.ctx-menu {
    position: fixed;
    z-index: 200;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 160px;
    padding: 0.25rem 0;
    display: none;
}
.ctx-menu.show { display: block; }
.ctx-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    cursor: pointer;
    white-space: nowrap;
    color: #374151;
}
.ctx-item:hover { background: #f3f4f6; }
.ctx-item.danger { color: #ef4444; }
.ctx-item.danger:hover { background: #fef2f2; }
.ctx-sep { height: 1px; background: #e5e7eb; margin: 0.25rem 0; }

/* ── Mobile FAB ──────────────────────────────────────────────── */
.mobile-fab { display: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    /* Global */
    .flow-toast-container { left: 10px; right: 10px; max-width: none; width: auto; }
    .flow-grid-button { font-size: 0.85rem; padding: 0.2rem 0.4rem; }
    .flow-grid-button > div { padding: 0.5rem; }

    /* Mailbox layout */
    .mailbox-wrap { height: calc(100vh - 180px); border-radius: 0.75rem; }
    .mailbox-sidebar { display: none; }
    .mailbox-list { min-width: 0; }
    .mailbox-detail { position: fixed; inset: 0; z-index: 50; background: #fff; border: none; border-radius: 0; }
    .mailbox-detail.hidden-pane { display: none; }
    .mailbox-detail.fullpane { border-radius: 0; }

    /* Compose modal */
    .compose-modal { width: 100%; left: 0; right: 0; max-width: 100%; border-radius: 0.75rem 0.75rem 0 0; }
    .compose-modal.fullscreen { left: 0; top: 0; transform: none; width: 100%; max-width: 100%; border-radius: 0; }

    /* Toolbar compact */
    .mailbox-toolbar { padding: 0.375rem 0.5rem; gap: 0.25rem; }
    .toolbar-search { min-width: 6rem; }
    .toolbar-search:focus-within { min-width: 8rem; }
    .toolbar-btn { width: 1.75rem; height: 1.75rem; font-size: 0.8125rem; }

    /* Email rows compact */
    .email-row { padding: 0.5rem 0.625rem; gap: 0.375rem; }
    .email-row .email-sender { width: 100px; min-width: 100px; font-size: 0.75rem; }
    .email-row .email-subject { font-size: 0.75rem; }
    .email-row .email-date { font-size: 0.65rem; }

    /* Mobile folders bar (replaces sidebar) */
    .mobile-folders {
        display: flex;
        gap: 0.25rem;
        padding: 0.5rem;
        overflow-x: auto;
        border-bottom: 1px solid #e5e7eb;
        background: #fff;
        flex-shrink: 0;
        -webkit-overflow-scrolling: touch;
    }
    .mobile-folders::-webkit-scrollbar { display: none; }
    .mobile-folder-btn {
        padding: 0.35rem 0.75rem;
        font-size: 0.7rem;
        font-weight: 600;
        border-radius: 999px;
        white-space: nowrap;
        border: 1px solid #e5e7eb;
        background: #fff;
        color: #6b7280;
        cursor: pointer;
        flex-shrink: 0;
    }
    .mobile-folder-btn.active { background: #031b4e; color: #fff; border-color: #031b4e; }

    /* FAB compose button */
    .mobile-fab {
        display: flex;
        position: fixed;
        bottom: 1.25rem;
        left: 1.25rem;
        z-index: 90;
        width: 3.25rem;
        height: 3.25rem;
        border-radius: 1rem;
        background: #ff3673;
        color: #fff;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 16px rgba(255, 54, 115, 0.4);
        border: none;
        cursor: pointer;
        font-size: 1.25rem;
        transition: transform 0.15s;
    }
    .mobile-fab:active { transform: scale(0.92); }
}

@media (max-width: 480px) {
    .email-row .email-sender { width: 80px; min-width: 80px; }
    .toolbar-search input { font-size: 0.75rem; }
}
