/* Email hub — global sheet (scoped .razor.css is not linked in this app’s App.razor head). */

.email-hub {
    --bm-navy: #262646;
    --bm-navy-light: #353560;
    --bm-teal: #4fd1c5;
    --bm-teal-hover: #38b2ac;
    --bm-amber: #fff8e1;
    --bm-linked: #e6fffa;
    --bm-border: #e2e8f0;
    --bm-text: #1a202c;
    --bm-muted: #64748b;
    --bm-font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
    font-family: var(--bm-font);
    color: var(--bm-text);
    background: #f1f5f9;
    /* Bleed past MainLayout container-fluid horizontal padding */
    width: calc(100% + 3rem);
    max-width: 100vw;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    /* Fixed viewport band so inner panes can scroll (min-height alone lets the hub grow forever). */
    height: calc(100vh - 140px);
    max-height: calc(100vh - 140px);
    min-height: 280px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.email-hub *,
.email-hub *::before,
.email-hub *::after {
    box-sizing: border-box;
}

/* material-dashboard.css sets h1–h6 to Roboto Slab globally — keep Email hub on Inter */
.email-hub h1,
.email-hub h2,
.email-hub h3,
.email-hub h4,
.email-hub h5,
.email-hub h6,
.email-hub .h1,
.email-hub .h2,
.email-hub .h3,
.email-hub .h4,
.email-hub .h5,
.email-hub .h6 {
    font-family: var(--bm-font) !important;
}

/* ——— Top bar ——— */
.email-hub-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    background: linear-gradient(135deg, var(--bm-navy) 0%, #252547 100%);
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.email-hub-topbar h1 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    font-family: var(--bm-font) !important;
}

.email-hub-topbar-sub {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    opacity: 0.75;
    color: #cbd5e1;
}

.email-hub-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Hub buttons: avoid Bootstrap .btn-primary (theme pink) */
.email-hub-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.email-hub-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.email-hub-btn.w-100 {
    width: 100%;
}

.email-hub button.email-hub-btn,
.email-hub button.email-hub-compose,
.email-hub .email-hub-nav-item {
    text-transform: none;
    font-family: inherit;
    letter-spacing: normal;
}

.email-hub-btn--teal {
    background: #3ed3d1;
    color: #fff;
    border-color: var(--bm-teal);
}

    .email-hub-btn--teal:hover:not(:disabled) {
        background: #3ed3d1;
        border-color: #3ed3d1;
    }

.email-hub-btn--ghost {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.2);
}

.email-hub-btn--ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.email-hub-alert {
    margin: 0;
    padding: 0.6rem 1.25rem;
    font-size: 0.8rem;
    background: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fcd34d;
}

.email-hub-alert--with-action {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.email-hub-alert-text {
    flex: 1;
    min-width: 200px;
    line-height: 1.45;
}

.email-hub-alert-btn {
    flex-shrink: 0;
    padding: 0.4rem 0.9rem;
    font-size: 0.78rem;
}

.email-hub-loading,
.email-hub-empty {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--bm-muted);
}

/* ——— Three panes ——— */
.email-hub-main {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    border-top: 1px solid var(--bm-border);
}

.email-hub-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--bm-navy);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    padding: 1rem 0.75rem;
    gap: 0.25rem;
    min-height: 0;
    overflow-y: auto;
}

.email-hub-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.email-hub-brand {
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.75;
    color: var(--bm-teal) !important;
}

.email-hub-brand-title {
    font-weight: 800;
    font-size: 1.05rem;
    color: #fff !important;
    margin-bottom: 0;
    line-height: 1.2;
}

.email-hub-sidebar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-start;
    margin-top: 0.5rem;
    padding: 0 0.15rem;
}

.email-hub-sidebar-sync.email-hub-disconnect {
    border: none;
    color: #9d174d !important;
    background: #fce7f3;
}

.email-hub-sidebar-sync.email-hub-disconnect:hover:not(:disabled) {
    background: #fbcfe8;
    color: #831843 !important;
}

