/* ============================================================
   BINGO MAILER — Master Stylesheet
   ------------------------------------------------------------
   Table of Contents
   1.  Reset & Base
   2.  Layout — Main Structure
   3.  Topbar
   4.  Sidebar
   5.  Mail List
       5a. Top Bar (Select / Bulk Controls)
       5b. Mail Items
       5c. Unread State
       5d. Attachment Badge
   6.  Mail View
       6a. Header & Avatar
       6b. Meta Bar
       6c. Body
       6d. Attachments Panel
       6e. Action Buttons
       6f. Empty State
   7.  Compose Modal
       7a. Modal Shell
       7b. Fields
       7c. Editor (Quill)
       7d. Mail Trail
       7e. Attachment Row
   8.  Buttons (shared)
   9.  Login Page
   ============================================================ */


/* ============================================================
   1. RESET & BASE
   ============================================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: 'Segoe UI', sans-serif;
    background: #f4f6f9;
    overflow: auto;
}


/* ============================================================
   2. LAYOUT — MAIN STRUCTURE
   ============================================================ */

.main-layout {
    display: flex;
    height: calc(100vh - 65px);
}

/* ============================================================
   3. TOPBAR
   ============================================================ */

.topbar {
    height: 65px;
    background: linear-gradient(to right, #0F2B5B, #63A0AE);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    border-bottom: 2px solid rgba(255,255,255,0.15);
    position: relative;
    z-index: 10000;
    overflow: visible;  /* ADD THIS — prevents clipping the dropdown */
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 10000;  /* higher than mail list topbar z-index of 20 */
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    height: 32px;
    background: transparent;
}

.brand {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.search-box {
    width: 400px;
    background: rgba(255, 255, 255, 0.10);
    border-radius: 25px;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.search-box i {
    color: rgba(255, 255, 255, 0.6);
}

.search-box input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    color: #ffffff;
    font-size: 14px;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.user-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-box span {
    color: #ffffff;
    font-size: 14px;
}

.avatar {
    width: 34px;
    height: 34px;
    background: #6366f1;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 15px;
    flex-shrink: 0;
}

.logout-btn {
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #ffffff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
    background: transparent;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

/* ── Search results box ──────────────────────────────────── */
.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
}

.search-results-box {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    z-index: 10000;
    overflow: hidden;
    max-height: 420px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    flex-direction: column;
    padding: 12px 18px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f5f7ff;
}

.search-result-from {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

.search-result-subject {
    font-size: 13px;
    color: #374151;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-date {
    font-size: 11px;
    color: #9ca3af;
}

.search-result-subject mark {
    background: #fef08a;
    color: #111827;
    border-radius: 2px;
    padding: 0 2px;
}

.search-no-result {
    padding: 24px 18px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

.search-no-result i {
    display: block;
    font-size: 28px;
    margin-bottom: 8px;
    color: #d1d5db;
}

.search-loading {
    padding: 20px 18px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

.search-header {
    padding: 10px 18px;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}


/* ============================================================
   4. SIDEBAR
   ============================================================ */

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: #F2F1EC;
    color: #202124;
    padding: 16px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
}

.sidebar-header {
    display: none;
}

.compose-btn {
    width: 100%;
    padding: 10px 18px;
    border: none;
    border-radius: 24px;
    background: #1a73e8;
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    text-align: left;
}

.compose-btn:hover {
    background: #1557b0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar a,
.sidebar a:hover,
.sidebar a:visited {
    text-decoration: none;
    color: inherit;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 24px;
    cursor: pointer;
    color: #202124;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.menu-item svg {
    flex-shrink: 0;
    stroke: #202124;
}

.menu-item:hover {
    background: #e8eaed;
    color: #202124;
}

.menu-item.active {
    background: #e8eaedd2;
    color: #202124;
    font-weight: 600;
    border-radius: 999px;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.06);
}

.menu-item.active svg {
    stroke: #202124;
}

.menu-badge {
    margin-left: auto;
    color: #5f6368;
    font-size: 13px;
    font-weight: 500;
}

.menu-item.active .menu-badge {
    color: #202124;
}

/* ============================================================
   5. MAIL LIST — REPLACE ENTIRE SECTION
   ============================================================ */

.mail-list {
    width: 350px;
    flex-shrink: 0;
    background: #F2F3F5;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* ── 5a. Top Bar ─────────────────────────────────────────── */

.mail-list-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-bottom: 1px solid #e8e8e8;
    background: #f0f2f5;
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 40px;
}

.select-toggle-btn {
    background: none;
    border: none;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    letter-spacing: 0.2px;
}

.select-toggle-btn:hover {
    text-decoration: underline;
}

.bulk-controls {
    display: none;
    align-items: center;
    gap: 10px;
}

.bulk-controls.visible {
    display: flex;
}

.dots-menu-wrapper {
    position: relative;
}

.dots-btn {
    background: none;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 5px 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    height: 30px;
    transition: background 0.15s;
}

.dots-btn span {
    display: block;
    width: 4px;
    height: 4px;
    background: #444;
    border-radius: 50%;
}

.dots-btn:hover {
    background: #e8e8e8;
}

.dots-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 170px;
    z-index: 100;
    overflow: hidden;
}

.dots-dropdown.open {
    display: block;
}

.dots-option {
    padding: 10px 16px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 9px;
    transition: background 0.15s;
}

.dots-option i {
    width: 14px;
    text-align: center;
    font-size: 13px;
}

.dots-option:hover {
    background: #f5f5f5;
}

.dots-option.danger {
    color: #d93025;
}

.dots-option.select-all-opt {
    border-bottom: 1px solid #eee;
    color: #555;
    font-weight: 500;
}

/* ── 5b. Mail Items ──────────────────────────────────────── */

.mail-item-wrapper {
    display: flex;
    align-items: center;
    margin: 4px 8px;
    border-radius: 10px;
    border-bottom: none;
    padding: 0;
    transition: background 0.15s, box-shadow 0.15s;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.mail-item-wrapper:hover {
    background: #eef2ff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.mail-checkbox {
    display: none;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #1a73e8;
    margin-left: 10px;
}

.select-mode .mail-checkbox {
    display: block;
}

.mail-item-link {
    text-decoration: none !important;
    color: inherit !important;
    flex: 1;
    min-width: 0;
}

.mail-item {
    padding: 12px 14px;
    cursor: pointer;
    border-left: none;
    border-radius: 10px;
    width: 100%;
}

.mail-sender {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.mail-subject {
    font-size: 13px;
    color: #374151;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mail-preview {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.mail-time {
    font-size: 11px;
    color: #6b7280;
    float: right;
}

/* ── 5c. Unread State ────────────────────────────────────── */

.mail-item-wrapper.unread-mail {
    background: #fff;
}

.mail-item-wrapper.unread-mail .mail-item {
    background-color: #fff;
    border-left: none;
}

.mail-item-wrapper.unread-mail .mail-sender {
    font-weight: 700;
    color: #000;
}

.mail-item-wrapper.unread-mail .mail-subject {
    font-weight: 700;
    color: #1a1a1a;
}

.mail-item-wrapper.unread-mail .mail-time {
    color: #374151;
    font-weight: 600;
}

/* ── 5d. Active mail ─────────────────────────────────────── */

.mail-item-wrapper.active-mail {
    background: #dde3f0;
    box-shadow: none;
}

.mail-item-wrapper.active-mail .mail-item {
    background-color: transparent;
    border-left: none;
    border-radius: 10px;
}

.mail-item-wrapper.active-mail .mail-sender {
    font-weight: 600;
    color: #1a3a6e;
}

/* ── 5e. Attachment Badge ────────────────────────────────── */

.attach-badge {
    display: inline-flex;
    align-items: center;
    background: transparent;
    color: #6b7280;
    border-radius: 4px;
    padding: 1px 3px;
    font-size: 11px;
    margin-left: 4px;
    vertical-align: middle;
}


/* ============================================================
   6. MAIL VIEW — REPLACE ENTIRE SECTION
   ============================================================ */

.mail-view {
    flex: 1;
    height: 100%;
    min-width: 0;
    background: #F2F3F5;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

/* ── Thread subject + action bar row ─────────────────────── */

.thread-subject-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    padding: 18px 24px 14px 24px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.thread-meta-row {
    display: block;
    font-size: 12px;
    color: #555;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 480px;
}

.thread-subject-row {
    font-weight: 600;
    color: #222;
    font-size: 13px;
}

.thread-meta-label {
    color: #888;
    font-weight: 500;
    min-width: 48px;
    display: inline-block;
}

.thread-subject-header > span {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

/* Action button bar */
.mail-action-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.mail-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
    text-decoration: none;
}

.mail-action-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
    color: #374151;
}

.mail-action-btn i {
    font-size: 12px;
    color: #6b7280;
}

.mail-action-btn.btn-danger-outline {
    color: #dc2626;
    border-color: #fca5a5;
}

.mail-action-btn.btn-danger-outline i {
    color: #dc2626;
}

.mail-action-btn.btn-danger-outline:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

.mail-action-btn.btn-more {
    padding: 7px 12px;
}

/* ── Thread email header — 3-section layout ───────────────────── */
.thread-email-header {
    display: flex;
    align-items: flex-start;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    gap: 0;
}

/* Section 1 — 35% */
.teh-s1 {
    width: 35%;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding-right: 12px;
    position: relative;   /* anchor for the popup */
}

/* Section 2 — 50%: wrap instead of truncate */
.teh-s2 {
    width: 50%;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
    white-space: normal;        /* ← wrap */
    word-break: break-word;     /* ← break long words too */
    overflow: visible;
    text-overflow: unset;
    align-self: center;
    padding: 0 12px;
    line-height: 1.4;
}

/* Section 3 — 15% */
.teh-s3 {
    width: 15%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    align-self: flex-start;     /* ← stay top when subject wraps */
    padding-top: 2px;
}

/* ── Sender detail popup ───────────────────────────────────────── */
.teh-sender-popup {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 999;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.13);
    padding: 12px 16px;
    min-width: 280px;
    max-width: 420px;
}

.teh-sender-popup.open {
    display: block;
}

.teh-popup-row {
    display: flex;
    gap: 8px;
    font-size: 12.5px;
    color: #333;
    margin-bottom: 6px;
    align-items: flex-start;
    line-height: 1.4;
}

.teh-popup-row:last-child {
    margin-bottom: 0;
}

.teh-popup-label {
    font-weight: 600;
    color: #888;
    min-width: 38px;
    flex-shrink: 0;
}

.teh-popup-value {
    word-break: break-all;
    cursor: text;       /* let user select and copy naturally */
    user-select: text;
}

.teh-popup-close {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 14px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.teh-popup-close:hover {
    color: #333;
}

/* ── 6a. Thread email cards ──────────────────────────────── */

.thread-email {
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    margin: 0 16px 10px 16px;
    overflow: hidden;
    transition: box-shadow 0.15s;
    background: #fff;
}

.thread-email:not(.thread-collapsed) {
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}

.thread-email-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    background: #fff;
    transition: background 0.15s;
    user-select: none;
}

.thread-email-header:hover {
    background: #f9fafb;
}

.thread-collapsed .thread-email-header {
    background: #fafafa;
}

.thread-avatar {
    width: 36px;
    height: 36px;
    font-size: 15px;
    flex-shrink: 0;
    background: #4f46e5;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.thread-header-meta {
    flex: 1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.thread-from {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-date {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    flex-shrink: 0;
}

.thread-chevron {
    font-size: 11px;
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.thread-email-body {
    border-top: 1px solid #f0f0f0;
    background: #fff;
    padding: 16px 20px;
}

/* ── 6b. No mail / empty state ───────────────────────────── */

.no-mail {
    text-align: center;
    color: #aaa;
    margin-top: 80px;
    font-size: 18px;
}

/* ── 6c. Meta, body, attachments (unchanged) ─────────────── */

.mail-meta {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #374151;
    display: flex;
    justify-content: space-between;
}

.mail-date {
    white-space: nowrap;
}

.mail-body {
    line-height: 1.6;
    font-size: 14px;
    color: #111827;
    margin-top: 10px;
    padding: 10px 0;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

.mail-body table {
    max-width: 100% !important;
    width: auto !important;
}

.mail-body img {
    max-width: 100%;
    height: auto;
}

.mail-body div {
    max-width: 100% !important;
}

.mail-attachments {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.attachment-title {
    font-weight: 600;
    margin-bottom: 10px;
}

.attachment-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 5px 5px 0 0;
    background: #f1f3f5;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: background 0.2s;
}

.attachment-box:hover {
    background: #e2e6ea;
}

.att-size {
    font-size: 12px;
    color: #6b7280;
}

/* OLD mail-actions (bottom buttons) — hide them */
.mail-actions {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
}

/* ============================================================
   7. COMPOSE MODAL
   ============================================================ */


/* ── 7a. Modal Shell ──────────────────────────────────────── */

.modal-content,
.compose-modal-content {
    border-radius: 12px;
    overflow: hidden;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-bottom: 1px solid #eee;
}

.modal-footer {
    border-top: 1px solid #eee;
}

.compose-modal-header {
    background: #1e1e2e;
    color: #fff;
    padding: 14px 20px;
    border-bottom: none;
}

.compose-modal-header .modal-title {
    font-size: 15px;
    font-weight: 500;
    color: #fff;
}

.compose-modal-footer {
    border-top: 1px solid #f0f0f0;
    padding: 12px 16px;
    gap: 8px;
}


/* ── 7b. Fields ───────────────────────────────────────────── */

.compose-fields {
    border-bottom: 1px solid #f0f0f0;
}

.compose-field-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f5f5f5;
    padding: 0 16px;
    min-height: 42px;
    gap: 10px;
}

.compose-field-row:last-child {
    border-bottom: none;
}

.compose-field-label {
    font-size: 12px;
    color: #9ca3af;
    width: 48px;
    flex-shrink: 0;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.compose-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #111827;
    background: transparent;
    padding: 8px 0;
}

.compose-input[readonly] {
    color: #6b7280;
    font-size: 13px;
}

.compose-input::placeholder {
    color: #d1d5db;
}


/* ── 7c. Editor (Quill) ───────────────────────────────────── */

.compose-editor-wrap {
    min-height: 180px;
}

.compose-editor-wrap .ql-toolbar {
    border: none;
    border-bottom: 1px solid #f0f0f0;
    padding: 8px 12px;
}

.compose-editor-wrap .ql-container {
    border: none;
    font-size: 14px;
    font-family: 'Segoe UI', sans-serif;
}

.compose-editor-wrap .ql-editor {
    min-height: 160px;
    padding: 14px 18px;
    color: #111827;
    line-height: 1.7;
}

.compose-editor-wrap .ql-editor.ql-blank::before {
    color: #d1d5db;
    font-style: normal;
}

/* Standalone Quill instance (non-compose) */
#editor {
    height: 250px;
}

.ql-editor {
    min-height: 200px;
    font-size: 14px;
}


/* ── 7d. Mail Trail ───────────────────────────────────────── */

.compose-trail-wrap {
    border-top: 1px solid #f0f0f0;
    padding: 0;
}

.compose-trail-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    cursor: pointer;
    color: #6b7280;
    font-size: 13px;
    user-select: none;
    transition: background 0.15s;
}

.compose-trail-toggle:hover {
    background: #f9fafb;
    color: #374151;
}

.trail-dots {
    font-size: 16px;
    letter-spacing: -1px;
    color: #9ca3af;
    line-height: 1;
}

.compose-trail {
    padding: 0 18px 16px 18px;
    max-height: 280px;
    overflow-y: auto;
    font-size: 13px;
    color: #555;
    background: #fafafa;
}


/* ── 7e. Attachment Row ───────────────────────────────────── */

.compose-attachment-row {
    padding: 8px 16px;
    border-top: 1px solid #f0f0f0;
}

.compose-attach-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    transition: background 0.15s;
    margin: 0;
}

.compose-attach-label:hover {
    background: #f3f4f6;
    color: #374151;
}

.compose-attach-label i {
    font-size: 14px;
}


/* ============================================================
   8. BUTTONS (SHARED)
   ============================================================ */

.btn {
    padding: 9px 18px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-primary,
.btn-reply {
    background: #2563eb;
    color: #fff;
}

.btn-primary:hover,
.btn-reply:hover {
    background: #1d4ed8;
}

.btn-secondary,
.btn-reply-all {
    background: #6b7280;
    color: #fff;
}

.btn-secondary:hover,
.btn-reply-all:hover {
    background: #4b5563;
}

.btn-danger,
.btn-delete {
    background: #dc2626;
    color: #fff;
}

.btn-danger:hover,
.btn-delete:hover {
    background: #b91c1c;
}


/* ============================================================
   9. LOGIN PAGE
   ============================================================ */

.login-box {
    width: 380px;
    background: #fff;
    padding: 35px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.login-title {
    text-align: center;
    margin-bottom: 25px;
}

.login-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
}

.login-logo img {
    max-width: 150px;
    display: block;
}

.form-control {
    height: 45px;
}

.footer-text {
    text-align: center;
    margin-top: 15px;
    font-size: 13px;
    color: #777;
}
/* ── Active (currently viewed) sent mail ─────────────────── */
.mail-item-wrapper.active-mail .mail-item {
    background-color: #eef2ff;
    border-left: 4px solid #4f46e5;
}

.mail-item-wrapper.active-mail .mail-sender {
    font-weight: 600;
    color: #3730a3;
}
/* ── Add these rules into style.css under Section 5a ─────────────────────────
   (Topbar groups, Refresh widget, Pagination, Empty state)
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Topbar inner groups ─────────────────────────────────── */
.topbar-left-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-right-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mail-count-label {
    font-size: 11px;
    color: #9ca3af;
}

/* ── Refresh widget ──────────────────────────────────────── */
.refresh-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
}

.refresh-countdown {
    font-size: 11px;
    color: #9ca3af;
    min-width: 28px;
    text-align: right;
    font-variant-numeric: tabular-nums;  /* stops layout shifting as digits change */
}

.refresh-btn {
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
}

.refresh-btn:hover {
    background: #f1f3f4;
    color: #1a73e8;
}

.refresh-btn.spinning i {
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Pagination bar ──────────────────────────────────────── */
.mail-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid #f0f0f0;
    background: #fff;
    position: sticky;
    bottom: 0;
}

.page-info {
    font-size: 12px;
    color: #9ca3af;
}

.page-btns {
    display: flex;
    gap: 4px;
}

.page-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #374151;
    text-decoration: none;
    font-size: 11px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.page-btn:hover {
    background: #f1f3f4;
    color: #1a73e8;
    border-color: #1a73e8;
}

.page-btn.disabled {
    color: #d1d5db;
    border-color: #f0f0f0;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #aaa;
    font-size: 14px;
}

.empty-state i {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

/* ── Add these rules to style.css under Section 6 (Mail View) ────────────────
   Thread subject header + stacked email cards
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Thread count badge (in mail list row) ───────────────── */
.thread-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8eaed;
    color: #555;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    margin-left: 6px;
    vertical-align: middle;
}

.unread-mail .thread-count {
    background: #c2d3fc;
    color: #1a73e8;
}

/* ── Thread subject title in mail view ───────────────────── */
.thread-subject-header {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    padding: 20px 20px 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 8px;
    word-break: break-word;
}

/* ── Individual email card in thread ─────────────────────── */
.thread-email {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin: 0 16px 10px 16px;
    overflow: hidden;
    transition: box-shadow 0.15s;
}

.thread-email:last-of-type {
    margin-bottom: 0;
}

.thread-email:not(.thread-collapsed) {
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

/* ── Clickable header row ────────────────────────────────── */
.thread-email-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    background: #fff;
    transition: background 0.15s;
    user-select: none;
}

.thread-email-header:hover {
    background: #f9fafb;
}

/* Collapsed state — slightly muted */
.thread-collapsed .thread-email-header {
    background: #fafafa;
}

/* ── Avatar inside thread ────────────────────────────────── */
.thread-avatar {
    width: 36px;
    height: 36px;
    font-size: 15px;
    flex-shrink: 0;
}

/* ── From + date meta ────────────────────────────────────── */
.thread-header-meta {
    flex: 1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.thread-from {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-date {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Collapse chevron ────────────────────────────────────── */
.thread-chevron {
    font-size: 11px;
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.2s;
}

/* ── Email body area ─────────────────────────────────────── */
.thread-email-body {
    border-top: 1px solid #f0f0f0;
    background: #fff;
}


/* ── New changes in compose modal─────────────────────────────────────── */

.compose-field-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
}

.email-tag-input {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 8px;
    min-height: 36px;
    align-items: center;
    cursor: text;
    border-left: 1px solid #eee; /* subtle separator from system_cc */
}

.email-tag-input input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 160px;
    font-size: 13px;
    padding: 2px 4px;
    background: transparent;
}

.email-chip {
    display: inline-flex;
    align-items: center;
    background: #e8f0fe;
    color: #1a73e8;
    border-radius: 16px;
    padding: 2px 10px;
    font-size: 12px;
    gap: 6px;
    max-width: 220px;
    white-space: nowrap;
}

.email-chip.invalid {
    background: #fce8e6;
    color: #c5221f;
}

.email-chip .chip-remove {
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
}

.email-chip .chip-remove:hover {
    opacity: 1;
}