/* ======================================================
   أحلامي وأهدافي — Dreamy Goals
   ====================================================== */

:root {
  --bg: #EAF6FC;
  --card: #FFFFFF;
  --text: #3B3160;
  --muted: #7A6F9B;
  --purple: #8B6FD6;
  --purple-deep: #6D51BC;
  --purple-ink: #6A4FC0;
  --lavender: #C9B6F7;
  --sky: #BFE7F5;
  --mint: #B9E8CE;
  --mint-ink: #1F6B47;
  --yellow: #FCEFB4;
  --pink: #F06FB0;
  --cheek: #F6C9DC;
  --field: rgba(139, 111, 214, .08);
  --line: rgba(139, 111, 214, .16);
  --shadow: 0 10px 30px rgba(139, 111, 214, .12);
  --shadow-sm: 0 6px 18px rgba(139, 111, 214, .10);
  --topbar: rgba(234, 246, 252, .80);
  --nav: rgba(255, 255, 255, .90);
  --btn-grad: linear-gradient(135deg, #7B5FCC, #8B6FD6 55%, #A78EE8);
  --btn-shadow: 0 10px 22px rgba(139, 111, 214, .32);
  --danger: #E2568A;
  --radius: 28px;
}

html[data-theme="night"] {
  --bg: #221B3A;
  --card: #2E2550;
  --text: #EDE6FF;
  --muted: #B4A9DA;
  --purple: #A98EE8;
  --purple-deep: #C9B6F7;
  --purple-ink: #CDBBF7;
  --field: rgba(201, 182, 247, .12);
  --line: rgba(201, 182, 247, .20);
  --shadow: 0 10px 30px rgba(0, 0, 0, .32);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, .24);
  --topbar: rgba(34, 27, 58, .82);
  --nav: rgba(46, 37, 80, .94);
  --btn-grad: linear-gradient(135deg, #7B5FCC, #9B81E4 60%, #B49BEE);
  --btn-shadow: 0 10px 22px rgba(0, 0, 0, .34);
  --mint-ink: #9CE3BC;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  transition: background .4s ease, color .4s ease;
}

h1, h2, h3, h4 {
  font-family: "Baloo Bhaijaan 2", "Tajawal", system-ui, sans-serif;
  font-weight: 700;
  margin: 0;
  line-height: 1.35;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { user-select: none; -webkit-user-select: none; }

/* ---------------- السماء والخلفية ---------------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(180deg, #E3F3FC 0%, #EAF6FC 42%, #F4EEFF 100%);
  transition: background .6s ease;
}

html[data-theme="night"] .sky {
  background: linear-gradient(180deg, #1B1533 0%, #241C3F 45%, #2C2249 100%);
}

.cloud {
  position: absolute;
  width: 170px;
  height: 52px;
  background: #FFFFFF;
  border-radius: 999px;
  opacity: .58;
  filter: blur(1.5px);
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.cloud::before { width: 84px; height: 84px; top: -38px; right: 20px; }
.cloud::after { width: 58px; height: 58px; top: -24px; right: 96px; }

.c1 { top: 10%; left: -14%; animation: drift 40s ease-in-out infinite alternate; }
.c2 { top: 34%; left: 62%; width: 130px; height: 40px; opacity: .45; animation: drift 52s ease-in-out infinite alternate-reverse; }
.c3 { top: 66%; left: -8%; width: 200px; height: 58px; opacity: .40; animation: drift 62s ease-in-out infinite alternate; }
.c4 { top: -3%; left: 18%; width: 230px; height: 60px; background: #DCEBFF; opacity: .85; animation: drift 40s ease-in-out infinite alternate; }

html[data-theme="night"] .cloud { background: #3B3068; opacity: .55; }
html[data-theme="night"] .c4 { background: #4A3B85; opacity: .7; }

@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(70px); }
}

.twinkle {
  position: absolute;
  color: #FFFFFF;
  opacity: .75;
  font-size: 14px;
  animation: twinkle 5s ease-in-out infinite;
}
.t1 { top: 16%; left: 12%; animation-delay: 0s; }
.t2 { top: 46%; left: 82%; font-size: 11px; animation-delay: 1.4s; }
.t3 { top: 74%; left: 30%; font-size: 16px; animation-delay: 2.6s; }

html[data-theme="night"] .twinkle { color: #D9CBFB; opacity: .9; }

@keyframes twinkle {
  0%, 100% { opacity: .15; transform: scale(.85); }
  50% { opacity: .85; transform: scale(1.1); }
}

/* ---------------- الهيكل ---------------- */
.app {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 16px 118px;
  position: relative;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px 10px;
  background: var(--topbar);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  margin: 0 -16px 4px;
  padding-inline: 18px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { display: flex; flex: 0 0 auto; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong {
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 16px;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
}
.brand-text small {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.3;
  white-space: nowrap;
}

.stars-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border-radius: 999px;
  padding: 6px 12px 6px 10px;
  box-shadow: var(--shadow-sm);
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  flex: 0 0 auto;
}

/* ---------------- المشاهد ---------------- */
.views { position: relative; }
.view { display: none; }
.view.is-active { display: block; }

.view-anim { animation: viewIn .34s cubic-bezier(.22, .9, .3, 1); }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 16px;
}

.view-head h1 {
  font-size: 25px;
  color: var(--text);
}

.view-head .head-sub {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  font-family: "Tajawal", sans-serif;
  font-weight: 500;
  margin-top: 2px;
}

/* ---------------- البطاقات ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: background .4s ease;
}

.card + .card { margin-top: 14px; }

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  margin-bottom: 12px;
  color: var(--text);
}

.card-title svg { color: var(--purple); flex: 0 0 auto; }

/* ---------------- بطاقة الترحيب ---------------- */
.greet-card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.greet-card::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 182, 247, .28), rgba(201, 182, 247, 0) 70%);
  top: -70px;
  left: -50px;
  pointer-events: none;
}

