/* المراسلات الداخلية بنمط صندوق البريد (ألوان وتخطيط مستوحاة من Gmail).
   المكوّن: scripts/frontend/internal-correspondence-mail.jsx — يُربط عبر scripts/patch-internal-correspondence-mail.mjs. */
.bm-root, .bm-compose, .bm-modal, .bm-snackbar {
  --bm-bg: #f6f8fc;
  --bm-surface: #ffffff;
  --bm-ink: #1f1f1f;
  --bm-muted: #5e5e5e;
  --bm-subtle: #747775;
  --bm-line: #e0e3e7;
  --bm-hover: #e9eef6;
  --bm-active: #d3e3fd;
  --bm-active-ink: #041e49;
  --bm-primary: #0b57d0;
  --bm-primary-hover: #0842a0;
  --bm-compose: #c2e7ff;
  --bm-compose-ink: #001d35;
  --bm-read-row: #f2f6fc;
  --bm-checked-row: #c2dbff;
  --bm-star: #f4b400;
  --bm-danger: #b3261e;
  --bm-warn: #b06000;
  --bm-shadow-row: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
}
.bm-root {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 8px;
  min-height: calc(100vh - 210px);
  padding: 8px 8px 8px 12px;
  border-radius: 20px;
  background: var(--bm-bg);
  color: var(--bm-ink);
  position: relative;
  font-size: 14px;
}
.bm-root *, .bm-compose *, .bm-modal *, .bm-snackbar * { box-sizing: border-box; }
.bm-root button, .bm-compose button, .bm-modal button, .bm-snackbar button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; margin: 0; }
.bm-root button:disabled, .bm-compose button:disabled, .bm-modal button:disabled { cursor: default; opacity: .45; }
.bm-root input, .bm-root select, .bm-compose input, .bm-compose select, .bm-modal input, .bm-modal select { font: inherit; color: inherit; margin: 0; }