.email-hub-sidebar-sync {
    padding: 0.32rem 0.6rem;
    font-size: 0.72rem;
    border-radius: 7px;
}

.email-hub-compose {
    width: 100%;
    border: none;
    border-radius: 999px;
    padding: 0.55rem 0.85rem;
    background: var(--bm-teal);
    color: #fff;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    margin-bottom: 0.75rem;
    transition: background 0.15s, color 0.15s;
}

.email-hub-compose:hover {
    background: var(--bm-teal-hover);
    color: #fff;
}

.email-hub-section-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.5;
    margin: 0.75rem 0 0.35rem;
    color: #94a3b8 !important;
}

.email-hub-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: none;
    background: transparent;
    color: #cbd5e1;
    text-align: left;
    padding: 0.5rem 0.55rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.email-hub-nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.email-hub-nav-item.active {
    background: var(--bm-teal);
    color: #fff;
    font-weight: 600;
}

.email-hub-nav-item.active .email-hub-badge {
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
}

.email-hub-nav-left {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.email-hub-more-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    border: none;
    background: transparent;
    color: rgba(226, 232, 240, 0.7);
    text-align: left;
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    text-transform: uppercase;
}

.email-hub-more-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.email-hub-more-toggle i {
    font-size: 0.65rem;
    width: 0.7rem;
}

.email-hub-sidebar-more {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.email-hub-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    font-weight: 600;
}

.email-hub-badge-new {
    background: var(--bm-teal);
    color: var(--bm-navy);
    font-size: 0.55rem;
    font-weight: 800;
    padding: 0.12rem 0.35rem;
    border-radius: 4px;
    margin-left: 0.25rem;
}

.email-hub-user {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.72rem;
}

.email-hub-user-name {
    color: #fff !important;
    font-weight: 700;
}

.email-hub-user-email {
    opacity: 0.65;
    word-break: break-all;
    margin-top: 0.2rem;
    color: #94a3b8 !important;
}

.email-hub-signature-panel {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.email-hub-signature-input {
    min-height: 88px;
    font-size: 0.72rem;
    margin-bottom: 0.45rem;
}

.email-hub-signature-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.email-hub-signature-status {
    font-size: 0.68rem;
    margin-bottom: 0.4rem;
    line-height: 1.35;
}

.email-hub-signature-status--ok {
    color: #5eead4;
}

.email-hub-signature-status--warn {
    color: #fcd34d;
}

.email-hub-signature-note {
    font-size: 0.68rem;
    color: #94a3b8;
    line-height: 1.35;
}

/* ——— List ——— */
.email-hub-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    min-height: 0;
    overflow: hidden;
}

.email-hub-list {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    background: #fff;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.email-hub-list-header {
    flex-shrink: 0;
    padding: 0.45rem 1rem;
    border-bottom: 1px solid var(--bm-border);
    background: #f0f0f5;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    min-height: 44px;
}

.email-hub-toolbar-icons {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.email-hub-toolbar-icon {
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.email-hub-toolbar-icon:hover:not(:disabled) {
    background: rgba(15, 23, 42, 0.06);
    color: var(--bm-navy);
    font-family: var(--bm-font);
}

.email-hub-list-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s;
}

.email-hub-list-back:hover {
    background: #e2e8f0;
}

.email-hub-toolbar-icon:disabled {
    opacity: 0.35;
    cursor: default;
}

.email-hub-toolbar-icon.is-starred {
    color: #eab308;
}

.email-hub-toolbar-status {
    font-size: 0.82rem;
    color: #475569;
}

.email-hub-toolbar-status strong {
    font-size: 0.82rem;
    color: var(--bm-navy);
    margin-right: 0.25rem;
}

.email-hub-list-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.email-hub-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
    min-height: 40px;
}

.email-hub-row:hover {
    background: #f4f5f7;
}

.email-hub-row.selected {
    background: rgba(79, 209, 197, 0.1);
}

