/* رصيد · Raseed — نظام التصميم */
:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #5B6474;
  --border: #E3E6EB;
  --border-2: #D9DDE4;
  --accent: #0F7B6C;
  --accent-hover: #0B5F54;
  --accent-soft: #E8F5F2;
  --accent-ink: #1E4D46;
  --panel: #EEF0F3;
  --warn-bg: #FFF8E6;
  --warn-border: #F0DDA8;
  --warn-ink: #6B4E00;
  --radius: 14px;
  --font: 'Vazirmatn', system-ui, sans-serif;
  --paper-font: 'Amiri', 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, textarea { font-family: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* أزرار */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: 12px; padding: 12px 18px; font-size: 15px; font-weight: 600; min-height: 44px; transition: background .15s, border-color .15s; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #1E293B; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-line { background: var(--surface); color: var(--ink); border: 1px solid var(--border-2); }
.btn-line:hover { border-color: var(--ink-2); }
.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 36px; border-radius: 10px; }
.icon-btn { width: 44px; height: 44px; border: none; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--bg); color: var(--ink); flex: none; }
.icon-btn:hover { background: var(--border); }
.icon-btn.dark { background: var(--ink); color: #fff; }
.icon-btn.soft { background: var(--accent-soft); color: var(--accent); }
.icon-btn:disabled { opacity: .5; cursor: default; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--ink-2); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.pill { font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }

/* الشعار */
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark { width: 38px; height: 38px; border-radius: 11px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text b { font-size: 19px; font-weight: 800; }
.logo-text small { font-size: 11px; color: var(--muted); letter-spacing: .08em; }

/* ========== البداية ========== */
.onboard { min-height: 100%; display: flex; flex-direction: column; }
.onboard header { display: flex; align-items: center; justify-content: space-between; padding: 20px 40px; gap: 12px; flex-wrap: wrap; }
.onboard header span { color: var(--muted); font-size: 14px; }
.onboard main { flex: 1; display: flex; justify-content: center; padding: 16px 20px 56px; }
.onboard .wrap { width: 100%; max-width: 760px; display: flex; flex-direction: column; gap: 26px; }
.steps { display: flex; gap: 8px; justify-content: center; }
.steps span { width: 32px; height: 6px; border-radius: 3px; background: var(--border-2); }
.steps span.on { background: var(--accent); }
.hero { text-align: center; display: flex; flex-direction: column; gap: 10px; }
.hero h1 { margin: 0; font-size: 40px; font-weight: 800; letter-spacing: -.01em; }
.hero p { margin: 0; font-size: 17px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card h2 { margin: 0; font-size: 18px; font-weight: 700; }
.card-head span { font-size: 13px; color: var(--muted); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice { padding: 18px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; color: var(--ink); transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--border-2); background: var(--bg); }
.choice b { font-size: 17px; }
.choice small { font-size: 12px; color: var(--muted); }
.choice.wide { align-items: flex-start; text-align: start; padding: 20px; gap: 6px; }
.choice.wide small { font-size: 14px; line-height: 1.6; }
.choice[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); padding: 17px 13px; }
.choice.wide[aria-pressed="true"] { padding: 19px; }
.choice[aria-pressed="true"] b { color: var(--accent); }
.choice[aria-pressed="true"] small { color: var(--accent-ink); }
.onboard .btn-dark { align-self: center; min-width: 260px; padding: 16px 28px; font-size: 17px; border-radius: var(--radius); }
.onboard .btn-dark:disabled { opacity: .4; cursor: default; }

/* ========== الحساب ========== */
.auth-wrap { max-width: 480px; }
.lang-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field input { border: 1px solid var(--border-2); border-radius: 12px; padding: 12px 14px; font-size: 16px; font-weight: 400; color: var(--ink); background: #fff; min-height: 48px; }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.muted { color: var(--muted); font-size: 13px; }
.link-btn { border: none; background: none; color: var(--accent); font-size: 14px; font-weight: 600; padding: 8px; align-self: center; min-height: 44px; }
.link-btn:hover { text-decoration: underline; }
.auth-wrap .btn-dark { align-self: stretch; min-width: 0; }
.loading { height: 100%; display: flex; align-items: center; justify-content: center; }
.loading .logo-mark { width: 56px; height: 56px; border-radius: 16px; animation: blink 1.4s infinite; }
.trial-badge { margin-top: auto; background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-ink); border-radius: 10px; padding: 8px 12px; font-size: 13px; text-align: center; }
.trial-badge + .profile-row { margin-top: 0; }
.profile-row { margin-top: auto; display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; }
.profile-row .profile { margin-top: 0; border-top: none; padding: 0 4px; flex: 1; min-width: 0; }
.profile-row .profile span { overflow: hidden; }

/* ========== لوحة الإدارة ========== */
.table-wrap { max-width: 1100px; margin: 0 auto; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: start; font-size: 12px; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table small { color: var(--muted); }
.admin-table select { border: 1px solid var(--border-2); border-radius: 8px; padding: 6px 8px; font-family: inherit; font-size: 13px; background: #fff; }
.admin-note { max-width: 1100px; margin: 12px auto 0; }

/* ========== هيكل التطبيق ========== */
.shell { display: flex; height: 100vh; height: 100dvh; }
.sidebar { width: 264px; flex: none; background: var(--surface); border-inline-end: 1px solid var(--border); padding: 20px 16px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
.sidebar .logo { padding: 0 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: none; background: none; color: var(--ink-2); font-size: 15px; text-align: start; min-height: 44px; }
.nav button:hover { background: var(--bg); }
.nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.recent { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.recent-label { font-size: 12px; color: var(--muted); padding: 0 12px 6px; }
.recent button { border: none; background: none; text-align: start; font-size: 14px; color: var(--ink-2); padding: 9px 12px; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent button:hover { background: var(--bg); }
.recent button.active { background: var(--bg); color: var(--ink); font-weight: 600; }
.recent .empty { font-size: 13px; color: var(--muted); padding: 4px 12px; }
.profile { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--border); border-radius: 0; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: start; width: 100%; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; color: var(--ink-2); flex: none; }
.profile span { display: flex; flex-direction: column; line-height: 1.35; font-size: 14px; font-weight: 600; color: var(--ink); }
.profile small { font-size: 12px; color: var(--muted); font-weight: 400; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--border); background: var(--surface); min-height: 72px; }
.topbar .title { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.topbar .title b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title small { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .actions { display: flex; align-items: center; gap: 8px; }
.menu-btn, .draft-toggle { display: none; }

/* ========== المحادثة ========== */
.workspace { flex: 1; display: flex; min-height: 0; }
.chat { flex: 1 1 400px; min-width: 0; display: flex; flex-direction: column; }
.chat.centered .messages, .chat.centered .composer { width: 100%; max-width: 800px; margin-inline: auto; }
.messages { flex: 1; overflow-y: auto; padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; }
.msg .bot-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; margin-top: 2px; }
.bubble { border-radius: 4px 16px 16px 16px; padding: 13px 16px; font-size: 15px; line-height: 1.85; max-width: 560px; overflow-wrap: anywhere; }
.msg.bot .bubble { background: var(--surface); border: 1px solid var(--border); }
.msg.user { justify-content: flex-start; flex-direction: row-reverse; }
.msg.user .bubble { background: var(--accent); color: #fff; border-radius: 16px 4px 16px 16px; white-space: pre-wrap; }
.msg.wide .bubble { max-width: 720px; width: 100%; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin-bottom: 0; }
.bubble ol, .bubble ul { margin: 6px 0; padding-inline-start: 22px; }
.bubble h4 { margin: 14px 0 4px; font-size: 13px; font-weight: 700; color: var(--accent); }
.bubble h4:first-child { margin-top: 0; }
.bubble strong { font-weight: 700; }
.draft-card { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--accent-soft); border: none; width: 100%; text-align: start; color: var(--ink); }
.draft-card .icon { width: 40px; height: 40px; border-radius: 10px; background: #fff; color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.draft-card span { display: flex; flex-direction: column; font-size: 14px; font-weight: 700; line-height: 1.4; }
.draft-card small { font-size: 12px; font-weight: 400; color: var(--accent-ink); }
.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .4; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; } }
.error-note { background: #FDECEC; border: 1px solid #F3C2C2; color: #8A1C1C; border-radius: 12px; padding: 10px 14px; font-size: 14px; }

.composer { padding: 10px 28px 18px; display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.input-row { display: flex; align-items: flex-end; gap: 8px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 16px; padding: 8px; }
.input-row:focus-within { border-color: var(--accent); }
.input-row textarea { flex: 1; border: none; outline: none; resize: none; font-size: 15px; line-height: 1.7; background: transparent; padding: 9px 0; max-height: 180px; color: var(--ink); }
.hint { font-size: 12px; color: var(--muted); text-align: center; }

/* المرفقات */
.attach-btn { background: transparent; color: var(--muted); }
.attach-btn:hover { background: var(--bg); color: var(--ink); }
.staged { display: flex; gap: 8px; flex-wrap: wrap; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px 6px 6px 10px; font-size: 13px; color: var(--ink-2); }
.file-chip img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex: none; }
.file-chip > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip button { border: none; background: var(--bg); color: var(--muted); width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.file-chip button:hover { color: #8A1C1C; background: #FDECEC; }
.msg-atts { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 6px; }
.msg-thumb { width: 120px; height: 90px; object-fit: cover; border-radius: 10px; border: 2px solid rgba(255,255,255,.4); }
.msg-file { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.18); border-radius: 8px; padding: 4px 10px; font-size: 13px; white-space: normal; }
body.dragging::after { content: attr(data-drop); position: fixed; inset: 12px; border: 2px dashed var(--accent); background: rgba(238,242,253,.9); border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: var(--accent); z-index: 70; pointer-events: none; }

/* الصوت */
.mic-btn { background: transparent; color: var(--muted); }
.mic-btn:hover { background: var(--bg); color: var(--ink); }
.mic-btn.listening { background: #FDECEC; color: #B42318; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(180,35,24,.35); } 50% { box-shadow: 0 0 0 6px rgba(180,35,24,0); } }
.speak-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 4px 12px; font-size: 12px; min-height: 30px; }
.speak-btn:hover, .speak-btn.on { color: var(--accent); border-color: var(--accent); }

/* ========== لوحة المسودة ========== */
.draft-panel { flex: 1 1 460px; min-width: 0; background: var(--panel); border-inline-start: 1px solid var(--border); padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.draft-panel .bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.draft-panel .bar b { font-size: 14px; color: var(--ink-2); }
.draft-panel .bar div { display: flex; gap: 8px; flex-wrap: wrap; }
.notes { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-ink); border-radius: 12px; padding: 10px 14px; font-size: 13px; line-height: 1.8; white-space: pre-wrap; }
.paper { background: #fff; border-radius: 6px; box-shadow: 0 1px 3px rgba(15,23,42,.08); padding: 40px 44px; font-family: var(--paper-font); font-size: 17px; line-height: 2; color: #111827; min-height: 400px; outline: none; }
.paper[contenteditable="true"] { box-shadow: 0 0 0 2px var(--accent); }
.paper h3 { margin: 0 0 14px; text-align: center; font-size: 22px; }
.paper h5 { margin: 12px 0 2px; font-size: 17px; font-weight: 700; }
.paper p { margin: 0; min-height: 1em; }
.panel-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); text-align: center; padding: 40px; font-size: 15px; line-height: 1.8; }
.panel-empty .icon { width: 56px; height: 56px; border-radius: 16px; background: #fff; display: flex; align-items: center; justify-content: center; color: var(--muted); }

/* ========== مستنداتي ========== */
.docs { flex: 1; overflow-y: auto; padding: 28px; }
.docs .list { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.doc-row { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.doc-row .icon { width: 42px; height: 42px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.doc-row .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.doc-row .meta b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-row .meta small { font-size: 12px; color: var(--muted); }
.docs .empty { text-align: center; color: var(--muted); padding: 60px 20px; }

/* ========== نافذة الرمز ========== */
.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: 20px; padding: 28px; width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px; }
.modal h2 { margin: 0; font-size: 20px; }
.modal input { border: 1px solid var(--border-2); border-radius: 12px; padding: 12px 14px; font-size: 16px; }
.toast { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; z-index: 60; }
[dir="ltr"] .toast { transform: translateX(-50%); }
.backdrop { display: none; }

/* ========== الموبايل والشاشات الصغيرة ========== */
.panel-close { display: none !important; }
@media (max-width: 1100px) {
  .draft-panel { position: fixed; inset: 0; z-index: 30; border: none; display: none; padding-top: 16px; }
  .draft-panel.open { display: flex; }
  .draft-toggle { display: inline-flex; }
  .panel-close { display: inline-flex !important; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 40; transform: translateX(105%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  [dir="ltr"] .sidebar { transform: translateX(-105%); }
  .sidebar.open { transform: none !important; }
  .backdrop.open { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 35; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 14px; }
  .topbar .pill { display: none; }
  .messages { padding: 18px 14px; }
  .composer { padding: 8px 12px 14px; }
  .paper { padding: 26px 22px; font-size: 16px; }
  .onboard header { padding: 16px 20px; }
  .hero h1 { font-size: 30px; }
  .card { padding: 20px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .docs { padding: 16px; }
}
.code-input { font-size: 24px !important; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }

.phone-row { display: flex; gap: 8px; }
.phone-row select { flex: none; border: 1px solid var(--border-2); border-radius: 12px; padding: 0 10px; font-size: 15px; font-family: inherit; background: #fff; min-height: 48px; }
.phone-row input { flex: 1; min-width: 0; border: 1px solid var(--border-2); border-radius: 12px; padding: 12px 14px; font-size: 16px; min-height: 48px; }
.phone-row input:focus, .phone-row select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* تثبيت التطبيق */
.install-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; border: 1px dashed var(--accent); background: transparent; color: var(--accent); border-radius: 10px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.install-btn:hover { background: rgba(31, 79, 216, .06); }
.install-btn.side { margin-top: auto; margin-bottom: 10px; }
.install-btn.side ~ .trial-badge { margin-top: 0; }
.install-btn.side ~ .profile-row { margin-top: 0; }
.install-btn.auth { margin-top: 14px; }
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: grid; place-items: center; z-index: 70; padding: 16px; }
.modal { background: #fff; border-radius: 18px; padding: 24px; max-width: 360px; width: 100%; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-icon { display: block; margin: 0 auto; width: 64px; height: 64px; border-radius: 16px; }
.modal h3 { margin: 12px 0 8px; font-size: 18px; }
.modal ol { text-align: start; line-height: 2; padding-inline-start: 22px; margin: 0 0 16px; }
.modal .btn { width: 100%; }

/* تبديل سريع للغة والمنطقة */
.qs-btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border: 1px solid var(--border-2); border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s, box-shadow .15s; white-space: nowrap; }
.qs-btn:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 79, 216, .1); }
.qs-btn svg { color: var(--muted); flex: none; }
.qs-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--border-2); }
.qs-reg { color: var(--muted); font-weight: 500; }
.sheet-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: flex-end; padding: 76px 24px 24px; animation: fadeIn .15s ease; }
.sheet { width: 400px; max-width: 100%; background: #fff; border-radius: 18px; padding: 18px 18px 16px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); animation: popIn .18s ease; }
.sheet-grab { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet-head b { font-size: 17px; }
.sheet-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 14px 2px 8px; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-grid.one { grid-template-columns: 1fr; }
.sheet-opt { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start; padding: 12px 14px; min-height: 56px; border: 1.5px solid var(--border); border-radius: 12px; background: #fff; font: inherit; cursor: pointer; transition: border-color .12s, background .12s; }
.sheet-opt b { font-size: 15px; color: var(--ink); }
.sheet-opt small { font-size: 12px; color: var(--muted); line-height: 1.5; padding-inline-end: 24px; }
.sheet-opt:hover { border-color: var(--border-2); background: #FAFBFC; }
.sheet-opt.on { border-color: var(--accent); background: rgba(31, 79, 216, .05); }
.sheet-opt.on b { color: var(--accent); }
.qs-check { position: absolute; top: 12px; inset-inline-end: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.sheet-done { width: 100%; margin-top: 16px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
@keyframes slideUp { from { transform: translateY(100%); } }
@media (max-width: 760px) {
  .topbar { gap: 8px; }
  .topbar .title { min-width: 50px; }
  .qs-btn { height: 36px; padding: 0 10px; gap: 5px; font-size: 12.5px; }
  .qs-btn .qs-dot, .qs-btn .qs-reg, .qs-btn > svg:last-child { display: none; }
  .sheet-wrap { align-items: flex-end; justify-content: stretch; padding: 0; }
  .sheet { width: 100%; border-radius: 22px 22px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); animation: slideUp .22s cubic-bezier(.2,.8,.2,1); }
  .sheet-grab { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--border-2); margin: 4px auto 10px; }
}

/* الملاحظات والشروط */
.side-link { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 0 10px; border: none; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; border-radius: 10px; cursor: pointer; margin-top: auto; margin-bottom: 6px; }
.side-link:hover { background: var(--bg, #F6F7F9); color: var(--ink); }
.side-link ~ .install-btn.side { margin-top: 0; }
.side-link ~ .trial-badge, .side-link ~ .profile-row { margin-top: 0; }
.terms-foot { display: block; text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 8px; text-decoration: none; }
.terms-foot:hover { color: var(--accent); text-decoration: underline; }
.terms-check { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; line-height: 1.7; color: var(--ink); cursor: pointer; }
.terms-check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.terms-check a { color: var(--accent); font-weight: 600; }
.sheet-wrap.center { align-items: center; justify-content: center; padding: 16px; }
.fb-sub { margin: 0 2px 12px; font-size: 13.5px; }
.fb-kinds { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.fb textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border-2); border-radius: 12px; padding: 12px; font: inherit; font-size: 15px; resize: vertical; min-height: 120px; }
.fb textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,123,108,.12); }
.fb .error-note { margin-top: 8px; }
.admin-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.admin-tabs .badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #DC2626; color: #fff; font-size: 11px; margin-inline-start: 4px; }
.fb-list { display: flex; flex-direction: column; gap: 10px; }
.fb-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.fb-card.done { opacity: .55; }
.fb-card p { white-space: pre-wrap; margin: 8px 0; line-height: 1.8; }
.fb-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fb-top small, .fb-meta small { color: var(--muted); }
.fb-kind { font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #EEF2FF; color: var(--accent); }
.fb-kind.k-bug, .fb-kind.k-bad { background: #FEF2F2; color: #B91C1C; }
.fb-kind.k-praise, .fb-kind.k-good { background: #ECFDF5; color: #047857; }
.fb-meta { font-size: 13px; color: var(--muted); margin-bottom: 10px; line-height: 1.7; }
@media (max-width: 760px) { .sheet-wrap.center { align-items: flex-end; padding: 0; } }
.btn-line.danger { color: #B91C1C; border-color: #FECACA; } .btn-line.danger:hover { background: #FEF2F2; border-color: #B91C1C; }

/* الآيفون والموبايل: المناطق الآمنة (الساعة بالأعلى وشريط الرجوع بالأسفل) */
html, body { overscroll-behavior: none; }
.shell { box-sizing: border-box; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.onboard { box-sizing: border-box; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
@media (max-width: 1100px) {
  .draft-panel { padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: env(safe-area-inset-bottom); }
}
@media (max-width: 860px) {
  .sidebar { padding-top: calc(20px + env(safe-area-inset-top)); padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* حذف الحساب */
.danger-zone h2 { font-size: 16px; margin: 0 0 4px; }
.danger-zone .row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-danger { background: #B91C1C; color: #fff; border: none; }
.btn-danger:hover { background: #991B1B; }
.del-warn { background: #FEF2F2; border: 1px solid #FECACA; color: #7F1D1D; border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.8; margin-bottom: 12px; }
.fb .field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.fb .field input { border: 1px solid var(--border-2); border-radius: 12px; padding: 0 12px; min-height: 48px; font: inherit; font-size: 16px; }

/* الاشتراك الشهري */
.sheet { max-height: calc(100dvh - 32px); overflow-y: auto; }
.trial-badge .btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; width: 100%; justify-content: center; }
.sub-badge { margin-top: auto; background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; border-radius: 10px; padding: 8px 12px; font-size: 13px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.sub-badge small { color: #047857; }
.sub-badge.soon { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-ink); }
.sub-badge.soon small { color: var(--warn-ink); }
.sub-badge .btn { margin-top: 6px; }
.side-link ~ .sub-badge { margin-top: 0; }
.sub-badge + .profile-row { margin-top: 0; }
.sub-cta { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; }
.pay-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; background: #F1F5FF; border: 1px solid #DBE4FF; border-radius: 14px; padding: 14px 16px; margin: 4px 0 4px; }
.pay-price b { font-size: 26px; color: var(--accent); }
.pay-price span { color: var(--muted); font-weight: 600; }
.pay-price small { flex-basis: 100%; color: var(--muted); }
.pay-months { display: flex; gap: 6px; flex-wrap: wrap; }
.pay-methods { display: grid; gap: 8px; }
.pay-method { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 12px; background: #fff; font: inherit; cursor: pointer; text-align: start; min-height: 52px; }
.pay-method b { font-size: 15px; }
.pay-method span { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: .5px; }
.pay-method.on { border-color: var(--accent); background: rgba(31, 79, 216, .05); }
.pay-copy { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; }
.pay .field { margin-bottom: 10px; }
.pay-file { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; border: 1.5px dashed var(--border-2); border-radius: 12px; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; padding: 8px; }
.pay-file:hover { border-color: var(--accent); color: var(--accent); }
.pay-file img { max-height: 120px; max-width: 45%; border-radius: 8px; }
.pay-note { font-size: 12.5px; margin: 10px 2px 0; text-align: center; }
.pay-pending { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-ink); border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 8px; }
.pay-done { text-align: center; padding: 10px 0 4px; }
.pay-ok { width: 64px; height: 64px; border-radius: 50%; background: #ECFDF5; color: #047857; font-size: 32px; display: grid; place-items: center; margin: 4px auto 10px; font-weight: 800; }
.pay-done h3 { margin: 0 0 6px; }
.pay-row { font-size: 14px; margin: 4px 0; line-height: 1.7; }
.pay-proof { display: block; max-width: 160px; max-height: 200px; border-radius: 10px; border: 1px solid var(--border); margin: 8px 0; cursor: zoom-in; }
.pay-proof.big { max-width: 100%; max-height: none; cursor: zoom-out; }
.pay-card .row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.fb-kind.k-pay-pending { background: var(--warn-bg); color: var(--warn-ink); }
.fb-kind.k-pay-approved { background: #ECFDF5; color: #047857; }
.fb-kind.k-pay-rejected { background: #FEF2F2; color: #B91C1C; }
.pay-card.st-approved, .pay-card.st-rejected { opacity: .7; }
.admin-table .cost { color: #047857; font-size: 13px; }
.notify-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }
/* القائمة الجانبية: لا تنضغط العناصر، والقائمة نفسها تتمرر عند الامتلاء */
.sidebar > * { flex-shrink: 0; }
.recent button, .recent .recent-label { flex-shrink: 0; }
.recent button { min-height: 40px; line-height: 1.5; }

/* التحقق من المواد */
.lawcheck { margin: 0 0 12px; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; line-height: 1.8; }
.lawcheck.ok { background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; }
.lawcheck.warn { background: #FFF7ED; border: 1px solid #FDBA74; color: #7C2D12; }
.lc-head { font-weight: 700; }
.lc-issue { margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(0,0,0,.12); }
.lc-issue small { color: var(--muted); }
.lc-q { margin-top: 4px; color: #9A3412; }
.lc-o { margin-top: 4px; color: #0F172A; background: #fff; border-radius: 8px; padding: 6px 10px; }
.lawcheck details { margin-top: 8px; }
.lawcheck summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.lc-ref { margin-top: 8px; color: #0F172A; background: #fff; border-radius: 8px; padding: 8px 10px; max-height: 180px; overflow: auto; }
.lc-ref small { color: var(--muted); }
.lc-tag { background: #FEE2E2; color: #991B1B; border-radius: 6px; padding: 0 6px; font-size: 12px; }


/* تبويبات لائحة / استشارات */
.mode-tabs { display: flex; gap: 8px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.mode-tabs::-webkit-scrollbar { display: none; }
.mode-tabs button { flex: 0 0 auto; padding: 0 16px; white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--bg); color: var(--ink); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; }
.mode-tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(15,123,108,.25); }
.mode-tabs button svg { flex-shrink: 0; }
.mode-cards { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 8px; max-width: 560px; }
.mode-card { display: flex; align-items: center; gap: 14px; text-align: start; padding: 16px 18px; border-radius: 18px; border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.mode-card.on { border-color: var(--accent); background: var(--accent-soft); }
.mode-card .mc-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent); color: #fff; flex-shrink: 0; }
.mode-card .mc-tx { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.mode-card b { font-size: 16px; }
.mode-card small { font-size: 13px; color: var(--muted); line-height: 1.5; }
.mode-card .mc-here { color: var(--accent); font-weight: 900; font-size: 18px; }

/* جداول القوائم المالية */
.tbl { overflow-x: auto; margin: 10px 0; -webkit-overflow-scrolling: touch; }
.tbl table { border-collapse: collapse; width: 100%; min-width: 320px; font-size: 14px; }
.tbl th, .tbl td { border: 1px solid var(--border-2); padding: 7px 10px; text-align: start; vertical-align: top; }
.tbl th { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.tbl td:not(:first-child) { font-variant-numeric: tabular-nums; }
.tbl tr:nth-child(even) td { background: #FAFBFC; }
.paper .tbl table { font-size: 15px; }
