/* Zainab's Space — calm study + life planner. Soft rose pink, blush, ivory, sage. */
:root {
  --ivory: #FBF8F3;
  --ivory-2: #F4EEE6;
  --card: #FFFFFF;
  --lavender: #E3A3B5;
  --lavender-soft: #FBE6EC;
  --lavender-deep: #B8607A;
  --pink: #F2C1CF;
  --pink-soft: #FDF0F3;
  --sage: #A7C4A0;
  --sage-soft: #E6EFE2;
  --ink: #43343B;
  --ink-soft: #75636B;
  --ink-faint: #A6949C;
  --line: #F1E3E8;
  --danger: #C98B8B;
  --ok: #8FB08A;
  --shadow: 0 6px 24px rgba(140, 60, 90, 0.08);
  --shadow-sm: 0 2px 8px rgba(140, 60, 90, 0.06);
  --radius: 20px;
  --radius-sm: 14px;
  --tap: 46px;
  --nav-h: 68px;
  --maxw: 560px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
  /* category accents */
  --cat-work: #E3A3B5;
  --cat-personal: #F2C1CF;
  --cat-wellness: #A7C4A0;
  --cat-pilates: #A7C4A0;
  --cat-oncall: #B8607A;
  --cat-other: #B9B2C2;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--ivory);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
[dir="rtl"] { font-family: "Noto Sans Arabic", var(--font); }

h1, h2, h3 { font-weight: 650; letter-spacing: -0.01em; margin: 0; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--lavender-deep); }

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
  position: relative;
}

/* ---------- Top bar ---------- */
.topbar {
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 20px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar .greeting { font-size: 15px; color: var(--ink-soft); }
.topbar .title { font-size: 26px; }
.topbar .date { font-size: 14px; color: var(--ink-faint); margin-top: 2px; }
.iconbtn {
  width: var(--tap); height: var(--tap); border-radius: 50%; border: none;
  background: var(--card); box-shadow: var(--shadow-sm); color: var(--ink-soft);
  display: grid; place-items: center; font-size: 20px; flex: 0 0 auto;
}
.iconbtn:active { transform: scale(0.94); }

/* ---------- Views & cards ---------- */
.view { padding: 8px 20px 20px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); margin: 22px 2px 10px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 14px;
}
.card.soft { box-shadow: var(--shadow-sm); }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.center { text-align: center; }

/* hero / now card */
.hero { background: linear-gradient(135deg, var(--lavender-soft), var(--pink-soft)); }
.now-row { display: flex; align-items: center; gap: 14px; }
.now-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 5px var(--sage-soft); flex: 0 0 auto; }
.now-label { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.now-title { font-size: 19px; font-weight: 600; }
.next-line { margin-top: 10px; font-size: 14px; color: var(--ink-soft); }

/* timeline */
.timeline { position: relative; }
.tl-item { display: flex; gap: 14px; padding: 4px 0; }
.tl-time { width: 64px; flex: 0 0 auto; text-align: end; font-size: 13px; color: var(--ink-faint); padding-top: 14px; }
.tl-body {
  flex: 1; background: var(--card); border-radius: var(--radius-sm); padding: 12px 14px;
  box-shadow: var(--shadow-sm); border-inline-start: 4px solid var(--cat-other); margin-bottom: 10px;
}
.tl-body.cat-work { border-color: var(--cat-work); }
.tl-body.cat-personal { border-color: var(--cat-personal); }
.tl-body.cat-wellness, .tl-body.cat-pilates { border-color: var(--cat-wellness); }
.tl-body.cat-oncall { border-color: var(--cat-oncall); background: var(--lavender-soft); }
.tl-title { font-weight: 600; font-size: 15px; }
.tl-meta { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.tl-now { box-shadow: 0 0 0 2px var(--sage); }
.pill { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--lavender-soft); color: var(--lavender-deep); margin-inline-start: 6px; }
.pill.shared { background: var(--pink-soft); color: #B07A88; }
.pill.rest { background: var(--sage-soft); color: #6E8A69; }

/* checklist */
.check-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: none; }
.checkbox { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--lavender); background: transparent; flex: 0 0 auto; display: grid; place-items: center; color: #fff; }
.checkbox.on { background: var(--sage); border-color: var(--sage); }
.check-title { flex: 1; }
.check-row.done .check-title { text-decoration: line-through; color: var(--ink-faint); }
.prio-high { color: var(--pink); font-size: 12px; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--ivory-2); color: var(--ink-soft); }

/* routines */
.routine-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.routine { background: var(--card); border-radius: var(--radius-sm); padding: 14px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 6px; }
.routine .emoji { font-size: 22px; }
.routine.on { background: var(--sage-soft); }
.streak { font-size: 12px; color: var(--ink-faint); }

/* buttons */
.btn { border: none; border-radius: 999px; padding: 13px 20px; font-size: 15px; font-weight: 600; background: var(--lavender); color: #fff; box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(0.97); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--card); color: var(--lavender-deep); }
.btn.sage { background: var(--sage); }
.btn.pink { background: var(--pink); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* FAB quick add */
.fab {
  position: fixed; inset-inline-end: calc(50% - var(--maxw)/2 + 20px); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
  width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(135deg, var(--lavender), var(--pink));
  color: #fff; font-size: 30px; border: none; box-shadow: 0 8px 22px rgba(142,121,184,.4); z-index: 40; display: grid; place-items: center;
}
@media (max-width: 600px){ .fab { inset-inline-end: 20px; } }
.fab:active { transform: scale(0.93); }

/* bottom nav */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  display: flex; z-index: 30; max-width: var(--maxw); margin: 0 auto;
}
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--ink-faint); font-size: 11px; }
.nav a .ni { font-size: 22px; line-height: 1; }
.nav a.active { color: var(--lavender-deep); }