.email-hub-row-from {
    font-weight: 400;
    font-size: 0.8125rem;
    color: var(--bm-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 0 0 190px;
    max-width: 190px;
}

.email-hub-row-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0;
    overflow: hidden;
}

.email-hub-row-subject {
    font-size: 0.8125rem;
    color: var(--bm-muted);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    max-width: 42%;
}

.email-hub-row-preview {
    font-size: 0.8125rem;
    color: #94a3b8;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
}

.email-hub-row-date {
    font-size: 0.75rem;
    color: var(--bm-muted);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 3.2rem;
    text-align: right;
}

.email-hub-row-actions {
    display: none;
    align-items: center;
    gap: 0.1rem;
    flex-shrink: 0;
}

.email-hub-row:hover .email-hub-row-date {
    display: none;
}

.email-hub-row:hover .email-hub-row-actions {
    display: inline-flex;
}

.email-hub-row-action {
    width: 1.85rem;
    height: 1.85rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.email-hub-row-action:hover {
    background: #e2e8f0;
    color: var(--bm-navy);
}

.email-hub-star {
    border: none;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    padding: 0;
    width: 1.15rem;
    flex-shrink: 0;
    line-height: 1;
}

.email-hub-star:hover,
.email-hub-star.is-starred {
    color: #eab308;
}

.email-hub-tag-chip {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-top: 0;
    font-size: 0.68rem;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    font-weight: 650;
    border: none;
    cursor: pointer;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-hub-tag-add {
    display: none;
    flex-shrink: 0;
    font-size: 0.72rem;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #475569;
    font-weight: 600;
    cursor: pointer;
}

.email-hub-row:hover .email-hub-tag-add {
    display: inline-flex;
}

.tag-linked {
    background: #5eead4;
    color: #134e4a;
}

.tag-suggested {
    background: #fde68a;
    color: #92400e;
}

.tag-untagged {
    background: #edf2f7;
    color: #4a5568;
}

.tag-sent {
    background: #e9d8fd;
    color: #553c9a;
}

/* ——— Detail ——— */
.email-hub-detail {
    flex: 1 1 auto;
    min-width: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.email-hub-banner {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--bm-border);
}

.email-hub-banner-suggest {
    background: var(--bm-amber);
    color: #744210;
}

.email-hub-banner-linked {
    background: var(--bm-linked);
    color: #234e52;
}

.email-hub-banner .email-hub-btn {
    margin-top: 0.35rem;
}

.email-hub-detail-header {
    flex-shrink: 0;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--bm-border);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.email-hub-detail-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--bm-navy);
    line-height: 1.35;
    word-break: break-word;
    font-family: var(--bm-font) !important;
}

.email-hub-detail-meta {
    font-size: 0.78rem;
    color: var(--bm-muted);
}

.email-hub-detail-actions {
    display: flex;
    gap: 0.15rem;
    flex-shrink: 0;
}

.email-hub-detail-actions button {
    border: 1px solid var(--bm-border);
    background: #fff;
    border-radius: 6px;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.85;
    transition: background 0.12s, opacity 0.12s;
}

.email-hub-detail-actions button:hover {
    background: #f8fafc;
    opacity: 1;
}

.email-hub-tagbar {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--bm-border);
    background: #f8fafc;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.78rem;
}

.email-hub-tagbar label {
    margin: 0;
    color: var(--bm-muted);
}

.email-hub-select {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--bm-border);
    border-radius: 6px;
    font-size: 0.78rem;
    max-width: 220px;
    background: #fff;
}

.email-hub-client-search {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-width: min(100%, 280px);
    flex: 1 1 280px;
}

.email-hub-client-search-input {
    flex: 1 1 180px;
    min-width: 160px;
    max-width: 280px;
    padding: 0.35rem 0.55rem;
    font-size: 0.78rem;
}

.email-hub-client-saved {
    width: 100%;
    font-size: 0.75rem;
    color: #0f766e;
    font-weight: 600;
}

