#mailDashboardView {
    min-height: calc(100vh - 92px);
    max-width: 100%;
    overflow-x: hidden;
}

.mail-dashboard-shell {
    display: grid;
    gap: 14px;
    padding: 18px 0 24px;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.mail-dashboard-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    padding: 0 2px;
}

.mail-dashboard-toolbar h2 {
    margin: 0;
    color: #171717;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
}

.mail-dashboard-toolbar p {
    margin: 6px 0 0;
    color: #636363;
    font-size: 13px;
    line-height: 1.45;
}

.mail-dashboard-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.mail-dashboard-actions select {
    height: 34px;
    min-width: 116px;
    border: 1px solid #d7dce3;
    border-radius: 8px;
    background: #fff;
    color: #20242a;
    font: inherit;
    font-size: 13px;
    padding: 0 10px;
    max-width: 100%;
}

.mail-dashboard-section-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 4px;
    margin-bottom: 2px;
}

.mail-dashboard-metrics {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    min-width: 0;
    padding: 3px 3px 5px;
    margin: -3px -3px -5px;
}

.mail-dashboard-metrics::-webkit-scrollbar {
    display: none;
}

.mail-dashboard-metric {
    flex: 0 0 auto;
    min-width: 100px;
    min-height: 54px;
    border: 1px solid #e2e5e9;
    border-radius: 8px;
    background: #fff;
    padding: 9px 12px;
    display: grid;
    align-content: space-between;
    gap: 5px;
}

.mail-dashboard-metric span {
    color: #707781;
    font-size: 11px;
    font-weight: 700;
}

.mail-dashboard-metric strong {
    color: #15181d;
    font-size: 18px;
    font-weight: 850;
    line-height: 1;
}

.mail-dashboard-metric.is-red {
    border-color: #f0c5c0;
    background: #fff8f6;
}

.mail-dashboard-metric.is-green {
    border-color: #badfcd;
    background: #f5fbf7;
}

.mail-dashboard-metric.is-blue {
    border-color: #c2d5f3;
    background: #f6f9ff;
}

.mail-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(310px, 0.72fr) minmax(0, 1.28fr);
    gap: 12px;
    align-items: start;
    min-width: 0;
}

.mail-dashboard-list-pane,
.mail-dashboard-detail-pane {
    background: #fff;
    min-width: 0;
    border: 1px solid #e2e5e9;
    border-radius: 12px;
}

.mail-dashboard-list-pane {
    overflow: hidden;
}

.mail-dashboard-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 48px;
    padding: 0 14px;
    border-bottom: 1px solid #eceff3;
}

.mail-dashboard-tabs {
    display: none;
}

.mail-dashboard-metric.is-tab-card {
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.mail-dashboard-metric.is-tab-card:hover {
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.07);
}

.mail-dashboard-metric.is-ink.is-tab-card.is-active {
    border: 2px solid #94a3b8;
    background: #f8fafc;
}

.mail-dashboard-metric.is-ink.is-tab-card.is-active span {
    color: #475569;
}

.mail-dashboard-metric.is-ink.is-tab-card.is-active strong {
    color: #0f172a;
}

.mail-dashboard-metric.is-purple.is-tab-card.is-active {
    border: 2px solid #c4b5fd;
    background: #faf7ff;
}

.mail-dashboard-metric.is-purple.is-tab-card.is-active span {
    color: #7c3aed;
}

.mail-dashboard-metric.is-purple.is-tab-card.is-active strong {
    color: #5b21b6;
}

.mail-dashboard-tab {
    min-width: 72px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #5e6874;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 850;
}

.mail-dashboard-tab.is-active {
    background: #fff;
    color: #172033;
    box-shadow: 0 1px 3px rgba(18, 24, 40, 0.08);
}

.mail-dashboard-pane-header strong {
    color: #20242a;
    font-size: 14px;
    font-weight: 800;
}

.mail-dashboard-pane-header span {
    color: #6c737d;
    font-size: 12px;
    font-weight: 700;
}

.mail-dashboard-list {
    display: grid;
    max-height: calc(100vh - 286px);
    min-height: 420px;
    overflow: auto;
}

