/* MajidTek Mail. Colours and sizes are variables on <html>; data-theme="dark" swaps them.
   Layout uses logical properties (inline-start/end) so Arabic and English share every rule. */

:root {
    --mtm-brand: #0F6CBD; --mtm-brand-hover: #115EA3; --mtm-brand-press: #0C3B5E;
    --mtm-brand-soft: #EBF3FC; --mtm-brand-soft2: #CFE4FA; --mtm-on-brand: #fff;
    --mtm-top: #0F6CBD; --mtm-top-search: rgba(255,255,255,.92);
    --mtm-canvas: #F5F5F5; --mtm-card: #FFFFFF; --mtm-card2: #FAFAFA;
    --mtm-line: #E0E0E0; --mtm-line-soft: #EDEDED;
    --mtm-text: #242424; --mtm-text2: #616161; --mtm-text3: #8A8A8A;
    --mtm-hover: rgba(0,0,0,.045); --mtm-press: rgba(0,0,0,.08);
    --mtm-flag: #C50F1F; --mtm-pin: #0F6CBD; --mtm-danger: #C50F1F; --mtm-ok: #107C10; --mtm-warn-bg: #FFF4CE; --mtm-warn-text: #835C00;
    --mtm-shadow: 0 0 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.14);
    --mtm-shadow-lg: 0 0 8px rgba(0,0,0,.12), 0 14px 28px rgba(0,0,0,.14);
    --mtm-radius: 8px;
    --mtm-font: "Segoe UI Variable Text", "Segoe UI", "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif;
}
html[lang="ar"] { --mtm-font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif; }
html[data-theme="dark"] {
    --mtm-brand: #479EF5; --mtm-brand-hover: #62ABF5; --mtm-brand-press: #2886DE;
    --mtm-brand-soft: #082338; --mtm-brand-soft2: #0C3B5E; --mtm-on-brand: #0A1A28;
    --mtm-top: #0A2E4A; --mtm-top-search: rgba(255,255,255,.12);
    --mtm-canvas: #141414; --mtm-card: #1F1F1F; --mtm-card2: #292929;
    --mtm-line: #3D3D3D; --mtm-line-soft: #2E2E2E;
    --mtm-text: #F5F5F5; --mtm-text2: #ADADAD; --mtm-text3: #8A8A8A;
    --mtm-hover: rgba(255,255,255,.06); --mtm-press: rgba(255,255,255,.1);
    --mtm-flag: #F1707B; --mtm-pin: #479EF5; --mtm-danger: #F1707B; --mtm-ok: #54B054; --mtm-warn-bg: #4A3B0B; --mtm-warn-text: #FDE7A0;
    --mtm-shadow: 0 0 2px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.5);
    --mtm-shadow-lg: 0 0 8px rgba(0,0,0,.4), 0 14px 28px rgba(0,0,0,.5);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--mtm-font); font-size: 14px; color: var(--mtm-text); background: var(--mtm-canvas); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--mtm-brand); }
h1:focus { outline: none; }
:focus-visible { outline: 2px solid var(--mtm-brand); outline-offset: 1px; }
::selection { background: var(--mtm-brand-soft2); }

/* thin, quiet scroll bars */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--mtm-text3) 55%, transparent) transparent; }