/* القائمة الجانبية */
.bm-sidebar { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 16px; min-width: 0; }
.bm-compose-btn {
  display: inline-flex; align-items: center; gap: 12px; align-self: flex-start;
  height: 56px; padding: 0 20px 0 24px; margin: 4px 8px 14px 0;
  border-radius: 16px; background: var(--bm-compose) !important; color: var(--bm-compose-ink) !important;
  font-weight: 600; font-size: 14px; transition: box-shadow .15s;
}
.bm-compose-btn:hover { box-shadow: 0 1px 3px 0 rgba(60, 64, 67, .3), 0 4px 8px 3px rgba(60, 64, 67, .15); }
.bm-folders { display: flex; flex-direction: column; }
.bm-folder {
  display: flex; align-items: center; gap: 16px; height: 32px; padding: 0 22px 0 12px;
  border-radius: 16px 0 0 16px; color: var(--bm-ink); text-align: right; font-size: 14px;
}
.bm-folder:hover { background: var(--bm-hover) !important; }
.bm-folder.is-active { background: var(--bm-active) !important; color: var(--bm-active-ink); font-weight: 700; }
.bm-folder.is-strong { font-weight: 700; }
.bm-folder svg { flex-shrink: 0; color: #444746; }
.bm-folder.is-active svg { color: var(--bm-active-ink); }
.bm-folder-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-folder-count { font-size: 12px; font-weight: 600; color: inherit; }
.bm-folder-count.is-alert { background: #fce8b2; color: #7a4100; border-radius: 10px; padding: 0 7px; line-height: 18px; }
.bm-side-heading { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px 4px 8px; font-size: 13px; font-weight: 600; color: var(--bm-ink); }
.bm-side-hint { margin: 0; padding: 2px 22px 6px 12px; font-size: 12px; color: var(--bm-subtle); }
.bm-label-dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; display: inline-block; }
.bm-backdrop { display: none; }

/* المنطقة الرئيسية */
.bm-main { display: flex; flex-direction: column; min-width: 0; gap: 8px; }
.bm-searchbar {
  position: relative; display: flex; align-items: center; gap: 4px; height: 48px; padding: 0 6px;
  border-radius: 24px; background: #eaf1fb; max-width: 720px; transition: background .15s, box-shadow .15s;
}
.bm-searchbar:focus-within { background: #fff; box-shadow: 0 1px 1px 0 rgba(65, 69, 73, .3), 0 1px 3px 1px rgba(65, 69, 73, .15); }
.bm-search-input { flex: 1; min-width: 0; height: 100%; border: 0 !important; outline: 0 !important; background: transparent !important; box-shadow: none !important; font-size: 16px !important; padding: 0 4px !important; }
.bm-menu-btn { display: none !important; }
.bm-filter-panel {
  position: absolute; top: calc(100% + 4px); right: 0; left: 0; z-index: 30;
  display: grid; gap: 12px; padding: 20px; border-radius: 8px; background: #fff;
  box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .12), 0 1px 5px 0 rgba(0, 0, 0, .2);
}
.bm-filter-actions { display: flex; justify-content: flex-end; gap: 8px; }
.bm-dot-count { position: absolute; top: 4px; left: 4px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--bm-primary); color: #fff; font-size: 10px; line-height: 16px; text-align: center; padding: 0 3px; }

.bm-banner {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px; border-radius: 12px;
  background: #fef7e0 !important; color: #7a4100 !important; text-align: right; font-weight: 500;
}
.bm-banner span { flex: 1; }

.bm-listwrap, .bm-thread { flex: 1; display: flex; flex-direction: column; min-height: 0; border-radius: 16px; background: var(--bm-surface); overflow: visible; }
.bm-toolbar { display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 4px 12px; border-bottom: 1px solid #f1f3f4; position: sticky; top: 0; z-index: 5; background: var(--bm-surface); border-radius: 16px 16px 0 0; }
.bm-toolbar-note { font-size: 13px; color: var(--bm-muted); margin-inline-start: 8px; }
.bm-actions { display: flex; align-items: center; gap: 2px; }
.bm-pager { margin-inline-start: auto; display: flex; align-items: center; gap: 2px; font-size: 12px; color: var(--bm-muted); }
.bm-pager span { padding: 0 8px; }

.bm-icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; color: #444746 !important; flex-shrink: 0; }
.bm-icon-btn:hover:not(:disabled) { background: rgba(68, 71, 70, .08) !important; }
.bm-icon-btn.is-on { color: var(--bm-primary) !important; background: #d3e3fd !important; }
.bm-icon-btn-sm { width: 30px; height: 30px; }

.bm-checkbox { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; margin: 0; cursor: pointer; flex-shrink: 0; }
.bm-checkbox:hover { background: rgba(68, 71, 70, .08); }
.bm-checkbox input, .bm-check input, .bm-menu-item input { width: 16px; height: 16px; accent-color: var(--bm-primary); cursor: pointer; margin: 0; }

/* قائمة الرسائل */
.bm-list { display: flex; flex-direction: column; }
.bm-row {
  position: relative; display: grid; grid-template-columns: 40px 32px minmax(120px, 200px) minmax(0, 1fr) auto;
  align-items: center; gap: 4px; min-height: 40px; padding: 0 8px 0 16px; cursor: pointer;
  background: var(--bm-read-row); border-bottom: 1px solid rgba(100, 121, 143, .12); color: var(--bm-ink);
}
.bm-row.is-unread { background: #fff; font-weight: 700; }
.bm-row.is-checked { background: var(--bm-checked-row); }
.bm-row:hover { box-shadow: var(--bm-shadow-row); z-index: 2; }
.bm-row:last-child { border-radius: 0 0 16px 16px; }
.bm-star { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; color: #8e918f !important; }
.bm-star:hover { background: rgba(68, 71, 70, .08) !important; }
.bm-star.is-on { color: var(--bm-star) !important; }
.bm-star.is-on svg { fill: currentColor; }
.bm-row-from { display: flex; align-items: center; gap: 4px; min-width: 0; padding-inline-end: 12px; }
.bm-row-from > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-row-count { font-size: 12px; font-weight: 400; color: var(--bm-muted); }
.bm-draft-word { color: #d93025; font-weight: 400; }
.bm-row-body { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; }
.bm-row-subject { flex-shrink: 0; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.bm-row-snippet { color: var(--bm-muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.bm-row-meta { display: flex; align-items: center; gap: 6px; padding-inline-start: 12px; font-size: 12px; white-space: nowrap; }
.bm-row.is-unread .bm-row-date { color: var(--bm-ink); }
.bm-row-date { color: var(--bm-muted); }
.bm-row-clip { color: var(--bm-subtle); }
.bm-row-hover { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); display: none; align-items: center; background: inherit; }
.bm-row:hover .bm-row-hover { display: flex; }
.bm-row:hover .bm-row-meta { visibility: hidden; }
.bm-row-hover .bm-icon-btn { width: 36px; height: 36px; }

.bm-chip {
  --chip: #5f6368;
  display: inline-flex; align-items: center; flex-shrink: 0; height: 20px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
  color: var(--chip); background: color-mix(in srgb, var(--chip) 14%, white); border: 1px solid color-mix(in srgb, var(--chip) 30%, white);
}
.bm-imp { display: inline-flex; align-items: center; flex-shrink: 0; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.bm-imp-urgent { background: #fce8e6; color: #c5221f; }
.bm-imp-important { background: #fef7e0; color: #b06000; }
.bm-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 320px; color: var(--bm-subtle); }
.bm-empty p { margin: 0; font-size: 15px; color: var(--bm-muted); }
.bm-empty-sm { min-height: 160px; }

/* المحادثة */
.bm-thread-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 20px 72px 8px 24px; }
.bm-thread-head h2 { margin: 0; font-size: 22px; font-weight: 400; line-height: 1.4; color: var(--bm-ink); }
.bm-thread-head .bm-star { margin-inline-start: auto; }
.bm-thread-ref { padding: 0 72px 8px 24px; font-size: 13px; color: var(--bm-muted); }
.bm-messages { display: flex; flex-direction: column; padding: 0 16px 0 24px; }
.bm-message { border-bottom: 1px solid #eceff1; }
.bm-message-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: start; gap: 12px; padding: 14px 0 10px; cursor: pointer; }
.bm-message-who { min-width: 0; line-height: 1.5; }
.bm-message-who strong { font-weight: 700; font-size: 14px; }
.bm-me { color: var(--bm-muted); font-size: 12px; }
.bm-message-to { display: flex; flex-direction: column; font-size: 12px; color: var(--bm-muted); }
.bm-message-snippet { font-size: 13px; color: var(--bm-muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bm-message-date { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--bm-muted); white-space: nowrap; padding-top: 2px; }
.bm-message-actions { display: flex; margin-top: -8px; }
.bm-message-body { padding: 0 52px 18px 0; }
.bm-content { font-size: 14px; line-height: 1.9; color: #222; overflow-wrap: anywhere; }
.bm-content p, .bm-content div { margin: 0; }
.bm-content ul, .bm-content ol { margin: 4px 0; padding-inline-start: 24px; }
.bm-content ul { list-style: disc; }
.bm-content ol { list-style: decimal; }
.bm-content a { color: var(--bm-primary); text-decoration: underline; }
.bm-content blockquote { margin: 8px 0; padding: 0 12px 0 0; border-right: 1px solid #ccc; color: #505050; }
.bm-attachments { margin-top: 16px; padding-top: 12px; border-top: 1px solid #eceff1; }
.bm-attachments-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.bm-attachment-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.bm-attachment { display: flex; align-items: center; gap: 8px; width: 200px; max-width: 100%; height: 48px; padding: 0 12px; border: 1px solid var(--bm-line); border-radius: 8px; color: var(--bm-ink) !important; text-decoration: none !important; font-size: 13px; }
.bm-attachment svg { color: #d93025; flex-shrink: 0; }
.bm-attachment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-attachment:hover { background: #f8f9fa; box-shadow: 0 1px 2px rgba(60, 64, 67, .2); }
.bm-receipts { margin-top: 14px; font-size: 12px; }
.bm-receipts ul { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--bm-line); border-radius: 8px; }
.bm-receipts li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 12px; border-bottom: 1px solid #f1f3f4; }
.bm-receipts li:last-child { border-bottom: 0; }
.bm-receipts li .is-read { color: #188038; }
.bm-reply-bar { display: flex; flex-wrap: wrap; gap: 12px; padding: 20px 76px 24px 24px; }
.bm-link { display: inline-flex; align-items: center; gap: 4px; color: var(--bm-primary) !important; font-size: 13px; padding: 2px 0; }
.bm-link:hover { text-decoration: underline; }

/* أزرار عامة */
.bm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 18px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.bm-btn-primary { background: var(--bm-primary) !important; color: #fff !important; }
.bm-btn-primary:hover:not(:disabled) { background: var(--bm-primary-hover) !important; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.bm-btn-ghost { color: var(--bm-primary) !important; }
.bm-btn-ghost:hover { background: rgba(11, 87, 208, .08) !important; }
.bm-btn-outline { border: 1px solid #747775 !important; color: #444746 !important; height: 40px; padding: 0 20px; }
.bm-btn-outline:hover { background: rgba(68, 71, 70, .08) !important; }
.bm-btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }

/* القوائم المنسدلة */
.bm-menu-anchor { position: relative; display: inline-flex; }
.bm-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 40; min-width: 220px; max-height: 360px; overflow-y: auto;
  padding: 8px 0; border-radius: 8px; background: #fff; color: var(--bm-ink); font-weight: 400;
  box-shadow: 0 4px 8px 3px rgba(60, 64, 67, .15), 0 1px 3px rgba(60, 64, 67, .3);
}
.bm-menu-up { top: auto; bottom: calc(100% + 6px); }
.bm-menu-templates { min-width: 280px; }
.bm-menu-title { padding: 4px 16px 8px; font-size: 12px; font-weight: 600; color: var(--bm-muted); }
.bm-menu-empty { padding: 4px 16px 8px; font-size: 12px; color: var(--bm-subtle); }
.bm-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 4px 16px; text-align: right; font-size: 14px; cursor: pointer; margin: 0; }
.bm-menu-item:hover { background: #f1f3f4 !important; }
.bm-menu-close { justify-content: center; color: var(--bm-primary) !important; font-weight: 600; }
.bm-menu-sep { height: 1px; margin: 6px 0; background: var(--bm-line); }
.bm-menu-input { display: block; width: calc(100% - 32px); margin: 0 16px 8px !important; height: 36px; padding: 0 8px; border: 1px solid var(--bm-line); border-radius: 6px; }
.bm-menu-wide { width: calc(100% - 32px); margin: 0 16px 4px; }
.bm-template-item { flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 16px; }
.bm-template-item small { color: var(--bm-muted); font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* نافذة الكتابة */
.bm-compose {
  position: fixed; bottom: 0; left: 24px; z-index: 9000; display: flex; flex-direction: column;
  width: 560px; max-width: calc(100vw - 16px); height: min(620px, calc(100vh - 80px));
  border-radius: 16px 16px 0 0; background: #fff; color: var(--bm-ink, #1f1f1f);
  box-shadow: 0 8px 10px 1px rgba(0, 0, 0, .14), 0 3px 14px 2px rgba(0, 0, 0, .12), 0 5px 5px -3px rgba(0, 0, 0, .2);
  font-size: 14px;
}
.bm-compose.is-min { height: auto; width: 320px; }
.bm-compose.is-max { left: 50%; bottom: 50%; transform: translate(-50%, 50%); width: min(1100px, calc(100vw - 48px)); height: min(820px, calc(100vh - 48px)); border-radius: 16px; }
.bm-compose-backdrop { position: fixed; inset: 0; z-index: 8999; background: rgba(0, 0, 0, .45); }
.bm-compose-head { display: flex; align-items: center; gap: 2px; height: 40px; padding: 0 16px 0 6px; border-radius: 16px 16px 0 0; background: #f2f6fc; cursor: default; }
.bm-compose.is-min .bm-compose-head { cursor: pointer; }
.bm-compose-title { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-compose-save { font-size: 12px; color: #5e5e5e; white-space: nowrap; margin-inline-end: 6px; }
.bm-compose-body { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 0 16px; }
.bm-compose-subject { height: 40px; border: 0 !important; border-bottom: 1px solid #f1f3f4 !important; outline: 0 !important; box-shadow: none !important; padding: 0 !important; background: transparent !important; font-size: 14px; }
.bm-compose-more { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f3f4; }
.bm-compose-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0; }
.bm-file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; height: 30px; padding: 0 6px 0 10px; border-radius: 6px; background: #f1f3f4; font-size: 13px; font-weight: 500; }
.bm-file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #0b57d0; }
.bm-file-chip button { display: inline-flex; color: #5e5e5e; }
.bm-compose-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 16px 14px; border-top: 1px solid #f1f3f4; }
.bm-compose-foot label { margin: 0; }
.bm-spacer { flex: 1; }
.bm-send-group { display: inline-flex; }
.bm-send { height: 36px; padding: 0 22px; background: #0b57d0 !important; color: #fff !important; font-weight: 600; border-radius: 0 18px 18px 0; }
.bm-send:hover:not(:disabled) { background: #0842a0 !important; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.bm-send-more { padding: 0 8px; border-radius: 18px 0 0 18px; border-right: 1px solid rgba(255, 255, 255, .35) !important; display: inline-flex; align-items: center; }
.bm-follow-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; background: #e8f0fe; color: #0b57d0; font-size: 12px; }

/* حقل المستلمين */
.bm-recipients { position: relative; display: flex; align-items: flex-start; gap: 8px; min-height: 40px; border-bottom: 1px solid #f1f3f4; padding: 4px 0; }
.bm-recipients-label { flex-shrink: 0; min-width: 40px; line-height: 32px; color: #5e5e5e; font-size: 14px; }
.bm-recipients-box { position: relative; flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.bm-recipients-box > input { flex: 1; min-width: 120px; height: 32px; border: 0 !important; outline: 0 !important; box-shadow: none !important; padding: 0 !important; background: transparent !important; }
.bm-person { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 8px; border: 1px solid #c4c7c5; border-radius: 13px; font-size: 13px; background: #fff; }
.bm-person button { display: inline-flex; color: #5e5e5e; border-radius: 50%; }
.bm-person button:hover { background: #e8eaed !important; }
.bm-cc-toggle { flex-shrink: 0; line-height: 32px; padding: 0; }
.bm-suggest { position: absolute; top: calc(100% + 2px); right: 0; z-index: 50; width: min(380px, 100%); max-height: 300px; overflow-y: auto; padding: 6px 0; border-radius: 8px; background: #fff; box-shadow: 0 4px 8px 3px rgba(60, 64, 67, .15), 0 1px 3px rgba(60, 64, 67, .3); }
.bm-suggest-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 14px; text-align: right; }
.bm-suggest-item:hover, .bm-suggest-item.is-active { background: #f1f3f4 !important; }
.bm-suggest-item small { margin-inline-start: auto; color: #5e5e5e; font-size: 11px; }
.bm-group-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #e8f0fe; color: #0b57d0; }
.bm-avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 50%; color: #fff; font-weight: 600; line-height: 1; letter-spacing: 0; user-select: none; }

/* المحرر */
.bm-editor { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.bm-editor-tools { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px 0; border-bottom: 1px solid #f1f3f4; }
.bm-editor-area { flex: 1; padding: 10px 2px; outline: 0; line-height: 1.9; font-size: 14px; overflow-wrap: anywhere; cursor: text; }
.bm-editor-area:empty::before { content: attr(data-placeholder); color: #8e918f; }
.bm-editor-area ul { list-style: disc; padding-inline-start: 24px; margin: 4px 0; }
.bm-editor-area ol { list-style: decimal; padding-inline-start: 24px; margin: 4px 0; }
.bm-editor-area a { color: #0b57d0; text-decoration: underline; }
.bm-editor-area blockquote { margin: 8px 0; padding: 0 12px 0 0; border-right: 1px solid #ccc; color: #505050; }
.bm-form .bm-editor { border: 1px solid #c4c7c5; border-radius: 8px; padding: 0 10px; }

/* الحقول */
.bm-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; }
.bm-field > span { font-size: 12px; font-weight: 600; color: #444746; }
.bm-field input, .bm-field select, .bm-label-add input {
  height: 38px; padding: 0 10px; border: 1px solid #c4c7c5; border-radius: 6px; background: #fff; outline: 0; width: 100%;
}
.bm-field input:focus, .bm-field select:focus, .bm-label-add input:focus { border-color: #0b57d0; box-shadow: 0 0 0 1px #0b57d0; }
.bm-field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.bm-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; margin: 0; }
.bm-hint { color: #5e5e5e; font-size: 12px; }

/* إشعار التراجع */
.bm-snackbar {
  position: fixed; bottom: 24px; left: 96px; z-index: 9001; display: flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 6px 8px 6px 16px; border-radius: 4px; background: #313033; color: #f4eff4;
  box-shadow: 0 3px 5px -1px rgba(0, 0, 0, .2), 0 6px 10px 0 rgba(0, 0, 0, .14); font-size: 14px;
}
.bm-snackbar span { padding-inline-end: 16px; }
.bm-snackbar button { color: #a8c7fa !important; font-weight: 600; padding: 8px 12px; border-radius: 4px; }
.bm-snackbar button:hover { background: rgba(168, 199, 250, .12) !important; }

/* نافذة الإعدادات */
.bm-modal-backdrop { position: fixed; inset: 0; z-index: 9002; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .45); }
.bm-modal { display: flex; flex-direction: column; width: min(860px, 100%); max-height: calc(100vh - 32px); border-radius: 16px; background: #fff; color: #1f1f1f; box-shadow: 0 24px 38px 3px rgba(0, 0, 0, .14), 0 9px 46px 8px rgba(0, 0, 0, .12); font-size: 14px; }
.bm-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px 6px 10px; }
.bm-modal-head h2 { margin: 0; font-size: 20px; font-weight: 500; }
.bm-tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid #e0e3e7; overflow-x: auto; }
.bm-tab { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border-bottom: 3px solid transparent !important; color: #444746 !important; font-weight: 500; white-space: nowrap; }
.bm-tab:hover { background: #f1f3f4 !important; }
.bm-tab.is-active { color: #0b57d0 !important; border-bottom-color: #0b57d0 !important; }
.bm-modal-body { flex: 1; overflow-y: auto; padding: 18px 20px 22px; }
.bm-tab-intro { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.bm-tab-intro p, .bm-tab-text { margin: 0; color: #5e5e5e; font-size: 13px; line-height: 1.7; flex: 1; min-width: 220px; }
.bm-form { display: flex; flex-direction: column; gap: 14px; }
.bm-form .bm-recipients { border: 1px solid #c4c7c5; border-radius: 8px; padding: 2px 10px; }
.bm-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.bm-cards { display: flex; flex-direction: column; gap: 8px; }
.bm-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid #e0e3e7; border-radius: 12px; }
.bm-card:hover { background: #f8fafd; }
.bm-card-row { justify-content: space-between; }
.bm-card-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bm-card-main strong { font-size: 14px; }
.bm-card-main span { font-size: 13px; color: #444746; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-card-main small { font-size: 12px; color: #747775; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-card-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.bm-count-pill { font-size: 12px; color: #444746; background: #f1f3f4; border-radius: 10px; padding: 2px 8px; margin-inline-end: 6px; }
.bm-variables { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 0; }
.bm-variables small { color: #5e5e5e; font-size: 12px; }
.bm-variable { height: 26px; padding: 0 10px !important; border-radius: 13px; background: #e8f0fe !important; color: #0b57d0 !important; font-size: 12px; font-weight: 600; }
.bm-variable:hover { background: #d3e3fd !important; }
.bm-preview { padding: 12px 14px; border-radius: 8px; background: #f8f9fa; }
.bm-preview small { display: block; margin-bottom: 4px; color: #747775; }
.bm-label-add { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bm-label-add input { flex: 1; min-width: 180px; width: auto; }
.bm-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.bm-swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff !important; box-shadow: 0 0 0 1px #c4c7c5; padding: 0 !important; }
.bm-swatch.is-on { box-shadow: 0 0 0 2px #1f1f1f; }
.bm-swatch-sm { width: 18px; height: 18px; }

/* الجوال */
@media (max-width: 900px) {
  .bm-root { grid-template-columns: minmax(0, 1fr); padding: 6px; border-radius: 14px; min-height: calc(100vh - 180px); }
  .bm-sidebar { position: fixed; top: 0; right: 0; bottom: 0; z-index: 8998; width: 272px; padding: 12px 0; background: #fff; overflow-y: auto; transform: translateX(105%); transition: transform .2s ease; box-shadow: 0 0 16px rgba(0, 0, 0, .2); }
  .bm-sidebar-open .bm-sidebar { transform: none; }
  .bm-sidebar-open .bm-backdrop { display: block; position: fixed; inset: 0; z-index: 8997; background: rgba(0, 0, 0, .35); }
  .bm-menu-btn { display: inline-flex !important; }
  .bm-searchbar { max-width: none; }
  .bm-row { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: 'check from meta' 'check body star'; row-gap: 0; padding: 8px 8px 8px 12px; }
  .bm-row > .bm-checkbox { grid-area: check; align-self: start; }
  .bm-row > .bm-star { grid-area: star; justify-self: end; }
  .bm-row-from { grid-area: from; }
  .bm-row-body { grid-area: body; flex-wrap: wrap; white-space: normal; row-gap: 2px; }
  .bm-row-subject { max-width: 100%; }
  .bm-row-snippet { display: block; width: 100%; white-space: nowrap; }
  .bm-row-meta { grid-area: meta; }
  .bm-row:hover .bm-row-hover { display: none; }
  .bm-row:hover .bm-row-meta { visibility: visible; }
  .bm-thread-head, .bm-thread-ref { padding-left: 16px; padding-right: 16px; }
  .bm-messages { padding: 0 12px; }
  .bm-message-head { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .bm-message-actions { grid-column: 2 / -1; justify-content: flex-start; margin-top: 0; }
  .bm-message-body { padding-right: 0; }
  .bm-reply-bar { padding: 16px; }
  .bm-pager span { display: none; }
  .bm-compose, .bm-compose.is-max { left: 0; right: 0; bottom: 0; transform: none; width: 100%; max-width: none; height: 100%; border-radius: 0; }
  .bm-compose.is-min { height: auto; width: 100%; }
  .bm-compose-head { border-radius: 0; }
  .bm-snackbar { right: 12px; left: 12px; bottom: 12px; }
}