.mail-dashboard-list-item {
    position: relative;
    border-bottom: 1px solid #eef1f4;
}

.mail-dashboard-list-item:last-child {
    border-bottom: 0;
}

.mail-dashboard-list-item.is-selected {
    background: #f7f8fa;
}

.mail-dashboard-list-trigger {
    width: 100%;
    border: 0;
    background: transparent;
    display: grid;
    gap: 4px;
    padding: 9px 14px;
    text-align: left;
    cursor: pointer;
}

.mail-dashboard-list-trigger:hover {
    background: #fafbfc;
}

.mail-dashboard-list-top,
.mail-dashboard-list-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.mail-dashboard-priority {
    flex: 0 0 auto;
    min-width: 28px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 850;
}

.mail-dashboard-priority.is-high {
    color: #9c2f22;
    background: #ffe8e3;
}

.mail-dashboard-priority.is-mid {
    color: #68520d;
    background: #fff2be;
}

.mail-dashboard-priority.is-low {
    color: #33634a;
    background: #e1f4e8;
}

.mail-dashboard-list-subject {
    min-width: 0;
    color: #20242a;
    font-size: 15.5px;
    font-weight: 800;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-dashboard-list-meta,
.mail-dashboard-list-summary,
.mail-dashboard-list-footer {
    color: #666e79;
    font-size: 12px;
    line-height: 1.35;
}

.mail-dashboard-list-summary {
    display: none;
}

.mail-detail-addr {
    font-size: 12px;
    color: #555e6d;
    line-height: 1.4;
    margin: 1px 0 0;
}

.mail-addr-label {
    display: inline-block;
    min-width: 52px;
    font-weight: 700;
    color: #8892a0;
    font-size: 11px;
}

.mail-dashboard-list-footer {
    justify-content: space-between;
    color: #4a525d;
    font-weight: 700;
}

.mail-dashboard-more-row {
    display: flex;
    justify-content: center;
    padding: 6px 8px;
    border-top: 1px solid #eef1f4;
    background: #fbfcfd;
}

.mail-dashboard-more-row button {
    min-width: 100px;
    font-size: 12px;
    padding: 6px 12px;
}

.mail-dashboard-detail-pane {
    min-height: 520px;
    padding: 16px;
    overflow: hidden;
}

.mail-dashboard-detail-empty,
.mail-dashboard-empty {
    min-height: 220px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 10px;
    color: #707781;
    font-size: 13px;
    text-align: center;
    padding: 24px;
}

.mail-dashboard-empty strong {
    color: #252a31;
    font-size: 14px;
}

.mail-dashboard-empty span {
    max-width: 320px;
    line-height: 1.45;
}

.mail-dashboard-empty.compact {
    min-height: 72px;
    padding: 12px;
    border: 1px dashed #d7dce3;
    border-radius: 8px;
}

.mail-dashboard-detail {
    display: grid;
    gap: 14px;
}

.mail-dashboard-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #eceff3;
    padding-bottom: 14px;
}

.mail-dashboard-detail-kicker {
    color: #5b6470;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 5px;
}

.mail-dashboard-detail-header h3 {
    margin: 0;
    color: #171717;
    font-size: 20px;
    font-weight: 850;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.mail-dashboard-detail-header p {
    margin: 7px 0 0;
    color: #6c737d;
    font-size: 12px;
}

.mail-dashboard-detail-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.mail-dashboard-section {
    display: grid;
    gap: 10px;
}

.mail-business-action-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #ead8b8;
    border-radius: 8px;
    background: #fffaf0;
    padding: 12px;
}

.mail-business-action-panel.is-matched {
    border-color: #c9e1d0;
    background: #f6fbf7;
}

.mail-business-action-panel strong {
    display: block;
    color: #20242a;
    font-size: 13px;
    font-weight: 850;
}

.mail-business-action-panel span {
    display: block;
    margin-top: 3px;
    color: #666e79;
    font-size: 12px;
    line-height: 1.4;
}

.mail-business-action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.mail-dashboard-section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.mail-dashboard-section-title strong {
    color: #20242a;
    font-size: 14px;
    font-weight: 850;
}

