/* Email Responder */

.er-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px 48px;
}

.er-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 20px;
}

.er-input-section {
    margin-bottom: 20px;
}

.er-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.er-section-title {
    margin: 0;
    font-size: 15px;
    line-height: 1.3;
    font-weight: 650;
    color: var(--text);
}

.er-section-hint {
    margin: -4px 0 14px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.er-workspace {
    display: grid;
    grid-template-columns: minmax(320px, 0.88fr) minmax(420px, 1.12fr);
    gap: 18px;
    align-items: start;
}

.er-left-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.er-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.er-field > span,
.er-type-row label {
    font-size: 12px;
    line-height: 1.25;
    color: var(--text-secondary);
    font-weight: 600;
}

.er-field-wide {
    grid-column: 1 / -1;
}

.er-input,
.er-select,
.er-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
    padding: 9px 11px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.er-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.er-input:focus,
.er-select:focus,
.er-textarea:focus {
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.er-textarea {
    resize: vertical;
}

.er-raw-email,
.er-draft-body {
    min-height: 330px;
}

.er-raw-email {
    font-family: "SF Mono", Consolas, monospace;
    font-size: 13px;
}

.er-signature {
    min-height: 84px;
}

.er-actions,
.er-draft-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.er-actions {
    margin-top: 14px;
}

.er-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.2;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.er-btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.er-btn-primary {
    color: #fff;
    background: var(--apple-blue);
    border-color: var(--apple-blue);
}

.er-btn-primary:hover {
    background: var(--apple-blue-hover);
    border-color: var(--apple-blue-hover);
}

.er-btn-secondary,
.er-btn-ghost {
    color: var(--text);
    background: var(--bg-card);
}

.er-btn-secondary:hover,
.er-btn-ghost:hover {
    background: var(--bg-input);
    border-color: var(--apple-blue);
}

.er-btn:active {
    transform: translateY(1px);
}

.er-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.er-type-row {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.er-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(52, 199, 89, 0.12);
    color: #1a7a38;
    font-size: 12px;
    font-weight: 650;
}

.er-status-pill:empty {
    display: none;
}

.er-notice {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 159, 10, 0.35);
    background: rgba(255, 159, 10, 0.08);
    color: var(--text);
    font-size: 13px;
    line-height: 1.4;
}

.er-carrier-section {
    border-color: rgba(255, 159, 10, 0.35);
    background: linear-gradient(0deg, rgba(255, 159, 10, 0.06), rgba(255, 159, 10, 0.06)), var(--bg-card);
}

.er-draft-section {
    position: sticky;
    top: 18px;
}

.er-debug {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 12px;
}

.er-debug summary {
    cursor: pointer;
    user-select: none;
}

.er-debug pre {
    max-height: 180px;
    overflow: auto;
    margin: 10px 0 0;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    white-space: pre-wrap;
}

@media (max-width: 980px) {
    .er-main {
        padding: 16px 14px 36px;
    }

    .er-workspace {
        grid-template-columns: 1fr;
    }

    .er-draft-section {
        position: static;
    }
}

@media (max-width: 620px) {
    .er-section {
        padding: 15px 14px;
    }

    .er-section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .er-actions,
    .er-draft-actions {
        justify-content: stretch;
    }

    .er-btn {
        flex: 1 1 auto;
    }

    .er-fields-grid,
    .er-type-row {
        grid-template-columns: 1fr;
    }
}
