/* ═══════════════════════════════════════════════════════════════
   Personal Profile — page design system
   Identity: رزق الله (sky-blue core on navy, gold rewards)
   Mobile-first · RTL · light + dark themes · reduced-motion aware
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #F4F7FC;
  --surface: #FFFFFF;
  --surface-2: #F6F9FD;
  --ink: #12203F;
  --muted: #5A6B8C;
  --line: #E3E9F3;
  --primary: #10367D;
  --primary-2: #1B4FA0;
  --navy-soft: rgba(16, 54, 125, 0.09);
  --sky: #0EA5E9;
  --sky-2: #38BDF8;
  --sky-ink: #0369A1;
  --sky-soft: rgba(14, 165, 233, 0.12);
  --gold: #C9A34A;
  --gold-2: #D9B65C;
  --gold-ink: #8A6A1E;
  --gold-soft: rgba(201, 163, 74, 0.14);
  --green: #0E9F6E;
  --green-2: #2BB886;
  --green-soft: rgba(14, 159, 110, 0.14);
  --purple: #7C6CF0;
  --purple-soft: rgba(124, 108, 240, 0.14);
  --red: #E11D48;
  --red-soft: rgba(225, 29, 72, 0.12);
  --fajr: #D95A1B;
  --fajr-soft: rgba(217, 90, 27, 0.13);
  --shadow: 0 10px 30px -14px rgba(16, 54, 125, 0.22);
  --shadow-lg: 0 24px 60px -22px rgba(16, 54, 125, 0.30);
  --ring: 0 0 0 3px rgba(14, 165, 233, 0.25);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-display: "Amiri", serif;
  --font-body: "Cairo", sans-serif;
}

html[data-theme="dark"] {
  --bg: #070C1B;
  --surface: #0F1730;
  --surface-2: #152040;
  --ink: #EDF1F9;
  --muted: #93A2C4;
  --line: rgba(255, 255, 255, 0.09);
  --primary: #2B63C9;
  --primary-2: #3F78E0;
  --navy-soft: rgba(59, 130, 246, 0.14);
  --sky: #38BDF8;
  --sky-2: #7DD3FC;
  --sky-ink: #7DD3FC;
  --sky-soft: rgba(56, 189, 248, 0.15);
  --gold: #E0BC5E;
  --gold-2: #F0D489;
  --gold-ink: #F3E2AF;
  --gold-soft: rgba(224, 188, 94, 0.15);
  --green: #2BB886;
  --green-2: #4DD4A4;
  --green-soft: rgba(43, 184, 134, 0.16);
  --purple: #9A8CFF;
  --purple-soft: rgba(154, 140, 255, 0.16);
  --red: #F05A7A;
  --red-soft: rgba(240, 90, 122, 0.15);
  --fajr: #FF9E4F;
  --fajr-soft: rgba(255, 158, 79, 0.16);
  --shadow: 0 12px 34px -14px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 28px 64px -22px rgba(0, 0, 0, 0.65);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--bg); }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1100px 560px at 85% -10%, var(--sky-soft), transparent 60%),
    radial-gradient(900px 520px at 8% 0%, var(--gold-soft), transparent 55%),
    linear-gradient(180deg, #F6F9FE 0%, var(--bg) 100%);
  background-attachment: fixed;
}
html[data-theme="dark"] body {
  background:
    radial-gradient(1100px 560px at 85% -10%, rgba(14, 165, 233, 0.10), transparent 60%),
    radial-gradient(900px 520px at 8% 0%, rgba(224, 188, 94, 0.06), transparent 55%),
    linear-gradient(180deg, #0A1024 0%, var(--bg) 100%);
}
a { text-decoration: none; color: inherit; }
button { font-family: var(--font-body); }
img { display: block; }
[hidden] { display: none !important; }

.container {
  width: min(1200px, 100% - 40px);
  margin-inline: auto;
}

/* ═══ Navbar ═══ */
.navbar {
  background: linear-gradient(135deg, #0B2A63 0%, var(--primary) 55%, #123F8F 100%);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 6px 22px -12px rgba(11, 42, 99, 0.6);
}
.navbar-inner {
  width: min(1280px, 100% - 48px);
  margin-inline: auto;
  display: flex; align-items: center;
  justify-content: space-between;
  min-height: 78px;
  gap: 12px;
}
.navbar-logo { display: flex; align-items: center; gap: 10px; color: #FDF8F2; }
.navbar-logo img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.navbar-title { font-family: var(--font-display); font-weight: 700; font-size: 24px; }
.navbar-actions { display: flex; align-items: center; gap: 10px; }
.navbar-back {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px;
  color: #fff; font-size: 13.5px; font-weight: 700;
  padding: 0 16px; border-radius: 99px;
  background: rgba(253, 248, 242, 0.14);
  border: 1px solid rgba(253, 248, 242, 0.26);
  transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}
.navbar-back:hover { background: rgba(253, 248, 242, 0.24); border-color: rgba(253, 248, 242, 0.4); }
.navbar-back:active { transform: translateY(1px); }
.navbar-back svg { flex-shrink: 0; }

/* ═══ Page intro ═══ */
.page-intro { text-align: center; padding: 30px 0 4px; }
.page-intro h1 {
  font-family: var(--font-display);
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 700;
  color: var(--primary);
  display: inline-flex; align-items: center; gap: 10px;
}
html[data-theme="dark"] .page-intro h1 { color: var(--ink); }
.page-intro p { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* ═══ Layout ═══ */
.dash { padding: 18px 0 60px; }
.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 18px;
}

/* ═══ Cards ═══ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset-inline: 18px; top: 0; height: 3px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(90deg, transparent, var(--sky), transparent);
  opacity: 0.6;
}
.card--gold::before { background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.card-title {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 19px; font-weight: 700;
  color: var(--ink);
}
.card-title .card-ico {
  width: 38px; height: 38px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  font-size: 19px;
}

/* ═══ Profile Hero — بطاقة مطابقة لبطاقة الملف في التطبيق (ProfileCard + ProfileHeader) ═══ */
/* بطاقة بيضاء كبيرة متمركزة: زوايا كبيرة (20px) + ظل ناعم مثل التطبيق (shadows.md) */
.hero-card {
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 6px 14px rgba(16, 54, 125, 0.1);
}
html[data-theme="dark"] .hero-card { border-color: var(--line); box-shadow: var(--shadow); }
.hero-card::before { display: none; }

/* أيقونة الإعدادات — أعلى البطاقة في جهة الترتيب العربي (الأعلى / اليسار) */
.hero-settings {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  box-shadow: 0 6px 14px -6px rgba(16, 54, 125, 0.18);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.hero-settings:hover { color: var(--sky-ink); border-color: var(--sky); background: var(--sky-soft); }
html[data-theme="dark"] .hero-settings:hover { color: var(--sky); }
.hero-settings:active { transform: translateY(1px); }
.hero-settings:focus-visible { outline: none; box-shadow: var(--ring); }
.hero-settings svg { flex-shrink: 0; }

/* الحيّز العلوي: صورة ⬅ اسم ⬅ نبذة (إن وُجدت) ⬅ تاريخ الانضمام — كلها ممركزة */
.hero-main {
  padding: 22px 20px 0;
  text-align: center;
}

/* الصورة الرمزية — مثل التطبيق: حلقة 108 بإطار أبيض (3px) وظل سماوي ناعم، والصورة 100 */
.hero-avatar {
  position: relative;
  width: 108px; height: 108px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid #FFFFFF;
  background: var(--surface-2);
  box-shadow: 0 8px 18px rgba(14, 165, 233, 0.35);
  display: flex; align-items: center; justify-content: center;
}
.hero-avatar img {
  width: 100px; height: 100px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
}
.hero-avatar .initials {
  width: 100px; height: 100px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 40px; font-weight: 700; line-height: 1;
  color: var(--primary);
  background: linear-gradient(160deg, var(--sky-soft), var(--surface-2));
}

/* الاسم — مثل التطبيق: Amiri 22 / عريض / حبر / ممركز */
.hero-name {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; line-height: 1.3;
  color: var(--ink);
  direction: ltr; text-align: center; unicode-bidi: embed;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
  margin-top: 14px;
}

/* النبذة — تظهر أسفل الاسم إن وُجدت (مثل التطبيق: bodySM بحبر) */
.hero-bio {
  font-size: 13px; line-height: 1.6; color: var(--ink);
  margin-top: 6px;
}

/* تاريخ الانضمام — أيقونة تقويم + «عضو منذ [التاريخ]» بنفس ترتيب ولون التطبيق */
.hero-since {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  margin-top: 10px;
}
.hero-since svg { flex-shrink: 0; color: var(--muted); }

/* زر «تعديل الملف» — مثل التطبيق: أبيض، حدود كحلية 1.5، مستدير 12، أيقونة قلم */
.hero-edit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: calc(100% - 40px);
  margin: 0 20px 20px;
  min-height: 46px;
  padding: 12px 12px;
  font-family: var(--font-body);
  font-size: 12px; font-weight: 700;
  color: var(--primary);
  background: var(--surface);
  border: 1.5px solid var(--primary);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.hero-edit svg { flex-shrink: 0; }
.hero-edit:hover, .hero-edit:active { background: var(--primary); color: #fff; }
.hero-edit:focus-visible {
  outline: none; box-shadow: var(--ring);
}
.navbar-back:focus-visible { outline: none; box-shadow: var(--ring); }

/* ═══ Achievements ═══ */
.ach-hero {
  display: flex; align-items: center; gap: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background:
    radial-gradient(300px 140px at 90% -30%, var(--gold-soft), transparent 70%),
    var(--surface-2);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.ach-hero-ring {
  position: relative; flex-shrink: 0;
  width: 62px; height: 62px;
}
.ach-hero-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ach-ring-track {
  fill: none; stroke: var(--surface); stroke-width: 4;
}
.ach-ring-fill {
  fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round;
  stroke-dasharray: 116.2; stroke-dashoffset: 116.2;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.ach-hero-ring-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700;
  color: var(--gold-ink);
  font-variant-numeric: tabular-nums;
}
html[data-theme="dark"] .ach-hero-ring-num { color: var(--gold); }
.ach-hero-txt { flex: 1; min-width: 0; }
.ach-hero-title {
  display: block;
  font-family: var(--font-display);
  font-size: 16px; font-weight: 700; color: var(--ink);
}
.ach-hero-count { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.ach-hero-bar {
  height: 8px; margin-top: 9px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.ach-hero-bar-fill {
  display: block; height: 100%; width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.ach-tabs {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 14px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ach-tabs::-webkit-scrollbar { display: none; }
.ach-tab {
  flex-shrink: 0;
  min-height: 36px;
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: 12.5px; font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.ach-tab:hover { color: var(--ink); border-color: var(--sky-soft); }
.ach-tab:active { transform: translateY(1px); }
.ach-tab:focus-visible { outline: none; box-shadow: var(--ring); }
.ach-tab--on {
  color: #fff;
  background: linear-gradient(135deg, var(--sky), var(--primary-2));
  border-color: transparent;
}

.ach-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.ach {
  display: flex; flex-direction: column; align-items: stretch;
  min-width: 0;
  text-align: right;
  font-family: var(--font-body);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  --tier: var(--sky); --tier-soft: var(--sky-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.ach:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--tier-soft); }
.ach:active { transform: translateY(0); }
.ach:focus-visible { outline: none; box-shadow: var(--ring); }
.ach-diff-1 { --tier: var(--green);  --tier-soft: var(--green-soft); }
.ach-diff-2 { --tier: var(--sky);    --tier-soft: var(--sky-soft); }
.ach-diff-3 { --tier: var(--gold);   --tier-soft: var(--gold-soft); }
.ach-diff-4 { --tier: var(--red);    --tier-soft: var(--red-soft); }
.ach-diff-5 { --tier: var(--purple); --tier-soft: var(--purple-soft); }

.ach-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
.ach-ico {
  position: relative;
  width: 46px; height: 46px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 14px; font-size: 22px;
  background: var(--tier-soft);
  transition: box-shadow 0.2s ease;
}
.ach-state {
  position: absolute;
  bottom: -5px; inset-inline-end: -5px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1;
  background: var(--surface);
  border: 1.5px solid var(--line);
  color: var(--muted);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
}
.ach--done .ach-state {
  background: var(--tier);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 8px var(--tier-soft);
}
.ach-diff {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 99px;
  white-space: nowrap;
}
.ach-diff::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ach-diff--green  { color: var(--green);    background: var(--green-soft); }
.ach-diff--blue   { color: var(--sky-ink);  background: var(--sky-soft); }
.ach-diff--purple { color: var(--purple);   background: var(--purple-soft); }
.ach-diff--orange { color: var(--gold-ink); background: var(--gold-soft); }
.ach-diff--red    { color: var(--red);      background: var(--red-soft); }
html[data-theme="dark"] .ach-diff--blue   { color: var(--sky); }
html[data-theme="dark"] .ach-diff--orange { color: var(--gold); }

.ach-name { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.ach-desc {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 11.5px; color: var(--muted); line-height: 1.55;
  min-height: calc(2 * 1.55em);
  margin-top: 3px;
}
.ach-bar {
  display: block; height: 7px; margin-top: 11px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.ach-bar-fill {
  display: block; height: 100%; width: 0;
  border-radius: 99px;
  background: var(--tier);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.ach-left {
  display: block; margin-top: 7px;
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ach--done {
  border-color: var(--tier);
  background: linear-gradient(160deg, var(--tier-soft), var(--surface-2) 75%);
  box-shadow: 0 8px 22px -12px var(--tier);
}
.ach--done .ach-ico { box-shadow: 0 0 0 3px var(--tier-soft), 0 0 18px var(--tier-soft); }
.ach--done .ach-left { color: var(--tier); }
/* Locked cards: muted icon + faint bar (state also via 🔒 + text, not color only) */
.ach:not(.ach--done) .ach-ico { opacity: 0.72; }
.ach:not(.ach--done) .ach-bar { opacity: 0.8; }
.ach-empty { text-align: center; font-size: 13px; color: var(--muted); padding: 18px 0 6px; }

/* Compact preview grid (profile page: top 5) — 2×2 pairs like the public profile */
.ach-grid--mini {
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ach-grid--mini .ach { padding: 11px 12px; }
.ach-grid--mini .ach-top { margin-bottom: 8px; }
.ach-grid--mini .ach-ico { width: 40px; height: 40px; border-radius: 12px; font-size: 19px; }
.ach-grid--mini .ach-name { font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ach-grid--mini .ach-desc { -webkit-line-clamp: 1; min-height: auto; font-size: 11px; margin-top: 2px; }
.ach-grid--mini .ach-bar { margin-top: 9px; height: 6px; }
.ach-grid--mini .ach-left { margin-top: 6px; font-size: 10.5px; }

/* Show-all achievements button (links to achievements.html) */
.ach-more {
  display: flex; justify-content: center; margin-top: 16px;
}
.ach-more-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  font-family: var(--font-body);
  font-size: 14px; font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  border: 1px solid transparent;
  border-radius: 99px;
  cursor: pointer;
  box-shadow: 0 10px 24px -10px rgba(201, 163, 74, 0.6);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.ach-more-btn:hover { filter: brightness(1.05); box-shadow: 0 12px 28px -10px rgba(201, 163, 74, 0.75); }
.ach-more-btn:active { transform: translateY(1px); }
.ach-more-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.ach-more-btn svg { flex-shrink: 0; }

/* ═══ Achievement detail modal ═══ */
.ach-detail-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ach-detail-ico {
  width: 58px; height: 58px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 16px; font-size: 27px;
  background: var(--gold-soft);
}
.ach-detail-htxt { flex: 1; min-width: 0; }
.ach-detail-name {
  display: block;
  font-family: var(--font-display);
  font-size: 19px; font-weight: 700; color: var(--ink);
}
.ach-detail-cat { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.ach-detail-desc { font-size: 13.5px; color: var(--muted); line-height: 1.7; margin-bottom: 16px; }
.ach-detail-progress { display: flex; align-items: center; gap: 12px; }
.ach-detail-bar {
  flex: 1; height: 9px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.ach-detail-bar-fill {
  display: block; height: 100%; width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
}
.ach-detail-status {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ach-detail-remain {
  margin-top: 10px;
  font-size: 12.5px; font-weight: 700; color: var(--gold-ink);
}
html[data-theme="dark"] .ach-detail-remain { color: var(--gold); }
.ach-detail-parts {
  list-style: none; margin: 0 0 16px; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.ach-detail-parts li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12.5px; color: var(--muted);
}
.ach-detail-parts li.ach-part--ok { border-color: var(--green-soft); color: var(--ink); }
.ach-part-check {
  width: 20px; height: 20px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 11px; font-weight: 700;
  color: transparent;
  border: 1.5px solid var(--line);
}
.ach-part--ok .ach-part-check { color: #fff; background: var(--green); border-color: var(--green); }
.ach-part-name { flex: 1; font-weight: 600; }
.ach-part-progress {
  flex-shrink: 0; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ach-part--ok .ach-part-progress { color: var(--green); }

/* ═══ Settings — بطاقات مطابقة لبطاقات الإعدادات في التطبيق (SettingsCard) ═══ */
/* قائمة عامودية من بطاقات مستقلة مثل التطبيق */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* بطاقة إعداد — صف أفقي: أيقونة | عنوان+وصف | سهم (مثل التطبيق) */
.setting-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  width: 100%;
  padding: 14px;
  font-family: var(--font-body);
  text-align: right;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
a.setting-card { text-decoration: none; cursor: pointer; }
button.setting-card { cursor: pointer; }
button.setting-card:hover, a.setting-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--sky-soft);
}
.setting-card:active { transform: translateY(0); }
.setting-card:focus-visible { outline: none; box-shadow: var(--ring); }

/* أيقونة داخل مربع صغير بحواف دائرية — جهة اليمين في RTL */
.setting-ico {
  flex-shrink: 0;
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface-2);
}
.setting-ico svg { flex-shrink: 0; }

.setting-txt {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.setting-name { display: block; font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.setting-desc { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.setting-arrow { color: var(--muted); flex-shrink: 0; display: inline-flex; }

/* تلوين أيقونات البطاقات */
.setting-card--fav .setting-ico { background: var(--gold-soft); }
.setting-card--fav .setting-arrow { color: var(--gold-ink); }
.setting-card--admin .setting-ico { background: var(--sky-soft); }
.setting-card--admin .setting-arrow { color: var(--sky-ink); }

/* شارة عدد عناصر المفضلة — ذهبية/بيج مثل التطبيق */
.fav-count-pill {
  flex-shrink: 0;
  font-size: 11.5px; font-weight: 700;
  color: var(--gold-ink);
  background: var(--gold-soft);
  padding: 5px 11px;
  border-radius: 99px;
  white-space: nowrap;
}
html[data-theme="dark"] .fav-count-pill { color: var(--gold); }

/* بطاقة تسجيل الخروج — وردية/حمراء مثل التطبيق */
.setting-card--logout {
  background: #FEF2F2;
  border: 1px solid rgba(225, 29, 72, 0.3);
}
html[data-theme="dark"] .setting-card--logout {
  background: rgba(240, 90, 122, 0.1);
  border-color: rgba(240, 90, 122, 0.28);
}
.setting-card--logout:hover {
  border-color: var(--red-soft);
  box-shadow: 0 8px 22px -12px rgba(225, 29, 72, 0.4);
}
.setting-card--logout .setting-ico { background: var(--red-soft); color: var(--red); }
.setting-card--logout .setting-name { color: var(--red); }
.setting-card--logout .setting-arrow { color: rgba(225, 29, 72, 0.5); }
html[data-theme="dark"] .setting-card--logout .setting-arrow { color: rgba(240, 90, 122, 0.6); }

/* رسائل الحالة داخل النماذج (تستخدمها صفحة «تعديل الملف») */
.form-msg {
  padding: 10px 13px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  margin-bottom: 12px; display: none;
}
.form-msg--success { background: var(--green-soft); color: var(--green); display: block; }
.form-msg--error { background: var(--red-soft); color: var(--red); display: block; }
.form-msg--info { background: var(--sky-soft); color: var(--sky-ink); display: block; }
html[data-theme="dark"] .form-msg--info { color: var(--sky); }

/* أزرار عامة */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  font-size: 14px; font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--sky), var(--primary-2));
  box-shadow: 0 8px 20px -8px rgba(14, 165, 233, 0.55);
}
.btn--primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn--ghost {
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.btn--ghost:hover:not(:disabled) { border-color: var(--sky-soft); color: var(--primary); }
.btn--danger {
  color: #fff;
  background: linear-gradient(135deg, var(--red), #C20F3B);
  box-shadow: 0 8px 20px -8px rgba(225, 29, 72, 0.55);
}
.btn--danger:hover:not(:disabled) { filter: brightness(1.06); }
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: currentColor;
  border-radius: 50%; animation: spin 0.6s linear infinite;
}

/* نافذة تأكيد تسجيل الخروج */
.modal--confirm { width: min(420px, 100%); }
.logout-msg { font-size: 14px; color: var(--muted); line-height: 1.7; margin-bottom: 18px; }
.logout-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ═══ Achievement modal ═══ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(7, 12, 27, 0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.modal-overlay--open { opacity: 1; visibility: visible; }
.modal {
  width: min(560px, 100%);
  max-height: min(82vh, 700px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px 18px;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.modal-overlay--open .modal { transform: translateY(0) scale(1); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.modal-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--ink); }
.modal-close {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); cursor: pointer; font-size: 18px;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.modal-close:hover { background: var(--red-soft); color: var(--red); }
.modal-close:active { transform: translateY(1px); }
.modal-close:focus-visible { outline: none; box-shadow: var(--ring); }

/* ═══ Toast ═══ */
.toast-container {
  position: fixed; top: 18px; inset-inline-end: 18px; z-index: 300;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  padding: 13px 18px; border-radius: var(--radius-md);
  color: #fff; font-size: 13.5px; font-weight: 700;
  min-width: 250px; max-width: 92vw;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.35s ease;
}
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--primary-2); }

/* ═══ Loading ═══ */
.loading-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh; flex-direction: column; gap: 16px;
}
.loading-orb {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--sky);
  animation: spin 0.7s linear infinite;
}
.loading-screen p { color: var(--muted); font-size: 14px; }

/* ═══ Section reveal animation ═══ */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1); }
.reveal--in { opacity: 1; transform: translateY(0); }

/* ═══ Keyframes ═══ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-18px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ═══ Reduced motion ═══ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ═══ Responsive: small phones ═══ */
@media (max-width: 430px) {
  .navbar-back { padding: 0 11px; }
  .navbar-back-label { display: none; }
  .navbar-title { font-size: 18px; }
  .navbar-actions { gap: 6px; }
}

/* ═══ Responsive: tablets ═══ */
@media (min-width: 560px) {
  .ach-grid { grid-template-columns: repeat(2, 1fr); }
  .ach-hero-ring { width: 70px; height: 70px; }
  .ach-hero-ring-num { font-size: 20px; }
}

@media (min-width: 640px) {
  .card { padding: 26px 24px; }
  .hero-card { padding: 0; }
  .settings-list { gap: 14px; }
  .setting-card { padding: 16px; }
  .hero-main { padding: 28px 26px 0; }
  .hero-edit { width: calc(100% - 52px); margin: 0 26px 26px; }
}

@media (min-width: 900px) {
  .ach-grid { grid-template-columns: repeat(3, 1fr); }
  .ach-grid--mini { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ach-hero { padding: 18px; }
}