/* forms / modal */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(50,40,60,.38); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { background: var(--ivory); width: 100%; max-width: var(--maxw); border-radius: 24px 24px 0 0; padding: 20px 20px calc(env(safe-area-inset-bottom,0px) + 20px); max-height: 92vh; overflow-y: auto; animation: slideup .28s cubic-bezier(.2,.8,.2,1); }
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.sheet h2 { margin-bottom: 14px; }
.grabber { width: 40px; height: 4px; border-radius: 999px; background: var(--line); margin: 0 auto 14px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-sm);
  padding: 13px 14px; font-size: 16px; color: var(--ink); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--lavender-soft); border-color: var(--lavender); }
textarea { min-height: 80px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: 13px; color: var(--ink-soft); }
.seg button.on { background: var(--lavender-soft); border-color: var(--lavender); color: var(--lavender-deep); font-weight: 600; }
.daygrid { display: flex; gap: 6px; }
.daygrid button { flex: 1; aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 13px; color: var(--ink-soft); }
.daygrid button.on { background: var(--sage); color: #fff; border-color: var(--sage); }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-views { display: flex; gap: 6px; }
.month-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.month-grid .dow { text-align: center; font-size: 11px; color: var(--ink-faint); padding: 4px 0; }
.mcell { aspect-ratio: 1; border-radius: 12px; background: var(--card); box-shadow: var(--shadow-sm); padding: 5px; font-size: 13px; position: relative; display: flex; flex-direction: column; align-items: center; }
.mcell.out { opacity: .4; }
.mcell.today { outline: 2px solid var(--lavender); }
.mcell .dots { display: flex; gap: 2px; margin-top: auto; flex-wrap: wrap; justify-content: center; }
.mcell .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--lavender); }
.hour-row { display: flex; gap: 10px; border-top: 1px solid var(--line); min-height: 48px; padding: 2px 0; }
.hour-row .h { width: 54px; font-size: 12px; color: var(--ink-faint); padding-top: 2px; flex: 0 0 auto; }
.hour-row .slot { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 2px 0; }

/* states */
.empty { text-align: center; color: var(--ink-faint); padding: 40px 20px; }
.empty .em { font-size: 40px; display: block; margin-bottom: 10px; }
.loading { text-align: center; padding: 40px; color: var(--ink-faint); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--lavender-soft); border-top-color: var(--lavender); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: calc(var(--nav-h) + 80px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); animation: fade .2s; max-width: 90%; }
.toast.err { background: var(--danger); }
.save-state { font-size: 12px; color: var(--ink-faint); }
.save-state.saving { color: var(--lavender-deep); }
.save-state.saved { color: var(--ok); }
.save-state.err { color: var(--danger); }

