/* My Life OS — "سماء يومك"
   The hero is a sky that follows the real time of day (dawn, day, golden hour, dusk, night),
   with the sun or moon on an arc and the five prayers marked on it.
   Everything else stays calm: misty lilac ground, white cards, one warm sunrise accent,
   and a soft color per area of life. */
:root {
  --bg: #F3F2FA; --surface: #FFFFFF; --raise: #FAFAFE; --ink: #1C1B2E; --muted: #6C6A86; --line: #E7E5F2;
  --accent: #FF6B57; --accent-soft: #FFE9E5; --on-accent: #FFFFFF;
  --mint: #18A889; --mint-soft: #DDF5EE;
  --sky: #3B82F6; --sky-soft: #E1ECFF;
  --sun: #E89A00; --sun-soft: #FFF1D1;
  --rose: #F0568C; --rose-soft: #FFE3EE;
  --lav: #7C64F2; --lav-soft: #ECE8FF;
  --good: #16A34A; --warn: #D97706; --bad: #DC2626;
  --display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --body: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --r: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11121D; --surface: #1A1B2B; --raise: #202238; --ink: #ECEBF7; --muted: #A09EBB; --line: #2B2D44;
    --accent: #FF8A78; --accent-soft: #3A2228; --on-accent: #1A1B2B;
    --mint: #3DD1AE; --mint-soft: #15342D;
    --sky: #6EA6FF; --sky-soft: #172742;
    --sun: #FFC247; --sun-soft: #3A2E12;
    --rose: #FF7DAA; --rose-soft: #3A1C29;
    --lav: #A694FF; --lav-soft: #262142;
    --good: #4ADE80; --warn: #FBBF24; --bad: #F87171;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.6; -webkit-text-size-adjust: 100%; }
.wrap { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 14px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 110px) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 18px; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
section { display: flex; flex-direction: column; gap: 10px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card { background: var(--surface); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* top bar */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.top .hello { display: flex; flex-direction: column; }
.iconbtn { width: 40px; height: 40px; border-radius: 14px; border: 0; background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.iconbtn svg { width: 22px; height: 22px; }

/* sky hero */
.sky { position: relative; border-radius: 26px; padding: 18px 18px 14px; overflow: hidden; color: var(--sky-ink, #1C1B2E); background: var(--sky-bg); isolation: isolate; }
.sky::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 80% at 80% 0%, rgba(255,255,255,.35), transparent 60%); z-index: -1; pointer-events: none; }
.sky .stars { position: absolute; inset: 0; z-index: -1; opacity: var(--stars, 0); pointer-events: none; }
.sky .kick { font-size: 12.5px; opacity: .85; }
.sky .title { font-family: var(--display); font-weight: 700; font-size: 26px; line-height: 1.25; overflow-wrap: anywhere; }
.sky .note { font-size: 14px; opacity: .9; }
.sky .bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.35); overflow: hidden; margin-top: 8px; }
.sky .bar i { display: block; height: 100%; background: currentColor; opacity: .85; border-radius: 3px; }
.sky .arc { width: 100%; height: auto; display: block; margin-top: 6px; }
.sky .next { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.35); flex-wrap: wrap; }
.sky .acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.sky button { background: rgba(255,255,255,.28); color: inherit; border: 0; }
.sky button.on { background: rgba(255,255,255,.9); color: #1C1B2E; }

/* buttons + inputs */
button { font: inherit; cursor: pointer; border-radius: 12px; border: 0; padding: 9px 14px; background: var(--raise); color: var(--ink); font-weight: 600; }
button.primary { background: var(--accent); color: var(--on-accent); }
button.soft { background: var(--accent-soft); color: var(--accent); }
button.ghost { background: transparent; color: var(--muted); font-weight: 500; padding: 6px 8px; }
button.wide { width: 100%; padding: 13px; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 64px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; }
form.inline input[type=text] { flex: 1 1 160px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surface); padding: 4px; border-radius: 14px; }
.seg button { background: transparent; color: var(--muted); font-weight: 500; font-size: 13px; padding: 8px 4px; border-radius: 10px; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12.5px; padding: 6px 12px; border-radius: 999px; background: var(--raise); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tag { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--raise); color: var(--muted); white-space: nowrap; }
.tag.late { background: var(--bad); color: #fff; }
.tag.good { background: var(--mint-soft); color: var(--mint); }

/* check circle */
.check { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px solid var(--line); background: transparent; padding: 0; display: grid; place-items: center; }
.check.on { background: var(--mint); border-color: var(--mint); }
.check.on::after { content: ""; width: 10px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.done-text { color: var(--muted); text-decoration: line-through; }
.list > * + * { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 10px; padding: 10px 0; min-width: 0; }

/* prayers */
.prayers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pr { background: var(--surface); border: 0; border-radius: 16px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 500; }
.pr b { font-family: var(--display); font-size: 14px; }
.pr span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pr.next { outline: 2px solid var(--lav); }
.pr.on { background: var(--lav); color: #fff; }
.pr.on span { color: rgba(255,255,255,.85); }

/* timeline */
.tl { display: flex; flex-direction: column; }
.blk { display: grid; grid-template-columns: 50px 1fr; gap: 12px; padding: 11px 0; }
.blk + .blk { border-top: 1px solid var(--line); }
.blk .t { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; direction: ltr; text-align: right; padding-top: 2px; }
.blk .b { border-inline-start: 4px solid var(--line); padding-inline-start: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; border-radius: 2px; }
.blk .b > b { font-weight: 600; overflow-wrap: anywhere; }
.blk .b .m { font-size: 12px; color: var(--muted); }
.blk.past { opacity: .55; }
.blk.cur { background: var(--accent-soft); border-radius: 14px; margin-inline: -10px; padding-inline: 10px; }
.blk.cur + .blk { border-top-color: transparent; }
.k-fixed .b { border-color: var(--muted); }
.k-routine .b { border-color: var(--lav); }
.k-flexible .b { border-color: var(--sun); }
.k-optional .b { border-color: var(--mint); }
.k-home .b { border-color: var(--sky); }
.k-body .b { border-color: var(--rose); }
.k-social .b { border-color: var(--accent); }
.k-buffer .b { border-color: var(--sun); border-style: dashed; }
.k-sleep .b { border-color: var(--lav); }
.pmark { font-size: 12px; color: var(--lav); font-weight: 600; }
.sub-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.sub-list .item { padding: 2px 0; }
.sub-list .check { width: 22px; height: 22px; }

/* area color helpers */
.a-mint { --a: var(--mint); --a-soft: var(--mint-soft); }
.a-sky { --a: var(--sky); --a-soft: var(--sky-soft); }
.a-sun { --a: var(--sun); --a-soft: var(--sun-soft); }
.a-rose { --a: var(--rose); --a-soft: var(--rose-soft); }
.a-lav { --a: var(--lav); --a-soft: var(--lav-soft); }
.hero { background: var(--a-soft); border-radius: 24px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.hero .big { font-family: var(--display); font-size: 34px; font-weight: 700; line-height: 1.15; color: var(--a); font-variant-numeric: tabular-nums; }
.hero .lbl { font-size: 13px; color: var(--ink); opacity: .8; }
.meter { height: 10px; border-radius: 5px; background: var(--raise); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 5px; background: var(--a, var(--accent)); }
.stat { background: var(--surface); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat b { font-family: var(--display); font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat .d { font-size: 12px; }
.up { color: var(--good); } .down { color: var(--bad); } .same { color: var(--muted); }
.ring { width: 64px; height: 64px; flex: none; }
.tip { background: var(--surface); border-radius: 18px; padding: 14px 16px; font-size: 14px; display: flex; gap: 12px; align-items: flex-start; }
.tip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--a, var(--accent)); flex: none; margin-top: 7px; }
.empty { color: var(--muted); font-size: 14px; }
.amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.in { color: var(--good); } .out { color: var(--ink); }
.cat-chips .chip { padding: 8px 12px; }
details > summary { cursor: pointer; color: var(--muted); font-size: 13px; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* bottom tabs */
nav.tabs { position: fixed; inset: auto 0 0 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 0 max(8px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-left, 0px)); }
nav.tabs .in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
nav.tabs button { background: transparent; color: var(--muted); border-radius: 0; padding: 9px 2px 10px; font-size: 11.5px; font-weight: 500; display: flex; flex-direction: column; align-items: center; gap: 3px; }
nav.tabs svg { width: 24px; height: 24px; }
nav.tabs button[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* sheet (settings) */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(17,18,29,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet .panel { background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 24px) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 16px; }
.toast { position: fixed; z-index: 50; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: 14px; max-width: calc(100% - 32px); }
@media (max-width: 380px) { .prayers { gap: 4px; } .pr b { font-size: 13px; } .sky .title { font-size: 22px; } .hero .big { font-size: 28px; } }
@media (prefers-reduced-motion: no-preference) { .check, .pr, .chip, .seg button { transition: background .18s, color .18s; } .sky { transition: background 1s; } }
