:root {
  color-scheme: light;
  --emerald: #053d38;
  --teal: #0d6a60;
  --teal-2: #10927e;
  --gold: #d8b35a;
  --cream: #f8f3e8;
  --paper: rgba(255, 252, 244, .92);
  --ink: #102521;
  --muted: #64746f;
  --line: rgba(5, 61, 56, .12);
  --soft: rgba(5, 61, 56, .055);
  --shadow: 0 16px 40px rgba(5, 61, 56, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  direction: rtl;
  font-family: "Cairo", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 0%, rgba(216, 179, 90, .22), transparent 24rem),
    radial-gradient(circle at 10% 12%, rgba(16, 146, 126, .12), transparent 22rem),
    linear-gradient(135deg, #f8f3e8, #eef7f1 55%, #fffaf0);
}
body.dark {
  --paper: rgba(11, 41, 38, .92);
  --ink: #fbf5ea;
  --muted: #b9cac4;
  --line: rgba(255, 255, 255, .12);
  --soft: rgba(255, 255, 255, .065);
  background: linear-gradient(135deg, #031716, #082f2c 58%, #151107);
  color-scheme: dark;
}

button, input, select { font: inherit; }
button {
  border: 0;
  border-radius: 16px;
  min-height: 44px;
  padding: 10px 13px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(5, 61, 56, .08);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
button:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(5, 61, 56, .14); }
button.active, button.done, .primary {
  background: linear-gradient(135deg, var(--emerald), var(--teal));
  color: #fff;
}
button span { font-weight: 800; }
.wide { width: 100%; }
.danger { background: #fff0ed; color: #a23122; }

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, .8);
  color: var(--ink);
  outline: none;
}
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, .8);
  color: var(--ink);
  outline: none;
}
label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
small, p { color: var(--muted); }
h1, h2, h3, p { margin-top: 0; }
h1, h2 {
  font-family: "Noto Kufi Arabic", "Cairo", sans-serif;
  letter-spacing: 0;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(16px);
}
.brand-mark {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--emerald), var(--teal));
  color: var(--gold);
  font: 800 38px "Noto Kufi Arabic", sans-serif;
}

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 10px 12px 92px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px;
  backdrop-filter: blur(16px);
}
.topbar strong { color: var(--emerald); font-size: 18px; }
body.dark .topbar strong { color: var(--gold); }
.topbar span { color: var(--muted); font-size: 12px; font-weight: 700; }

.content {
  display: grid;
  gap: 12px;
}
.compact-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 14px;
  backdrop-filter: blur(16px);
}

.dashboard {
  display: grid;
  grid-template-columns: 1.4fr .72fr .72fr .56fr .56fr;
  gap: 10px;
}
.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 172px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(5, 61, 56, .98), rgba(13, 106, 96, .95)),
    radial-gradient(circle at 20% 100%, rgba(216, 179, 90, .22), transparent 18rem);
}
.hero h1 {
  margin: 6px 0 5px;
  font-size: clamp(25px, 3vw, 40px);
  line-height: 1.25;
}
.hero p, .hero small, .hero .eyebrow { color: rgba(255, 255, 255, .78); }
.eyebrow { font-weight: 800; }
.hero.prayer-due {
  background:
    linear-gradient(135deg, #062b29, #0f6b60 58%, #9b6f1d),
    radial-gradient(circle at 20% 100%, rgba(255, 220, 132, .35), transparent 18rem);
  animation: pulsePrayer 2.8s ease-in-out infinite;
}
.hero-cta {
  margin-top: 10px;
  background: linear-gradient(135deg, var(--gold), #f7e7ad);
  color: #1b251f;
  font-weight: 900;
}
.ring {
  position: relative;
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--gold) calc(var(--p) * 1%), rgba(255,255,255,.16) 0);
}
.ring::before {
  content: "";
  position: absolute;
  width: 76px;
  height: 76px;
  border-radius: inherit;
  background: var(--emerald);
}
.ring b { position: relative; color: #fff; font-size: 22px; }

.quick {
  display: grid;
  gap: 10px;
  align-content: stretch;
}
.next-action {
  height: 88px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  text-align: start;
  background: linear-gradient(135deg, var(--gold), #f4df99);
  color: #1b251f;
  font-weight: 900;
}
.next-action span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255,255,255,.42);
}
.quick div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 16px;
  background: var(--soft);
}
.quick strong { font-size: 13px; }

