:root{
  --accent:#0E5E4E; --accent-dark:#0A4639; --accent-soft:#EEF3F1;
  --ink:#0F1B2D; --ink-2:#1F2A3A; --muted:#5B6676; --line:#D5DAE1; --line-soft:#EEF0F3;
  --ground:#F6F7F9; --card:#FFFFFF; --dot:#E8A33D; --ok:#1A7F4B;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{font-family:'Inter','Noto Sans Arabic',sans-serif;color:var(--ink);background:#E4E7EC;display:flex;justify-content:center;align-items:center;min-height:100vh}
a{color:var(--accent)} a:hover{color:var(--accent-dark)}
button{font-family:inherit;cursor:pointer}
input,textarea{font-family:inherit;color:var(--ink)}
input::placeholder,textarea::placeholder{color:#6B7684}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}

.phone{width:390px;height:844px;background:var(--card);border-radius:28px;overflow:hidden;position:relative;box-shadow:0 20px 60px rgba(15,27,45,.18)}
@media (max-width:480px){
  body{background:var(--card);display:block}
  .phone{width:100%;height:100vh;height:100dvh;border-radius:0;box-shadow:none}
}
.screen{position:absolute;inset:0;display:none;flex-direction:column}
.screen.active{display:flex}

/* shared */
.btn{height:54px;border-radius:14px;border:0;background:var(--accent);color:#fff;font-size:16px;font-weight:700;display:flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;width:100%}
.btn:hover{background:var(--accent-dark);color:#fff}
.btn-outline{background:transparent;border:1px solid var(--line);color:var(--ink);font-weight:600}
.btn-outline:hover{background:var(--ground);color:var(--ink)}
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:14px;font-weight:600}
.input{height:50px;border:1px solid var(--line);border-radius:12px;background:#fff;padding:0 14px;font-size:15px;width:100%}
.input:focus{outline:2px solid var(--accent);outline-offset:-1px;border-color:var(--accent)}
.icon-btn{width:44px;height:44px;border:0;background:transparent;color:var(--ink);border-radius:22px;display:flex;align-items:center;justify-content:center;text-decoration:none}
.icon-btn:hover{background:var(--ground);color:var(--ink)}
.logo{border-radius:12px;background:var(--accent);color:#fff;display:flex;align-items:center;justify-content:center}
.muted{color:var(--muted)}
.ltr{direction:ltr;unicode-bidi:isolate}
.avatar{width:44px;height:44px;flex:0 0 44px;border-radius:22px;color:#fff;display:flex;align-items:center;justify-content:center;font-size:17px;font-weight:700}

/* auth */
.auth{background:var(--ground);padding:56px 24px 32px;gap:28px;overflow-y:auto}
.auth h1{margin:0;font-size:28px;line-height:1.35}
.auth p{margin:0;font-size:15px;line-height:1.7;color:var(--muted)}
.auth form{display:flex;flex-direction:column;gap:16px;margin:0}
.addr{height:50px;border:2px solid var(--accent);border-radius:12px;background:#fff;display:flex;align-items:center;overflow:hidden;direction:ltr}
.addr input{flex:1;min-width:0;height:100%;border:0;background:transparent;padding:0 14px;font-size:15px;outline:none}
.addr span{height:100%;display:flex;align-items:center;padding:0 14px;background:var(--accent-soft);color:var(--accent);font-size:15px;font-weight:600}
.avail{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--ok)}
.check{display:flex;align-items:center;gap:10px;font-size:14px;color:var(--muted);min-height:44px}
.check input{width:20px;height:20px;accent-color:var(--accent);margin:0}
.auth-foot{margin-top:auto;display:flex;flex-direction:column;gap:16px}
.auth-foot .switch{text-align:center;font-size:14px;color:var(--muted)}
.auth-foot .switch a{font-weight:700;text-decoration:none}

/* inbox */
.inbox-head{padding:48px 20px 12px;display:flex;flex-direction:column;gap:14px}
.row-between{display:flex;align-items:center;justify-content:space-between;gap:8px}
.inbox-head h1{margin:0;font-size:26px}
.me{width:44px;height:44px;border-radius:22px;border:0;background:var(--accent);color:#fff;font-size:17px;font-weight:700}
.search{height:48px;border-radius:24px;background:#F0F2F5;display:flex;align-items:center;gap:10px;padding:0 16px;color:var(--muted)}
.search input{flex:1;min-width:0;border:0;background:transparent;font-size:15px;outline:none}
.chips{display:flex;gap:8px;flex-wrap:wrap}
.chip{height:36px;padding:0 16px;border-radius:18px;border:1px solid var(--line);background:#fff;color:var(--ink);font-size:14px;font-weight:500}
.chip.on{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:600}
.list{flex:1;overflow-y:auto;padding-bottom:80px}
.mail{display:flex;gap:12px;padding:14px 20px;text-decoration:none;color:var(--ink);border-bottom:1px solid var(--line-soft);background:#fff}
.mail:hover{background:var(--ground);color:var(--ink)}
.mail.unread{background:#F4F8F6}
.mail .body{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.mail .name,.mail .subj{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mail .name{font-size:15px}
.mail .time{font-size:12px;color:var(--muted);white-space:nowrap}
.mail .subj{flex:1;min-width:0;font-size:14px}
.mail .prev{font-size:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mail.unread .name,.mail.unread .subj,.mail.unread .time{font-weight:700}
.udot{width:10px;height:10px;flex:0 0 10px;border-radius:5px;background:var(--dot)}
.fab{position:absolute;right:20px;bottom:96px;height:56px;padding:0 22px;border-radius:18px;background:var(--accent);color:#fff;text-decoration:none;display:flex;align-items:center;gap:10px;font-size:15px;font-weight:700;box-shadow:0 6px 18px rgba(15,27,45,.22)}
.fab:hover{background:var(--accent-dark);color:#fff}
.nav{height:76px;border-top:1px solid #E4E7EC;background:#fff;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));padding-bottom:8px}
.nav a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;text-decoration:none;color:var(--muted);font-size:12px;font-weight:500}
.nav a.on{color:var(--accent);font-weight:700}

/* read */
.topbar{padding:44px 12px 8px;display:flex;align-items:center;justify-content:space-between}
.read-body{flex:1;overflow-y:auto;padding:8px 20px 20px;display:flex;flex-direction:column;gap:20px}
.read-body h1{margin:0;font-size:22px;line-height:1.5}
.msg{font-size:15px;line-height:1.9;color:var(--ink-2);display:flex;flex-direction:column;gap:12px}
.msg p{margin:0}
.attach{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--line);border-radius:14px;text-decoration:none;color:var(--ink)}
.attach:hover{background:var(--ground);color:var(--ink)}
.pdf{width:40px;height:44px;border-radius:8px;background:#FDECEC;color:#B42318;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700}
.read-foot{padding:16px 20px 28px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;border-top:1px solid var(--line-soft)}
.read-foot .btn{height:50px;font-size:15px}

/* compose */
.compose-top{padding:44px 12px 8px 16px;display:flex;align-items:center;gap:8px;border-bottom:1px solid var(--line-soft)}
.compose-top h1{margin:0;flex:1;font-size:18px}
.send{height:44px;padding:0 18px;border-radius:22px;border:0;background:var(--accent);color:#fff;display:flex;align-items:center;gap:8px;font-size:15px;font-weight:700}
.send:hover{background:var(--accent-dark)}
.cform{flex:1;display:flex;flex-direction:column;margin:0;min-height:0}
.crow{display:flex;align-items:center;gap:12px;min-height:56px;padding:0 20px;border-bottom:1px solid var(--line-soft)}
.crow > label,.crow > .lbl{width:48px;font-size:14px;color:var(--muted)}
.crow input{flex:1;min-width:0;height:44px;border:0;background:transparent;font-size:15px;outline:none}
.to-wrap{flex:1;min-width:0;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.pill{height:32px;padding:0 12px;border-radius:16px;background:var(--accent-soft);color:var(--accent);display:flex;align-items:center;font-size:13px;font-weight:600}
.cform textarea{flex:1;border:0;resize:none;padding:18px 20px;font-size:15px;line-height:1.9;outline:none;min-height:0}
.quota{padding:14px 20px 28px;display:flex;flex-direction:column;gap:8px;border-top:1px solid var(--line-soft);background:var(--ground)}
.bar{height:6px;border-radius:3px;background:#E4E7EC;overflow:hidden}
.bar > div{height:100%;background:var(--accent);border-radius:3px}

.toast{position:absolute;left:50%;bottom:110px;transform:translateX(-50%);background:var(--ink);color:#fff;padding:12px 18px;border-radius:12px;font-size:14px;opacity:0;pointer-events:none;transition:opacity .2s;white-space:nowrap}
.toast.show{opacity:1}

/* sent + settings */
.settings-body{flex:1;overflow-y:auto;padding:4px 20px 24px;display:flex;flex-direction:column;gap:18px;background:var(--ground)}
.card{background:#fff;border:1px solid var(--line-soft);border-radius:16px;padding:16px;display:flex;flex-direction:column;gap:14px}
.card h2{margin:0;font-size:15px;font-weight:700}
.prof{display:flex;align-items:center;gap:14px}
.prof .big{width:56px;height:56px;flex:0 0 56px;border-radius:28px;background:var(--accent);color:#fff;display:flex;align-items:center;justify-content:center;font-size:22px;font-weight:700}
.textarea{min-height:84px;border:1px solid var(--line);border-radius:12px;padding:12px 14px;font-size:15px;line-height:1.7;resize:vertical;width:100%}
.textarea:focus{outline:2px solid var(--accent);outline-offset:-1px}
.toggle{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;font-size:15px}
.switch-i{appearance:none;-webkit-appearance:none;width:48px;height:28px;border-radius:14px;background:#C9CFD8;position:relative;margin:0;cursor:pointer;transition:background .2s;flex:0 0 48px}
.switch-i::after{content:"";position:absolute;top:3px;inset-inline-start:3px;width:22px;height:22px;border-radius:11px;background:#fff;transition:inset-inline-start .2s}
.switch-i:checked{background:var(--accent)}
.switch-i:checked::after{inset-inline-start:23px}
.select{height:44px;border:1px solid var(--line);border-radius:10px;background:#fff;padding:0 10px;font-size:15px;font-family:inherit;color:var(--ink)}
.btn-sm{height:46px;font-size:15px}
.btn-danger{background:#fff;border:1px solid #F3C4C0;color:#B42318}
.btn-danger:hover{background:#FEF3F2;color:#B42318}

/* app states */
.err{display:none;font-size:14px;line-height:1.5;color:#B42318;background:#FEF3F2;border:1px solid #FECDCA;border-radius:12px;padding:10px 12px}
.err.show{display:block}
.btn[disabled],.send[disabled]{opacity:.6;cursor:wait}
.msg.text{white-space:pre-wrap;word-break:break-word}
.html-frame{width:100%;min-height:55vh;border:1px solid var(--line-soft);border-radius:12px;background:#fff}
.empty{text-align:center;padding:48px 24px;color:var(--muted);font-size:14px;line-height:1.7}
.ts-box{min-height:65px}
.star-on{color:#B54708}
.att-list{display:flex;flex-direction:column;gap:8px}
.att-list .attach{cursor:default}
.loading{display:flex;align-items:center;justify-content:center;flex:1;color:var(--muted);font-size:14px}
.rec-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border:1px solid var(--line-soft);border-radius:12px;font-size:14px}
.rec-item button{border:0;background:transparent;color:#B42318;font-weight:600;font-size:13px;min-height:36px;padding:0 6px}