.mail-dashboard-section-title span {
    color: #757d88;
    font-size: 12px;
    line-height: 1.35;
}

.mail-template-recommendations {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.mail-template-option,
.mail-quick-template-btn {
    border: 1px solid #dde2e8;
    border-radius: 8px;
    background: #fff;
    color: #252a31;
    cursor: pointer;
    font: inherit;
}

.mail-template-option {
    display: grid;
    gap: 7px;
    min-height: 86px;
    padding: 11px;
    text-align: left;
}

.mail-template-option:hover,
.mail-quick-template-btn:hover {
    background: #f8fafb;
    border-color: #cbd4de;
}

.mail-template-option.is-selected,
.mail-quick-template-btn.is-selected {
    border-color: #2d6cdf;
    box-shadow: inset 0 0 0 1px #2d6cdf;
}

.mail-template-option-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mail-template-option-main strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 850;
}

.mail-template-option-main em {
    color: #2d6cdf;
    font-size: 12px;
    font-style: normal;
    font-weight: 850;
}

.mail-template-option > span:last-child {
    color: #69727d;
    font-size: 12px;
    line-height: 1.35;
}

.mail-quick-template-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mail-quick-template-btn {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 800;
}

.mail-templates-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: #f4f6f9;
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: background 0.15s;
}

.mail-templates-toggle:hover {
    background: #eaecf2;
}

.mail-templates-toggle strong {
    font-size: 13px;
    font-weight: 850;
    color: #252a31;
}

.mail-templates-arrow {
    font-size: 14px;
    color: #8a95a3;
    transition: transform 0.2s;
    display: inline-block;
}

.mail-templates-arrow.is-open {
    transform: rotate(180deg);
}

.mail-templates-section .mail-quick-template-row {
    padding: 10px 4px 4px;
}

.mail-dashboard-body-iframe {
    width: 100%;
    min-height: 180px;
    max-height: 560px;
    border: 1px solid #e5e8ec;
    border-radius: 8px;
    background: #fff;
    display: block;
    overflow: auto;
}

.mail-dashboard-body-preview {
    max-height: 186px;
    overflow: auto;
    border: 1px solid #e5e8ec;
    border-radius: 8px;
    background: #fbfcfd;
    color: #2c3138;
    font-size: 13px;
    line-height: 1.55;
    padding: 12px;
}

/* ── 편집기 카드 ─────────────────────────────── */
.mail-draft-panel {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    overflow: hidden;
    display: grid;
    gap: 0;
}

.mail-draft-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px 11px;
    border-bottom: 1px solid #edf0f5;
    background: #f8fafc;
}

.mail-draft-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.mail-draft-panel-header strong {
    font-size: 13px;
    font-weight: 850;
    color: #252a31;
    white-space: nowrap;
}

.mail-draft-panel-header span {
    font-size: 11px;
    font-weight: 700;
    color: #6b7785;
    background: #edf2f7;
    border-radius: 999px;
    padding: 3px 9px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-ai-reply-toggle {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* ── To / Subject 필드 ───────────────────────── */
.mail-draft-fields {
    display: grid;
    border-bottom: 1px solid #edf0f5;
}

.mail-draft-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border-bottom: 1px solid #f0f3f7;
}

.mail-draft-field:last-child {
    border-bottom: none;
}

.mail-draft-field label {
    flex-shrink: 0;
    width: 44px;
    color: #8a95a3;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mail-draft-field input {
    flex: 1;
    border: none;
    background: transparent;
    color: #171717;
    font: inherit;
    font-size: 13px;
    line-height: 1.5;
    padding: 11px 0;
    outline: none;
    min-width: 0;
}

.mail-auto-reply-panel {
    display: grid;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid #edf0f5;
    background: #fbfcff;
}

.mail-auto-reply-panel label {
    color: #475569;
    font-size: 12px;
    font-weight: 850;
}

.mail-auto-reply-panel textarea {
    width: 100%;
    min-height: 86px;
    border: 1px solid #d7dce3;
    border-radius: 8px;
    background: #fff;
    color: #171717;
    font: inherit;
    font-size: 13px;
    line-height: 1.55;
    padding: 10px 11px;
    resize: vertical;
    box-sizing: border-box;
}

.mail-auto-reply-panel textarea:focus {
    outline: none;
    border-color: #6b8fd9;
    box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.12);
}