/* auth */
.auth-wrap { max-width: 400px; margin: 0 auto; padding: 8vh 24px; }
.auth-logo { text-align: center; margin-bottom: 8px; font-size: 44px; }
.auth-wrap h1 { text-align: center; margin-bottom: 4px; }
.auth-wrap p.sub { text-align: center; color: var(--ink-soft); margin: 0 0 26px; }
.linkbtn { background: none; border: none; color: var(--lavender-deep); font-size: 14px; padding: 8px; }

.offline-banner { background: var(--pink-soft); color: #9c6b77; text-align: center; font-size: 13px; padding: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Animated water glass ---------- */
.water-glass { width: 96px; height: 136px; display: block; margin: 6px auto 2px; overflow: visible; }
.water-glass #waterGroup { transition: transform .7s cubic-bezier(.34,.8,.3,1); }
.water-glass .wave { animation: waterWave 2.6s linear infinite; }
.water-glass .wave2 { animation: waterWave 3.9s linear infinite reverse; }
@keyframes waterWave { from { transform: translateX(0); } to { transform: translateX(-120px); } }
.water-bubble { animation: waterBubble 3.4s ease-in infinite; }
@keyframes waterBubble { 0% { transform: translateY(0); opacity: 0; } 25% { opacity: .75; } 100% { transform: translateY(-46px); opacity: 0; } }

/* ---------- study ---------- */
.sbar { height: 10px; border-radius: 999px; background: var(--ivory-2); overflow: hidden; margin: 6px 0 4px; }
.sbar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--lavender), var(--lavender-deep)); transition: width .4s ease; }
.sbar.ok .sbar-fill { background: linear-gradient(90deg, var(--sage), var(--ok)); }
.sbar.sand .sbar-fill { background: linear-gradient(90deg, var(--pink-soft), var(--pink)); }
.s-label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; color: var(--ink-soft); }
.s-label b { color: var(--ink); font-size: 14px; }
.s-label b.warn { color: #B9774E; } .s-label b.good { color: var(--ok); }
.study-hero .count-row { display: flex; gap: 12px; margin-bottom: 14px; }
.study-hero .count { flex: 1; background: rgba(255,255,255,.65); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.count-n { font-size: 34px; font-weight: 700; color: var(--lavender-deep); line-height: 1.1; }
.count-l { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip.weak { background: #F6E1D5; color: #9A5A35; }
.phase { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.phase:last-child { border-bottom: 0; }
.phase-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ivory-2); color: var(--ink-soft); font-weight: 600; flex: 0 0 auto; }
.phase.on .phase-n { background: var(--lavender-deep); color: #fff; }
.phase .pill { margin-inline-start: 8px; }
.hchart { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.hcol { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.hbar { width: 100%; border-radius: 4px 4px 2px 2px; background: var(--lavender); min-height: 2px; }
.hcol.today .hbar { outline: 2px solid var(--lavender-deep); outline-offset: 1px; }
.cat-row { padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.cat-row:last-of-type { border-bottom: 0; }
.cat-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.cat-name { font-weight: 600; font-size: 15px; }
.cat-badges { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.week { padding: 10px 0; border-bottom: 1px solid var(--line); }
.week:last-of-type { border-bottom: 0; }
.tl-meta.overdue { color: #B9774E; font-weight: 600; }
.card .seg { margin-bottom: 8px; }
.nav a { font-size: 10.5px; }

/* ---------- soft dashboard ---------- */
.card { border-radius: 24px; }
.card.dash { background: linear-gradient(160deg, #FFFFFF 0%, var(--pink-soft) 100%); box-shadow: var(--shadow); }
.stabs { display: flex; gap: 4px; padding: 4px; margin: 4px 0 14px; background: var(--pink-soft); border-radius: 999px;
  position: sticky; top: 8px; z-index: 5; box-shadow: var(--shadow-sm); }
.stabs button { flex: 1; border: 0; background: transparent; padding: 10px 4px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.stabs button.on { background: #fff; color: var(--lavender-deep); box-shadow: 0 2px 8px rgba(140,60,90,.12); }
.ring { position: relative; flex: 0 0 auto; }
.ring svg { display: block; }
.ring-arc { transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-big { font-size: 46px; font-weight: 750; line-height: 1; color: var(--lavender-deep); }
.ring-mid { font-size: 26px; font-weight: 750; line-height: 1; color: var(--lavender-deep); }
.ring-small { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.ring-tag { margin-top: 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff;
  background: linear-gradient(90deg, var(--pink), var(--lavender-deep)); padding: 4px 10px; border-radius: 999px; }
.dash-ring { display: flex; justify-content: center; margin: 6px 0 18px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.tile { border-radius: 18px; padding: 12px 6px; text-align: center; }
.tile.t1 { background: linear-gradient(160deg, #FDE3EA, #F8CFDB); }
.tile.t2 { background: linear-gradient(160deg, #F3E6F7, #E6D3F0); }
.tile.t3 { background: linear-gradient(160deg, #E9F3E5, #D6EAD0); }
.tile-n { font-size: 24px; font-weight: 750; color: var(--ink); line-height: 1.1; }
.tile-l { font-size: 11px; color: var(--ink-soft); margin-top: 3px; }
.tile-s { font-size: 11px; color: var(--ink-faint); }
.btn.big { padding: 16px; font-size: 16px; border-radius: 18px; background: linear-gradient(90deg, var(--pink), var(--lavender-deep)); color: #fff; box-shadow: 0 8px 20px rgba(184,96,122,.25); }
.chip.pinkchip { background: #fff; border: 1px solid var(--lavender-soft); color: var(--lavender-deep); }
.overall { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.mini { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.sbar { height: 12px; }

/* ---------- photo banner ---------- */
.pbanner { position: relative; height: 270px; margin: -8px -20px 16px; border-radius: 0 0 32px 32px; overflow: hidden;
  background: linear-gradient(150deg, var(--pink-soft), var(--pink) 60%, var(--lavender-deep)); box-shadow: var(--shadow); }
.pbanner.tall { height: 290px; }
.pb-bg { position: absolute; inset: -30px; width: calc(100% + 60px); height: calc(100% + 60px); object-fit: cover; filter: blur(22px) saturate(1.1); transform: scale(1.05); }
.pb-shade { position: absolute; inset: 0; background: linear-gradient(120deg, rgba(184,96,122,.88) 0%, rgba(227,163,181,.70) 55%, rgba(242,193,207,.45) 100%); }
.pbanner.noimg .pb-shade { background: none; }
.pb-frame { position: absolute; top: calc(22px + env(safe-area-inset-top, 0px)); bottom: 22px; inset-inline-end: 18px; aspect-ratio: 3 / 4;
  border-radius: 26px; overflow: hidden; border: 4px solid rgba(255,255,255,.9); box-shadow: 0 12px 30px rgba(110,30,60,.35); background: #fff; }
.pb-frame img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; display: block; }
.pb-gear { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); inset-inline-start: 14px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px); z-index: 2; }
.pb-text { position: absolute; inset-inline-start: 20px; bottom: 22px; width: calc(100% - 20px - 18px - 170px - 14px); color: #fff; }
.pbanner.noimg .pb-text { width: auto; inset-inline-end: 20px; }
.pb-title { font-size: 23px; font-weight: 750; line-height: 1.2; text-shadow: 0 2px 12px rgba(80,20,40,.3); }
.pb-sub { font-size: 13px; opacity: .95; margin-top: 4px; text-shadow: 0 1px 8px rgba(80,20,40,.3); }
.pb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pb-chip { font-size: 11.5px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.cover-prev { height: 150px; border-radius: 20px; overflow: hidden; background: linear-gradient(150deg, var(--pink-soft), var(--pink)); display: grid; place-items: center; color: #fff; font-weight: 600; }
.cover-prev img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }
