/* ==========================================================================
   Email Compose Modal Styles
   ========================================================================== */

.email-compose-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.email-compose-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
}

.email-compose-modal {
    position: relative;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}
.dark .email-compose-modal {
    background-color: #1f2937;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Header */
.email-compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f9fafb;
    border-radius: 12px 12px 0 0;
}
.dark .email-compose-header {
    border-bottom-color: #374151;
    background-color: #111827;
}
.email-compose-header__title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}
.dark .email-compose-header__title {
    color: #f3f4f6;
}
.email-compose-header__actions {
    display: flex;
    align-items: center;
    gap: 2px;
}
.email-compose-header__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    color: #6b7280;
    transition: all 0.15s;
}
.email-compose-header__btn:hover {
    background-color: #f3f4f6;
    color: #374151;
}
.dark .email-compose-header__btn:hover {
    background-color: #374151;
    color: #d1d5db;
}
.email-compose-header__btn svg {
    width: 16px;
    height: 16px;
}

/* Body / form */
.email-compose-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1rem;
}

.email-compose-field {
    padding: 0.375rem 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}
.dark .email-compose-field {
    border-bottom-color: #1f2937;
}
.email-compose-field--body {
    border-bottom: none;
    flex: 1;
    display: block;
}
.email-compose-field__label {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: 70px;
    flex-shrink: 0;
    margin-right: 0.5rem;
}
.dark .email-compose-field__label {
    color: #9ca3af;
}
.email-compose-field__row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}
.email-compose-field__input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.8125rem;
    color: #111827;
    background: transparent;
    padding: 0.25rem 0;
}
.dark .email-compose-field__input {
    color: #f3f4f6;
}
.email-compose-field__input::placeholder {
    color: #9ca3af;
}
.email-compose-field__input:focus {
    outline: none;
}
select.email-compose-field__input {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    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='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.25rem center;
    padding-right: 1.25rem;
}
.email-compose-field__error {
    font-size: 0.75rem;
    color: #ef4444;
    flex-basis: 100%;
    padding-left: calc(70px + 0.5rem);
}

.email-compose-ccbcc-toggle {
    font-size: 0.6875rem;
    font-weight: 500;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.15s;
    flex-shrink: 0;
}
.email-compose-ccbcc-toggle:hover {
    background-color: #f3f4f6;
    color: #374151;
}

/* ── CC Pill Field ──────────────────────────── */

.ec-pill-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-height: 28px;
    padding: 2px 0;
}
.ec-pill {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 6px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #1e40af;
    line-height: 1.4;
    max-width: 250px;
}
.dark .ec-pill {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}
.ec-pill__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ec-pill__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 3px;
    color: #93c5fd;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.1s;
}
.ec-pill__remove:hover {
    background: #dbeafe;
    color: #1e40af;
}
.dark .ec-pill__remove {
    color: #60a5fa;
}
.dark .ec-pill__remove:hover {
    background: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}
.ec-pill__remove svg {
    width: 10px;
    height: 10px;
}
.ec-pill-field__input {
    flex: 1;
    min-width: 80px;
    border: none;
    outline: none;
    font-size: 0.8125rem;
    color: #111827;
    background: transparent;
    padding: 0.25rem 0;
}
.dark .ec-pill-field__input {
    color: #f3f4f6;
}
.ec-pill-field__input::placeholder {
    color: #9ca3af;
}

/* Rich text toolbar */
.email-compose-toolbar {
    display: flex;
    gap: 2px;
    padding: 4px 6px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    align-items: center;
}
.dark .email-compose-toolbar {
    background: #111827;
    border-bottom-color: #374151;
}
.email-compose-toolbar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    min-width: 28px;
    height: 28px;
    transition: background 0.1s;
}
.email-compose-toolbar__btn:hover {
    background-color: #e5e7eb;
}
.dark .email-compose-toolbar__btn {
    color: #d1d5db;
}
.dark .email-compose-toolbar__btn:hover {
    background-color: #374151;
}
.email-compose-toolbar__sep {
    width: 1px;
    height: 20px;
    background: #d1d5db;
    margin: 0 4px;
    flex-shrink: 0;
}
.dark .email-compose-toolbar__sep {
    background: #4b5563;
}