.mail-auto-reply-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mail-auto-reply-footer span {
    min-width: 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.45;
}

.mail-auto-reply-footer button {
    flex: 0 0 auto;
}

/* ── HTML 에디터 ──────────────────────────────── */
.mail-html-editor {
    display: grid;
    grid-template-rows: auto 1fr;
}

.mail-html-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #edf0f5;
    flex-wrap: wrap;
}

.mail-html-editor-toolbar button {
    min-width: 28px;
    height: 26px;
    padding: 0 7px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #3d4653;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    line-height: 1;
    transition: background 0.12s, border-color 0.12s;
}

.mail-html-editor-toolbar button:hover {
    background: #edf0f5;
    border-color: #d4d9e1;
    transform: none;
    box-shadow: none;
}

.mail-toolbar-sep {
    width: 1px;
    height: 16px;
    background: #dde2e8;
    margin: 0 3px;
    flex-shrink: 0;
}

.mail-html-editor-body {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 14px 16px;
    color: #171717;
    font-size: 13px;
    line-height: 1.7;
    outline: none;
}

.mail-html-editor-body p {
    margin: 0 0 2px;
}

.mail-html-editor-body:focus-visible {
    outline: none;
}

.mail-html-editor:focus-within .mail-html-editor-body {
    /* focus 표시는 카드 border로 처리 */
}

.mail-draft-panel:focus-within {
    border-color: #93b4f5;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05), 0 0 0 3px rgba(45,108,223,0.12);
}

/* ── 경고 / 체크리스트 ───────────────────────── */
.mail-draft-warning {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 12px 16px 0;
    border: 1px solid #f0d3a7;
    border-radius: 8px;
    background: #fff9ed;
    color: #75520e;
    font-size: 12px;
    font-weight: 800;
    padding: 8px 11px;
}

.mail-draft-checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px 0;
}

.mail-draft-checklist span {
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #d9e2ea;
    border-radius: 999px;
    background: #f7f9fb;
    color: #4d5661;
    font-size: 12px;
    font-weight: 750;
    padding: 4px 10px;
}

.mail-draft-checklist span::before {
    content: "✓";
    color: #9db8d4;
    font-size: 10px;
    font-weight: 900;
}

/* ── 액션 버튼 행 ────────────────────────────── */
.mail-draft-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #edf0f5;
    background: #f8fafc;
}

/* ── 수신 첨부파일 ──────────────────────────── */
.mail-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0 2px;
}

.mail-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #dde4ed;
    border-radius: 8px;
    background: #f7f9fc;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    color: #384352;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mail-attachment-chip .attach-icon {
    flex-shrink: 0;
    font-size: 14px;
}

.mail-attachment-size {
    color: #8a95a3;
    font-weight: 600;
    font-size: 11px;
    flex-shrink: 0;
}

/* ── 편집기 첨부파일 목록 ────────────────────── */
.mail-draft-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px 0;
}

.mail-draft-attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #d4dce8;
    border-radius: 8px;
    background: #f4f7fb;
    padding: 5px 8px 5px 10px;
    font-size: 12px;
    font-weight: 700;
    color: #384352;
    max-width: 200px;
}

.mail-draft-attachment span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.mail-draft-attachment button {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #8a95a3;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mail-draft-attachment button:hover {
    background: #e2e8f0;
    color: #3d4653;
    transform: none;
}

/* ── 편집기 드래그 오버 하이라이트 ─────────── */
.mail-html-editor.is-drag-over {
    border-color: #2d6cdf;
    box-shadow: 0 0 0 3px rgba(45,108,223,0.15);
    background: #f0f5ff;
}

/* ── 데스크탑 메트릭 카드 ────────────────────── */
@media (min-width: 721px) {
    .mail-dashboard-metrics {
        gap: 10px;
    }
    .mail-dashboard-metric {
        flex: 1 1 0;
        min-width: 0;
        min-height: 76px;
        padding: 14px 18px;
        border-radius: 12px;
    }
    .mail-dashboard-metric span {
        font-size: 12px;
    }
    .mail-dashboard-metric strong {
        font-size: 26px;
    }
}

