:root {
  --green: #1F2E27; --beige: #F2EFE7; --card: #FFFFFF; --gold: #8C6329;
  --text: #1F2E27; --muted: #6B7069; --line: #E4DFD3;
  --danger: #B3261E; --success: #2E7D4F;
  --radius: 16px; --shadow: 0 10px 30px rgba(31, 46, 39, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --beige: #15170F; --card: #1F2421; --gold: #D9B27C; --text: #F2EFE7;
    --muted: #A7AA9F; --line: #2F3530; --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; background: var(--beige); color: var(--text); padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0); }
button, input { font: inherit; color: inherit; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fade .35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.auth { min-height: 100vh; max-width: 440px; margin: 0 auto; padding: 32px 18px; display: flex; flex-direction: column; justify-content: center; }
.brand { text-align: center; margin-bottom: 22px; }
.brand-mark { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px; background: var(--green); color: #D9B27C; display: grid; place-items: center; font-family: 'Amiri', serif; font-size: 34px; box-shadow: var(--shadow); }
.brand-name { font-size: 24px; font-weight: 700; letter-spacing: .3px; direction: ltr; }
.brand-name span, .topbar-brand span { color: var(--gold); }
.brand-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-card { padding: 22px 18px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--beige); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.tab { border: 0; background: transparent; padding: 10px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; transition: .2s; }
.tab.active { background: var(--card); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.title { font-size: 20px; margin: 0 0 8px; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.8; margin: 0 0 16px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field input { width: 100%; height: 50px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); font-size: 16px; outline: none; transition: border-color .2s, box-shadow .2s; }
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(140, 99, 41, .12); }
.field input[dir="ltr"] { text-align: left; }
.pw { position: relative; }
.pw input { padding-left: 48px; }
.pw-toggle { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: transparent; color: var(--muted); border-radius: 10px; cursor: pointer; }
.pw-toggle.on { color: var(--gold); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 18px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.link { border: 0; background: none; color: var(--gold); font-weight: 600; font-size: 14px; cursor: pointer; padding: 6px 0; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; border-radius: 12px; border: 0; font-size: 16px; font-weight: 700; cursor: pointer; transition: transform .1s, opacity .2s; margin-top: 8px; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--green); color: #F2EFE7; }
@media (prefers-color-scheme: dark) { .btn.primary { background: #D9B27C; color: #15170F; } }
.btn.ghost { background: transparent; color: var(--text); border: 1.5px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid var(--line); }
.btn:disabled { opacity: .7; cursor: default; }
.btn.loading { color: transparent; position: relative; }
.btn.loading::after { content: ''; position: absolute; width: 22px; height: 22px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }

.verify-icon { font-size: 44px; text-align: center; margin-bottom: 8px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 22px; }

.topbar { position: sticky; top: 0; z-index: 5; background: var(--green); color: #F2EFE7; padding: 16px 18px; }
.topbar-brand { font-weight: 700; font-size: 18px; direction: ltr; text-align: right; }
.topbar-brand span { color: #D9B27C; }
.page { max-width: 640px; margin: 0 auto; padding: 18px; display: grid; gap: 14px; }
.profile-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--green); color: #D9B27C; display: grid; place-items: center; font-size: 22px; font-weight: 700; flex-shrink: 0; }
.hello { font-size: 17px; margin-bottom: 6px; }
.chip { display: inline-block; padding: 4px 12px; border-radius: 999px; background: rgba(140, 99, 41, .12); color: var(--gold); font-size: 13px; font-weight: 600; }
.list { padding: 4px 18px; }
.list-row { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list-row:last-child { border-bottom: 0; }
.list-row span { color: var(--muted); }
.list-row b { overflow-wrap: anywhere; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0)); transform: translate(-50%, 20px); max-width: calc(100% - 32px); padding: 13px 18px; border-radius: 12px; background: var(--green); color: #F2EFE7; font-size: 14px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .3s; z-index: 50; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--success); color: #fff; }