.email-hub-client-suggestions {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    z-index: 20;
    width: min(100%, 320px);
    border: 1px solid var(--bm-border);
    border-radius: 8px;
    background: #fff;
    max-height: 160px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.email-hub-client-suggestion {
    display: block;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
    color: var(--bm-text, #1e293b);
    cursor: pointer;
}

.email-hub-client-suggestion:hover {
    background: #f8fafc;
}

.email-hub-body-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 1.25rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--bm-text);
}

/* HTML newsletters: override pre-wrap from .email-hub-body-scroll */
.email-hub-body-html {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    font-size: inherit;
    line-height: 1.55;
    color: var(--bm-text);
}

.email-hub-body-html img {
    max-width: 100% !important;
    height: auto !important;
}

.email-hub-body-html table {
    max-width: 100%;
}

.email-hub-reply {
    flex-shrink: 0;
    border-top: 1px solid var(--bm-border);
    padding: 0.75rem 1rem;
    background: #fafafa;
}

.email-hub-reply > label:first-of-type {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--bm-muted);
    margin-bottom: 0.35rem;
}

.email-hub-textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid #f3efef;
    border-radius: 8px;
    font-size: 0.8125rem;
    resize: vertical;
    min-height: 4.5rem;
    font-family: inherit;
}

.email-hub-reply-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.email-hub-reply-footer--inline {
    justify-content: flex-start;
    align-items: center;
}

.email-hub-attachment-strip {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--bm-border);
    background: #f8fafc;
    font-size: 0.78rem;
}

.email-hub-attachment-strip-label {
    flex-shrink: 0;
}

.email-hub-attachment-pill {
    padding: 0.15rem 0.5rem;
    background: #fff;
    border: 1px solid var(--bm-border);
    border-radius: 999px;
    max-width: min(220px, 100%);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
    color: var(--bm-navy, #262646);
    cursor: pointer;
}

a.email-hub-attachment-pill:hover {
    border-color: var(--bm-teal, #4fd1c5);
    background: rgba(79, 209, 197, 0.12);
}

.email-hub-attach-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    min-width: 2.25rem;
    border-radius: 8px;
    border: 1px solid var(--bm-border);
    cursor: pointer;
    flex-shrink: 0;
    background: #fff;
    margin: 0;
}

.email-hub-attach-icon-btn input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    font-size: 0;
}

.email-hub-attach-icon-glyph {
    pointer-events: none;
    font-size: 1rem;
    line-height: 1;
}