.greet-body { position: relative; z-index: 1; min-width: 0; }

.greet-hi {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

.greet-name {
  font-size: 26px;
  color: var(--text);
  margin: 2px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 190px;
}

.greet-date {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.cloud-hero {
  flex: 0 0 auto;
  animation: floaty 4s ease-in-out infinite;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.cloud-svg { display: block; filter: drop-shadow(0 8px 14px rgba(139, 111, 214, .18)); }

/* ---------------- بطاقة التقدم ---------------- */
.progress-card {
  margin-top: 14px;
  border-radius: var(--radius);
  padding: 18px 20px;
  background: linear-gradient(135deg, #7B5FCC, #8B6FD6 55%, #A78EE8);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 14px 32px rgba(123, 95, 204, .34);
}

.progress-info { min-width: 0; }

.pc-label {
  font-size: 11.5px;
  letter-spacing: 0;
  opacity: .85;
  display: block;
}

.pc-title {
  font-size: 19px;
  margin: 3px 0 0;
  color: #FFFFFF;
  line-height: 1.35;
}

.pc-sub {
  margin: 6px 0 0;
  font-size: 12px;
  opacity: .88;
}

.pc-stars {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  background: rgba(255, 255, 255, .18);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 700;
}

.ring-wrap { position: relative; flex: 0 0 auto; display: grid; place-items: center; }
.ring { transform: rotate(-90deg); display: block; }
.ring-fill { transition: stroke-dashoffset .7s cubic-bezier(.3, .9, .3, 1); }

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  pointer-events: none;
}

.ring-num {
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
}
.ring-num small { font-size: 12px; opacity: .8; }
.ring-cap { font-size: 10px; opacity: .82; margin-top: 1px; }

/* ---------------- إحصاءات ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.stat-card {
  background: var(--card);
  border-radius: 22px;
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-num {
  display: block;
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--purple-ink);
}

.stat-cap { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------------- عناوين الأقسام ---------------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 22px 2px 10px;
}

.section-head h2 { font-size: 17px; color: var(--text); }

.link-btn {
  background: none;
  border: 0;
  color: var(--purple-ink);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 12px;
  cursor: pointer;
  min-height: 34px;
}
.link-btn:active { background: var(--field); }

/* ---------------- الأزرار ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  min-height: 46px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  -webkit-user-select: none;
  user-select: none;
}

.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn:focus-visible,
.icon-btn:focus-visible,
.tab:focus-visible,
.chip:focus-visible,
.cat-chip:focus-visible,
.mini-btn:focus-visible,
.check:focus-visible,
.link-btn:focus-visible,
.theme-option:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--btn-grad);
  color: #FFFFFF;
  box-shadow: var(--btn-shadow);
}

.btn-soft {
  background: var(--field);
  color: var(--purple-ink);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: inset 0 0 0 2px var(--line);
}

.btn-danger {
  background: linear-gradient(135deg, #D94A80, #F06FB0);
  color: #FFFFFF;
  box-shadow: 0 10px 22px rgba(240, 111, 176, .30);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--field);
  color: var(--purple-ink);
  font-size: 17px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: var(--field);
  color: var(--purple-ink);
  border-radius: 999px;
  padding: 8px 13px;
  min-height: 38px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s ease, transform .14s ease;
}
.mini-btn:active { transform: scale(.95); }
.mini-btn.danger { color: var(--danger); background: rgba(226, 86, 138, .10); }

/* ---------------- رقائق التصفية ---------------- */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip {
  border: 0;
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 16px;
  min-height: 40px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background .2s, color .2s, transform .14s;
}

.chip.on {
  background: var(--btn-grad);
  color: #FFFFFF;
  box-shadow: var(--btn-shadow);
}

.chip:active { transform: scale(.96); }

/* ---------------- أهداف ---------------- */
.goal-card {
  position: relative;
  margin-bottom: 12px;
  border-inline-start: 5px solid var(--c, var(--lavender));
}

.goal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: color-mix(in srgb, var(--c, #C9B6F7) 30%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.goal-pct {
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: var(--purple-ink);
  background: var(--field);
  border-radius: 999px;
  padding: 2px 11px;
}
.goal-pct.full { background: rgba(185, 232, 206, .45); color: var(--mint-ink); }

.goal-title {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 3px;
  word-break: break-word;
}
.goal-title.done { text-decoration: line-through; color: var(--muted); }

.goal-desc {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  word-break: break-word;
}

.bar {
  height: 9px;
  border-radius: 999px;
  background: var(--field);
  overflow: hidden;
  margin: 10px 0 10px;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8B6FD6, #C9B6F7);
  transition: width .55s cubic-bezier(.3, .9, .3, 1);
}

.goal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 12px;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.meta-item.overdue { color: var(--danger); font-weight: 700; }

.goal-actions { display: flex; flex-wrap: wrap; gap: 7px; }

/* ---------------- المهام ---------------- */
.task-list { list-style: none; margin: 0; padding: 0; }

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: background .3s, box-shadow .3s;
}

.check {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.check-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.4px solid var(--lavender);
  display: grid;
  place-items: center;
  color: #FFFFFF;
  transition: background .22s ease, border-color .22s ease, transform .22s ease;
}

.check:active .check-circle { transform: scale(.88); }

.task-item.is-done .check-circle {
  background: var(--mint);
  border-color: var(--mint);
}

.task-body { flex: 1 1 auto; min-width: 0; padding-top: 4px; }

.task-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
  transition: color .25s;
}

.task-item.is-done .task-title {
  text-decoration: line-through;
  color: var(--muted);
  text-decoration-color: var(--lavender);
}

.task-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--field);
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-daily { background: rgba(191, 231, 245, .5); color: #1C6480; }
html[data-theme="night"] .tag-daily { background: rgba(191, 231, 245, .16); color: #A9DCF0; }

.task-actions { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }

.task-actions .mini-btn { padding: 7px 9px; min-height: 32px; }

/* ---------------- عبارات ---------------- */
.quote-hero {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 22px 22px;
  text-align: center;
}

.quote-hero::before {
  content: "";
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(252, 239, 180, .55), rgba(252, 239, 180, 0) 70%);
  top: -90px;
  right: -60px;
  pointer-events: none;
}

.quote-mark {
  font-family: Georgia, serif;
  font-size: 54px;
  line-height: .6;
  color: var(--lavender);
  margin-bottom: 8px;
}

.quote-text {
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 20px;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 20px;
  position: relative;
  z-index: 1;
  animation: quoteIn .5s cubic-bezier(.22, .9, .3, 1);
  word-break: break-word;
}

@keyframes quoteIn {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.quote-actions {
  display: flex;
  gap: 9px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.quote-teaser {
  background: linear-gradient(135deg, rgba(252, 239, 180, .55), rgba(191, 231, 245, .45));
  border-radius: 24px;
  padding: 18px;
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

html[data-theme="night"] .quote-teaser {
  background: linear-gradient(135deg, rgba(252, 239, 180, .12), rgba(191, 231, 245, .12));
}

.fav-card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  margin-bottom: 11px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.fav-text {
  flex: 1 1 auto;
  margin: 0;
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text);
  word-break: break-word;
}

/* ---------------- حالات فارغة ---------------- */
.empty-state {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 26px 20px;
  text-align: center;
}

.empty-art { display: flex; justify-content: center; margin-bottom: 6px; opacity: .95; }

.empty-title {
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 17px;
  color: var(--text);
  margin: 0 0 4px;
}

.empty-sub { font-size: 13px; color: var(--muted); margin: 0 0 16px; }

/* ---------------- الإنجازات ---------------- */
.ach-hero {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.ach-hero .ring-num { color: var(--text); }
.ach-hero .ring-cap { color: var(--muted); }

.ach-hero-text h2 { font-size: 18px; color: var(--text); margin-bottom: 4px; }
.ach-hero-text p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

.badge-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.badge {
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: .5;
  filter: grayscale(.6);
  transition: opacity .3s, filter .3s, transform .3s;
}

.badge.on { opacity: 1; filter: none; }

.badge-icon {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--field);
  color: var(--purple-ink);
  flex: 0 0 auto;
}
.badge.on .badge-icon { background: linear-gradient(135deg, #FCEFB4, #F6C9DC); color: #8A6A1F; }

.badge-text strong { display: block; font-size: 12.5px; color: var(--text); }
.badge-text small { font-size: 10.5px; color: var(--muted); }

.ach-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  padding: 12px 16px;
  margin-bottom: 9px;
}

.ach-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mint);
  color: var(--mint-ink);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.ach-row-text { flex: 1 1 auto; min-width: 0; }
.ach-row-text strong {
  display: block;
  font-size: 14px;
  color: var(--text);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ach-row-text small { font-size: 11px; color: var(--muted); }

/* ---------------- الإعدادات ---------------- */
.name-row { display: flex; gap: 8px; align-items: stretch; }
.name-row .btn { flex: 0 0 auto; padding-inline: 18px; }

.text-input {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--field);
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 12px 16px;
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color .2s, background .2s;
}

.text-input:focus {
  border-color: var(--lavender);
  background: var(--card);
}

.text-input::placeholder { color: var(--muted); opacity: .75; }

.hint { font-size: 11.5px; color: var(--muted); margin: 9px 2px 0; }

.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.theme-option {
  border: 2.5px solid transparent;
  background: var(--field);
  border-radius: 20px;
  padding: 12px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  transition: border-color .2s, background .2s, color .2s;
}

.theme-option.on { border-color: var(--purple); color: var(--purple-ink); background: var(--card); }

.theme-preview {
  height: 44px;
  border-radius: 14px;
  margin-bottom: 8px;
  display: flex;
  gap: 4px;
  padding: 7px;
  align-items: flex-end;
}
.theme-preview.light { background: linear-gradient(135deg, #EAF6FC, #F4EEFF); }
.theme-preview.night { background: linear-gradient(135deg, #221B3A, #2E2550); }
.theme-preview span { flex: 1; border-radius: 6px; height: 12px; }
.theme-preview.light span:nth-child(1) { background: #8B6FD6; height: 22px; }
.theme-preview.light span:nth-child(2) { background: #C9B6F7; }
.theme-preview.light span:nth-child(3) { background: #B9E8CE; }
.theme-preview.night span:nth-child(1) { background: #A98EE8; height: 22px; }
.theme-preview.night span:nth-child(2) { background: #C9B6F7; }
.theme-preview.night span:nth-child(3) { background: #FCEFB4; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  cursor: pointer;
  position: relative;
}

.switch-row + .switch-row { border-top: 1px solid var(--line); }

.switch-text { display: flex; flex-direction: column; min-width: 0; }
.switch-text strong { font-size: 14px; font-weight: 700; color: var(--text); }
.switch-text small { font-size: 11.5px; color: var(--muted); }

.switch-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.switch-ui {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: rgba(139, 111, 214, .24);
  flex: 0 0 auto;
  transition: background .24s ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 6px rgba(59, 49, 96, .24);
  transition: transform .24s cubic-bezier(.3, .9, .3, 1);
}

.switch-input:checked + .switch-ui { background: var(--purple); }
.switch-input:checked + .switch-ui::after { transform: translateX(-22px); }
.switch-input:focus-visible + .switch-ui { outline: 3px solid var(--purple); outline-offset: 2px; }

.about {
  margin-top: 20px;
  text-align: center;
  padding: 8px 0 0;
}
.about-slogan {
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 14px;
  color: var(--purple-ink);
  line-height: 1.8;
  margin: 6px 0 0;
}
.about small { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; }

.danger-zone .btn { width: 100%; }
.danger-zone .btn + .btn { margin-top: 9px; }

/* ---------------- شريط التنقل ---------------- */
.tabbar {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: min(568px, calc(100% - 20px));
  display: flex;
  gap: 2px;
  padding: 7px 6px;
  background: var(--nav);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 26px;
  box-shadow: 0 12px 34px rgba(139, 111, 214, .22), 0 0 0 1px rgba(255, 255, 255, .5) inset;
  z-index: 50;
}

html[data-theme="night"] .tabbar {
  box-shadow: 0 12px 34px rgba(0, 0, 0, .40), 0 0 0 1px rgba(201, 182, 247, .1) inset;
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: 0;
  padding: 8px 0 6px;
  border-radius: 18px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, transform .16s ease;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
}

.tab svg { width: 21px; height: 21px; flex: 0 0 auto; }
.tab span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab:active { transform: scale(.94); }
.tab.active { color: var(--purple-ink); background: var(--field); }

/* ---------------- المودالات ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 37, 78, .45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn .24s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 30px 30px 0 0;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 40px rgba(59, 49, 96, .22);
  animation: sheetUp .34s cubic-bezier(.22, .9, .3, 1);
  overscroll-behavior: contain;
}

@keyframes sheetUp {
  from { transform: translateY(30px); opacity: .6; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-head h2 { font-size: 20px; color: var(--text); }

.modal-actions {
  display: flex;
  gap: 9px;
  margin-top: 18px;
}

.modal-actions .btn { flex: 1 1 auto; }

.field { display: block; margin-bottom: 14px; }

.field > span {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 7px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--field);
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 12px 16px;
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color .2s ease, background .2s ease;
  -webkit-appearance: none;
  appearance: none;
  resize: none;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--lavender);
  background: var(--card);
}

.field input::placeholder,
.field textarea::placeholder { color: var(--muted); opacity: .7; }

.field select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A6F9B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  background-size: 18px;
  padding-left: 42px;
}

.cat-picker { display: flex; flex-wrap: wrap; gap: 7px; }

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 2px solid transparent;
  background: var(--field);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 13px;
  min-height: 40px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .18s, background .18s, color .18s, transform .14s;
}
.cat-chip:active { transform: scale(.95); }
.cat-chip.on { border-color: var(--purple); background: var(--card); color: var(--purple-ink); }

/* مودال التهنئة */
.celebrate-card { text-align: center; position: relative; overflow: hidden; }

.celebrate-art { display: flex; justify-content: center; margin-bottom: 4px; animation: hop .9s ease-in-out infinite; }

@keyframes hop {
  0%, 100% { transform: translateY(0) scale(1); }
  30%      { transform: translateY(-12px) scale(1.04); }
  55%      { transform: translateY(0) scale(.98); }
}

.celebrate-heading { font-size: 22px; color: var(--text); margin-bottom: 4px; }

.celebrate-goal {
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 17px;
  color: var(--purple-ink);
  margin: 0 0 8px;
  word-break: break-word;
}

.celebrate-msg { font-size: 13.5px; color: var(--muted); margin: 0 0 14px; line-height: 1.7; }

.reward-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(252, 239, 180, .85), rgba(246, 201, 220, .8));
  color: #8A6A1F;
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 800;
  font-size: 14px;
  font-family: "Baloo Bhaijaan 2", sans-serif;
}

.confirm-card h2 { font-size: 19px; margin-bottom: 8px; color: var(--text); }
.confirm-message { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.7; }

.welcome-card { text-align: center; }
.welcome-art { display: flex; justify-content: center; margin-bottom: 2px; animation: floaty 4s ease-in-out infinite; }
.welcome-title { font-size: 22px; color: var(--text); margin-bottom: 6px; }
.welcome-sub {
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 14px;
  color: var(--purple-ink);
  margin: 0 0 18px;
  line-height: 1.8;
}
.welcome-card .field { text-align: start; }

/* ---------------- جسيمات ---------------- */
.particle {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  animation: burst 1.4s cubic-bezier(.2, .7, .4, 1) forwards;
  z-index: 5;
}

@keyframes burst {
  0%   { transform: translate(-50%, -50%) scale(.4); opacity: 0; }
  15%  { opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(1.05);
    opacity: 0;
  }
}

/* ---------------- التوست ---------------- */
.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translate(-50%, 16px);
  background: #3B3160;
  color: #FFFFFF;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease, transform .28s ease;
  max-width: calc(100% - 40px);
  text-align: center;
  box-shadow: 0 12px 30px rgba(59, 49, 96, .32);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- استجابة ---------------- */
@media (min-width: 720px) {
  .modal { align-items: center; padding: 20px; }
  .modal-card {
    border-radius: 30px;
    max-width: 480px;
    max-height: 84vh;
    padding-bottom: 24px;
  }
  .tab { font-size: 11px; }
  .tab svg { width: 22px; height: 22px; }
}

@media (max-width: 380px) {
  .app { padding-inline: 12px; }
  .greet-name { font-size: 23px; max-width: 150px; }
  .pc-title { font-size: 17px; }
  .tab { font-size: 8.5px; }
  .tab svg { width: 19px; height: 19px; }
  .stat-num { font-size: 19px; }
  .card { padding: 16px; }
  .goal-title { font-size: 16.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .particle { display: none; }
}