/* 🎨 هوية بصمة ديتيلز: كحلي #0B3A5B/#123f59 + ذهبي #c5983c — بلا ازدحام، والمحتوى هو البطل */
:root {
  --navy: #0b3a5b;
  --navy-2: #123f59;
  --gold: #c5983c;
  --bg: #eef2f7;
  --line: #dbe3ec;
  --text: #1e293b;
  --muted: #64748b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  direction: rtl;
}

/* ── شاشة الدخول ── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}
.auth-brand {
  background: linear-gradient(160deg, var(--navy) 0%, #08283d 100%);
  color: #fff;
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.brand-mark { width: 112px; height: 112px; border-radius: 26px; background: #fff; padding: 8px; }
.auth-brand h1 { font-size: 26px; margin: 14px 0 0; }
.brand-latin { color: #cbd5e1; letter-spacing: 1.2px; font-size: 12px; margin: 4px 0 0; }
.brand-divider { width: 84px; height: 4px; background: var(--gold); border-radius: 4px; margin: 18px 0; }
.auth-brand h2 { font-size: 30px; margin: 0; color: #fff; }
.brand-note { color: #cbd5e1; line-height: 1.9; max-width: 520px; }
.brand-points { color: #a9c4d8; line-height: 2; padding-inline-start: 18px; margin-top: 10px; }

.auth-form {
  background: #fff;
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-form h3 { margin: 0 0 4px; font-size: 24px; color: var(--navy); }
.auth-sub { color: var(--muted); margin: 0 0 22px; }
.auth-form label { display: block; font-size: 13px; font-weight: 700; margin: 14px 0 6px; }
.auth-form input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  font-size: 15px;
}
.auth-form input:focus { outline: 2px solid rgba(18, 63, 89, .25); border-color: var(--navy-2); }
.auth-form button {
  margin-top: 22px;
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--navy-2);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}
.auth-form button:disabled { opacity: .6; cursor: progress; }
.auth-hint { color: var(--muted); font-size: 12px; margin-top: 18px; }

/* ── التنبيهات ── */
.alert { border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 700; margin-top: 14px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }

/* ── الشاشة الرئيسية ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--navy);
  color: #fff;
  padding: 10px 18px;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-brand img { width: 38px; height: 38px; border-radius: 10px; background: #fff; padding: 3px; }
.topbar-brand strong { display: block; font-size: 15px; }
.topbar-brand span { font-size: 11px; color: #a9c4d8; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.chip { background: rgba(255,255,255,.14); border-radius: 999px; padding: 4px 10px; font-size: 11px; font-weight: 700; }
.chip-muted { background: #eef2f7; color: var(--muted); }
.topbar .chip-muted { background: rgba(255,255,255,.14); color: #dbeafe; }

.btn { border: 1px solid transparent; border-radius: 10px; padding: 8px 12px; font-size: 12px; font-weight: 800; cursor: pointer; }
.btn-primary { background: var(--gold); color: #2b1d00; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.viewer-actions .btn-ghost, .modal-head .btn-ghost { border-color: var(--line); color: var(--navy-2); }

.layout {
  display: grid;
  grid-template-columns: 220px minmax(280px, 1fr) minmax(0, 1.4fr);
  gap: 12px;
  padding: 12px;
  height: calc(100vh - 60px);
}
.folders, .list-pane, .view-pane {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  overflow: auto;
  min-height: 0;
}
.folders h4, .list-head, .viewer-head h3 { margin: 0 0 10px; color: var(--navy); font-size: 14px; }
.folders ul { list-style: none; margin: 0; padding: 0; }
.folders li button {
  width: 100%;
  text-align: right;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
}
.folders li button:hover { background: #f1f5f9; }
.folders li button.active { background: var(--navy-2); color: #fff; font-weight: 800; }
.folders-sep { height: 1px; background: var(--line); margin: 12px 0; }
.search-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.folders input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; margin-top: 6px; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.messages { list-style: none; margin: 0; padding: 0; }
.messages li {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.messages li:hover { background: #f8fafc; }
.messages li.active { border-color: var(--navy-2); box-shadow: 0 0 0 2px rgba(18,63,89,.12); }
.messages li.unseen { background: #f0f9ff; border-color: #bae6fd; }
.m-subject { font-weight: 800; font-size: 13px; margin-bottom: 4px; }
.m-meta { color: var(--muted); font-size: 11px; display: flex; justify-content: space-between; gap: 8px; }

.viewer-head h3 { font-size: 17px; }
.viewer-meta { display: flex; gap: 12px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.viewer-body {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.9;
  max-height: 60vh;
  overflow: auto;
}
.viewer-actions { margin-top: 12px; display: flex; gap: 8px; }
.attachments { margin-top: 12px; }
.attachments strong { display: block; font-size: 12px; color: var(--navy); margin-bottom: 6px; }
.attachments ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.attachments button { text-align: right; border-color: var(--line); color: var(--navy-2); width: 100%; }
.empty { color: var(--muted); font-size: 13px; padding: 24px; text-align: center; }

/* ── نافذة الإرسال ── */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; padding: 18px; z-index: 50; }
.modal-box { background: #fff; border-radius: 18px; padding: 18px; width: min(760px, 96vw); max-height: 92vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-head h3 { margin: 0; color: var(--navy); }
.modal-box label { display: block; font-size: 12px; font-weight: 700; margin: 10px 0 4px; }
.modal-box input, .modal-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .auth-shell { grid-template-columns: 1fr; }
}
