/* ── Mail Rich Editor ─────────────────────────────────────────────────────── */

.mre-wrap {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mre-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px 6px;
    background: #f7f7f7;
    border-bottom: 1px solid #e5e5e5;
    align-items: center;
}

.mre-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 3px 6px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    transition: background 0.1s, border-color 0.1s;
}
.mre-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
}
.mre-btn.mre-active {
    background: #d0e7ff;
    border-color: #90c0f0;
    color: #1565c0;
}
.mre-btn .material-icons {
    font-size: 15px;
}

.mre-sep {
    width: 1px;
    height: 20px;
    background: #ddd;
    margin: 0 3px;
    flex-shrink: 0;
}

.mre-select {
    font-size: 11px;
    height: 26px;
    max-width: 118px;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 0 4px;
    background: #fff;
    color: #333;
    cursor: pointer;
}
.mre-select:hover { border-color: #bbb; }

.mre-color-btn {
    position: relative;
}
.mre-inline-image-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.mre-color-btn input[type=color] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    cursor: pointer;
    padding: 0;
    border: none;
}

.mre-editor {
    flex: 1;
    min-height: 120px;
    padding: 8px 10px;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    overflow-y: auto;
    word-break: break-word;
}
.mre-editor:empty:before {
    content: attr(data-placeholder);
    color: #aaa;
    pointer-events: none;
}
.mre-editor a { color: #1976d2; }
.mre-editor img.mre-inline-img {
    max-width: 100%;
    height: auto;
    cursor: pointer;
    vertical-align: bottom;
    border-radius: 2px;
}
.mre-editor img.mre-inline-img.mre-inline-img-selected {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}
.mre-img-resize-handle {
    position: fixed;
    width: 12px;
    height: 12px;
    background: #1976d2;
    border: 2px solid #fff;
    border-radius: 2px;
    cursor: nwse-resize;
    z-index: 1305;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    display: none;
}
.mre-editor blockquote {
    border-left: 3px solid #ccc;
    margin: 6px 0;
    padding-left: 10px;
    color: #555;
}

.mre-source {
    flex: 1;
    min-height: 120px;
    padding: 8px 10px;
    font-size: 12px;
    font-family: monospace;
    border: none;
    outline: none;
    resize: none;
    background: #1e1e1e;
    color: #d4d4d4;
    display: none;
}
.mre-wrap.mre-source-mode .mre-source { display: block; }
.mre-wrap.mre-source-mode .mre-editor { display: none; }

.mre-link-popover {
    display: none;
    position: absolute;
    z-index: 9999;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,.15);
    padding: 8px;
    gap: 4px;
    flex-direction: column;
    min-width: 240px;
}
.mre-link-popover.visible { display: flex; }
.mre-link-popover input {
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 4px 6px;
    font-size: 13px;
}
.mre-link-popover .mre-link-actions {
    display: flex;
    gap: 4px;
}
.mre-link-popover .mre-link-actions button {
    flex: 1;
    padding: 3px 6px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #f7f7f7;
}
.mre-link-popover .mre-link-actions button.primary {
    background: #1976d2;
    color: #fff;
    border-color: #1565c0;
}