.mini-stat {
  display: grid;
  gap: 4px;
  min-height: 172px;
  align-content: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .66);
}
.prayer-clock {
  display: grid;
  gap: 5px;
  align-content: center;
  min-height: 172px;
}
.prayer-clock > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--soft);
  color: var(--teal);
  font-weight: 900;
}
.prayer-clock b {
  font-size: 24px;
  color: var(--emerald);
}
.prayer-clock em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}
.prayer-clock strong { color: var(--gold); }
body.dark .mini-stat { background: rgba(255,255,255,.055); }
.mini-stat span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--soft);
  color: var(--teal);
}
.mini-stat b {
  color: var(--emerald);
  font-size: 28px;
  line-height: 1;
}
body.dark .mini-stat b { color: var(--gold); }
.mini-stat em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.mode-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}
.mode-strip button {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon title" "icon hint";
  column-gap: 9px;
  align-items: center;
  text-align: start;
  min-height: 64px;
  border: 1px solid var(--line);
}
.mode-strip span { grid-area: icon; font-size: 22px; }
.mode-strip b { grid-area: title; }
.mode-strip small { grid-area: hint; color: inherit; opacity: .7; }

.section-title {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
  margin-bottom: 11px;
}
.section-title > span, .page-head > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(5, 61, 56, .1), rgba(216, 179, 90, .18));
  color: var(--teal);
  font-weight: 900;
}
.section-title h2, .page-head h1 { margin: 0; font-size: 18px; }
.section-title small { font-size: 12px; text-align: end; }

.today-map { padding-bottom: 12px; }
.task-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.task-tile {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--soft);
}
.task-tile span { color: var(--teal); font-weight: 900; }
.task-tile b { font-size: 14px; }
.task-tile.done {
  border-color: rgba(216, 179, 90, .55);
  background: linear-gradient(135deg, rgba(216, 179, 90, .18), rgba(16, 146, 126, .09));
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.wide-panel { grid-column: 1 / -1; }
.panel { min-height: 100%; }

.prayer-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.prayer-card {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 4px;
  text-align: center;
  border: 1px solid var(--line);
}
.prayer-card span { font-size: 20px; color: var(--teal); }
.prayer-card.done span { color: #fff; }

.input-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.target-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  background: var(--soft);
  font-size: 13px;
}
.quran-focus {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(5,61,56,.08), rgba(216,179,90,.14));
  margin-bottom: 10px;
}
.quran-focus b {
  display: block;
  margin: 2px 0;
  font-size: 34px;
  color: var(--emerald);
  line-height: 1;
}
body.dark .quran-focus b { color: var(--gold); }
.quran-focus span { color: var(--muted); font-size: 12px; }
.quran-open {
  display: grid;
  place-items: center;
  min-width: 128px;
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 16px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--emerald), var(--teal));
  font-weight: 900;
}
.quran-actions { margin: 10px 0; grid-template-columns: repeat(3, 1fr); }
.quran-page-entry { grid-template-columns: repeat(2, 1fr); }

.small-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.small-actions button {
  display: grid;
  gap: 4px;
  align-content: center;
  min-height: 76px;
}

.dhikr-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
}
.dhikr-card {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--soft);
}
.dhikr-main {
  min-height: 92px;
  display: grid;
  gap: 4px;
  align-content: center;
  text-align: center;
  box-shadow: none;
}
.dhikr-main span { color: var(--teal); }
.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(5, 61, 56, .13);
}
.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), #f4df99);
}
.row-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}
.good-deed-box {
  display: grid;
  gap: 9px;
}
.row-actions button { min-height: 38px; padding: 8px; box-shadow: none; }

.challenge-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}
.challenge-grid button {
  min-height: 104px;
  display: grid;
  gap: 7px;
  align-content: center;
  text-align: start;
  border: 1px solid var(--line);
}
.locked {
  background: linear-gradient(135deg, rgba(255,255,255,.82), rgba(216,179,90,.16));
}