.email-hub-attach-meta {
    font-size: 0.72rem;
    color: var(--bm-muted);
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-hub-link-clear {
    border: none;
    background: none;
    padding: 0;
    margin-left: 0.35rem;
    font-size: 0.72rem;
    color: var(--bm-teal, #4fd1c5);
    cursor: pointer;
    text-decoration: underline;
}

.email-hub-link-clear:hover {
    color: var(--bm-teal-hover, #38b2ac);
}

.email-hub-reply-send {
    margin-left: auto;
    flex-shrink: 0;
}

.email-hub-drawer-footer-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    margin-top: 0.35rem;
}

.email-hub-drawer-send {
    flex: 1 1 auto;
    min-width: 0;
}

.email-hub-reply-hint {
    font-size: 0.7rem;
    color: var(--bm-muted);
}

.email-hub-inline-error {
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    font-size: 0.78rem;
    color: #9b2c2c;
    background: #fff5f5;
    border: 1px solid #feb2b2;
}

.email-hub-attach-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.78rem;
}

.email-hub-file-pick {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    color: var(--bm-muted, #64748b);
}

.email-hub-file-pick span {
    font-weight: 600;
    color: var(--bm-navy, #262646);
}

.email-hub-file-pick input[type="file"] {
    font-size: 0.72rem;
    max-width: min(100%, 220px);
}

.email-hub-attach-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.email-hub-attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 0.72rem;
    max-width: 100%;
    word-break: break-word;
}

.email-hub-attach-remove {
    border: none;
    background: none;
    cursor: pointer;
    color: #64748b;
    padding: 0 0.15rem;
    line-height: 1;
}

.email-hub-attach-remove:hover {
    color: #b91c1c;
}

/* ——— Drawer ——— */
.email-hub-drawer {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    width: min(420px, calc(100vw - 2rem));
    max-height: min(520px, 72vh);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(30, 30, 63, 0.28);
    display: flex;
    flex-direction: column;
    z-index: 1200;
    border: 1px solid var(--bm-border);
    overflow: hidden;
}

.email-hub-drawer-head {
    background: var(--bm-navy);
    color: #fff;
    padding: 0.55rem 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.email-hub-drawer-head button {
    background: transparent;
    border: none;
    color: red;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.15rem 0.35rem;
}

.email-hub-drawer-head button:hover {
    color: #fff;
}

.email-hub-drawer-body {
    padding: 0.85rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.email-hub-input {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid #f3efef;
    border-radius: 6px;
    font-size: 0.8125rem;
}

/* ——— Modal ——— */
.email-hub-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1190;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.email-hub-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.email-hub-modal.email-hub-modal--signature {
    max-width: min(720px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
}

.email-hub-modal.email-hub-modal--compose {
    max-width: min(560px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
}

.email-hub-modal-body--compose {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.email-hub-modal-footer--compose {
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.email-hub-sig-badge {
    font-size: 0.65rem;
    color: #059669;
    font-weight: 700;
}

.email-hub-modal-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bm-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bm-navy);
}

.email-hub-modal-header h6 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    font-family: var(--bm-font) !important;
}

.email-hub-modal-body {
    padding: 1rem;
}

.email-hub-modal-body--scroll {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.email-hub-modal-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--bm-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

@media (max-width: 991px) {
    .email-hub-main {
        flex-direction: column;
    }

    .email-hub-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .email-hub-sidebar .email-hub-user {
        width: 100%;
    }

    .email-hub-list {
        width: 100%;
        max-width: none;
        max-height: none;
        border-right: none;
    }
}

.email-hub-row.unread {
    background: #fff;
}

.email-hub-row.unread .email-hub-row-from {
    font-weight: 600;
    color: var(--bm-text, #1e293b);
}

.email-hub-row.unread .email-hub-row-subject {
    font-weight: 600;
    color: var(--bm-text, #1e293b);
}

.email-hub-row:not(.unread) .email-hub-row-from {
    font-weight: 400;
    color: #94a3b8;
}

.email-hub-row:not(.unread) .email-hub-row-subject {
    font-weight: 400;
    color: #64748b;
}

.email-hub-row:not(.unread) .email-hub-row-preview {
    color: #94a3b8;
}

.email-hub-calendar-event {
    padding: 0.6rem 0.8rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 0.4rem;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
    background: #fff;
}

.email-hub-calendar-event:hover {
    background: #f0f9ff;
    border-color: var(--bm-teal, #2dd4bf);
}

.email-hub-checkbox-wrap {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
}

.email-hub-checkbox-wrap input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--bm-teal, #2dd4bf);
}

/* ——— Right utility rail ——— */
.email-hub-rail {
    width: 64px;
    flex-shrink: 0;
    background: #f0f0f5;
    border-left: 1px solid #e4e4ed;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.35rem;
    position: relative;
    z-index: 4;
}

.email-hub-rail-btn {
    width: 52px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.2rem;
    border-radius: 10px;
    font-size: 0.62rem;
    font-weight: 600;
}

.email-hub-rail-btn i {
    font-size: 1.15rem;
    width: 2.15rem;
    height: 2.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d6d6e0;
    border-radius: 10px;
    background: #fff;
}

.email-hub-rail-btn:hover,
.email-hub-rail-btn.is-active {
    color: var(--bm-navy);
}

.email-hub-rail-btn:hover i,
.email-hub-rail-btn.is-active i {
    border-color: var(--bm-teal);
    color: var(--bm-teal);
}

/* ——— Tag popover ——— */
.email-hub-tag-popover {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 5.5rem;
    z-index: 40;
    width: 280px;
    background: #fff;
    border: 1px solid var(--bm-border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
    padding: 0.85rem;
    text-align: left;
}

.email-hub-tag-popover-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--bm-navy);
    margin-bottom: 0.5rem;
}

.email-hub-tag-popover-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.65rem;
}

.email-hub-detail .email-hub-tag-popover {
    right: auto;
    left: 0;
}

/* ——— Detail full-screen ——— */
.email-hub-detail-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--bm-border);
    flex-shrink: 0;
}

.email-hub-back {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 999px;
    border: none;
    background: #eef0f4;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.25rem;
}

.email-hub-back:hover {
    background: #e2e5ec;
    color: var(--bm-navy);
}

.email-hub-detail-subject {
    padding: 1.1rem 1.25rem 0.35rem;
}

.email-hub-detail-subject h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--bm-navy);
    line-height: 1.3;
}

.email-hub-compose-tagbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    background: #f3f4f8;
    border: 1px solid #e8e9ef;
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
}

.email-hub-compose-tagbar > label {
    margin: 0;
    font-weight: 700;
    color: #334155;
    font-size: 0.82rem;
    white-space: nowrap;
}

.email-hub-modal-close {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.email-hub-modal-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.email-hub-tagbar label {
    font-weight: 700;
    color: var(--bm-navy) !important;
}

/* ——— Calendar popover ——— */
.email-hub-cal-popover {
    position: absolute;
    right: calc(100% + 0.55rem);
    top: 0.65rem;
    width: 340px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    border: 1px solid #e8e9ef;
    z-index: 50;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    max-height: min(560px, calc(100vh - 8rem));
    overflow: hidden;
}

.email-hub-cal-popover.is-expanded {
    position: relative;
    left: auto;
    top: auto;
    right: auto;
    bottom: auto;
    transform: none;
    width: min(960px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    height: min(720px, calc(100vh - 2rem));
    z-index: 1;
    flex-shrink: 0;
}

.email-hub-cal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top, 0px)) 1rem 1rem;
    pointer-events: none;
}