/* Rich text editable area */
.email-compose-body__editable {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: #111827;
    background: transparent;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.dark .email-compose-body__editable {
    color: #f3f4f6;
}
.email-compose-body__editable:empty::before {
    content: attr(data-placeholder);
    color: #9ca3af;
    pointer-events: none;
}
.email-compose-body__editable a {
    color: #2563eb;
    text-decoration: underline;
}
.email-compose-body__editable ul,
.email-compose-body__editable ol {
    padding-left: 1.5em;
    margin: 0.25em 0;
}
.email-compose-body__editable li {
    margin-bottom: 0.125em;
}

/* Footer */
.email-compose-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    border-top: 1px solid #e5e7eb;
    background-color: #f9fafb;
    border-radius: 0 0 12px 12px;
}
.dark .email-compose-footer {
    border-top-color: #374151;
    background-color: #111827;
}
.email-compose-footer__left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.email-compose-footer__right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Archive toggle */
.email-compose-archive-toggle {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
}
.email-compose-archive-toggle__checkbox {
    width: 14px;
    height: 14px;
    cursor: pointer;
}
.email-compose-archive-toggle__label {
    font-size: 0.75rem;
    color: #6b7280;
}
.dark .email-compose-archive-toggle__label {
    color: #9ca3af;
}

/* Buttons */
.email-compose-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}
.email-compose-btn--cancel {
    background-color: #f3f4f6;
    color: #6b7280;
}
.email-compose-btn--cancel:hover {
    background-color: #e5e7eb;
    color: #374151;
}
.dark .email-compose-btn--cancel {
    background-color: #374151;
    color: #9ca3af;
}
.dark .email-compose-btn--cancel:hover {
    background-color: #4b5563;
    color: #d1d5db;
}
.email-compose-btn--send {
    background-color: #0d9488;
    color: #fff;
}
.email-compose-btn--send:hover {
    background-color: #0f766e;
}
.email-compose-btn--send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.email-compose-btn--send svg {
    display: inline;
}