/* ---------- small shared pieces ---------- */
.mtm-spinner { display: inline-block; width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--mtm-brand-soft2); border-top-color: var(--mtm-brand); animation: mtm-spin .8s linear infinite; }
.mtm-spinner-light { border-color: rgba(255,255,255,.35); border-top-color: #fff; }
.mtm-spinner-sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes mtm-spin { to { transform: rotate(360deg); } }
.mtm-boot { position: fixed; inset: 0; z-index: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: linear-gradient(140deg, #0F6CBD, #0C3B5E); }
.mtm-boot-mark svg { width: 84px; height: 84px; }
.mtm-boot-inline { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 160px; }

.mtm-avatar { --s: 36px; --c: #0F6CBD; display: inline-flex; align-items: center; justify-content: center; flex: none; width: var(--s); height: var(--s); border-radius: 50%;
    background: var(--c); color: #fff; font-weight: 600; font-size: calc(var(--s) * .38); letter-spacing: .01em; user-select: none; line-height: 1; }

.mtm-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 0; border-radius: 6px; background: transparent; color: var(--mtm-text2); flex: none; }
.mtm-icon-btn:hover { background: var(--mtm-hover); color: var(--mtm-text); }
.mtm-icon-btn .mud-icon-root { font-size: 20px; }

.mtm-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; height: 100%; padding: 32px 20px; color: var(--mtm-text2); gap: 6px; }
.mtm-empty > .mud-icon-root { font-size: 56px; color: var(--mtm-text3); opacity: .7; }
.mtm-empty h2 { margin: 8px 0 0; font-size: 17px; font-weight: 600; color: var(--mtm-text); }
.mtm-empty p { margin: 0 0 8px; font-size: 13px; }
.mtm-empty-art { width: 190px; height: auto; }
.mtm-empty-list { height: auto; padding-top: 64px; }

.mtm-tag { --c: #8A8A8A; display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
    color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
html[data-theme="dark"] .mtm-tag { color: color-mix(in srgb, var(--c) 55%, #fff); }
.mtm-tag button { border: 0; background: none; padding: 0; margin-inline-start: 2px; font-size: 14px; line-height: 1; color: inherit; opacity: .7; }
.mtm-tag button:hover { opacity: 1; }
.mtm-tag-high { --c: #C50F1F; }
.mtm-tag-high .mud-icon-root { font-size: 13px; }
.mtm-tag-folder { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 4px; font-size: 11.5px; color: var(--mtm-text2); background: var(--mtm-hover); }

.mtm-menu-label { padding: 6px 16px 2px; font-size: 11.5px; font-weight: 600; color: var(--mtm-text3); text-transform: none; }
.mtm-cat-item, .mtm-check-item { display: inline-flex; align-items: center; gap: 10px; }
.mtm-cat-item i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.mtm-ltr input, .mtm-ltr textarea { direction: ltr; text-align: left; }
.mtm-link { display: inline-flex; align-items: center; align-self: flex-start; gap: 4px; border: 0; background: none; padding: 4px 0; color: var(--mtm-brand); font-weight: 600; font-size: 13px; }
.mtm-note { padding: 10px 12px; border-radius: 6px; font-size: 13px; line-height: 1.6; background: var(--mtm-brand-soft); color: var(--mtm-text); border-inline-start: 3px solid var(--mtm-brand); }
.mtm-note.warn { background: var(--mtm-warn-bg); color: var(--mtm-warn-text); border-color: #EAA300; }
.mtm-note.error { background: color-mix(in srgb, var(--mtm-danger) 12%, transparent); border-color: var(--mtm-danger); }
.is-error { color: var(--mtm-danger) !important; }

/* ---------- MudBlazor, tuned to the same look ---------- */
.mud-typography, .mud-input, .mud-button-root, .mud-list-item-text, .mud-menu-item, .mud-snackbar { font-family: var(--mtm-font) !important; }
.mud-popover { border-radius: 8px !important; box-shadow: var(--mtm-shadow-lg) !important; }
.mud-menu-list { padding: 4px !important; }
.mud-menu-item { border-radius: 4px; min-height: 34px !important; padding-block: 4px !important; font-size: 13.5px; }
.mud-menu-item .mud-menu-item-icon { min-width: 30px !important; }
.mud-menu-item .mud-icon-root { font-size: 19px; }
.mud-snackbar { border-radius: 8px !important; }
.mud-dialog { border-radius: 12px !important; }
.mud-button-root { border-radius: 6px; }
.mud-tooltip { font-size: 12px !important; border-radius: 4px !important; }

#blazor-error-ui { color-scheme: light only; background: #FFF4CE; color: #242424; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; inset-inline: 0; padding: .6rem 1.25rem .7rem; position: fixed; z-index: 3000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; inset-inline-end: .75rem; top: .5rem; }

/* ====================================================================== the frame of the app */
.mtm-app { position: fixed; inset: 0; z-index: 1; display: flex; flex-direction: column; background: var(--mtm-canvas); color: var(--mtm-text); }

.mtm-top { display: flex; align-items: center; gap: 8px; height: 48px; flex: none; padding-inline: 8px 10px; background: var(--mtm-top); color: #fff; }
.mtm-top-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 6px; background: transparent; color: #fff; flex: none; }
.mtm-top-btn:hover { background: rgba(255,255,255,.14); }
.mtm-top-btn .mud-icon-root { font-size: 21px; }
.mtm-lang-btn span { font-weight: 700; font-size: 13px; }
.mtm-only-narrow { display: none; }
.mtm-brand { display: inline-flex; align-items: center; gap: 8px; padding-inline: 6px 14px; color: #fff; text-decoration: none; font-weight: 600; font-size: 16px; white-space: nowrap; flex: none; }
.mtm-brand svg { width: 26px; height: 26px; }
.mtm-search { flex: 1; min-width: 0; max-width: 560px; margin-inline: auto; display: flex; align-items: center; gap: 6px; height: 32px; padding-inline: 10px 4px; border-radius: 6px; background: var(--mtm-top-search); color: #424242; transition: background .15s; }
.mtm-search:focus-within { background: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.35); color: #242424; }
.mtm-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 100%; font-size: 14px; color: inherit; }
.mtm-search input::placeholder { color: inherit; opacity: .75; }
.mtm-search input::-webkit-search-cancel-button { display: none; }
.mtm-search-clear { display: inline-flex; border: 0; background: none; padding: 4px; border-radius: 4px; color: inherit; }
.mtm-search-clear:hover { background: rgba(0,0,0,.08); }
html[data-theme="dark"] .mtm-search { color: #E0E0E0; }
html[data-theme="dark"] .mtm-search:focus-within { background: #292929; color: #fff; }
.mtm-top-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.mtm-me { border: 0; background: none; padding: 2px; border-radius: 50%; margin-inline-start: 4px; display: inline-flex; }
.mtm-me:hover { box-shadow: 0 0 0 2px rgba(255,255,255,.4); }
.mtm-me .mtm-avatar { box-shadow: 0 0 0 1.5px rgba(255,255,255,.7); }
.mtm-me-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px; min-width: 250px; }
.mtm-me-card div { display: flex; flex-direction: column; min-width: 0; }
.mtm-me-card strong { font-size: 14.5px; }
.mtm-me-card span { font-size: 12.5px; color: var(--mtm-text2); overflow: hidden; text-overflow: ellipsis; }

.mtm-body { flex: 1; min-height: 0; display: flex; }
.mtm-rail { width: 48px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 8px; }
.mtm-rail-item { position: relative; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 6px; color: var(--mtm-text2); text-decoration: none; }
.mtm-rail-item:hover { background: var(--mtm-hover); color: var(--mtm-text); }
.mtm-rail-item.is-active { color: var(--mtm-brand); background: var(--mtm-card); box-shadow: var(--mtm-shadow); }
.mtm-rail-item.is-active::before { content: ""; position: absolute; inset-inline-start: -4px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--mtm-brand); }
.mtm-rail-item .mud-icon-root { font-size: 22px; }
.mtm-rail-label { display: none; }
.mtm-rail-badge { position: absolute; top: 2px; inset-inline-end: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--mtm-brand); color: var(--mtm-on-brand); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.mtm-main { flex: 1; min-width: 0; min-height: 0; }

/* ====================================================================== mail */
.mtm-mail { height: 100%; display: flex; flex-direction: column; gap: 8px; padding: 8px; padding-inline-start: 0; }

/* ---- command bar */
.mtm-cmd { display: flex; align-items: center; gap: 2px; flex: none; height: 44px; padding-inline: 6px; background: var(--mtm-card); border-radius: var(--mtm-radius); box-shadow: var(--mtm-shadow); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.mtm-cmd::-webkit-scrollbar { display: none; }
.mtm-cmd .mud-menu { flex: none; }
.mtm-cmd-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding-inline: 8px; border: 0; border-radius: 6px; background: transparent; color: var(--mtm-text); font-size: 13.5px; white-space: nowrap; flex: none; cursor: pointer; }
.mtm-cmd-btn .mud-icon-root { font-size: 20px; color: var(--mtm-text2); }
.mtm-cmd-btn:hover:not(:disabled) { background: var(--mtm-hover); }
.mtm-cmd-btn:hover:not(:disabled) .mud-icon-root { color: var(--mtm-brand); }
.mtm-cmd-btn:active:not(:disabled) { background: var(--mtm-press); }
.mtm-cmd-btn:disabled { opacity: .42; cursor: default; }
.mtm-cmd-btn.is-flag .mud-icon-root { color: var(--mtm-flag); }
.mtm-cmd-btn.is-high { background: color-mix(in srgb, var(--mtm-danger) 12%, transparent); color: var(--mtm-danger); }
.mtm-cmd-btn.is-high .mud-icon-root { color: var(--mtm-danger); }
.mtm-cmd-btn.is-busy .mud-icon-root { animation: mtm-spin 1s linear infinite; }
.mtm-cmd-caret { font-size: 16px !important; margin-inline-start: -4px; }
.mtm-cmd-primary { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding-inline: 12px 14px; border: 0; border-radius: 6px; background: var(--mtm-brand); color: var(--mtm-on-brand); font-weight: 600; font-size: 13.5px; white-space: nowrap; flex: none; margin-inline: 4px; }
.mtm-cmd-primary:hover { background: var(--mtm-brand-hover); }
.mtm-cmd-primary:active { background: var(--mtm-brand-press); }
.mtm-cmd-sep { width: 1px; height: 22px; background: var(--mtm-line); margin-inline: 4px; flex: none; }
.mtm-cmd-fill { flex: 1; }
.mtm-cmd-count { font-weight: 700; padding-inline: 4px 8px; }
@media (max-width: 1500px) { .mtm-cmd-btn > span { display: none; } .mtm-cmd-caret { margin-inline-start: -6px; } }

/* ---- the three panes */
.mtm-panes { flex: 1; min-height: 0; display: grid; gap: 8px; grid-template-columns: 236px minmax(300px, 380px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.no-folders .mtm-panes { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
.no-folders .mtm-folders { display: none; }
.pane-bottom .mtm-panes { grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: minmax(160px, 42%) minmax(0, 1fr); }
.pane-bottom .mtm-folders { grid-row: 1 / span 2; }
.pane-bottom.no-folders .mtm-panes { grid-template-columns: minmax(0, 1fr); }
.pane-off .mtm-panes { grid-template-columns: 236px minmax(0, 1fr); }
.pane-off.no-folders .mtm-panes { grid-template-columns: minmax(0, 1fr); }
.pane-off:not(.has-item) .mtm-reading, .pane-off.has-item .mtm-list { display: none; }
.mtm-scrim { display: none; }

.mtm-list, .mtm-reading { background: var(--mtm-card); border-radius: var(--mtm-radius); box-shadow: var(--mtm-shadow); min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.mtm-reading { background: var(--mtm-card2); }

/* ---- folder pane */
.mtm-folders { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.mtm-folders-scroll { flex: 1; overflow-y: auto; padding: 2px 4px 12px 8px; padding-inline: 8px 4px; }
.mtm-newmail { display: none; }
.mtm-fgroup { margin-bottom: 6px; }
.mtm-fgroup-head { display: flex; align-items: center; gap: 4px; width: 100%; height: 32px; padding-inline: 4px 8px; border: 0; border-radius: 6px; background: none; font-weight: 600; font-size: 13.5px; color: var(--mtm-text); text-align: start; }
.mtm-fgroup-head:hover { background: var(--mtm-hover); }
.mtm-fgroup-head > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.mtm-fgroup-head .mud-icon-root { color: var(--mtm-text2); }
.mtm-folder { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding-inline: 28px 4px; border: 0; border-radius: 6px; background: none; color: var(--mtm-text); font-size: 13.5px; cursor: pointer; user-select: none; text-align: start; }
.mtm-folder:hover { background: var(--mtm-hover); }
.mtm-folder.is-active { background: var(--mtm-brand-soft2); font-weight: 600; }
html[data-theme="dark"] .mtm-folder.is-active { background: var(--mtm-brand-soft2); }
.mtm-folder.is-active .mtm-folder-icon { color: var(--mtm-brand); }
.mtm-folder.has-unread .mtm-folder-name { font-weight: 700; }
.mtm-folder.drop-hot { background: var(--mtm-brand-soft2); box-shadow: inset 0 0 0 2px var(--mtm-brand); }
.mtm-folder-icon { color: var(--mtm-text2); font-size: 19px !important; flex: none; }
.mtm-folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-folder-count { font-size: 12.5px; font-weight: 700; color: var(--mtm-brand); padding-inline: 2px 6px; }
.mtm-folder-more { display: none; flex: none; }
.mtm-folder-more .mud-icon-button { padding: 3px; }
.mtm-folder:hover .mtm-folder-more, .mtm-folder:focus-within .mtm-folder-more { display: inline-flex; }
.mtm-folder:hover .mtm-folder-count, .mtm-folder:focus-within .mtm-folder-count { display: none; }
.mtm-folder-new { color: var(--mtm-brand); font-size: 13px; }
.mtm-folder-new .mud-icon-root { color: var(--mtm-brand); }
.mtm-add-account { padding-inline-start: 8px; margin-top: 4px; }
.mtm-folder-edit { display: flex; align-items: center; gap: 10px; height: 34px; padding-inline: 28px 4px; }
.mtm-folder-edit .mud-icon-root { color: var(--mtm-text2); font-size: 19px; flex: none; }
.mtm-folder-edit input { flex: 1; min-width: 0; height: 28px; border: 1px solid var(--mtm-brand); border-radius: 4px; background: var(--mtm-card); padding-inline: 8px; outline: 0; font-size: 13.5px; }

/* ---- message list */
.mtm-list-head { display: flex; align-items: center; gap: 8px; height: 48px; flex: none; padding-inline: 14px 8px; border-bottom: 1px solid var(--mtm-line-soft); }
.mtm-list-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; }
.mtm-list-title strong { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-list-sub { font-size: 12.5px; color: var(--mtm-text2); margin-inline-start: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-star { display: inline-flex; border: 0; background: none; padding: 4px; border-radius: 4px; color: var(--mtm-text3); }
.mtm-star:hover { background: var(--mtm-hover); }
.mtm-star.on { color: #EAA300; }
.mtm-list-tool { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding-inline: 8px; border: 0; border-radius: 6px; background: none; color: var(--mtm-text2); font-size: 13px; white-space: nowrap; }
.mtm-list-tool:hover { background: var(--mtm-hover); color: var(--mtm-text); }
.mtm-list-tool.on { color: var(--mtm-brand); font-weight: 600; background: var(--mtm-brand-soft); }
.mtm-list-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.mtm-more { display: flex; justify-content: center; align-items: center; min-height: 48px; }

.mtm-tick { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: none; border: 1.5px solid var(--mtm-text3); border-radius: 50%; background: var(--mtm-card); color: transparent; padding: 0; }
.mtm-tick .mud-icon-root { font-size: 15px; }
.mtm-tick:hover { border-color: var(--mtm-brand); color: var(--mtm-brand); }
.mtm-tick.on { background: var(--mtm-brand); border-color: var(--mtm-brand); color: var(--mtm-on-brand); }
.mtm-tick:disabled { opacity: .4; }
.mtm-tick-all { margin-inline-end: 4px; }

.mtm-group { position: sticky; top: 0; z-index: 2; padding: 10px 16px 6px; font-size: 12.5px; font-weight: 600; color: var(--mtm-text2); background: var(--mtm-card); }
.mtm-row { position: relative; display: flex; align-items: flex-start; gap: 0; padding: 9px 12px 9px 0; padding-inline: 0 12px; border-bottom: 1px solid var(--mtm-line-soft); cursor: pointer; user-select: none; outline-offset: -2px; }
.mtm-row:hover { background: var(--mtm-hover); }
.mtm-row.is-checked { background: var(--mtm-brand-soft); }
.mtm-row.is-active { background: var(--mtm-brand-soft2); }
.mtm-row-bar { position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; background: transparent; }
.mtm-row.is-unread .mtm-row-bar { background: var(--mtm-brand); }
.mtm-row-lead { position: relative; width: 56px; flex: none; display: flex; justify-content: center; padding-top: 2px; }
.mtm-row-lead .mtm-tick { position: absolute; top: 9px; opacity: 0; }
.mtm-row:hover .mtm-row-avatar, .mtm-row.is-checked .mtm-row-avatar { visibility: hidden; }
.mtm-row:hover .mtm-tick, .mtm-row.is-checked .mtm-tick, .mtm-row .mtm-tick:focus-visible { opacity: 1; }
.mtm-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mtm-row-line1, .mtm-row-line2 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mtm-row-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--mtm-text); }
.mtm-row.is-unread .mtm-row-from { font-weight: 700; }
.mtm-draft-tag { font-style: normal; color: var(--mtm-danger); margin-inline-end: 4px; }
.mtm-row-icons { display: inline-flex; align-items: center; gap: 2px; flex: none; height: 22px; }
.mtm-row-icons .mud-icon-root { font-size: 16px; }
.ic-soft { color: var(--mtm-text3); } .ic-high { color: var(--mtm-danger); } .ic-pin { color: var(--mtm-pin); } .ic-flag { color: var(--mtm-flag); }
.mtm-row-quick { display: none; align-items: center; gap: 0; flex: none; height: 22px; }
.mtm-row-quick button { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 24px; border: 0; border-radius: 4px; background: none; color: var(--mtm-text2); padding: 0; }
.mtm-row-quick button:hover { background: var(--mtm-press); color: var(--mtm-brand); }
.mtm-row-quick button.on-flag { color: var(--mtm-flag); }
.mtm-row-quick .mud-icon-root { font-size: 17px; }
@media (hover: hover) {
    .mtm-row:hover .mtm-row-quick { display: inline-flex; }
    .mtm-row:hover .mtm-row-icons { display: none; }
}
.mtm-row-subject { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--mtm-text); }
.mtm-row.is-unread .mtm-row-subject { color: var(--mtm-brand); font-weight: 600; }
.mtm-row-date { flex: none; font-size: 12px; color: var(--mtm-text2); white-space: nowrap; }
.mtm-row.is-unread .mtm-row-date { color: var(--mtm-brand); font-weight: 600; }
.mtm-row-preview { font-size: 13px; color: var(--mtm-text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-row-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
body.mtm-dragging .mtm-row { cursor: grabbing; }

/* compact list: one tight line less, no avatars */
.mtm-compact .mtm-row { padding-block: 5px; }
.mtm-compact .mtm-row-lead { width: 38px; }
.mtm-compact .mtm-row-avatar { display: none; }
.mtm-compact .mtm-row-lead .mtm-tick { position: static; opacity: .0; margin-top: 2px; }
.mtm-compact .mtm-row:hover .mtm-tick, .mtm-compact .mtm-row.is-checked .mtm-tick { opacity: 1; }
.mtm-compact .mtm-row-preview { display: none; }
.mtm-compact .mtm-group { padding-block: 6px 4px; }

.mtm-skeleton { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--mtm-line-soft); }
.sk-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--mtm-hover); flex: none; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 7px; padding-top: 3px; }
.sk-lines i { height: 9px; border-radius: 4px; background: linear-gradient(90deg, var(--mtm-hover), var(--mtm-press), var(--mtm-hover)); background-size: 200% 100%; animation: mtm-shimmer 1.3s linear infinite; }
.sk-lines i:nth-child(1) { width: 45%; } .sk-lines i:nth-child(2) { width: 80%; } .sk-lines i:nth-child(3) { width: 65%; }
@keyframes mtm-shimmer { to { background-position: -200% 0; } }

/* ---- reading pane */
.mtm-read { height: 100%; overflow-y: auto; padding: 14px 16px 24px; }
.mtm-read-head { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px 10px; padding: 2px 4px 12px; }
.mtm-read-head h1 { flex: 1; min-width: 200px; margin: 0; font-size: 20px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.mtm-read-tags { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 5px; }
.mtm-read-card { background: var(--mtm-card); border-radius: var(--mtm-radius); box-shadow: var(--mtm-shadow); padding: 14px 16px 16px; }
.mtm-read-meta { display: flex; align-items: flex-start; gap: 12px; }
.mtm-read-who { flex: 1; min-width: 0; }
.mtm-read-from { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.mtm-read-from strong { font-size: 15px; font-weight: 600; }
.mtm-read-addr { font-size: 12.5px; color: var(--mtm-text2); overflow-wrap: anywhere; }
.mtm-read-to { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; border: 0; background: none; padding: 2px 0; font-size: 13px; color: var(--mtm-text2); text-align: start; }
.mtm-read-to span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-read-to:hover { color: var(--mtm-text); }
.mtm-read-details { margin-top: 8px; padding: 10px 12px; border-radius: 6px; background: var(--mtm-card2); font-size: 13px; display: grid; gap: 6px; }
.mtm-read-details > div { display: grid; grid-template-columns: 76px 1fr; gap: 8px; }
.mtm-read-details b { font-weight: 600; color: var(--mtm-text2); }
.mtm-person { display: inline-block; margin-inline-end: 10px; }
.mtm-person i { font-style: normal; color: var(--mtm-text2); }
.mtm-read-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.mtm-read-actions { display: flex; align-items: center; gap: 2px; }
.mtm-read-actions .mud-icon-button { padding: 6px; border-radius: 6px; }
.mtm-read-date { font-size: 12px; color: var(--mtm-text2); white-space: nowrap; }
.mtm-read-body { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--mtm-line-soft); }
.mtm-read-body.light-paper { background: #fff; border-radius: 6px; padding: 14px; border-top: 0; }
.mtm-frame { display: block; width: 100%; min-height: 60px; border: 0; background: transparent; }
.mtm-read-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.mtm-pill-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding-inline: 12px 14px; border: 1px solid var(--mtm-line); border-radius: 6px; background: var(--mtm-card); color: var(--mtm-text); font-size: 13.5px; font-weight: 600; }
.mtm-pill-btn:hover { background: var(--mtm-hover); border-color: var(--mtm-text3); }
.mtm-pill-btn .mud-icon-root { color: var(--mtm-brand); }
html[dir="rtl"] .mtm-read-actions .mud-icon-root, html[dir="rtl"] .mtm-pill-btn .mud-icon-root, html[dir="rtl"] .mtm-cmd-btn .mud-icon-root[class*="reply"], html[dir="rtl"] .mtm-flip { }

/* files of a message */
.mtm-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mtm-file { display: flex; align-items: stretch; max-width: 260px; min-width: 150px; border: 1px solid var(--mtm-line); border-radius: 6px; background: var(--mtm-card); overflow: hidden; }
.mtm-file:hover { border-color: var(--mtm-text3); }
.mtm-file-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px 10px; text-decoration: none; color: var(--mtm-text); }
.mtm-file-main .mud-icon-root { font-size: 26px; flex: none; }
.mtm-file-text { display: flex; flex-direction: column; min-width: 0; }
.mtm-file-text b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-file-text small { font-size: 11.5px; color: var(--mtm-text2); }
.mtm-file-save { display: inline-flex; align-items: center; justify-content: center; width: 34px; border: 0; border-inline-start: 1px solid var(--mtm-line); background: none; color: var(--mtm-text2); }
.mtm-file-save:hover { background: var(--mtm-hover); color: var(--mtm-brand); }
.mtm-file.is-uploading { opacity: .8; }

/* ---- writing a message */
.mtm-compose { position: relative; height: 100%; display: flex; flex-direction: column; background: var(--mtm-card); }
.mtm-compose-head { display: flex; align-items: center; gap: 10px; flex: none; height: 52px; padding-inline: 18px 10px; border-bottom: 1px solid var(--mtm-line-soft); }
.mtm-compose-kind { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: none; border-radius: 9px; background: var(--mtm-brand-soft); color: var(--mtm-brand); }
.mtm-compose-head strong { font-size: 15.5px; font-weight: 600; white-space: nowrap; }
.mtm-save-state { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding-inline: 9px 11px; border-radius: 12px; background: var(--mtm-hover); color: var(--mtm-text2); font-size: 12px; white-space: nowrap; }
.mtm-save-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--mtm-ok); }
.mtm-save-state.is-saving i { background: var(--mtm-brand); animation: mtm-pulse 1s ease-in-out infinite; }
.mtm-save-state.is-error i { background: var(--mtm-danger); }
@keyframes mtm-pulse { 50% { opacity: .25; transform: scale(.7); } }
@keyframes mtm-rise { from { opacity: 0; transform: translateY(6px) scale(.98); } }

.mtm-compose-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.mtm-compose-fields { flex: none; padding: 4px 22px 0; }
.mtm-field { position: relative; display: flex; align-items: flex-start; gap: 12px; min-height: 46px; padding-block: 7px; border-bottom: 1px solid var(--mtm-line-soft); transition: border-color .15s; }
.mtm-field:focus-within { border-bottom-color: var(--mtm-brand); }
.mtm-field > label { flex: none; min-width: 44px; padding-top: 7px; font-size: 12.5px; font-weight: 600; color: var(--mtm-text3); }
.mtm-field-extra { display: inline-flex; gap: 2px; padding-top: 3px; flex: none; }
.mtm-field-extra button { border: 0; background: none; height: 26px; padding-inline: 9px; border-radius: 13px; color: var(--mtm-text2); font-size: 12.5px; font-weight: 600; }
.mtm-field-extra button:hover { background: var(--mtm-brand-soft); color: var(--mtm-brand); }
.mtm-from { flex: 1; height: 32px; border: 0; background: transparent; outline: 0; font-size: 14px; }
.mtm-from option { background: var(--mtm-card); color: var(--mtm-text); }
.mtm-field-subject { align-items: center; }
.mtm-subject { flex: 1; min-width: 0; height: 34px; border: 0; outline: 0; background: transparent; font-size: 18px; font-weight: 600; }
.mtm-subject::placeholder { font-weight: 500; color: var(--mtm-text3); }
.mtm-files-compose { padding-inline: 22px; margin-block: 12px 0; }

.mtm-rcpt { position: relative; flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-height: 32px; cursor: text; }
.mtm-rcpt input { flex: 1; min-width: 120px; height: 28px; border: 0; outline: 0; background: transparent; font-size: 14px; }
html[dir="rtl"] .mtm-rcpt input { text-align: right; }
.mtm-rcpt.is-bad input { color: var(--mtm-danger); text-decoration: underline wavy var(--mtm-danger); }
.mtm-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 28px; padding-inline: 3px 4px; border-radius: 14px; background: var(--mtm-card2); border: 1px solid var(--mtm-line); color: var(--mtm-text); font-size: 13px; transition: border-color .12s, background .12s; }
.mtm-chip:hover { border-color: var(--mtm-brand); background: var(--mtm-brand-soft); }
.mtm-chip > span:not(.mtm-avatar) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-chip button { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 0; border-radius: 50%; background: none; color: var(--mtm-text3); font-size: 15px; line-height: 1; padding: 0; }
.mtm-chip button:hover { background: var(--mtm-press); color: var(--mtm-text); }
.mtm-suggest { position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 30; width: min(380px, 100%); max-height: 300px; overflow-y: auto; padding: 6px; background: var(--mtm-card); border: 1px solid var(--mtm-line); border-radius: 12px; box-shadow: var(--mtm-shadow-lg); animation: mtm-rise .12s ease-out; }
.mtm-suggest-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.mtm-suggest-item.is-hot, .mtm-suggest-item:hover { background: var(--mtm-brand-soft); }
.mtm-suggest-item > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.mtm-suggest-item b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-suggest-item small { font-size: 12px; color: var(--mtm-text2); overflow: hidden; text-overflow: ellipsis; text-align: start; }
html[dir="rtl"] .mtm-suggest-item small { text-align: right; }

.mtm-compose-editor { flex: 1 0 auto; display: flex; flex-direction: column; min-height: 220px; }
.mtm-plain-editor { flex: 1; width: 100%; min-height: 220px; border: 0; outline: 0; resize: none; background: transparent; padding: 18px 24px; font-size: 15px; line-height: 1.7; }
.mtm-quote { flex: none; margin: 4px 22px 16px; border-top: 1px dashed var(--mtm-line); padding-top: 10px; }
.mtm-quote-bar { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--mtm-text2); }
.mtm-quote-toggle { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 20px; border: 1px solid var(--mtm-line); border-radius: 10px; background: var(--mtm-card2); color: var(--mtm-text2); padding: 0; }
.mtm-quote-toggle:hover { border-color: var(--mtm-brand); color: var(--mtm-brand); }
.mtm-quote-drop { border: 0; background: none; color: var(--mtm-brand); font-size: 12.5px; padding: 2px 4px; }
.mtm-quote-drop:hover { text-decoration: underline; }
.mtm-quote .mtm-frame { margin-top: 10px; }

/* ---- the text area of the editor */
.mtm-editor-host { flex: 1; display: flex; flex-direction: column; }
.ql-container.ql-snow { position: relative; flex: 1; display: flex; flex-direction: column; border: 0; font-family: var(--mtm-font); font-size: 15px; }
.ql-editor { flex: 1; min-height: 180px; padding: 18px 24px 28px; line-height: 1.7; color: var(--mtm-text); overflow-y: visible; caret-color: var(--mtm-brand); }
.ql-editor.ql-blank::before { font-style: normal; color: var(--mtm-text3); inset-inline: 24px; }
/* each paragraph goes right or left by the language typed in it, unless a direction was chosen for it */
.ql-editor > *, .ql-editor li { unicode-bidi: plaintext; text-align: start; }
.ql-editor > [style*="direction"], .ql-editor li[style*="direction"] { unicode-bidi: normal; }
.ql-editor p { margin: 0; }

/* ---- spelling check and word suggestions (lib/proof) ---- */
/* a word the dictionary does not know: drawn over the text, never stored in the message */
::highlight(spell) { text-decoration: underline wavy #E5252A; }
/* English: the rest of the word in grey after the cursor; Tab takes it */
.ghost-word { position: fixed; z-index: 1700; display: flex; align-items: center; gap: 6px; white-space: pre; color: var(--mtm-text3); cursor: pointer; user-select: none; }
.ghost-word[hidden], .sug-bar[hidden] { display: none; }
.ghost-word.chip { padding: 3px 8px; border-radius: 6px; background: var(--mtm-card); box-shadow: var(--mtm-shadow-lg); color: var(--mtm-text); }
.ghost-word kbd, .sug-bar kbd { font: 600 10px/15px var(--mtm-font); padding: 0 5px; border: 1px solid var(--mtm-line); border-radius: 4px; background: var(--mtm-card2); color: var(--mtm-text3); }
/* Arabic: whole words on small buttons under the cursor; Tab takes the first */
.sug-bar { position: fixed; z-index: 1700; display: flex; gap: 4px; padding: 4px; max-width: calc(100vw - 8px); border-radius: 10px; background: var(--mtm-card); box-shadow: var(--mtm-shadow-lg); border: 1px solid var(--mtm-line-soft); user-select: none; }
.sug-bar button { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border: 0; border-radius: 7px; background: none; font: inherit; font-size: 16px; line-height: 1; color: var(--mtm-text); white-space: nowrap; cursor: pointer; }
.sug-bar button:hover { background: var(--mtm-hover); }
.sug-bar button.on { background: var(--mtm-brand-soft); color: var(--mtm-brand); font-weight: 600; }
/* the corrections of a red word (right-click) */
.mtm-sp-menu { position: fixed; z-index: 1710; min-width: 190px; max-width: min(320px, calc(100vw - 8px)); padding: 6px; border-radius: 10px; background: var(--mtm-card); border: 1px solid var(--mtm-line-soft); box-shadow: var(--mtm-shadow-lg); font: 14px/1.3 var(--mtm-font); color: var(--mtm-text); user-select: none; }
.mtm-sp-menu .head { padding: 4px 10px 8px; font-size: 12.5px; color: var(--mtm-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mtm-sp-menu .head bdi { color: var(--mtm-danger); font-weight: 600; }
.mtm-sp-menu hr { margin: 5px 4px; border: 0; border-top: 1px solid var(--mtm-line-soft); }
.mtm-sp-menu button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; font: inherit; color: inherit; text-align: start; cursor: pointer; }
.mtm-sp-menu button.fix { font-weight: 600; font-size: 15px; }
.mtm-sp-menu button:hover:not(:disabled) { background: var(--mtm-hover); }
.mtm-sp-menu button:disabled { color: var(--mtm-text3); cursor: default; }
@media (max-width: 700px) { .sug-bar button { height: 40px; padding: 0 14px; font-size: 17px; } }
.ql-editor h1 { font-size: 1.7em; font-weight: 700; line-height: 1.3; margin: .3em 0 .15em; }
.ql-editor h2 { font-size: 1.35em; font-weight: 700; line-height: 1.35; margin: .3em 0 .15em; }
.ql-editor h3 { font-size: 1.13em; font-weight: 700; margin: .3em 0 .1em; }
.ql-snow .ql-editor a { color: var(--mtm-brand); text-decoration: underline; text-underline-offset: 2px; }
.ql-snow .ql-editor blockquote { margin: 8px 0; padding: 8px 16px; border: 0; border-inline-start: 3px solid var(--mtm-brand); border-radius: 0 10px 10px 0; background: var(--mtm-brand-soft); color: var(--mtm-text2); }
html[dir="rtl"] .ql-snow .ql-editor blockquote { border-radius: 10px 0 0 10px; }
.ql-snow .ql-editor .ql-code-block-container { margin: 8px 0; padding: 12px 16px; border-radius: 10px; background: #1B1F27; color: #E6EDF3; font-family: "Cascadia Code", Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.6; direction: ltr; text-align: left; unicode-bidi: normal; }
.ql-editor img { max-width: 100%; height: auto; border-radius: 8px; }
.ql-editor ol { padding-left: 0; padding-right: 0; padding-inline-start: 1.6em; margin: 4px 0; }
.ql-editor li > .ql-ui::before { margin-left: 0; margin-right: 0; margin-inline-start: -1.6em; margin-inline-end: .35em; text-align: end; color: var(--mtm-text2); }
.ql-editor ::selection { background: color-mix(in srgb, var(--mtm-brand) 26%, transparent); }

/* ---- the format bar: a floating strip above the action row */
.mtm-fmt-dock { flex: none; display: flex; justify-content: center; padding: 6px 14px 2px; container-type: inline-size; }
.mtm-fmt-dock.is-hidden { display: none; }
.mtm-fmt.ql-toolbar.ql-snow { display: flex; flex-wrap: nowrap; align-items: center; justify-content: center; row-gap: 2px; max-width: 100%; padding: 5px 4px; border: 1px solid var(--mtm-line); border-radius: 14px; background: var(--mtm-card); box-shadow: 0 8px 24px rgba(0,0,0,.09), 0 1px 3px rgba(0,0,0,.06); font-family: var(--mtm-font); animation: mtm-rise .16s ease-out; }
html[data-theme="dark"] .mtm-fmt.ql-toolbar.ql-snow { background: var(--mtm-card2); box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.mtm-fmt.ql-toolbar.ql-snow::after { display: none; }
.mtm-fmt.ql-toolbar.ql-snow .ql-formats { display: inline-flex; align-items: center; gap: 1px; margin: 0; padding-inline: 5px; border-inline-end: 1px solid var(--mtm-line-soft); }
.mtm-fmt.ql-toolbar.ql-snow .ql-formats:last-child { border-inline-end: 0; }
.mtm-fmt.ql-toolbar.ql-snow button { display: inline-flex; align-items: center; justify-content: center; float: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--mtm-text2); transition: background .12s, color .12s; }
.mtm-fmt.ql-toolbar.ql-snow button svg, .mtm-bubble svg { float: none; width: 19px; height: 19px; fill: currentColor; }
.mtm-fmt.ql-toolbar.ql-snow button:hover { background: var(--mtm-hover); color: var(--mtm-text); }
.mtm-fmt.ql-toolbar.ql-snow button.ql-active { background: var(--mtm-brand-soft2); color: var(--mtm-brand); }
.mtm-fmt.ql-toolbar.ql-snow button:active { transform: scale(.94); }
html[dir="rtl"] .mtm-fmt .ql-indent svg, html[dir="rtl"] .mtm-fmt .ql-undo svg, html[dir="rtl"] .mtm-fmt .ql-redo svg { transform: scaleX(-1); }
.mtm-fmt .ql-direction svg:last-child { display: none; }
.mtm-fmt .ql-direction.ql-active svg:first-child { display: none; }
.mtm-fmt .ql-direction.ql-active svg:last-child { display: inline; }

.mtm-fmt.ql-toolbar.ql-snow .ql-picker { float: none; height: 32px; font-size: 13px; font-weight: 500; color: var(--mtm-text); }
.mtm-fmt.ql-toolbar.ql-snow .ql-picker-label { display: inline-flex; align-items: center; height: 32px; padding: 0 22px 0 10px; border: 0; border-radius: 8px; color: inherit; white-space: nowrap; overflow: hidden; transition: background .12s; }
html[dir="rtl"] .mtm-fmt.ql-toolbar.ql-snow .ql-picker-label { padding: 0 10px 0 22px; }
.mtm-fmt.ql-toolbar.ql-snow .ql-picker-label:hover, .mtm-fmt.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label { background: var(--mtm-hover); color: var(--mtm-text); border: 0; }
.mtm-fmt.ql-toolbar.ql-snow .ql-picker-label::before { line-height: 32px; overflow: hidden; text-overflow: ellipsis; }
.mtm-fmt.ql-toolbar.ql-snow .ql-picker:not(.ql-color-picker):not(.ql-icon-picker) svg { position: absolute; top: 50%; right: 3px; left: auto; margin-top: -9px; width: 18px; height: 18px; }
html[dir="rtl"] .mtm-fmt.ql-toolbar.ql-snow .ql-picker:not(.ql-color-picker):not(.ql-icon-picker) svg { right: auto; left: 3px; }
.mtm-fmt .ql-picker .ql-stroke { stroke: var(--mtm-text3); }
.mtm-fmt.ql-toolbar.ql-snow .ql-picker.ql-header { width: 112px; }
.mtm-fmt.ql-toolbar.ql-snow .ql-picker.ql-font { width: 124px; }
.mtm-fmt.ql-toolbar.ql-snow .ql-picker.ql-size { width: 66px; }
.mtm-fmt.ql-toolbar.ql-snow .ql-picker-options { top: auto; bottom: calc(100% + 10px); margin: 0; min-width: 100%; max-height: 290px; overflow-y: auto; padding: 6px; border: 1px solid var(--mtm-line); border-radius: 12px; background: var(--mtm-card); box-shadow: var(--mtm-shadow-lg); z-index: 40; }
.mtm-fmt.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options { top: auto; margin-top: 0; animation: mtm-rise .12s ease-out; }
.mtm-fmt.ql-toolbar.ql-snow .ql-picker-item { display: block; padding: 7px 10px; border-radius: 8px; color: var(--mtm-text); white-space: nowrap; }
.mtm-fmt.ql-toolbar.ql-snow .ql-picker-item:hover { background: var(--mtm-hover); color: var(--mtm-text); }
.mtm-fmt.ql-toolbar.ql-snow .ql-picker-item.ql-selected { background: var(--mtm-brand-soft); color: var(--mtm-brand); font-weight: 600; }
/* what the pickers show: paragraph styles and the default font are named in the language of the page */
.mtm-fmt .ql-picker.ql-header .ql-picker-label::before, .mtm-fmt .ql-picker.ql-header .ql-picker-item::before { content: var(--h0, "Normal") !important; font-size: 13px !important; font-weight: 500 !important; }
.mtm-fmt .ql-picker.ql-header .ql-picker-label[data-value="1"]::before, .mtm-fmt .ql-picker.ql-header .ql-picker-item[data-value="1"]::before { content: var(--h1, "Heading 1") !important; }
.mtm-fmt .ql-picker.ql-header .ql-picker-label[data-value="2"]::before, .mtm-fmt .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { content: var(--h2, "Heading 2") !important; }
.mtm-fmt .ql-picker.ql-header .ql-picker-label[data-value="3"]::before, .mtm-fmt .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { content: var(--h3, "Heading 3") !important; }
.mtm-fmt .ql-picker.ql-header .ql-picker-item[data-value="1"]::before { font-size: 18px !important; font-weight: 700 !important; }
.mtm-fmt .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { font-size: 16px !important; font-weight: 700 !important; }
.mtm-fmt .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { font-size: 14.5px !important; font-weight: 700 !important; }
.mtm-fmt .ql-picker.ql-font .ql-picker-label::before, .mtm-fmt .ql-picker.ql-font .ql-picker-item::before { content: var(--font, "Font") !important; }
.mtm-fmt .ql-picker.ql-size .ql-picker-label::before, .mtm-fmt .ql-picker.ql-size .ql-picker-item::before { content: "15px" !important; }
.mtm-fmt .ql-picker.ql-font .ql-picker-label[data-value]::before, .mtm-fmt .ql-picker.ql-font .ql-picker-item[data-value]::before,
.mtm-fmt .ql-picker.ql-size .ql-picker-label[data-value]::before, .mtm-fmt .ql-picker.ql-size .ql-picker-item[data-value]::before { content: attr(data-value) !important; }
.mtm-fmt .ql-picker.ql-font .ql-picker-item[data-value="Arial"]::before { font-family: Arial; }
.mtm-fmt .ql-picker.ql-font .ql-picker-item[data-value="Tahoma"]::before { font-family: Tahoma; }
.mtm-fmt .ql-picker.ql-font .ql-picker-item[data-value="Times New Roman"]::before { font-family: "Times New Roman"; }
.mtm-fmt .ql-picker.ql-font .ql-picker-item[data-value="Georgia"]::before { font-family: Georgia; }
.mtm-fmt .ql-picker.ql-font .ql-picker-item[data-value="Courier New"]::before { font-family: "Courier New"; }
.mtm-fmt .ql-picker.ql-font .ql-picker-item[data-value="Cairo"]::before { font-family: Cairo; }
.mtm-fmt .ql-picker.ql-font .ql-picker-item[data-value="IBM Plex Sans Arabic"]::before { font-family: "IBM Plex Sans Arabic"; }
/* colours: the letter with a bar in the colour in use; round swatches to pick from */
.mtm-fmt.ql-toolbar.ql-snow .ql-color-picker, .mtm-fmt.ql-toolbar.ql-snow .ql-icon-picker { width: 32px; }
.mtm-fmt.ql-toolbar.ql-snow .ql-color-picker .ql-picker-label, .mtm-fmt.ql-toolbar.ql-snow .ql-icon-picker .ql-picker-label { justify-content: center; width: 32px; padding: 0; color: var(--mtm-text2); }
.mtm-fmt.ql-toolbar.ql-snow .ql-color-picker .ql-picker-label svg, .mtm-fmt.ql-toolbar.ql-snow .ql-icon-picker .ql-picker-label svg { position: static; width: 19px; height: 19px; fill: currentColor; overflow: visible; }
.mtm-fmt .ql-color .ql-color-label { fill: var(--mtm-text); }
.mtm-fmt .ql-background .ql-color-label { fill: #EAA300; }
.mtm-fmt.ql-toolbar.ql-snow .ql-color-picker .ql-picker-options { width: 214px; min-width: 0; padding: 12px; }
.mtm-fmt.ql-toolbar.ql-snow .ql-color-picker.ql-expanded .ql-picker-options { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.mtm-fmt.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item { float: none; width: 24px; height: 24px; margin: 0; padding: 0; border: 1px solid rgba(0,0,0,.12); border-radius: 50%; transition: transform .1s; }
.mtm-fmt.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item:hover { transform: scale(1.18); border-color: rgba(0,0,0,.3); }
.mtm-fmt.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item.ql-selected { box-shadow: 0 0 0 2px var(--mtm-card), 0 0 0 4px var(--mtm-brand); }
.mtm-fmt.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item:not([data-value]) { background: linear-gradient(135deg, transparent 45%, #D13438 45%, #D13438 55%, transparent 55%), #fff; }
.mtm-fmt.ql-toolbar.ql-snow .ql-icon-picker .ql-picker-options { min-width: 0; padding: 4px; }
.mtm-fmt.ql-toolbar.ql-snow .ql-icon-picker.ql-expanded .ql-picker-options { display: flex; gap: 2px; }
.mtm-fmt.ql-toolbar.ql-snow .ql-icon-picker .ql-picker-item { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; color: var(--mtm-text2); }
.mtm-fmt.ql-toolbar.ql-snow .ql-icon-picker .ql-picker-item svg { width: 19px; height: 19px; fill: currentColor; }

/* the bar never wraps: as its room shrinks, the less used tools step aside (they stay reachable by keyboard and the selection bar) */
@container (max-width: 980px) {
    .mtm-fmt .ql-formats:nth-child(1), .mtm-fmt button.ql-strike, .mtm-fmt button.ql-code-block, .mtm-fmt button.ql-indent { display: none !important; }
    .mtm-fmt.ql-toolbar.ql-snow .ql-picker.ql-header { width: 100px; }
    .mtm-fmt.ql-toolbar.ql-snow .ql-picker.ql-font { width: 108px; }
}
@container (max-width: 750px) {
    .mtm-fmt .ql-picker.ql-header, .mtm-fmt .ql-picker.ql-font { display: none !important; }
}
@container (max-width: 540px) {
    .mtm-fmt .ql-formats:nth-child(2), .mtm-fmt .ql-picker.ql-align { display: none !important; }
}
@container (max-width: 430px) {
    .mtm-fmt button.ql-blockquote, .mtm-fmt button.ql-clean { display: none !important; }
}

/* ---- the small bar over selected text */
.mtm-bubble { position: absolute; z-index: 15; display: flex; gap: 1px; padding: 4px; border-radius: 12px; background: #2B2B2B; box-shadow: 0 10px 28px rgba(0,0,0,.3); animation: mtm-rise .12s ease-out; direction: ltr; }
.mtm-bubble[hidden] { display: none; }
.mtm-bubble button { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: none; color: #D6D6D6; }
.mtm-bubble svg { width: 18px; height: 18px; }
.mtm-bubble button:hover { background: rgba(255,255,255,.14); color: #fff; }
.mtm-bubble button.on { background: #479EF5; color: #0A1A28; }
html[data-theme="dark"] .mtm-bubble { background: #3D3D3D; }

/* ---- floating boxes: emoji, link */
.mtm-pop { position: fixed; z-index: 2000; background: var(--mtm-card); color: var(--mtm-text); border: 1px solid var(--mtm-line); border-radius: 14px; box-shadow: var(--mtm-shadow-lg); animation: mtm-rise .13s ease-out; font-family: var(--mtm-font); }
.mtm-emoji { display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; padding: 10px; max-height: 268px; overflow-y: auto; }
.mtm-emoji button { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 9px; background: none; font-size: 21px; line-height: 1; transition: transform .1s; }
.mtm-emoji button:hover { background: var(--mtm-hover); transform: scale(1.18); }
.mtm-linkbox { display: flex; flex-direction: column; gap: 10px; width: min(330px, calc(100vw - 16px)); padding: 14px; }
.mtm-linkbox label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--mtm-text2); }
.mtm-linkbox label[hidden] { display: none; }
.mtm-linkbox input { height: 36px; padding-inline: 10px; border: 1px solid var(--mtm-line); border-radius: 8px; background: var(--mtm-card2); color: var(--mtm-text); font-size: 14px; outline: 0; }
.mtm-linkbox input:focus { border-color: var(--mtm-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mtm-brand) 18%, transparent); }
.mtm-linkbox .row { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.mtm-linkbox .row span { flex: 1; }
.mtm-linkbox .row button { height: 32px; padding-inline: 14px; border: 1px solid var(--mtm-line); border-radius: 8px; background: var(--mtm-card); color: var(--mtm-text); font-size: 13px; font-weight: 600; }
.mtm-linkbox .row button:hover { background: var(--mtm-hover); }
.mtm-linkbox .row .ok { background: var(--mtm-brand); border-color: var(--mtm-brand); color: var(--mtm-on-brand); }
.mtm-linkbox .row .ok:hover { background: var(--mtm-brand-hover); }
.mtm-linkbox .row .rm { border-color: transparent; color: var(--mtm-danger); padding-inline: 6px; }
/* the note Quill shows on an existing link */
.ql-snow .ql-tooltip { z-index: 20; padding: 8px 14px; border: 1px solid var(--mtm-line); border-radius: 10px; background: var(--mtm-card); color: var(--mtm-text); box-shadow: var(--mtm-shadow-lg); font-family: var(--mtm-font); font-size: 13px; }
.ql-snow .ql-tooltip a { color: var(--mtm-brand); }
.ql-snow .ql-tooltip input[type=text] { height: 30px; border: 1px solid var(--mtm-line); border-radius: 6px; background: var(--mtm-card2); color: var(--mtm-text); }
html[lang="ar"] .ql-snow .ql-tooltip::before { content: "فتح الرابط:"; }
html[lang="ar"] .ql-snow .ql-tooltip[data-mode=link]::before { content: "الرابط:"; }
html[lang="ar"] .ql-snow .ql-tooltip a.ql-action::after { content: "تعديل"; }
html[lang="ar"] .ql-snow .ql-tooltip a.ql-remove::before { content: "إزالة"; }
html[lang="ar"] .ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: "حفظ"; }

/* ---- the action row: send and the tools */
.mtm-compose-foot { display: flex; align-items: center; gap: 3px; flex: none; padding: 8px 14px 12px; }
.mtm-send { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding-inline: 18px 20px; flex: none; border: 0; border-radius: 19px; background: linear-gradient(135deg, var(--mtm-brand-hover), var(--mtm-brand)); color: var(--mtm-on-brand); font-size: 14px; font-weight: 600; box-shadow: 0 4px 14px color-mix(in srgb, var(--mtm-brand) 38%, transparent); transition: transform .12s, box-shadow .12s; }
html:not([data-theme="dark"]) .mtm-send { background: linear-gradient(135deg, #1A82DB, #0F6CBD 60%, #0C5AA0); }
.mtm-send:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 7px 18px color-mix(in srgb, var(--mtm-brand) 46%, transparent); }
.mtm-send:active:not(:disabled) { transform: none; }
.mtm-send:disabled { opacity: .6; cursor: default; box-shadow: none; }
.mtm-foot-sep { width: 1px; height: 22px; margin-inline: 8px 5px; background: var(--mtm-line); flex: none; }
.mtm-tool { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--mtm-text2); cursor: pointer; transition: background .12s, color .12s; }
.mtm-tool .mud-icon-root { font-size: 21px; }
.mtm-tool:hover { background: var(--mtm-hover); color: var(--mtm-text); }
.mtm-tool:active { transform: scale(.94); }
.mtm-tool.on { background: var(--mtm-brand-soft2); color: var(--mtm-brand); }
.mtm-tool.is-high { background: color-mix(in srgb, var(--mtm-danger) 13%, transparent); color: var(--mtm-danger); }
.mtm-tool-danger:hover { background: color-mix(in srgb, var(--mtm-danger) 12%, transparent); color: var(--mtm-danger); }
.mtm-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
html[dir="rtl"] .mtm-flip { transform: scaleX(-1); }

/* ---- "drop files here" */
.mtm-drop { display: none; position: absolute; inset: 8px; z-index: 60; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 2px dashed var(--mtm-brand); border-radius: 16px; background: color-mix(in srgb, var(--mtm-brand-soft) 90%, transparent); color: var(--mtm-brand); font-size: 16px; font-weight: 600; backdrop-filter: blur(3px); }
.mtm-compose.is-dropping .mtm-drop { display: flex; }
.mtm-drop .mud-icon-root { font-size: 46px; }
.mtm-drop-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: copy; }

/* ---- the small editor of the signature */
.mtm-rich { display: flex; flex-direction: column; border: 1px solid var(--mtm-line); border-radius: 10px; background: var(--mtm-card); transition: border-color .15s, box-shadow .15s; }
.mtm-rich:focus-within { border-color: var(--mtm-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mtm-brand) 16%, transparent); }
.mtm-fmt-mini.ql-toolbar.ql-snow { justify-content: flex-start; padding: 4px; border: 0; border-bottom: 1px solid var(--mtm-line-soft); border-radius: 10px 10px 0 0; box-shadow: none; animation: none; }
html[data-theme="dark"] .mtm-fmt-mini.ql-toolbar.ql-snow { background: var(--mtm-card); box-shadow: none; }
.mtm-fmt-mini.ql-toolbar.ql-snow .ql-picker-options { bottom: auto; top: calc(100% + 8px); }
.mtm-fmt-mini.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options { top: calc(100% + 8px); }
.mtm-rich-small .ql-editor { min-height: 110px; max-height: 220px; overflow-y: auto; padding: 12px 14px; }
.mtm-rich-small .ql-editor.ql-blank::before { inset-inline: 14px; }
.mtm-rich .mtm-plain-editor { min-height: 120px; }

.mtm-fab { display: none; }

/* ====================================================================== settings */
.mtm-settings-dialog { overflow: hidden; }
.mtm-settings-content { padding: 0 !important; margin: 0 !important; }
.mtm-settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: min(560px, 74vh); max-height: 80vh; }
.mtm-settings-nav { background: var(--mtm-card2); border-inline-end: 1px solid var(--mtm-line-soft); padding: 18px 10px; display: flex; flex-direction: column; gap: 2px; }
.mtm-settings-nav h2 { margin: 0 8px 12px; font-size: 18px; font-weight: 600; }
.mtm-settings-nav button { display: flex; align-items: center; justify-content: flex-start; flex: none; gap: 10px; height: 38px; padding-inline: 10px; border: 0; border-radius: 6px; background: none; font-size: 14px; color: var(--mtm-text); text-align: start; }
.mtm-settings-nav button:hover { background: var(--mtm-hover); }
.mtm-settings-nav button.is-active { background: var(--mtm-brand-soft2); font-weight: 600; }
.mtm-settings-nav button .mud-icon-root { color: var(--mtm-text2); }
.mtm-settings-nav button.is-active .mud-icon-root { color: var(--mtm-brand); }
.mtm-settings-body { position: relative; padding: 20px 26px 26px; overflow-y: auto; }
.mtm-settings-close { position: absolute; top: 12px; inset-inline-end: 12px; }
.mtm-settings-body h3 { margin: 0 0 18px; font-size: 19px; font-weight: 600; }
.mtm-settings-body h4 { margin: 22px 0 10px; font-size: 15px; font-weight: 600; }
.mtm-set { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; max-width: 520px; }
.mtm-set > label { font-size: 13px; font-weight: 600; color: var(--mtm-text2); }
.mtm-set-wide { max-width: 620px; gap: 12px; }
.mtm-set-note { margin: -8px 0 16px; color: var(--mtm-text2); font-size: 13px; line-height: 1.6; }
.mtm-set-actions { display: flex; gap: 8px; align-items: center; }
.mtm-seg { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--mtm-line); border-radius: 6px; overflow: hidden; align-self: flex-start; }
.mtm-seg button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding-inline: 16px; border: 0; background: var(--mtm-card); font-size: 13.5px; color: var(--mtm-text); border-inline-end: 1px solid var(--mtm-line); }
.mtm-seg button:last-child { border-inline-end: 0; }
.mtm-seg button:hover { background: var(--mtm-hover); }
.mtm-seg button.on { background: var(--mtm-brand); color: var(--mtm-on-brand); font-weight: 600; }
.mtm-accounts { display: flex; flex-direction: column; gap: 8px; max-width: 620px; }
.mtm-account { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--mtm-line); border-radius: 8px; background: var(--mtm-card); }
.mtm-account-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mtm-account-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; text-align: start; }
html[dir="rtl"] .mtm-account-text strong { text-align: right; }
.mtm-account-text small { font-size: 12.5px; color: var(--mtm-text2); }
.mtm-account-form { display: flex; flex-direction: column; gap: 12px; max-width: 620px; }
.mtm-account-form h4 { margin: 0 0 4px; }
.mtm-server { display: grid; grid-template-columns: minmax(0, 1fr) 96px 150px; gap: 10px; }
.mtm-profile-card { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.mtm-profile-card div { display: flex; flex-direction: column; }
.mtm-profile-card strong { font-size: 16px; }
.mtm-profile-card span { color: var(--mtm-text2); font-size: 13px; }

/* ====================================================================== sign-in and sign-up (plain pages) */
.mtm-auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: #F5F7FA; color: #242424; }
.mtm-auth-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 34px 44px; color: #fff; background: linear-gradient(145deg, #0F6CBD 0%, #0A4A85 55%, #0C2F57 100%); }
.mtm-auth-brand::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1.4px); background-size: 22px 22px; mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); pointer-events: none; }
.mtm-auth-glow { position: absolute; border-radius: 50%; filter: blur(70px); pointer-events: none; }
.mtm-auth-glow.g1 { width: 380px; height: 380px; background: #28A8EA; opacity: .55; top: -120px; inset-inline-end: -90px; }
.mtm-auth-glow.g2 { width: 320px; height: 320px; background: #8764B8; opacity: .45; bottom: -110px; inset-inline-start: -80px; }
.mtm-auth-brand > :not(.mtm-auth-glow) { position: relative; z-index: 1; }
.mtm-auth-brand-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mtm-auth-logo { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; padding-inline: 10px 16px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); backdrop-filter: blur(8px); font-size: 18px; font-weight: 500; letter-spacing: .01em; }
.mtm-auth-logo svg { width: 30px; height: 30px; }
.mtm-auth-logo b { font-weight: 700; }
.mtm-auth-lang { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding-inline: 12px 14px; border-radius: 999px; color: #fff; text-decoration: none; font-size: 13.5px; font-weight: 600; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); }
.mtm-auth-lang:hover { background: rgba(255,255,255,.2); }
.mtm-auth-lang svg { width: 18px; height: 18px; }
.mtm-auth-pitch { margin-block: auto; padding-block: 36px; max-width: 560px; }
.mtm-auth-pitch h1 { margin: 0 0 14px; font-size: clamp(28px, 3.1vw, 42px); line-height: 1.3; font-weight: 700; }
.mtm-auth-pitch h1 span { background: linear-gradient(90deg, #9FD8FF, #D3C2FF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mtm-auth-pitch p { margin: 0 0 28px; font-size: 16px; line-height: 1.8; color: rgba(255,255,255,.86); max-width: 500px; }
.mtm-auth-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mtm-auth-tiles > div { display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; align-items: center; padding: 14px 16px; border-radius: 14px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(8px); }
.mtm-auth-tiles svg { grid-row: span 2; width: 30px; height: 30px; padding: 5px; border-radius: 9px; background: rgba(255,255,255,.16); }
.mtm-auth-tiles b { font-size: 14.5px; font-weight: 600; }
.mtm-auth-tiles span { font-size: 12.5px; color: rgba(255,255,255,.78); }
.mtm-auth-foot { font-size: 12.5px; color: rgba(255,255,255,.6); }
.mtm-auth-side { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.mtm-auth-card { width: 100%; max-width: 420px; padding: 36px 34px 30px; border-radius: 20px; background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 18px 48px rgba(16,24,40,.1); }
.mtm-auth-card h2 { margin: 0 0 6px; font-size: 26px; font-weight: 700; color: #1B1B1B; }
.mtm-auth-sub { margin: 0 0 22px; color: #616161; font-size: 14.5px; line-height: 1.7; }
.mtm-auth-alert { margin-bottom: 16px; padding: 11px 14px; border-radius: 10px; background: #FDE7E9; color: #A4262C; font-size: 14px; line-height: 1.6; }
.mtm-auth-alert.warn { background: #FFF4CE; color: #835C00; }
.mtm-auth-form { display: flex; flex-direction: column; gap: 12px; }
/* MudBlazor fields, fitted to the card: rounder, a little taller, white inside */
.mtm-auth-form .mud-input-control { margin: 0; }
.mtm-auth-form .mud-input.mud-input-outlined { background: #fff; border-radius: 10px; font-size: 14px; }
.mtm-auth-form .mud-input-outlined-border { border-radius: 10px; border-color: #D1D1D1; }
.mtm-auth-form .mud-input.mud-input-outlined:hover .mud-input-outlined-border { border-color: #8A8A8A; }
.mtm-auth-form .mud-input.mud-input-outlined.mud-focused .mud-input-outlined-border, .mtm-auth-form .mud-input.mud-input-outlined:focus-within .mud-input-outlined-border { border-color: #0F6CBD; border-width: 2px; box-shadow: 0 0 0 4px rgba(15,108,189,.12); }
.mtm-auth-form .mud-input-label { color: #616161; }
.mtm-auth-form .mud-input-adornment .mud-icon-root, .mtm-auth-form .mud-input-adornment .mud-icon-button { color: #8A8A8A; }
.mtm-auth-form .mud-input-adornment .mud-typography { color: #424242; font-weight: 600; direction: ltr; }
.mtm-auth-form .mud-input-helper-text { margin-top: 5px; color: #8A8A8A; font-size: 12.5px; }
/* the address field runs left to right as a whole (icon first); the password only types left to right, its eye stays at the end */
.mtm-auth-form .mtm-ltr-field .mud-input { direction: ltr; }
.mtm-auth-form .mtm-ltr-field { direction: ltr; }
/* its label sits on the left too, over the gap in the border (MudBlazor would keep it on the right inside an Arabic page) */
.mtm-auth-form .mtm-ltr-field .mud-input-label { left: 0 !important; right: auto !important; transform-origin: top left !important; transform: translate(14px, -6px) scale(.75) !important; }
.mtm-auth-btn { display: inline-flex; align-items: center; justify-content: center; margin-top: 8px; height: 42px; padding-inline: 22px; border: 0; border-radius: 12px; background: linear-gradient(135deg, #1479D0, #0F6CBD 55%, #0C5AA0); color: #fff; font-size: 16px; font-weight: 600; text-decoration: none; box-shadow: 0 8px 20px rgba(15,108,189,.28); transition: transform .12s, box-shadow .12s; }
.mtm-auth-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(15,108,189,.34); }
.mtm-auth-alt { margin: 22px 0 0; text-align: center; color: #616161; font-size: 14px; }
.mtm-auth-alt a { color: #0F6CBD; font-weight: 600; text-decoration: none; }
.mtm-auth-alt a:hover { text-decoration: underline; }
.mtm-plain { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; background: #F5F7FA; color: #242424; }
.mtm-plain-code { font-size: 72px; font-weight: 700; color: #0F6CBD; line-height: 1; }
.mtm-plain h1 { margin: 12px 0 6px; font-size: 24px; }
.mtm-plain p { margin: 0; color: #616161; }

@media (max-width: 900px) {
    .mtm-auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .mtm-auth-brand { padding: 18px 18px 22px; justify-content: flex-start; }
    .mtm-auth-pitch { padding-block: 22px 0; margin-block: 0; }
    .mtm-auth-pitch h1 { font-size: 24px; margin-bottom: 6px; }
    .mtm-auth-pitch p { font-size: 14px; margin: 0; }
    .mtm-auth-tiles, .mtm-auth-foot { display: none; }
    .mtm-auth-side { align-items: flex-start; padding: 18px 14px 28px; }
    .mtm-auth-card { padding: 26px 20px 22px; border-radius: 16px; }
}

/* ====================================================================== phones and narrow windows: one pane at a time */
@media (max-width: 900px) {
    .mtm-only-narrow { display: inline-flex; }
    .mtm-hide-narrow { display: none !important; }
    .mtm-brand span { display: none; }
    .mtm-brand { padding-inline: 2px 4px; }
    .mtm-top { gap: 4px; padding-inline: 4px 6px; }
    .mtm-top-actions .mtm-lang-btn { display: none; }
    .mtm-body { flex-direction: column-reverse; }
    .mtm-rail { width: 100%; height: 56px; flex-direction: row; justify-content: space-around; padding: 0 6px env(safe-area-inset-bottom); background: var(--mtm-card); border-top: 1px solid var(--mtm-line); gap: 0; }
    .mtm-rail .mud-tooltip-root { flex: 1; display: flex; justify-content: center; }
    .mtm-rail-item { width: 100%; max-width: 96px; height: 50px; flex-direction: column; gap: 1px; border-radius: 8px; }
    .mtm-rail-item.is-active { background: none; box-shadow: none; }
    .mtm-rail-item.is-active::before { display: none; }
    .mtm-rail-label { display: block; font-size: 11px; font-weight: 600; }
    .mtm-rail-badge { top: 2px; inset-inline-end: calc(50% - 22px); }

    .mtm-mail { padding: 0; gap: 0; }
    .mtm-cmd { border-radius: 0; box-shadow: none; border-bottom: 1px solid var(--mtm-line-soft); padding-inline: 4px; }
    .mtm-cmd:not(:has(button)) { display: none; }
    .mtm-cmd-btn > span { display: none; }
    .mtm-cmd-btn { padding-inline: 9px; height: 38px; }
    .is-composing .mtm-cmd { display: none; }
    .mtm-panes, .no-folders .mtm-panes, .pane-off .mtm-panes, .pane-bottom .mtm-panes { display: block; position: relative; }
    .mtm-list, .mtm-reading { height: 100%; border-radius: 0; box-shadow: none; }
    .has-item .mtm-list { display: none; }
    .mtm-mail:not(.has-item) .mtm-reading { display: none; }
    .mtm-scrim { display: block; position: fixed; inset: 48px 0 0; z-index: 40; background: rgba(0,0,0,.4); }
    .mtm-folders, .no-folders .mtm-folders { display: flex; position: fixed; top: 48px; bottom: 0; inset-inline-start: 0; z-index: 41; width: min(84vw, 320px); background: var(--mtm-card); box-shadow: var(--mtm-shadow-lg); transform: translateX(-105%); transition: transform .2s ease; }
    html[dir="rtl"] .mtm-folders { transform: translateX(105%); }
    .mtm-folders.is-open, html[dir="rtl"] .mtm-folders.is-open { transform: none; }
    .mtm-folders-scroll { padding: 12px 8px 20px; }
    .mtm-newmail { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 40px; margin-bottom: 12px; border: 0; border-radius: 8px; background: var(--mtm-brand); color: var(--mtm-on-brand); font-weight: 600; }
    .mtm-folder, .mtm-fgroup-head { height: 42px; font-size: 14.5px; }
    .mtm-folder-more { display: inline-flex; }
    .mtm-folder .mtm-folder-count { display: inline !important; }
    .mtm-row-lead .mtm-tick { opacity: 0; }
    .mtm-row { padding-block: 11px; }
    .mtm-read { padding: 10px 8px 24px; }
    .mtm-read-head h1 { font-size: 18px; }
    .mtm-read-card { padding: 12px 12px 14px; }
    .mtm-read-date { display: none; }
    .mtm-read-meta { gap: 10px; }
    .mtm-fab { position: fixed; bottom: calc(72px + env(safe-area-inset-bottom)); inset-inline-end: 16px; z-index: 20; display: inline-flex; align-items: center; gap: 8px; height: 52px; padding-inline: 18px 20px; border: 0; border-radius: 26px; background: var(--mtm-brand); color: var(--mtm-on-brand); font-weight: 600; font-size: 15px; box-shadow: 0 6px 18px rgba(0,0,0,.28); }
    .mtm-settings { grid-template-columns: minmax(0, 1fr); max-height: 86vh; }
    .mtm-settings-nav { flex-direction: row; overflow-x: auto; padding: 10px; border-inline-end: 0; border-bottom: 1px solid var(--mtm-line-soft); scrollbar-width: none; }
    .mtm-settings-nav h2 { display: none; }
    .mtm-settings-nav button { flex: none; height: 34px; }
    .mtm-settings-body { padding: 16px 16px 22px; }
    .mtm-settings-close { top: 6px; inset-inline-end: 6px; position: fixed; display: none; }
    .mtm-server { grid-template-columns: minmax(0, 1fr) 84px; }
    .mtm-server > :first-child { grid-column: 1 / -1; }
}


/* ====================================================================== dialogs with forms */
.mtm-form { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.mtm-form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; }
.mtm-dialog-title { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; }
.mtm-dialog-title i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.mtm-colors { display: flex; gap: 10px; align-items: center; padding-inline: 4px; }
.mtm-colors button { width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--c); padding: 0; }
.mtm-colors button.on { box-shadow: 0 0 0 2px var(--mud-palette-surface), 0 0 0 4px var(--c); }

/* ====================================================================== calendar */
.mtm-cal, .mtm-people { height: 100%; display: flex; flex-direction: column; gap: 8px; padding: 8px; padding-inline-start: 0; }
.mtm-cal-today { height: 32px; padding-inline: 12px; border: 1px solid var(--mtm-line); border-radius: 6px; background: var(--mtm-card); font-weight: 600; font-size: 13.5px; flex: none; margin-inline-end: 4px; }
.mtm-cal-today:hover { background: var(--mtm-hover); }
.mtm-cal-title { font-size: 16px; font-weight: 600; margin-inline: 8px; white-space: nowrap; }
.mtm-seg-sm { flex: none; }
.mtm-seg-sm button { height: 30px; padding-inline: 12px; font-size: 13px; }
.mtm-cal-panes { flex: 1; min-height: 0; display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 8px; }
.mtm-cal-side { overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding-inline: 10px 2px; padding-top: 4px; }
.mtm-mini-head { display: flex; align-items: center; }
.mtm-mini-head strong { flex: 1; font-size: 13.5px; }
.mtm-mini-head .mtm-icon-btn { width: 26px; height: 26px; }
.mtm-mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; text-align: center; margin-top: 4px; }
.mtm-mini-dow { font-size: 11px; color: var(--mtm-text3); padding: 4px 0; }
.mtm-mini-grid button { aspect-ratio: 1; border: 0; background: none; border-radius: 50%; font-size: 12.5px; padding: 0; color: var(--mtm-text); }
.mtm-mini-grid button:hover { background: var(--mtm-press); }
.mtm-mini-grid button.off { color: var(--mtm-text3); }
.mtm-mini-grid button.sel { background: var(--mtm-brand-soft2); }
.mtm-mini-grid button.today { background: var(--mtm-brand); color: var(--mtm-on-brand); font-weight: 700; }
.mtm-agenda h3, .mtm-day-list h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--mtm-text2); }
.mtm-agenda-none { margin: 0; font-size: 13px; color: var(--mtm-text3); }
.mtm-agenda-item { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: start; border: 0; border-inline-start: 3px solid var(--c); border-radius: 6px; background: var(--mtm-card); box-shadow: var(--mtm-shadow); padding: 8px 10px; margin-bottom: 6px; }
.mtm-agenda-item:hover { background: var(--mtm-card2); }
.mtm-agenda-item b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-agenda-item small { font-size: 12px; color: var(--mtm-text2); }
.mtm-cal-main { background: var(--mtm-card); border-radius: var(--mtm-radius); box-shadow: var(--mtm-shadow); overflow: hidden; display: flex; flex-direction: column; min-height: 0; }

.mtm-month { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.mtm-month-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--mtm-line-soft); flex: none; }
.mtm-month-head span { padding: 8px 10px; font-size: 12.5px; font-weight: 600; color: var(--mtm-text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-month-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(0, 1fr)); }
.mtm-day { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: hidden; padding: 4px 4px 2px; border-inline-end: 1px solid var(--mtm-line-soft); border-bottom: 1px solid var(--mtm-line-soft); cursor: pointer; }
.mtm-day:nth-child(7n) { border-inline-end: 0; }
.mtm-day:hover { background: var(--mtm-hover); }
.mtm-day.weekend { background: color-mix(in srgb, var(--mtm-text3) 5%, transparent); }
.mtm-day.off .mtm-day-num { color: var(--mtm-text3); }
.mtm-day-num { align-self: flex-start; font-size: 12.5px; padding: 1px 7px; border-radius: 10px; white-space: nowrap; }
.mtm-day.today .mtm-day-num { background: var(--mtm-brand); color: var(--mtm-on-brand); font-weight: 700; }
.mtm-ev { --c: #0F6CBD; display: flex; align-items: center; gap: 5px; width: 100%; height: 20px; flex: none; padding: 0 6px; border: 0; border-inline-start: 3px solid var(--c); border-radius: 4px; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--mtm-text); font-size: 12px; text-align: start; overflow: hidden; white-space: nowrap; }
.mtm-ev:hover { background: color-mix(in srgb, var(--c) 28%, transparent); }
.mtm-ev.all { background: var(--c); color: #fff; border-inline-start: 0; }
.mtm-ev.all:hover { filter: brightness(1.08); }
.mtm-ev time { flex: none; font-size: 11px; color: var(--mtm-text2); }
.mtm-ev span { overflow: hidden; text-overflow: ellipsis; }
.mtm-ev-more { border: 0; background: none; padding: 0 6px; font-size: 11.5px; color: var(--mtm-text2); text-align: start; }
.mtm-ev-more:hover { color: var(--mtm-brand); }

.mtm-week { --days: 7; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.mtm-week-head, .mtm-week-allday, .mtm-week-body { display: grid; grid-template-columns: 58px repeat(var(--days), minmax(0, 1fr)); }
.mtm-week-head, .mtm-week-allday { flex: none; border-bottom: 1px solid var(--mtm-line-soft); padding-inline-end: 8px; }
.mtm-week-gutter { font-size: 10.5px; color: var(--mtm-text3); padding: 6px 2px; text-align: center; }
.mtm-week-day { display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 10px; border: 0; border-inline-start: 1px solid var(--mtm-line-soft); background: none; color: var(--mtm-text); }
.mtm-week-day:hover { background: var(--mtm-hover); }
.mtm-week-day small { font-size: 12px; color: var(--mtm-text2); }
.mtm-week-day b { font-size: 20px; font-weight: 600; line-height: 1.2; }
.mtm-week-day.today b, .mtm-week-day.today small { color: var(--mtm-brand); }
.mtm-week-allcell { display: flex; flex-direction: column; gap: 2px; min-height: 28px; padding: 3px; border-inline-start: 1px solid var(--mtm-line-soft); cursor: pointer; }
.mtm-week-scroll { flex: 1; min-height: 0; overflow-y: scroll; }
.mtm-week-body { position: relative; }
.mtm-week-hours span { display: block; height: 48px; font-size: 11px; color: var(--mtm-text3); text-align: center; transform: translateY(-7px); }
.mtm-week-col { position: relative; border-inline-start: 1px solid var(--mtm-line-soft); }
.mtm-week-col.today { background: color-mix(in srgb, var(--mtm-brand) 5%, transparent); }
.mtm-week-slot { height: 48px; border-bottom: 1px solid var(--mtm-line-soft); cursor: pointer; }
.mtm-week-slot:hover { background: var(--mtm-hover); }
.mtm-block { --c: #0F6CBD; position: absolute; display: flex; flex-direction: column; padding: 3px 6px; border: 0; border-inline-start: 3px solid var(--c); border-radius: 4px; background: color-mix(in srgb, var(--c) 20%, var(--mtm-card)); color: var(--mtm-text); font-size: 12px; text-align: start; overflow: hidden; z-index: 1; }
.mtm-block:hover { background: color-mix(in srgb, var(--c) 32%, var(--mtm-card)); z-index: 2; }
.mtm-block b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-block small { font-size: 11px; color: var(--mtm-text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-now { position: absolute; inset-inline: 0; height: 2px; background: #D13438; pointer-events: none; z-index: 3; }
.mtm-now::before { content: ""; position: absolute; inset-inline-start: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: #D13438; }
.mtm-day-list { padding: 12px 14px 96px; }

/* ====================================================================== people */
.mtm-people-panes { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 8px; }
.mtm-cmd-note { font-size: 12.5px; color: var(--mtm-text2); padding-inline: 8px; white-space: nowrap; }
.mtm-cmd-btn.is-star .mud-icon-root { color: #EAA300; }
.mtm-person-row { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--mtm-line-soft); color: var(--mtm-text); text-decoration: none; }
.mtm-person-row:hover { background: var(--mtm-hover); }
.mtm-person-row.is-active { background: var(--mtm-brand-soft2); }
.mtm-person-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mtm-person-text b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-person-text small { font-size: 12.5px; color: var(--mtm-text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtm-person-star { color: #EAA300; }
.mtm-contact { height: 100%; overflow-y: auto; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.mtm-contact > * { max-width: 720px; width: 100%; }
.mtm-contact-head { display: flex; align-items: center; gap: 22px; padding-bottom: 8px; }
.mtm-contact-head h1 { margin: 0; font-size: 24px; font-weight: 600; overflow-wrap: anywhere; }
.mtm-contact-head p { margin: 4px 0 0; color: var(--mtm-text2); }
.mtm-contact-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
a.mtm-pill-btn { text-decoration: none; }
.mtm-pill-primary { background: var(--mtm-brand); border-color: var(--mtm-brand); color: var(--mtm-on-brand); }
.mtm-pill-primary:hover { background: var(--mtm-brand-hover); border-color: var(--mtm-brand-hover); }
.mtm-pill-primary .mud-icon-root { color: inherit; }
.mtm-contact-card { background: var(--mtm-card); border-radius: var(--mtm-radius); box-shadow: var(--mtm-shadow); padding: 16px 18px; }
.mtm-contact-card h2 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.mtm-contact-field { display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.mtm-contact-field .mud-icon-root { color: var(--mtm-text2); }
.mtm-contact-field span { display: flex; flex-direction: column; min-width: 0; }
.mtm-contact-field small { font-size: 12px; color: var(--mtm-text2); }
.mtm-contact-field b { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; text-align: start; }
html[dir="rtl"] .mtm-contact-field b[dir="ltr"] { text-align: right; }
.mtm-contact-notes { margin: 0; white-space: pre-wrap; line-height: 1.7; }

/* ====================================================================== tasks */
.mtm-tasks { height: 100%; display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 8px; padding: 8px; padding-inline-start: 0; }
.mtm-tasks.has-item { grid-template-columns: 236px minmax(0, 1fr) 340px; }
.mtm-tasks-nav { display: flex; flex-direction: column; gap: 2px; padding-inline: 8px 2px; padding-top: 4px; }
.mtm-tasks-nav a { --c: #0F6CBD; display: flex; align-items: center; gap: 12px; height: 38px; padding-inline: 10px; border-radius: 6px; color: var(--mtm-text); text-decoration: none; font-size: 14px; }
.mtm-tasks-nav a .mud-icon-root { color: var(--c); }
.mtm-tasks-nav a:hover { background: var(--mtm-hover); }
.mtm-tasks-nav a.is-active { background: var(--mtm-brand-soft2); font-weight: 600; }
.mtm-tasks-nav em { margin-inline-start: auto; font-style: normal; font-size: 12.5px; color: var(--mtm-text2); }
.mtm-tasks-main { --c: #0F6CBD; background: var(--mtm-card); border-radius: var(--mtm-radius); box-shadow: var(--mtm-shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.mtm-tasks-head { display: flex; align-items: center; gap: 14px; padding: 20px 24px 12px; flex: none; }
.mtm-tasks-head > .mud-icon-root { font-size: 30px; color: var(--c); }
.mtm-tasks-head h1 { margin: 0; font-size: 22px; font-weight: 700; color: var(--c); }
.mtm-tasks-head p { margin: 2px 0 0; font-size: 13px; color: var(--mtm-text2); }
html[data-theme="dark"] .mtm-tasks-head h1, html[data-theme="dark"] .mtm-tasks-head > .mud-icon-root, html[data-theme="dark"] .mtm-tasks-nav a .mud-icon-root { color: color-mix(in srgb, var(--c) 55%, #fff); }
.mtm-task-add { display: flex; align-items: center; gap: 10px; flex: none; height: 46px; margin: 4px 20px 10px; padding-inline: 14px; border: 1px solid var(--mtm-line-soft); border-radius: 8px; background: var(--mtm-card2); }
.mtm-task-add:focus-within { border-color: var(--c); }
.mtm-task-add .mud-icon-root { color: var(--c); }
.mtm-task-add input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14.5px; }
.mtm-task-add button { border: 0; background: none; color: var(--mtm-brand); font-weight: 600; padding: 4px 8px; border-radius: 4px; }
.mtm-tasks-scroll { flex: 1; overflow-y: auto; padding: 0 20px 20px; }
.mtm-task { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 8px 12px; margin-bottom: 6px; border: 1px solid var(--mtm-line-soft); border-radius: 8px; background: var(--mtm-card); cursor: pointer; }
.mtm-task:hover { background: var(--mtm-hover); }
.mtm-task.is-active { background: var(--mtm-brand-soft); border-color: var(--mtm-brand-soft2); }
.mtm-task-check { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: none; padding: 0; border: 2px solid var(--c, var(--mtm-brand)); border-radius: 50%; background: none; color: transparent; }
.mtm-task-check .mud-icon-root { font-size: 15px; }
.mtm-task-check:hover { color: var(--c, var(--mtm-brand)); }
.mtm-task-check.on { background: var(--c, var(--mtm-brand)); color: #fff; }
.mtm-task-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mtm-task-text b { font-size: 14.5px; font-weight: 500; overflow-wrap: anywhere; }
.mtm-task.is-done .mtm-task-text b { text-decoration: line-through; color: var(--mtm-text3); }
.mtm-task-text small { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; font-size: 12px; color: var(--mtm-text2); }
.mtm-task-text small span { display: inline-flex; align-items: center; gap: 3px; }
.mtm-task-text small .mud-icon-root { font-size: 14px; }
.mtm-task-text small .is-late { color: var(--mtm-danger); }
.mtm-task-star { display: inline-flex; padding: 4px; border: 0; border-radius: 4px; background: none; color: var(--mtm-text3); flex: none; }
.mtm-task-star:hover { background: var(--mtm-press); }
.mtm-task-star.on { color: #EAA300; }
.mtm-task-done-head { display: flex; align-items: center; gap: 6px; padding: 10px 4px; border: 0; background: none; font-size: 13.5px; font-weight: 600; color: var(--mtm-text); }
.mtm-task-detail { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; padding: 14px; background: var(--mtm-card); border-radius: var(--mtm-radius); box-shadow: var(--mtm-shadow); }
.mtm-task-detail-head { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid var(--mtm-line-soft); border-radius: 8px; }
.mtm-task-detail-head .mtm-task-check { margin-top: 3px; }
.mtm-task-title { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: transparent; font-family: inherit; font-size: 16px; font-weight: 600; line-height: 1.4; }
.mtm-task-opt { display: flex; align-items: center; gap: 10px; min-height: 44px; padding-inline: 12px; border: 1px solid var(--mtm-line-soft); border-radius: 8px; background: var(--mtm-card); color: var(--mtm-text); font-size: 14px; text-align: start; }
button.mtm-task-opt:hover { background: var(--mtm-hover); }
.mtm-task-opt.on { color: var(--mtm-brand); font-weight: 600; }
.mtm-task-due { padding: 10px 0; border: 0; }
.mtm-task-due .mud-picker { width: 100%; }
.mtm-task-notes { flex: 1; min-height: 120px; padding: 12px; border: 1px solid var(--mtm-line-soft); border-radius: 8px; background: var(--mtm-card); outline: 0; resize: none; font-family: inherit; font-size: 14px; line-height: 1.6; }
.mtm-task-notes:focus, .mtm-task-detail-head:focus-within { border-color: var(--mtm-brand); }
.mtm-task-detail-foot { display: flex; align-items: center; justify-content: space-between; flex: none; }
.mtm-task-detail-foot small { color: var(--mtm-text3); font-size: 12px; }

/* icons that point somewhere (reply, forward, send) point the other way in Arabic */
html[dir="rtl"] .mtm-flip { transform: scaleX(-1); }
html[dir="rtl"] .mtm-flip-icon .mud-icon-root:first-child { transform: scaleX(-1); }
/* buttons centre their content by default; these are small cards whose lines fill the width */
.mtm-agenda-item, .mtm-block { align-items: stretch; }

@media (max-width: 900px) {
    .mtm-cal, .mtm-people { padding: 0; gap: 0; }
    .mtm-cal-panes { grid-template-columns: minmax(0, 1fr); }
    .mtm-cal-side { display: none; }
    .mtm-cal-main { border-radius: 0; box-shadow: none; overflow-y: auto; }
    .mtm-cal-title { font-size: 14px; margin-inline: 2px; }
    .mtm-month { flex: none; }
    .mtm-month-grid { flex: none; grid-template-rows: repeat(6, 62px); }
    .mtm-month-head span { padding: 6px 2px; text-align: center; }
    .mtm-day.sel { box-shadow: inset 0 0 0 2px var(--mtm-brand); }
    .mtm-ev { height: 15px; font-size: 10px; padding: 0 3px; border-inline-start-width: 2px; }
    .mtm-ev time { display: none; }
    .mtm-ev-more { font-size: 10px; padding: 0 2px; }
    .mtm-week-head, .mtm-week-allday, .mtm-week-body { grid-template-columns: 44px repeat(var(--days), minmax(0, 1fr)); }
    .mtm-week-day { align-items: center; padding: 4px 2px; }
    .mtm-week-day b { font-size: 15px; }
    .mtm-block small { display: none; }
    .mtm-people-panes { display: block; }
    .mtm-people-panes .mtm-list, .mtm-people-panes .mtm-reading { height: 100%; }
    .mtm-people.has-item .mtm-list, .mtm-people:not(.has-item) .mtm-reading { display: none; }
    .mtm-contact { padding: 18px 14px; }
    .mtm-contact-head { flex-direction: column; text-align: center; gap: 12px; }
    .mtm-contact-actions { justify-content: center; }
    .mtm-tasks, .mtm-tasks.has-item { display: flex; flex-direction: column; gap: 0; padding: 0; }
    .mtm-tasks-nav { flex-direction: row; flex: none; gap: 6px; padding: 8px; overflow-x: auto; scrollbar-width: none; }
    .mtm-tasks-nav a { flex: none; height: 34px; padding-inline: 12px; border: 1px solid var(--mtm-line); border-radius: 17px; gap: 6px; background: var(--mtm-card); }
    .mtm-tasks-nav em { margin-inline-start: 2px; }
    .mtm-tasks-main { flex: 1; border-radius: 0; box-shadow: none; }
    .mtm-tasks-head { padding: 12px 16px 6px; }
    .mtm-tasks-head h1 { font-size: 18px; }
    .mtm-tasks-head > .mud-icon-root { font-size: 24px; }
    .mtm-task-add { margin: 4px 12px 8px; }
    .mtm-tasks-scroll { padding: 0 12px 20px; }
    .mtm-task-detail { position: fixed; inset: 48px 0 56px; z-index: 30; border-radius: 0; }
    .mtm-form-row { grid-template-columns: minmax(0, 1fr); }
}

/* phones: the editor keeps the essentials in its format bar */
@media (max-width: 900px) {
    .mtm-compose-head { height: 48px; padding-inline: 6px 8px; gap: 8px; }
    .mtm-compose-fields { padding-inline: 14px; }
    .mtm-files-compose { padding-inline: 14px; }
    .mtm-subject { font-size: 17px; }
    .ql-editor { padding: 14px 16px 22px; }
    .ql-editor.ql-blank::before { inset-inline: 16px; }
    .mtm-plain-editor { padding: 14px 16px; }
    .mtm-quote { margin-inline: 14px; }
    .mtm-fmt-dock { padding: 4px 8px 0; }
    .mtm-compose-foot { padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); gap: 1px; }
    .mtm-foot-sep { margin-inline: 5px 2px; }
    .mtm-send { padding-inline: 14px 16px; }
    .mtm-emoji { grid-template-columns: repeat(7, 36px); }
}