@media (max-width: 1024px) {
    .mail-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .mail-dashboard-list {
        max-height: 360px;
        min-height: 260px;
    }

    .mail-template-recommendations {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .mail-dashboard-toolbar,
    .mail-dashboard-detail-header,
    .mail-dashboard-section-title {
        align-items: stretch;
        flex-direction: column;
    }

    .mail-dashboard-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .mail-dashboard-actions select,
    .mail-dashboard-actions button {
        flex: 1 1 140px;
    }

    .mail-dashboard-detail-actions {
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-start;
    }

    .mail-dashboard-detail-actions a,
    .mail-dashboard-detail-actions button {
        flex: 0 0 auto;
        height: 32px;
        padding: 0 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .mail-draft-panel-header,
    .mail-auto-reply-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .mail-draft-panel-title {
        width: 100%;
    }

    .mail-ai-reply-toggle,
    .mail-auto-reply-footer button {
        width: 100%;
    }

    .mail-dashboard-shell {
        padding-left: 5px;
        padding-right: 5px;
    }

    .mail-dashboard-pane-header {
        padding-left: 2px;
        padding-right: 2px;
    }

    /* 모바일에서 상세 패널은 오버레이로만 표시 */
    .mail-dashboard-detail-pane {
        display: none;
    }

    .mail-business-action-panel {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }

    .mail-business-action-buttons {
        flex-direction: row;
        gap: 6px;
    }

    .mail-business-action-buttons button {
        width: auto;
        padding: 0 10px;
        height: 30px;
        font-size: 12px;
        white-space: nowrap;
    }
}

@media (max-width: 720px) {
    .mail-dashboard-shell {
        padding-top: 14px;
    }

    .mail-dashboard-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .mail-dashboard-actions select {
        width: 100%;
        min-width: 0;
    }

    .mail-dashboard-actions button {
        white-space: nowrap;
    }

    .mail-dashboard-toolbar h2 {
        font-size: 22px;
    }
}

/* 답장 후보 삭제 버튼 */
.mail-dismiss-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.14s, color 0.14s;
    z-index: 1;
}

.mail-dismiss-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* 템플릿 에디터 모달 */
.template-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.template-editor-overlay.hidden {
    display: none;
}

.template-editor-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.18);
    width: 100%;
    max-width: 560px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.template-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #eef1f4;
    flex: 0 0 auto;
}

.template-editor-header strong {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
}

.template-editor-close {
    height: 32px;
    padding: 0 14px;
    border: 1px solid #d7dce3;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.template-editor-close:hover {
    background: #f8fafc;
}

.template-editor-list {
    overflow-y: auto;
    padding: 10px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.template-editor-item {
    border: 1px solid #e5e9ef;
    border-radius: 10px;
    overflow: hidden;
}

.template-editor-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 0;
    background: #f9fafb;
    cursor: pointer;
    text-align: left;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
}

.template-editor-toggle:hover {
    background: #f1f5f9;
}

.template-editor-num {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #e0e7ff;
    color: #4338ca;
    font-size: 11px;
    font-weight: 850;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.template-editor-item-name {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tpl-edited-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 10px;
    font-weight: 700;
    vertical-align: middle;
}

.template-editor-arrow {
    flex: 0 0 auto;
    color: #64748b;
    font-size: 13px;
}

.template-editor-fields {
    padding: 14px 14px 12px;
    border-top: 1px solid #eef1f4;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-editor-fields.hidden {
    display: none;
}

.template-editor-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.template-editor-input {
    width: 100%;
    height: 36px;
    border: 1px solid #d7dce3;
    border-radius: 8px;
    background: #fff;
    color: #1e293b;
    font: inherit;
    font-size: 13px;
    padding: 0 10px;
    box-sizing: border-box;
}

.template-editor-input:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15);
}

.template-editor-textarea {
    width: 100%;
    border: 1px solid #d7dce3;
    border-radius: 8px;
    background: #fff;
    color: #1e293b;
    font: inherit;
    font-size: 13px;
    padding: 9px 10px;
    resize: vertical;
    min-height: 100px;
    box-sizing: border-box;
    line-height: 1.55;
}