/* Attachments */
.email-compose-attachments {
    padding: 0.375rem 0.75rem;
    border-top: 1px solid #f3f4f6;
}
.dark .email-compose-attachments {
    border-top-color: #1f2937;
}
.email-compose-attachments__list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}
.email-compose-attachments__item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #374151;
}
.dark .email-compose-attachments__item {
    background: #1f2937;
    color: #d1d5db;
}
.email-compose-attachments__icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #6b7280;
}
.email-compose-attachments__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.email-compose-attachments__size {
    color: #9ca3af;
    font-size: 0.6875rem;
    flex-shrink: 0;
}
.email-compose-attachments__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    color: #9ca3af;
    flex-shrink: 0;
    transition: all 0.15s;
}
.email-compose-attachments__remove:hover {
    background: #e5e7eb;
    color: #ef4444;
}
.email-compose-attachments__remove svg {
    width: 12px;
    height: 12px;
}
.email-compose-attachments__dropzone {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.email-compose-attachments__dropzone:hover,
.email-compose-attachments__dropzone--active {
    border-color: #0d9488;
    background: #f0fdfa;
}
.dark .email-compose-attachments__dropzone {
    border-color: #374151;
}
.dark .email-compose-attachments__dropzone:hover,
.dark .email-compose-attachments__dropzone--active {
    border-color: #0d9488;
    background: rgba(13, 148, 136, 0.1);
}
.email-compose-attachments__input {
    display: none;
}
.email-compose-attachments__upload-icon {
    width: 14px;
    height: 14px;
    color: #9ca3af;
}
.email-compose-attachments__label {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* ── Attachment size warning ───────────────────── */

.email-compose-attachments__total {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem;
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
}
.dark .email-compose-attachments__total {
    background: #1f2937;
    color: #9ca3af;
}
.email-compose-attachments__total--warn {
    color: #92400e;
    background: #fef3c7;
}
.dark .email-compose-attachments__total--warn {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}
.email-compose-attachments__total--over {
    color: #991b1b;
    background: #fee2e2;
}
.dark .email-compose-attachments__total--over {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
}
.email-compose-attachments__total-msg {
    font-weight: 500;
}

/* ── Signature preview ──────────────────────────── */

.email-compose-signature-preview {
    margin-top: 0.25rem;
    padding: 0 0.25rem;
}

.email-compose-signature-preview__label {
    font-size: 0.6875rem;
    color: #9ca3af;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.email-compose-signature-preview__content {
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    color: #6b7280;
    max-height: 100px;
    overflow: auto;
}

/* ── Template attachment badge ──────────────────── */

.email-compose-attachments__badge {
    font-size: 0.625rem;
    font-weight: 600;
    color: #2563eb;
    background: #eff6ff;
    padding: 0.0625rem 0.375rem;
    border-radius: 9999px;
    margin-left: 0.25rem;
}

/* ==========================================================================
   Minimized Bar (Gmail-style bottom bar)
   ========================================================================== */

.email-compose-minimized-bar {
    position: fixed;
    bottom: 0;
    right: 7rem;
    width: 320px;
    z-index: 50;
    background: #fff;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    border-top: 3px solid #2563eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    cursor: default;
}
.dark .email-compose-minimized-bar {
    background: #1f2937;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    border-top-color: #3b82f6;
}

.email-compose-minimized-bar__content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    border-radius: 8px 0 0 0;
    transition: background 0.1s;
}
.email-compose-minimized-bar__content:hover {
    background: #f3f4f6;
}
.dark .email-compose-minimized-bar__content:hover {
    background: #374151;
}

.email-compose-minimized-bar__icon {
    width: 18px;
    height: 18px;
    color: #2563eb;
    flex-shrink: 0;
}
.dark .email-compose-minimized-bar__icon {
    color: #60a5fa;
}

.email-compose-minimized-bar__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.email-compose-minimized-bar__subject {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.dark .email-compose-minimized-bar__subject {
    color: #f3f4f6;
}

.email-compose-minimized-bar__to {
    font-size: 0.6875rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.dark .email-compose-minimized-bar__to {
    color: #9ca3af;
}

.email-compose-minimized-bar__actions {
    display: flex;
    align-items: center;
    gap: 1px;
    padding: 0.375rem 0.375rem;
    flex-shrink: 0;
}

.email-compose-minimized-bar__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    color: #6b7280;
    transition: all 0.15s;
}
.email-compose-minimized-bar__btn:hover {
    background: #e5e7eb;
    color: #374151;
}
.dark .email-compose-minimized-bar__btn:hover {
    background: #374151;
    color: #d1d5db;
}
.email-compose-minimized-bar__btn--close:hover {
    color: #ef4444;
}
.dark .email-compose-minimized-bar__btn--close:hover {
    color: #f87171;
}
.email-compose-minimized-bar__btn svg {
    width: 14px;
    height: 14px;
}

/* ==========================================================================
   AI Draft Card
   ========================================================================== */

.ai-draft-card {
    padding: 0.5rem 1rem 1rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-draft-card__inner {
    width: 100%;
    padding: 1.25rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 40%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    text-align: center;
}
.dark .ai-draft-card__inner {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #1e3a5f 100%);
    border-color: #4338ca;
}

.ai-draft-card__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.ai-draft-card__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: ai-draft-pulse 2.5s ease-in-out infinite;
}
.ai-draft-card__icon svg {
    width: 20px;
    height: 20px;
    color: #fff;
}

@keyframes ai-draft-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(124, 58, 237, 0); }
}

.ai-draft-card__title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #3730a3;
    margin: 0;
    text-align: left;
}
.dark .ai-draft-card__title {
    color: #c7d2fe;
}

.ai-draft-card__subtitle {
    font-size: 0.75rem;
    color: #6366f1;
    margin: 0.125rem 0 0;
    text-align: left;
}
.dark .ai-draft-card__subtitle {
    color: #a5b4fc;
}

