/* ================= تطبيق البريد ================= */
.mail{--acc:#0c5f6b;--acc2:#0c272c;--line:#e3e6e9;--muted:#6a737c;
  flex:1;min-height:0;display:grid;grid-template-columns:minmax(150px,17%) minmax(220px,31%) 1fr;
  font-size:max(11px,1.08cqw);background:#fff;color:#1b1f23;line-height:1.6}
.mail svg{fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.addr{direction:ltr;unicode-bidi:isolate}

/* الشريط الجانبي */
.m-side{background:#f3f5f6;border-inline-end:1px solid var(--line);padding:1.1em .8em;display:flex;flex-direction:column;gap:1em;min-width:0}
.m-acct{display:flex;flex-direction:column;padding:0 .3em;min-width:0}
.m-acct b{font-size:.95em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.m-acct span{font-size:.82em;color:var(--muted);direction:ltr;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.m-folders{display:flex;flex-direction:column;gap:.2em}
.m-folders button{display:flex;align-items:center;gap:.6em;border:0;background:none;border-radius:8px;padding:.55em .7em;cursor:pointer;
  font:500 1em var(--font);color:#2c3339;text-align:start}
.m-folders button svg{width:1.2em;height:1.2em;flex:none;color:#5d6a74}
.m-folders button:hover{background:#e8ecee}
.m-folders button.on{background:#dcebed;color:var(--acc2);font-weight:600}
.m-folders button.on svg{color:var(--acc)}
.m-folders em{margin-inline-start:auto;font-style:normal;font-weight:700;color:var(--acc);font-size:.9em}

/* القائمة */
.m-list{display:flex;flex-direction:column;min-width:0;min-height:0;border-inline-end:1px solid var(--line)}
.m-search{display:flex;align-items:center;gap:.5em;margin:.8em .8em .4em;padding:0 .7em;height:2.4em;border-radius:9px;background:#f0f2f4;border:1px solid transparent}
.m-search:focus-within{border-color:#b8d6da;background:#fff}
.m-search svg{width:1.1em;height:1.1em;color:#7b858e;flex:none}
.m-search input{flex:1;min-width:0;border:0;background:none;outline:0;font:inherit;color:inherit}
.m-list-head{padding:.3em 1em .5em;font-weight:700;font-size:1.05em;border-bottom:1px solid var(--line)}
.m-items{flex:1;overflow:auto}
.m-item{display:flex;gap:.7em;width:100%;text-align:start;border:0;border-bottom:1px solid #eef0f2;background:#fff;padding:.75em .9em;cursor:pointer;
  font:inherit;color:inherit;position:relative}
.m-item:hover{background:#f6f9fa}
.m-item.on{background:#e6f1f2}
.m-item.unread::before{content:"";position:absolute;inset-inline-start:0;top:0;bottom:0;width:3px;background:var(--acc)}
.m-item.unread b,.m-item.unread .m-subj{font-weight:700;color:#0a1c20}
.m-meta{flex:1;min-width:0;display:flex;flex-direction:column}
.m-row{display:flex;align-items:center;gap:.4em}
.m-row b{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.m-row time{margin-inline-start:auto;font-size:.82em;color:var(--muted);white-space:nowrap}
.m-item.unread .m-row time{color:var(--acc);font-weight:600}
.m-cnt{font-style:normal;font-size:.75em;background:#e7ebee;color:#47535c;border-radius:6px;padding:0 .4em}
.m-subj{font-size:.93em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.m-prev{font-size:.85em;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.m-empty{padding:3em 1em;text-align:center;color:var(--muted)}
.m-av{flex:none;width:2.5em;height:2.5em;border-radius:50%;display:grid;place-items:center;color:#fff;font-weight:600;font-size:.92em}

/* القراءة */
.m-read{position:relative;min-width:0;min-height:0;display:flex;flex-direction:column;background:#fbfcfc;overflow:auto}
.m-blank{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.6em;color:#9aa3ab}
.m-blank svg{width:4em;height:4em;stroke-width:1.2}
.m-read-top{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:.8em;padding:.9em 1.4em;background:rgba(251,252,252,.94);
  backdrop-filter:blur(8px);border-bottom:1px solid var(--line)}
.m-read-top h2{flex:1;min-width:0;font-size:1.35em;font-weight:700;line-height:1.4}
.m-back{display:none;border:0;background:none;width:2em;height:2em;border-radius:8px;cursor:pointer;color:var(--acc)}
.m-back svg{width:1.4em;height:1.4em}
.m-act{display:flex;align-items:center;gap:.4em;border:1px solid #cfd8dc;background:#fff;border-radius:8px;padding:.4em .9em;cursor:pointer;font:500 .95em var(--font);color:#24313a}
.m-act:hover{background:#f0f5f6;border-color:#b5c7cb}
.m-act svg{width:1.1em;height:1.1em}
.m-thread{padding:1em 1.4em;display:flex;flex-direction:column;gap:.9em}
.m-msg{background:#fff;border:1px solid var(--line);border-radius:12px;padding:1em 1.2em;box-shadow:0 1px 2px rgba(0,0,0,.03)}
.m-msg.mine{background:#f5fafb;border-color:#d6e8ea}
.m-msg header{display:flex;align-items:flex-start;gap:.7em;margin-bottom:.8em}
.m-from{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.45}
.m-from b{font-weight:700}
.m-from .addr{font-size:.82em;color:var(--muted)}
.m-from .to{font-size:.82em;color:var(--muted)}
.m-msg time{font-size:.8em;color:var(--muted);white-space:nowrap}
.m-body{white-space:pre-wrap;word-wrap:break-word;font-size:1.02em;line-height:1.95;color:#20272d}
.m-body.nocopy{user-select:none;-webkit-user-select:none}

/* الكتابة */
.m-compose-slot{padding:0 1.4em 1.4em}
.m-compose{background:#fff;border:1px solid #c9dfe2;border-radius:12px;box-shadow:0 6px 24px rgba(12,39,44,.08);display:flex;flex-direction:column;overflow:hidden}
.m-compose.new{margin:1em 1.4em 1.4em;flex:1;min-height:60%}
.c-row{display:flex;align-items:center;gap:.8em;padding:.6em 1em;border-bottom:1px solid #eef1f3}
.c-row label{color:var(--muted);min-width:4.2em;font-size:.9em}
.c-row input{flex:1;min-width:0;border:0;outline:0;font:inherit;color:inherit;background:none}
.c-row input[dir=ltr]{text-align:right}
.chip{background:#e9f3f4;border-radius:999px;padding:.1em .8em;font-size:.92em}
.c-body{flex:1;min-height:9em;border:0;outline:0;resize:vertical;padding:1em;font:inherit;font-size:1.02em;line-height:1.9;color:inherit}
.m-compose.new .c-body{min-height:14em}
.c-foot{display:flex;align-items:center;gap:.8em;padding:.6em 1em;border-top:1px solid #eef1f3;background:#fafbfb}
.c-send{display:flex;align-items:center;gap:.5em;border:0;border-radius:8px;background:var(--acc2);color:#fff;padding:.5em 1.2em;cursor:pointer;font:600 1em var(--font)}
.c-send:hover{filter:brightness(1.15)}
.c-send svg{width:1.05em;height:1.05em;transform:scaleX(-1)}
.c-count{font-size:.82em;color:var(--muted)}
.c-discard{margin-inline-start:auto;border:0;background:none;color:#8a2c2c;cursor:pointer;font:500 .92em var(--font)}

/* الجوال: قائمة ثم رسالة */
@media (max-width:820px), (max-height:520px){
  .mail{grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr);font-size:14px}
  .mail.reading{grid-template-rows:minmax(0,1fr)}
  .m-side{flex-direction:row;align-items:center;gap:.6em;padding:.6em .8em;border:0;border-bottom:1px solid var(--line);overflow-x:auto}
  .m-acct{display:none}
  .m-folders{flex-direction:row}
  .m-folders button{white-space:nowrap}
  .mail .m-read{display:none}
  .mail.reading .m-list,.mail.reading .m-side{display:none}
  .mail.reading .m-read{display:flex}
  .m-back{display:grid;place-items:center}
  .m-read-top{padding:.7em .8em}
  .m-thread{padding:.8em}
  .m-compose-slot{padding:0 .8em 1em}
  .m-compose.new{margin:.8em}
}

.win,.notice,.lpill{color-scheme:light}
.lpill,.notice{color-scheme:dark}
.c-body,.c-row input,.m-search input{background:#fff!important;color:#1b1f23!important}
.m-search input{background:transparent!important}