.email-hub-cal-overlay .email-hub-cal-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: auto;
}

.email-hub-cal-overlay .email-hub-cal-popover {
    pointer-events: auto;
    z-index: 1;
}

.email-hub-cal-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.55rem;
    flex-shrink: 0;
}

.email-hub-cal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.email-hub-cal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 0;
}

.email-hub-cal-head h3 {
    margin: 0;
    flex: 1;
    font-size: 1rem;
    font-weight: 700;
    color: var(--bm-navy);
}

.email-hub-cal-nav {
    width: 1.7rem;
    height: 1.7rem;
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
}

.email-hub-cal-nav:hover {
    background: #f1f5f9;
    color: var(--bm-navy);
}

.email-hub-cal-legend {
    display: flex;
    gap: 0.75rem;
    font-size: 0.68rem;
    color: #64748b;
    margin-bottom: 0.55rem;
}

.email-hub-cal-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
}

.email-hub-cal-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    display: inline-block;
}

.email-hub-cal-dot.leadgen { background: #3b82f6; }
.email-hub-cal-dot.email { background: #8b5cf6; }
.email-hub-cal-dot.sms { background: #f97316; }

.email-hub-cal-weekdays,
.email-hub-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
}

.email-hub-cal-weekdays {
    margin-bottom: 0.25rem;
}

.email-hub-cal-weekdays span {
    text-align: center;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #94a3b8;
    text-transform: uppercase;
}

.email-hub-cal-cell {
    min-height: 38px;
    height: 38px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.15rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    color: var(--bm-navy);
}

.email-hub-cal-popover.is-expanded .email-hub-cal-cell {
    min-height: 92px;
    height: 92px;
    align-items: stretch;
}

.email-hub-cal-cell:hover {
    background: #f8fafc;
}

.email-hub-cal-cell.is-muted {
    color: #cbd5e1;
}

.email-hub-cal-date {
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid transparent;
}

.email-hub-cal-cell.is-today .email-hub-cal-date {
    border-color: var(--bm-teal);
    background: transparent;
}

.email-hub-cal-chips {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 0.15rem;
    min-height: 0;
    overflow: hidden;
}

.email-hub-cal-chip {
    display: block;
    width: 100%;
    font-size: 0.62rem;
    line-height: 1.2;
    padding: 0.08rem 0.28rem;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.email-hub-cal-chip.meeting { background: #ddd6fe; color: #5b21b6; }
.email-hub-cal-chip.leadgen { background: #dbeafe; color: #1d4ed8; }
.email-hub-cal-chip.email { background: #ede9fe; color: #6d28d9; }
.email-hub-cal-chip.sms { background: #ffedd5; color: #c2410c; }

.email-hub-cal-new {
    margin-top: 0.7rem;
    width: 100%;
}

.email-hub-cal-popover.is-form {
    width: 380px;
    max-height: min(720px, calc(100vh - 5rem));
}

.email-hub-cal-popover.is-expanded.is-form {
    width: min(480px, calc(100vw - 2rem));
    height: min(720px, calc(100vh - 2rem));
    max-height: calc(100vh - 2rem);
}

.email-hub-cal-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 0;
    flex: 1 1 auto;
    padding-bottom: 0.25rem;
}

.email-hub-cal-title {
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--bm-teal);
    border-radius: 0;
    padding: 0.35rem 0.15rem 0.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--bm-navy);
    outline: none;
    background: transparent;
}

.email-hub-cal-title::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

.email-hub-cal-label {
    margin: 0.45rem 0 0.15rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
}

.email-hub-cal-datewrap {
    position: relative;
    border: 1px solid #e8e9ef;
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    background: #fff;
    color: var(--bm-navy);
    font-size: 0.875rem;
}

.email-hub-cal-datewrap input[type="date"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.email-hub-cal-addrow {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.email-hub-cal-addrow .email-hub-input,
.email-hub-cal-addrow .email-hub-client-search-input {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
}

.email-hub-cal-addbtn {
    padding: 0.4rem 0.85rem;
    flex-shrink: 0;
}

.email-hub-cal-guest-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.email-hub-cal-guest-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    font-size: 0.72rem;
    color: #334155;
}

.email-hub-cal-guest-chip button {
    border: none;
    background: none;
    cursor: pointer;
    color: #64748b;
    padding: 0;
    line-height: 1;
}

.email-hub-cal-pill {
    border: 1px solid #d6d6e0;
    background: #fff;
    color: #334155;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.email-hub-cal-pill:hover {
    border-color: var(--bm-teal);
    color: var(--bm-navy);
}

.email-hub-cal-pill.is-on {
    background: var(--bm-teal);
    border-color: var(--bm-teal);
    color: #fff;
}

.email-hub-cal-note {
    min-height: 4.5rem;
}

.email-hub-cal-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.65rem;
    padding-top: 0.5rem;
}

.email-hub-cal-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
}

.email-hub-cal-conf {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.email-hub-cal-conf button.is-on {
    background: var(--bm-teal);
    color: #fff;
    border-color: var(--bm-teal);
}

.email-hub-cal-conf .email-hub-btn--ghost {
    color: #334155;
    background: #fff;
}

.email-hub-cal-conf .email-hub-btn--ghost:hover:not(:disabled) {
    color: var(--bm-navy);
    background: #f8fafc;
}

@media (max-width: 991px) {
    .email-hub-rail {
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        padding: 0.4rem 0.75rem;
    }

    .email-hub-cal-popover {
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
        top: 3.5rem;
    }

    .email-hub-row-from {
        flex-basis: 120px;
        max-width: 120px;
    }
}