.review-grid {
  grid-template-columns: 1fr 1fr 1fr auto;
  align-items: end;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-head h1 { font-size: 22px; }
.page-head p { margin: 3px 0 0; }

.garden, .achievements, .stats {
  display: grid;
  gap: 10px;
}
.garden { grid-template-columns: repeat(4, 1fr); }
.stats { grid-template-columns: repeat(6, 1fr); }
.achievements { grid-template-columns: repeat(3, 1fr); }
.garden-card, .achievement, .stat {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--paper);
  box-shadow: 0 10px 26px rgba(5,61,56,.08);
}
.garden-card > span, .achievement span, .stat span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--soft);
  color: var(--teal);
  font-weight: 900;
}
.garden-card h3, .achievement h3 { margin: 9px 0 3px; }
.garden-card p, .achievement p { margin-bottom: 10px; font-size: 13px; }
.garden-card blockquote {
  margin: 8px 0 10px;
  padding: 9px 10px;
  border-inline-start: 3px solid var(--gold);
  border-radius: 12px;
  background: var(--soft);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.75;
}
.stat {
  display: grid;
  gap: 5px;
}
.stat b { font-size: 24px; color: var(--emerald); }
body.dark .stat b { color: var(--gold); }
.achievement.done {
  border-color: rgba(216, 179, 90, .58);
  background: linear-gradient(135deg, rgba(216, 179, 90, .17), rgba(255,255,255,.55));
}
.achievement > div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.timeline {
  margin: 0 0 8px;
  padding-inline-start: 10px;
  border-inline-start: 3px solid var(--gold);
}
.habit-pulse {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.habit-pulse b {
  padding: 12px;
  border-radius: 15px;
  background: var(--soft);
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.settings-grid small { grid-column: 1 / -1; }

.bottom {
  position: fixed;
  z-index: 20;
  inset-inline: 0;
  bottom: 0;
  width: min(720px, calc(100% - 16px));
  margin: 0 auto 8px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 252, 244, .88);
  box-shadow: 0 18px 44px rgba(5,61,56,.17);
  backdrop-filter: blur(18px);
}
body.dark .bottom { background: rgba(7, 31, 29, .9); }
.bottom button {
  display: grid;
  gap: 2px;
  place-items: center;
  min-height: 54px;
  padding: 7px 4px;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
}
.bottom button span { font-size: 18px; }
.bottom button b { font-size: 12px; }
.bottom button.active { background: var(--emerald); color: #fff; }

.toast {
  position: fixed;
  z-index: 40;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--emerald);
  color: #fff;
  box-shadow: var(--shadow);
  animation: pop .22s ease both;
}
.modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .42);
  backdrop-filter: blur(8px);
}
.modal-card {
  width: min(430px, 100%);
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.modal-card button {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  text-align: start;
}

@keyframes pop {
  from { opacity: 0; transform: translate(-50%, -8px) scale(.97); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes pulsePrayer {
  0%, 100% { box-shadow: var(--shadow); }
  50% { box-shadow: 0 0 0 4px rgba(216,179,90,.18), 0 18px 54px rgba(216,179,90,.22); }
}

@media (max-width: 1040px) {
  .dashboard { grid-template-columns: 1fr 1fr 1fr; }
  .hero { grid-column: 1 / -1; }
  .quick { grid-column: span 2; }
  .task-grid, .stats { grid-template-columns: repeat(3, 1fr); }
  .dhikr-grid { grid-template-columns: repeat(2, 1fr); }
  .garden { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .shell { padding-inline: 9px; }
  .dashboard, .two-col, .mode-strip, .settings-grid { grid-template-columns: 1fr; }
  .quick { grid-column: auto; }
  .prayer-clock { min-height: 118px; }
  .hero { min-height: 160px; }
  .task-grid, .prayer-grid, .small-actions, .input-grid, .challenge-grid, .garden, .achievements, .stats, .habit-pulse { grid-template-columns: repeat(2, 1fr); }
  .review-grid { grid-template-columns: 1fr; }
  .section-title { grid-template-columns: auto 1fr; }
  .section-title small { grid-column: 2; text-align: start; }
}

@media (max-width: 480px) {
  .compact-card { border-radius: 19px; padding: 12px; }
  .hero { grid-template-columns: 1fr; gap: 12px; }
  .ring { width: 92px; height: 92px; }
  .ring::before { width: 68px; height: 68px; }
  .task-grid, .prayer-grid, .small-actions, .input-grid, .challenge-grid, .garden, .achievements, .stats { grid-template-columns: 1fr; }
  .quran-focus, .quran-page-entry, .quran-actions { grid-template-columns: 1fr; }
  .dhikr-grid { grid-template-columns: 1fr; }
  .mini-stat { min-height: 112px; }
  .bottom { width: calc(100% - 10px); }
  .bottom button b { font-size: 11px; }
}