.template-editor-textarea:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15);
}

.template-editor-actions {
    display: flex;
    gap: 8px;
    padding-top: 4px;
}

/* 메일 상세 오버레이 */
.mail-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 1300;
    background: #f6f8fc;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mail-detail-overlay.hidden {
    display: none;
}

.mail-detail-overlay-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    height: 52px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.mail-detail-overlay-back {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 12px 6px 8px;
    border-radius: 8px;
    transition: background 0.14s;
    white-space: nowrap;
}

.mail-detail-overlay-back:hover {
    background: #f3f4f6;
}

.mail-detail-overlay-title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.mail-detail-overlay-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 12px;
}

.mail-detail-overlay-body .mail-dashboard-detail {
    max-width: 860px;
    margin: 0 auto;
}

/* 모바일 답장 작성 오버레이 */
.mail-compose-overlay {
    position: fixed;
    inset: 0;
    z-index: 1400;
    background: #f6f8fc;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mail-compose-overlay.hidden {
    display: none;
}

.mail-compose-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 52px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    gap: 12px;
}

.mail-compose-overlay-cancel {
    background: none;
    border: none;
    cursor: pointer;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 0;
    white-space: nowrap;
}

.mail-compose-overlay-cancel:hover {
    color: #111;
}

.mail-compose-overlay-title {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    flex: 1;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-compose-overlay-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 24px;
}

.mail-compose-overlay-body .mail-draft-panel {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.mail-compose-overlay-body .mail-draft-panel-header {
    background: transparent;
    border-bottom: 1px solid #edf0f5;
    padding-left: 0;
    padding-right: 0;
}

.mail-compose-overlay-body .mail-draft-fields {
    border-bottom-color: #edf0f5;
}

.mail-compose-overlay-body .mail-draft-actions {
    background: transparent;
    border-top-color: #edf0f5;
    padding-left: 0;
    padding-right: 0;
}

.mail-compose-overlay-body .mail-draft-actions .primary-btn {
    display: none;
}

/* 메일 상세 오버레이 하단 고정 CTA 영역 */
.mail-detail-overlay-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    background: #fff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.mail-detail-overlay-footer:empty {
    display: none;
}

.mail-detail-overlay-footer-actions {
    display: flex;
    gap: 8px;
}

.mail-detail-overlay-footer-actions a,
.mail-detail-overlay-footer-actions button {
    flex: 1;
    height: 46px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 12px;
}

.mail-detail-overlay-footer .mail-business-action-panel {
    border: none;
    padding: 0;
    background: transparent;
}

/* === 2026-06-07 dark theme === */
#mailDashboardView {
    min-height: calc(100vh - 48px);
    color: var(--color-text-primary);
}

.mail-dashboard-toolbar h2,
.mail-dashboard-pane-header strong,
.mail-dashboard-list-item-sender,
.mail-dashboard-list-item-subject,
.mail-dashboard-detail-pane,
.mail-dashboard-detail h3,
.mail-dashboard-detail h4,
.mail-detail-overlay-title,
.mail-compose-overlay-title {
    color: var(--color-text-primary);
}

.mail-dashboard-toolbar p,
.mail-dashboard-section-label,
.mail-dashboard-pane-header span,
.mail-dashboard-list-item-meta,
.mail-dashboard-list-item-preview,
.mail-dashboard-detail-empty {
    color: var(--color-text-secondary);
}

.mail-dashboard-actions select {
    background: var(--color-surface-2);
    color: var(--color-text-primary);
    border-color: var(--color-border-strong);
}