/* Context pills */
.ai-draft-card__context {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.ai-draft-card__context-label {
    font-size: 0.6875rem;
    color: #6366f1;
    font-weight: 500;
}
.dark .ai-draft-card__context-label {
    color: #a5b4fc;
}

.ai-draft-card__pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.1875rem 0.5rem;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 500;
    color: #4338ca;
}
.dark .ai-draft-card__pill {
    background: rgba(165, 180, 252, 0.15);
    border-color: rgba(165, 180, 252, 0.25);
    color: #c7d2fe;
}

/* Prompt input */
.ai-draft-card__prompt {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Textarea + dictate button side by side */
.ai-draft-card__input-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.ai-draft-card__input-row .ai-draft-card__input {
    flex: 1;
    min-width: 0;
}

/* Dictate button — sits beside textarea, matches its height */
.ai-draft-card__dictate {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 18%;
    min-width: 100px;
    padding: 0.5rem 0.625rem;
    background: #fff;
    color: #4338ca;
    border: 1.5px solid #c7d2fe;
    border-radius: 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1.3;
}
.ai-draft-card__dictate svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}
.ai-draft-card__dictate:hover {
    background: #ede9fe;
    border-color: #7c3aed;
    color: #7c3aed;
}
.ai-draft-card__dictate--active {
    background: #fef2f2 !important;
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    animation: dictate-pulse 1.5s ease-in-out infinite;
}
@keyframes dictate-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}
.dark .ai-draft-card__dictate {
    background: #1e1b4b;
    border-color: #4338ca;
    color: #a5b4fc;
}
.dark .ai-draft-card__dictate:hover {
    background: #312e81;
    border-color: #7c3aed;
    color: #c4b5fd;
}
.dark .ai-draft-card__dictate--active {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: #f87171 !important;
    color: #f87171 !important;
}

.ai-draft-card__interim {
    font-size: 0.75rem;
    color: #7c3aed;
    font-style: italic;
    padding: 0 0.25rem;
    min-height: 1rem;
}
.dark .ai-draft-card__interim {
    color: #a78bfa;
}

.ai-draft-card__input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid #c7d2fe;
    border-radius: 8px;
    font-size: 0.8125rem;
    color: #1e1b4b;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
}
.ai-draft-card__input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}
.ai-draft-card__input::placeholder {
    color: #a5b4fc;
    font-size: 0.75rem;
}
.dark .ai-draft-card__input {
    background: #1e1b4b;
    border-color: #4338ca;
    color: #e0e7ff;
}
.dark .ai-draft-card__input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}
.dark .ai-draft-card__input::placeholder {
    color: #6366f1;
}

