/* Почта: полноширинный список + модалки просмотра и написания */
.karat-mail { font-size: 0.875rem; }
.karat-mail-layout {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}
.karat-mail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 0 0 13rem;
    width: 13rem;
}
.karat-mail-folder {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.55rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    background: transparent;
    color: #475569;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
.karat-mail-folder:hover { background: rgb(241 245 249); color: #0f172a; }
.karat-mail-folder.is-active {
    border-color: rgb(14 165 233);
    background: rgb(224 242 254);
    color: #075985;
}
.karat-mail-folder--spam:not(.is-active) { color: #b45309; }
.karat-mail-folder--drop {
    border-style: dashed;
    border-color: rgb(14 165 233);
    background: rgb(224 242 254);
    color: #075985;
}
.karat-mail-folder-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.karat-mail-main { min-width: 0; flex: 1; }
.dark .karat-mail-folder { color: #cbd5e1; }
.dark .karat-mail-folder:hover { background: rgb(255 255 255 / 0.08); color: #f8fafc; }
.dark .karat-mail-folder.is-active {
    border-color: rgb(56 189 248);
    background: rgb(14 165 233 / 0.16);
    color: #bae6fd;
}
.karat-mail-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: center;
    margin-bottom: 0.5rem;
}
.karat-mail-folders { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.karat-mail-folders .karat-pill {
    margin: 0;
    border: 1px solid rgb(226 232 240);
    background: #fff;
    color: #475569;
    cursor: pointer;
}
.karat-mail-folders .karat-pill.is-on {
    background: #e0f2fe;
    color: #075985;
    border-color: #7dd3fc;
}
.dark .karat-mail-folders .karat-pill {
    background: transparent;
    border-color: rgb(255 255 255 / 0.12);
    color: #cbd5e1;
}
.dark .karat-mail-folders .karat-pill.is-on {
    background: rgb(14 165 233 / 0.16);
    color: #bae6fd;
    border-color: rgb(56 189 248);
}
.karat-mail-search {
    position: relative;
    display: flex;
    flex: 1 1 16rem;
    min-width: 14rem;
    align-items: center;
}
.karat-mail-search-icon {
    position: absolute;
    left: 0.65rem;
    color: #94a3b8;
    pointer-events: none;
}
.karat-mail-search-input { width: 100%; padding-left: 2rem; }
.karat-mail-actions { display: flex; gap: 0.4rem; margin-left: auto; }
.karat-mail-summary {
    margin: 0 0 0.4rem;
    font-size: 0.75rem;
    color: #64748b;
}

.karat-mail-list {
    border: 1px solid rgb(226 232 240);
    border-radius: 0.5rem;
    overflow: hidden;
    background: #fff;
}
.dark .karat-mail-list { background: rgb(15 23 42 / 0.4); border-color: rgb(255 255 255 / 0.1); }

.karat-mail-row {
    display: grid;
    grid-template-columns: 1.75rem minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    border-bottom: 1px solid rgb(241 245 249);
}
.karat-mail[data-scoped] .karat-mail-row {
    grid-template-columns: minmax(0, 1fr) auto;
}
.dark .karat-mail-row { border-bottom-color: rgb(255 255 255 / 0.06); }
.karat-mail-row:last-child { border-bottom: 0; }
.karat-mail-row:hover { background: rgb(248 250 252); }
.dark .karat-mail-row:hover { background: rgb(255 255 255 / 0.04); }
.karat-mail-row.is-active { background: rgb(224 242 254); }
.dark .karat-mail-row.is-active { background: rgb(14 165 233 / 0.12); }
.karat-mail-row.is-selected { background: rgb(240 249 255); }
.dark .karat-mail-row.is-selected { background: rgb(14 165 233 / 0.08); }
.karat-mail-row-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    cursor: pointer;
}

.karat-mail-row-body {
    display: grid;
    grid-template-columns:
        5.5rem
        minmax(7rem, 11rem)
        minmax(6rem, 10rem)
        minmax(0, 1fr)
        auto;
    align-items: center;
    column-gap: 0.75rem;
    min-width: 0;
    cursor: pointer;
}
.karat-mail-row-body:focus-visible {
    outline: 2px solid rgb(14 165 233 / 0.45);
    outline-offset: 2px;
}

.karat-mail-date {
    display: flex;
    flex-direction: column;
    font-size: 0.75rem;
    line-height: 1.2;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}
.karat-mail-addr,
.karat-mail-from {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8125rem;
}
.karat-mail-from { font-weight: 600; color: #0f172a; }
.dark .karat-mail-from { color: #e2e8f0; }
.karat-mail-addr { color: #64748b; }
.karat-mail-subj-block {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.karat-mail-subj { font-weight: 600; color: #0f172a; }
.dark .karat-mail-subj { color: #e2e8f0; }
.karat-mail-preview { color: #64748b; font-weight: 400; }
.karat-mail-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}
.karat-mail-party { background: #e0f2fe; color: #075985; }
.karat-mail-pending { background: #fef3c7; color: #92400e; }
.karat-mail-clip { color: #94a3b8; flex-shrink: 0; }

.karat-mail-row-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}
.karat-mail-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 0.45rem;
    background: transparent;
    color: #64748b;
    cursor: pointer;
}
.karat-mail-icon-btn:hover { background: rgb(241 245 249); color: #0f172a; }
.karat-mail-icon-btn--primary:hover { background: rgb(224 242 254); color: #0369a1; }
.karat-mail-icon-btn--spam:hover { background: #fef3c7; color: #b45309; }
.dark .karat-mail-icon-btn:hover { background: rgb(255 255 255 / 0.08); color: #e2e8f0; }

.karat-mail-empty { color: #64748b; padding: 1rem 0.75rem; margin: 0; }
.karat-mail-pagination { margin-top: 0.75rem; }
.karat-mail-selection {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid rgb(186 230 253);
    border-radius: 0.5rem;
    background: rgb(240 249 255);
    color: #075985;
    font-size: 0.8125rem;
}
.karat-mail-selection-move { min-width: 0; }
.karat-mail-selection-select { max-width: 16rem; }
.karat-mail-selection-hint { font-size: 0.75rem; color: rgb(7 89 133 / 0.75); }

/* Модалки письма — почти на весь экран */
.karat-mdl.karat-mail-mdl { z-index: 200; align-items: stretch; padding: 1rem; }
.karat-mdl-box.karat-mail-modal {
    width: calc(100vw - 2rem);
    max-width: none;
    height: calc(100vh - 2rem);
    max-height: calc(100vh - 2rem);
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 0.8rem;
}
.karat-mdl-box.karat-mail-modal.karat-mail-compose {
    overflow: visible;
    border-radius: 0.8rem;
}
.karat-mail-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem 0.6rem;
    border-bottom: 1px solid rgb(226 232 240);
    flex: 0 0 auto;
    min-width: 0;
    overflow: visible;
}
.dark .karat-mail-modal-head { border-bottom-color: rgb(255 255 255 / 0.1); }
.karat-mail-modal-head-main { min-width: 0; flex: 1 1 auto; overflow: hidden; }
.karat-mail-modal-context {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.5rem;
    font-size: 0.75rem;
    color: #64748b;
    min-width: 0;
}
.karat-mail-modal-mailbox { font-weight: 600; color: #0f172a; }
.dark .karat-mail-modal-mailbox { color: #e2e8f0; }
.karat-mail-modal-sep { color: #cbd5e1; }
.karat-mail-modal-subject {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dark .karat-mail-modal-subject { color: #f1f5f9; }
.karat-mail-modal-from {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.3rem;
    font-size: 0.8125rem;
    color: #334155;
}
.dark .karat-mail-modal-from { color: #cbd5e1; }
.karat-mail-modal-from-lbl { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: #94a3b8; }
.karat-mail-modal-head-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
    overflow: visible;
    position: relative;
    z-index: 5;
}

.karat-mail-link {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgb(241 245 249);
    flex: 0 0 auto;
    overflow: visible;
}
.dark .karat-mail-link { border-bottom-color: rgb(255 255 255 / 0.08); }
.karat-mail-link .karat-filter-search-select,
.karat-mail-link .karat-filter-search-select--toolbar {
    min-width: 16rem;
    max-width: 22rem;
}
.karat-mail-link .karat-filter-search-select__pop { z-index: 100; }
.karat-mail-link-lbl {
    font-size: 0.8125rem;
    color: #64748b;
    white-space: nowrap;
}
.dark .karat-mail-link-lbl { color: #94a3b8; }
.karat-mail-link .karat-mail-party {
    text-decoration: none;
}

.karat-mail-frame-wrap {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    background: #fff;
}
.karat-mail-iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.karat-mail-atts {
    margin: 0;
    padding: 0.5rem 1rem 0.75rem;
    list-style: none;
    font-size: 0.8rem;
    border-top: 1px solid rgb(241 245 249);
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.85rem;
    max-height: 6.5rem;
    overflow-x: hidden;
    overflow-y: auto;
    min-width: 0;
}
.karat-mail-atts li {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.karat-mail-atts a { color: #0369a1; text-decoration: underline; }
.karat-mail-att-size { color: #64748b; margin-left: 0.2rem; }

.karat-mail-compose-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
}
.karat-mail-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.55rem;
}
.karat-mail-field > span { font-size: 0.75rem; color: #64748b; }
.karat-mail-staged { font-size: 0.8rem; color: #334155; word-break: break-all; }
.dark .karat-mail-staged { color: #cbd5e1; }
.karat-mail-field--grow { flex: 1 1 auto; min-height: 10rem; }
.karat-mail-field--grow .karat-mail-textarea { flex: 1 1 auto; min-height: 10rem; height: 100%; }
.karat-mail-textarea { min-height: 10rem; resize: vertical; }
.karat-mail-compose .karat-filter-search-select--toolbar {
    min-width: 16rem;
    max-width: 22rem;
}
.karat-mail-compose-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
    padding: 0.65rem 1rem;
    border-top: 1px solid rgb(226 232 240);
    flex: 0 0 auto;
}
.dark .karat-mail-compose-foot { border-top-color: rgb(255 255 255 / 0.1); }

.karat-mail[data-scoped] .karat-mail-row-body {
    grid-template-columns:
        5.5rem
        minmax(7rem, 11rem)
        minmax(6rem, 10rem)
        minmax(0, 1fr)
        auto;
}

@media (max-width: 1100px) {
    .karat-mail-layout { flex-direction: column; }
    .karat-mail-sidebar {
        flex: none;
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.25rem;
    }
    .karat-mail-folder { flex-shrink: 0; }
    .karat-mail-row-body {
        grid-template-columns: 5.5rem minmax(0, 1fr) auto;
    }
    .karat-mail-addr { display: none; }
    .karat-mail-from { grid-column: 2; }
    .karat-mail-subj-block { grid-column: 2; }
    .karat-mail-meta { grid-column: 3; grid-row: 1 / span 2; }
}

.karat-mail-icon-btn--contact { width: auto; padding: 0 0.4rem; gap: 0.1rem; }
.karat-mail-contact-menu { position: relative; z-index: 6; }
.karat-mail [x-cloak] { display: none !important; }
.karat-mail-contact-menu-panel {
    position: absolute;
    top: calc(100% + 0.3rem);
    right: 0;
    z-index: 40;
    min-width: 17.5rem;
    padding: 0.3rem;
    border: 1px solid rgb(226 232 240);
    border-radius: 0.55rem;
    background: #fff;
    box-shadow: 0 10px 24px rgb(15 23 42 / 0.12);
}
.karat-mail-contact-menu-panel.is-open {
    display: block !important;
}
.dark .karat-mail-contact-menu-panel {
    background: #0f172a;
    border-color: rgb(255 255 255 / 0.12);
}
.karat-mail-contact-menu-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    width: 100%;
    padding: 0.45rem 0.55rem;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    color: #0f172a;
    text-align: left;
    cursor: pointer;
}
.karat-mail-contact-menu-item:hover { background: rgb(241 245 249); }
.dark .karat-mail-contact-menu-item { color: #e2e8f0; }
.dark .karat-mail-contact-menu-item:hover { background: rgb(255 255 255 / 0.08); }
.karat-mail-contact-menu-title { font-size: 0.8125rem; font-weight: 600; }
.karat-mail-contact-menu-hint { font-size: 0.7rem; color: #64748b; }

/* Выше окна письма (200): иначе «Вставить текст» / «Новый контакт» открываются за ним. */
.karat-mail-contact-mdl { z-index: 260; }
.karat-mdl-box.karat-mail-contact-box {
    width: min(32rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow: auto;
    padding: 0.85rem 1rem 1rem;
}
.karat-mail-contact-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}
.karat-mail-contact-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}
.karat-mail-contact-hint {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    color: #64748b;
}
.karat-mail-contact-form { display: flex; flex-direction: column; gap: 0.55rem; }
.karat-mail-email-row {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
}
.karat-mail-email-row .karat-mtr-input { flex: 1 1 auto; min-width: 0; }
.karat-mail-contact-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.karat-mail-contact-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
    margin-top: 0.85rem;
}
.karat-mail-contact-back { margin-bottom: 0.6rem; }
.karat-mail-contact-candidates { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.karat-mail-contact-candidate {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid rgb(226 232 240);
    border-radius: 0.5rem;
    background: #fff;
    text-align: left;
    cursor: pointer;
}
.karat-mail-contact-candidate:hover { border-color: rgb(14 165 233); background: rgb(240 249 255); }
.karat-mail-contact-candidate:disabled { opacity: 0.5; cursor: not-allowed; }
.karat-mail-contact-candidate-name { font-weight: 600; }
.karat-mail-contact-candidate span { font-size: 0.8rem; color: #475569; }
.karat-mail-contact-candidate-name { font-size: 0.875rem; color: #0f172a; }

/* Композер: цветные pill, адресная лента, холст, полка вложений */
.karat-mail-compose [x-cloak] { display: none !important; }
.karat-mail-compose .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.karat-mail-compose input,
.karat-mail-compose textarea,
.karat-mail-compose input:hover,
.karat-mail-compose textarea:hover,
.karat-mail-compose input:focus,
.karat-mail-compose input:focus-visible,
.karat-mail-compose textarea:focus,
.karat-mail-compose textarea:focus-visible {
    appearance: none;
    -webkit-appearance: none;
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    background-image: none;
    --tw-ring-inset: var(--tw-empty, /*!*/ /*!*/);
    --tw-ring-offset-width: 0px !important;
    --tw-ring-offset-color: transparent !important;
    --tw-ring-color: transparent !important;
    --tw-ring-offset-shadow: 0 0 #0000 !important;
    --tw-ring-shadow: 0 0 #0000 !important;
    --tw-shadow: 0 0 #0000 !important;
}
.karat-mail-compose input[type="search"]::-webkit-search-decoration,
.karat-mail-compose input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
}
.karat-mail-chrome {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.75rem;
    background: #f1f5f9;
    border-bottom: 1px solid rgb(226 232 240);
    flex: 0 0 auto;
    min-width: 0;
    border-radius: 0.8rem 0.8rem 0 0;
}
.dark .karat-mail-chrome {
    background: rgb(15 23 42 / 0.55);
    border-bottom-color: rgb(255 255 255 / 0.1);
}
.karat-mail-chrome-sep {
    width: 1px;
    align-self: stretch;
    background: rgb(203 213 225);
    flex-shrink: 0;
}
.dark .karat-mail-chrome-sep { background: rgb(255 255 255 / 0.12); }
.karat-mail-chrome-subject {
    flex: 1 1 auto;
    min-width: 8rem;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    padding: 0.2rem 0.15rem;
}
.karat-mail-chrome-subject::placeholder { font-weight: 600; color: #94a3b8; }
.dark .karat-mail-chrome-subject { color: #f8fafc; }
.karat-mail-chrome-x { flex-shrink: 0; font-size: 1.05rem; }
.karat-mail-pill {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    max-width: 100%;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
}
.karat-mail-pill-meta {
    font-weight: 500;
    font-size: 0.72rem;
    opacity: 0.8;
    font-variant-numeric: tabular-nums;
}
.karat-mail-pill--from { background: #e2e8f0; color: #334155; }
.karat-mail-pill--mode { background: #e0f2fe; color: #0369a1; }
.karat-mail-pill--client {
    align-items: center;
    background: #ecfdf5;
    color: #047857;
}
.karat-mail-pill--context { background: #e0e7ff; color: #3730a3; }
.dark .karat-mail-pill--from { background: rgb(148 163 184 / 0.2); color: #cbd5e1; }
.dark .karat-mail-pill--mode { background: rgb(14 165 233 / 0.18); color: #7dd3fc; }
.dark .karat-mail-pill--client { background: rgb(16 185 129 / 0.16); color: #6ee7b7; }
.dark .karat-mail-pill--context { background: rgb(99 102 241 / 0.2); color: #c7d2fe; }

.karat-mail-addr {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    border-bottom: 1px solid rgb(226 232 240);
    background: #fff;
}
.dark .karat-mail-addr { background: transparent; border-bottom-color: rgb(255 255 255 / 0.1); }
.karat-mail-addr-row {
    display: grid;
    grid-template-columns: 5.25rem minmax(0, 1fr) auto;
    gap: 0.45rem 0.65rem;
    align-items: center;
    padding: 0.35rem 0.75rem;
    min-width: 0;
    position: relative;
}
.karat-mail-addr-row + .karat-mail-addr-row {
    border-top: 1px solid rgb(241 245 249);
}
.dark .karat-mail-addr-row + .karat-mail-addr-row { border-top-color: rgb(255 255 255 / 0.06); }
.karat-mail-addr-lbl {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
}
.karat-mail-addr-row--client {
    grid-template-columns: 5.25rem minmax(0, 1fr);
}
.karat-mail-addr-row--client .karat-mail-addr-lbl { color: #047857; }
.karat-mail-recip--to .karat-mail-addr-lbl { color: #1d4ed8; }
.karat-mail-recip--cc .karat-mail-addr-lbl { color: #6d28d9; }
.karat-mail-client {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}
.karat-mail-client-q { flex: 1 1 8rem; min-width: 7rem; }
.karat-mail-pill-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1.55rem;
    height: 1.55rem;
    margin: 0 -0.05rem 0 0.12rem;
    border-radius: 999px;
    color: inherit;
    text-decoration: none;
}
.karat-mail-pill-open:hover { background: rgb(4 120 87 / 0.16); }
.karat-mail-pill-open svg {
    display: block;
    width: 1.2rem;
    height: 1.2rem;
}
.dark .karat-mail-pill-open:hover { background: rgb(110 231 183 / 0.2); }
.karat-mail-compose .karat-mail-icon-btn {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 0.45rem;
}
.karat-mail-compose .karat-mail-icon-btn svg { width: 14px; height: 14px; }
.karat-mail-addr-row--people {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.45rem;
}
.karat-mail-recip {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    flex: 1 1 auto;
}
.karat-mail-recip--cc {
    flex: 1 1 12rem;
    max-width: 22rem;
}
.karat-mail-cc-toggle {
    flex-shrink: 0;
    border: 0;
    background: transparent;
    padding: 0.28rem 0.5rem;
    border-radius: 0.45rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6d28d9;
    cursor: pointer;
}
.karat-mail-cc-toggle:hover { background: #f5f3ff; }

.karat-mail-chips {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    flex: 1 1 auto;
}
.karat-mail-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    max-width: 100%;
    padding: 0.12rem 0.25rem 0.12rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
}
.karat-mail-chip-text,
.karat-mail-chip-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.karat-mail-chip--to { background: #eff6ff; color: #1d4ed8; }
.karat-mail-chip--cc { background: #ede9fe; color: #6d28d9; }
.karat-mail-chip--file { background: #ffedd5; color: #c2410c; padding-left: 0.4rem; }
.dark .karat-mail-chip--to { background: rgb(59 130 246 / 0.16); color: #93c5fd; }
.dark .karat-mail-chip--cc { background: rgb(139 92 246 / 0.16); color: #c4b5fd; }
.dark .karat-mail-chip--file { background: rgb(249 115 22 / 0.16); color: #fdba74; }
.karat-mail-chip-ico { width: 0.9rem; height: 0.9rem; flex-shrink: 0; }
.karat-mail-chip-x {
    border: 0 !important;
    background: transparent;
    color: inherit;
    opacity: 0.55;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.28rem 0 0.1rem;
    border-radius: 999px;
}
.karat-mail-chip-x:hover { opacity: 1; background: rgb(15 23 42 / 0.08); }
.karat-mail-chip-input {
    flex: 1 1 8rem;
    min-width: 7rem;
    background: transparent;
    padding: 0.2rem 0.15rem;
    font-size: 0.82rem;
    color: #0f172a;
}
.dark .karat-mail-chip-input { color: #f1f5f9; }
.karat-mail-chip-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border: 0;
    border-radius: 0.45rem;
    background: #e2e8f0;
    color: #334155;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.karat-mail-chip-plus:hover { background: #cbd5e1; color: #0f172a; }

.karat-mail-choice-pop {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    z-index: 40;
    width: min(22rem, 70vw);
    max-height: 16rem;
    overflow: auto;
    background: #fff;
    border: 1px solid rgb(226 232 240);
    border-radius: 0.65rem;
    box-shadow: 0 12px 32px rgb(15 23 42 / 0.16);
    padding: 0.35rem;
}
.karat-mail-choice-pop--people {
    left: auto;
    right: 0;
}
.dark .karat-mail-choice-pop {
    background: #1e293b;
    border-color: rgb(255 255 255 / 0.12);
}
.karat-mail-compose .karat-mail-choice-q {
    width: 100%;
    margin-bottom: 0.25rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    background: transparent;
}
.dark .karat-mail-choice-q { color: #f1f5f9; }
.karat-mail-choice {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 0.5rem;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-radius: 0.45rem;
    cursor: pointer;
}
.karat-mail-choice:hover { background: #f0f9ff; }
.dark .karat-mail-choice:hover { background: rgb(14 165 233 / 0.12); }
.karat-mail-choice-name {
    grid-column: 1;
    font-size: 0.84rem;
    font-weight: 650;
    color: #0f172a;
}
.dark .karat-mail-choice-name { color: #f8fafc; }
.karat-mail-choice-email {
    grid-column: 1;
    font-size: 0.75rem;
    color: #64748b;
}
.karat-mail-choice-src {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    font-size: 0.68rem;
    font-weight: 600;
    color: #0369a1;
    background: #e0f2fe;
    border-radius: 999px;
    padding: 0.1rem 0.4rem;
}
.dark .karat-mail-choice-src { background: rgb(14 165 233 / 0.2); color: #7dd3fc; }
.karat-mail-choice-empty {
    padding: 0.55rem 0.5rem;
    font-size: 0.8rem;
    color: #64748b;
}

.karat-mail-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 2rem;
    border: 0;
    border-radius: 0.45rem;
    background: #0284c7;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.karat-mail-send:hover { background: #0369a1; }
.karat-mail-send:disabled { opacity: 0.6; cursor: wait; }

.karat-mail-canvas {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    margin: 0;
    background: #fff;
    overflow: hidden;
}
.dark .karat-mail-canvas { background: transparent; }
.karat-mail-canvas-input {
    flex: 1 1 auto;
    width: 100%;
    min-height: 12rem;
    resize: none;
    overflow-y: auto;
    padding: 0.9rem 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #0f172a;
    background: transparent;
}
.karat-mail-canvas-input::placeholder { color: #94a3b8; }
.dark .karat-mail-canvas-input { color: #e2e8f0; }

.karat-mail-attshelf {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.75rem 0.7rem;
    background: #fff;
    border-top: 1px solid rgb(226 232 240);
    flex: 0 0 auto;
    border-radius: 0 0 0.8rem 0.8rem;
}
.karat-mail-attshelf.has-files {
    background: #fffbeb;
    border-top-color: #fde68a;
}
.dark .karat-mail-attshelf {
    background: transparent;
    border-top-color: rgb(255 255 255 / 0.1);
}
.dark .karat-mail-attshelf.has-files {
    background: rgb(245 158 11 / 0.08);
    border-top-color: rgb(245 158 11 / 0.28);
}
.karat-mail-att-add {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.7rem;
    border: 1px dashed rgb(203 213 225);
    border-radius: 0.45rem;
    background: transparent;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 650;
    cursor: pointer;
}
.karat-mail-att-add:hover { background: #f8fafc; color: #334155; }
.karat-mail-attshelf.has-files .karat-mail-att-add {
    border-color: #f59e0b;
    background: #fff;
    color: #b45309;
}
.karat-mail-attshelf.has-files .karat-mail-att-add:hover { background: #fff7ed; }
.dark .karat-mail-att-add {
    background: transparent;
    color: #94a3b8;
    border-color: rgb(255 255 255 / 0.2);
}
.dark .karat-mail-attshelf.has-files .karat-mail-att-add {
    color: #fdba74;
    border-color: rgb(251 191 36 / 0.5);
}

@media (max-width: 720px) {
    .karat-mail-addr-row--client {
        grid-template-columns: 4.5rem minmax(0, 1fr);
    }
    .karat-mail-addr-row--people {
        flex-wrap: wrap;
    }
    .karat-mail-recip {
        flex: 1 1 100%;
    }
    .karat-mail-recip--cc { max-width: none; }
}