.mail-dashboard-metric,
.mail-dashboard-list-pane,
.mail-dashboard-detail-pane,
.mail-dashboard-list-item,
.mail-draft-panel,
.mail-template-panel {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

.mail-dashboard-metric span {
    color: var(--color-text-secondary);
}

.mail-dashboard-metric strong {
    color: var(--color-text-primary);
}

.mail-dashboard-metric.is-red {
    background: var(--color-danger-bg);
    border-color: rgba(248, 113, 113, 0.32);
}

.mail-dashboard-metric.is-green {
    background: var(--color-success-bg);
    border-color: rgba(74, 222, 128, 0.32);
}

.mail-dashboard-metric.is-blue {
    background: var(--color-info-bg);
    border-color: rgba(96, 165, 250, 0.32);
}

.mail-dashboard-metric.is-ink.is-tab-card.is-active,
.mail-dashboard-metric.is-purple.is-tab-card.is-active {
    background: var(--color-accent-muted);
    border-color: var(--color-accent);
}

.mail-dashboard-metric.is-ink.is-tab-card.is-active span,
.mail-dashboard-metric.is-purple.is-tab-card.is-active span {
    color: var(--color-text-secondary);
}

.mail-dashboard-metric.is-ink.is-tab-card.is-active strong,
.mail-dashboard-metric.is-purple.is-tab-card.is-active strong {
    color: var(--color-text-primary);
}

.mail-dashboard-pane-header,
.mail-dashboard-list-item,
.mail-draft-panel-header,
.mail-draft-fields,
.mail-draft-actions {
    border-color: var(--color-border);
}

.mail-dashboard-list-item:hover {
    background: var(--color-surface-hover);
}

.mail-dashboard-list-item.is-active,
.mail-dashboard-list-item.is-selected {
    background: var(--color-accent-muted);
    border-left: 3px solid var(--color-accent);
}

.mail-dashboard-list-trigger:hover {
    background: var(--color-surface-hover);
}

.mail-dashboard-list-subject,
.mail-dashboard-detail-header h3,
.mail-dashboard-section-title strong,
.mail-business-action-panel strong,
.mail-template-option,
.mail-quick-template-btn,
.mail-templates-toggle strong,
.mail-draft-panel-header strong {
    color: var(--color-text-primary);
}

.mail-dashboard-list-meta,
.mail-dashboard-list-summary,
.mail-dashboard-list-footer,
.mail-dashboard-detail-header p,
.mail-dashboard-detail-kicker,
.mail-dashboard-section-title span,
.mail-business-action-panel span,
.mail-template-option > span:last-child,
.mail-draft-panel-header span {
    color: var(--color-text-secondary);
}

.mail-business-action-panel,
.mail-business-action-panel.is-matched,
.mail-template-option,
.mail-quick-template-btn,
.mail-templates-toggle,
.mail-dashboard-body-preview,
.mail-draft-panel,
.mail-draft-panel-header,
.mail-draft-actions,
.mail-draft-checklist span,
.mail-attachment-chip,
.mail-draft-attachment {
    background: var(--color-surface-2);
    color: var(--color-text-primary);
    border-color: var(--color-border-strong);
}

.mail-template-option:hover,
.mail-quick-template-btn:hover,
.mail-templates-toggle:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-border-strong);
}

.mail-draft-field input,
.mail-html-editor-body {
    color: var(--color-text-primary);
}

.mail-draft-warning {
    background: var(--color-warning-bg);
    border-color: rgba(253, 224, 71, 0.28);
    color: var(--color-warning-text);
}

.mail-dashboard-tab {
    color: var(--color-text-secondary);
}

.mail-dashboard-tab.is-active {
    background: transparent;
    color: var(--color-accent);
    border-bottom: 2px solid var(--color-accent);
    box-shadow: none;
}

.mail-detail-overlay,
.mail-compose-overlay {
    background: var(--color-bg);
}

.mail-detail-overlay-header,
.mail-compose-overlay-header,
.mail-detail-overlay-footer {
    background: var(--color-surface);
    border-color: var(--color-border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.mail-detail-overlay-back,
.mail-compose-overlay-cancel {
    color: var(--color-text-secondary);
}

.mail-detail-overlay-back:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}

@media (max-width: 600px) {
    .mail-dashboard-toolbar {
        align-items: stretch;
    }

    .mail-dashboard-actions {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .mail-dashboard-actions select {
        width: 100%;
        min-width: 0;
    }

    .mail-dashboard-actions .small-btn {
        min-width: 0;
        padding-inline: 10px;
        white-space: normal;
    }
}