.ai-draft-card__generate {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 6px;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.ai-draft-card__generate:hover {
    background: linear-gradient(135deg, #6d28d9, #4338ca);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}
.ai-draft-card__generate:active {
    transform: translateY(0);
}
.ai-draft-card__generate svg {
    width: 14px;
    height: 14px;
}

/* Write manually link */
.ai-draft-card__manual {
    font-size: 0.6875rem;
    color: #8b5cf6;
    cursor: pointer;
    margin: 0;
    transition: color 0.15s;
}
.ai-draft-card__manual:hover {
    color: #7c3aed;
    text-decoration: underline;
}
.dark .ai-draft-card__manual {
    color: #a78bfa;
}
.dark .ai-draft-card__manual:hover {
    color: #c4b5fd;
}

/* ── AI Refine Bar ── */
.ai-refine-toggle { color: #7c3aed !important; }
.ai-refine-toggle--active { background: #ede9fe !important; color: #6d28d9 !important; }
.dark .ai-refine-toggle--active { background: rgba(124, 58, 237, 0.2) !important; color: #a78bfa !important; }

.ai-refine-bar {
    display: flex;
    flex-direction: column;
    background: #f5f3ff;
    border-bottom: 1px solid #e0e7ff;
    padding: 6px 8px;
}
.dark .ai-refine-bar {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.2);
}

.ai-refine-bar__row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-refine-bar__icon {
    width: 14px;
    height: 14px;
    color: #7c3aed;
    flex-shrink: 0;
}
.dark .ai-refine-bar__icon { color: #a78bfa; }

.ai-refine-bar__input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    background: #fff;
    color: #1f2937;
    outline: none;
    min-width: 0;
}
.ai-refine-bar__input:focus { border-color: #7c3aed; box-shadow: 0 0 0 1px #7c3aed; }
.dark .ai-refine-bar__input { background: #1f2937; border-color: #4b5563; color: #f3f4f6; }
.dark .ai-refine-bar__input:focus { border-color: #a78bfa; box-shadow: 0 0 0 1px #a78bfa; }

.ai-refine-bar__voice {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: #6b7280;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}
.ai-refine-bar__voice svg { width: 16px; height: 16px; }
.ai-refine-bar__voice:hover { background: #e0e7ff; color: #7c3aed; }
.ai-refine-bar__voice--active { background: #dc2626 !important; color: #fff !important; border-radius: 4px; animation: ai-refine-pulse 1.5s ease-in-out infinite; }
.dark .ai-refine-bar__voice:hover { background: rgba(124, 58, 237, 0.2); color: #a78bfa; }

@keyframes ai-refine-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.ai-refine-bar__go {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.ai-refine-bar__go:hover { background: #6d28d9; }
.ai-refine-bar__go:disabled { opacity: 0.4; cursor: not-allowed; }

.ai-refine-bar__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
}
.ai-refine-bar__close:hover { color: #374151; }
.dark .ai-refine-bar__close:hover { color: #d1d5db; }

.ai-refine-bar__interim {
    font-size: 11px;
    color: #7c3aed;
    padding: 2px 0 0 20px;
    font-style: italic;
}
.dark .ai-refine-bar__interim { color: #a78bfa; }

/* Loading state */
.ai-draft-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 200px;
    padding: 2rem;
}

.ai-draft-loading__spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e0e7ff;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: ai-draft-spin 0.8s linear infinite;
}
.dark .ai-draft-loading__spinner {
    border-color: #312e81;
    border-top-color: #a78bfa;
}

@keyframes ai-draft-spin {
    to { transform: rotate(360deg); }
}

.ai-draft-loading__text {
    font-size: 0.8125rem;
    color: #6366f1;
    font-weight: 500;
}
.dark .ai-draft-loading__text {
    color: #a5b4fc;
}

/* ---------------------------------------------------------------------------
   Split Send Button + Schedule Dropdown
   --------------------------------------------------------------------------- */
.email-compose-send-group {
    position: relative;
    display: inline-flex;
}

.email-compose-send-group__main {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-right: 1px solid rgba(255,255,255,0.2) !important;
}

.email-compose-send-group__caret {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
    min-width: 0 !important;
}

.email-compose-schedule-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 4px;
    width: 280px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    z-index: 60;
    overflow: visible;
}
.dark .email-compose-schedule-dropdown {
    background: #1f2937;
    border-color: #374151;
}

.email-compose-schedule-dropdown__title {
    padding: 0.5rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    border-bottom: 1px solid #f3f4f6;
}
.dark .email-compose-schedule-dropdown__title {
    border-color: #374151;
}

.email-compose-schedule-dropdown__opt {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: #374151;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}
.email-compose-schedule-dropdown__opt:hover {
    background: #f3f4f6;
}
.dark .email-compose-schedule-dropdown__opt {
    color: #d1d5db;
}
.dark .email-compose-schedule-dropdown__opt:hover {
    background: #374151;
}

.email-compose-schedule-dropdown__divider {
    height: 1px;
    background: #f3f4f6;
}
.dark .email-compose-schedule-dropdown__divider {
    background: #374151;
}

.email-compose-schedule-dropdown__custom {
    display: flex;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
}

.email-compose-schedule-dropdown__input {
    flex: 1;
    padding: 0.25rem 0.375rem;
    font-size: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    color: #374151;
    background: #fff;
}
.dark .email-compose-schedule-dropdown__input {
    background: #111827;
    border-color: #4b5563;
    color: #d1d5db;
}

.email-compose-schedule-dropdown__go {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    white-space: nowrap;
}
.email-compose-schedule-dropdown__go:hover {
    background: #4338ca;
}
.email-compose-schedule-dropdown__go:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
