/* ============================================================
   style.css — پوسته‌ی کامل اسطرلاب
   Cinematic astronomical identity: eight true sky periods cross-
   fade behind glassy, quiet surfaces. Persian turquoise + gold
   accents. A drawn SVG moon replaces the emoji. Mature, cool,
   atmospheric — never childish.
   ============================================================ */

/* ---------- local Vazirmatn (bundled, OFL) ---------- */
@font-face {
  font-family: 'Vazirmatn';
  font-weight: 400; font-style: normal; font-display: swap;
  src: url('/fonts/vazirmatn-arabic-400.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+200C-200E, U+2010-2011, U+204F, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'Vazirmatn';
  font-weight: 400; font-style: normal; font-display: swap;
  src: url('/fonts/vazirmatn-latin-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
}
@font-face {
  font-family: 'Vazirmatn';
  font-weight: 500; font-style: normal; font-display: swap;
  src: url('/fonts/vazirmatn-arabic-500.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+200C-200E, U+2010-2011, U+204F, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'Vazirmatn';
  font-weight: 500; font-style: normal; font-display: swap;
  src: url('/fonts/vazirmatn-latin-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
}
@font-face {
  font-family: 'Vazirmatn';
  font-weight: 700; font-style: normal; font-display: swap;
  src: url('/fonts/vazirmatn-arabic-700.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+200C-200E, U+2010-2011, U+204F, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'Vazirmatn';
  font-weight: 700; font-style: normal; font-display: swap;
  src: url('/fonts/vazirmatn-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
}

/* ---------- design tokens ---------- */
:root {
  --bg-grad-transition: 3500ms ease-in-out;
  --radius: 18px;
  --nav-h: calc(64px + env(safe-area-inset-bottom));
  --accent: #2fb9a8;          /* Persian turquoise */
  --accent-2: #d9a441;        /* saffron gold */
  --accent-3: #3d8fb0;        /* lapis blue */
  --danger: #e0655e;
  --gold-soft: rgba(217, 164, 65, .16);
  --holiday: #ff5c5c;         /* official holidays + Fridays (Jalali day number) */
}

html[data-scheme='dark'] {
  color-scheme: dark;
  --text: #e8ecfa;
  --muted: #93a0c2;
  --surface: rgba(13, 18, 42, 0.58);
  --surface-glass: rgba(24, 32, 66, 0.42);
  --border: rgba(148, 162, 214, 0.16);
  --shadow: 0 14px 34px rgba(2, 5, 20, .5);
  --input-bg: rgba(8, 12, 32, .55);
  --title-glow: 0 0 22px rgba(120, 160, 255, .18);
}
html[data-scheme='light'] {
  color-scheme: light;
  --text: #17263f;
  --muted: #536a8c;
  --surface: rgba(255, 255, 255, 0.66);
  --surface-glass: rgba(255, 255, 255, 0.52);
  --border: rgba(28, 64, 105, 0.13);
  --shadow: 0 10px 26px rgba(40, 80, 120, .12);
  --input-bg: rgba(255, 255, 255, 0.75);
  --title-glow: none;
  --holiday: #d3202e;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, system-ui, sans-serif;
  color: var(--text);
  background: #060a1c;                       /* base under layers */
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: color .9s ease;
  padding-top: env(safe-area-inset-top);
}

button { font-family: inherit; color: inherit; cursor: pointer; }

/* ---------- animated background stack ---------- */
#bgfx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-layer {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity var(--bg-grad-transition);
  will-change: opacity;
}
#stars { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1.6s ease; }

/* the drawn moon */
#moon-disc {
  position: absolute; z-index: 2;
  opacity: 0;
  transition: opacity 2.4s ease, inset-inline-end 4s linear, top 4s linear;
  user-select: none;
  filter: drop-shadow(0 0 18px rgba(210, 228, 255, .28));
}
#moon-disc svg { width: 100%; height: 100%; display: block; }
#moon-glow {
  position: absolute; z-index: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    rgba(198, 222, 250, .5) 0%,
    rgba(160, 178, 220, .24) 45%,
    transparent 70%);
  filter: blur(8px);
  opacity: 0;
  transition: opacity 3s ease, width 2s ease, height 2s ease, inset-inline-end 4s linear, top 4s linear;
  pointer-events: none;
}

/* atmospheric layers */
#sun-glow {
  position: absolute; z-index: 1; width: 70vmax; height: 46vmax; border-radius: 50%;
  opacity: 0; filter: blur(30px);
  transition: opacity 3.2s ease, background 3.2s ease;
  background: radial-gradient(circle at 50% 60%, rgba(255, 196, 110, .5), transparent 62%);
  bottom: -18vmax; left: -14vmax;
}
#haze {
  position: absolute; z-index: 1; inset-inline: 0; bottom: 0; height: 34%;
  opacity: .5; transition: opacity 3s ease, background 3s ease;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, .16));
}
.wisp {
  position: absolute; z-index: 1; height: 9vmax; border-radius: 50%;
  filter: blur(26px); opacity: 0; transition: opacity 3.5s ease;
  background: rgba(214, 226, 248, .13);
}
.wisp.w1 { top: 16%; left: -30%; width: 46vw; animation: wisp-drift 95s linear infinite; }
.wisp.w2 { top: 38%; left: 55%; width: 38vw; height: 7vmax; animation: wisp-drift 130s linear infinite reverse; }
@keyframes wisp-drift {
  from { transform: translateX(-8vw); }
  to   { transform: translateX(130vw); }
}
#vignette {
  position: absolute; inset: 0; z-index: 3; opacity: .55;
  transition: opacity 3s ease;
  background: radial-gradient(120% 90% at 50% 42%, transparent 58%, rgba(2, 4, 14, .5) 100%);
}
/* light scheme: barely-there vignette tuned per daylight bucket */
html[data-scheme='light'] #vignette { opacity: .12; }
html[data-scheme='light'][data-bucket='goldenAm'] #vignette,
html[data-scheme='light'][data-bucket='goldenPm'] #vignette { opacity: .18; }
#grain {
  position: absolute; inset: -50%; z-index: 3; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
  animation: grain-shift 9s steps(6) infinite;
}
@keyframes grain-shift {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-4%,3%); }
  40% { transform: translate(3%,-5%); }
  60% { transform: translate(-5%,-2%); }
  80% { transform: translate(4%,4%); }
}

/* per-period atmosphere: sun-glow position/color + haze tone */
html[data-bucket='sunrise'] #sun-glow {
  opacity: .85; left: -20vmax; bottom: -16vmax;
  background: radial-gradient(circle at 50% 60%, rgba(255, 187, 92, .62), transparent 60%);
}
html[data-bucket='goldenAm'] #sun-glow {
  opacity: .4; left: -18vmax; bottom: -22vmax;
  background: radial-gradient(circle at 50% 60%, rgba(255, 214, 138, .45), transparent 62%);
}
html[data-bucket='goldenPm'] #sun-glow {
  opacity: .45; left: auto; right: -20vmax; bottom: -22vmax;
  background: radial-gradient(circle at 50% 60%, rgba(255, 202, 110, .5), transparent 62%);
}
html[data-bucket='sunset'] #sun-glow {
  opacity: .95; left: auto; right: -18vmax; bottom: -14vmax;
  background: radial-gradient(circle at 50% 60%, rgba(255, 138, 66, .66), transparent 60%);
}
html[data-bucket='dusk'] #sun-glow {
  opacity: .3; left: auto; right: -16vmax; bottom: -20vmax;
  background: radial-gradient(circle at 50% 60%, rgba(224, 106, 84, .4), transparent 58%);
}
html[data-bucket='dawn'] #sun-glow {
  opacity: .35; left: -16vmax; bottom: -20vmax;
  background: radial-gradient(circle at 50% 60%, rgba(96, 190, 170, .4), transparent 60%);
}
html[data-bucket='daylight'] #sun-glow {
  opacity: .22; left: -16vmax; bottom: -26vmax;
  background: radial-gradient(circle at 50% 60%, rgba(255, 240, 200, .38), transparent 64%);
}
html[data-bucket='night'] #sun-glow { opacity: 0; }

html[data-bucket='sunset'] #haze,
html[data-bucket='goldenPm'] #haze {
  background: linear-gradient(180deg, transparent, rgba(255, 190, 120, .22));
}
html[data-bucket='sunrise'] #haze {
  background: linear-gradient(180deg, transparent, rgba(255, 220, 160, .26));
}
html[data-bucket='dawn'] #haze {
  background: linear-gradient(180deg, transparent, rgba(110, 200, 180, .16));
}
html[data-bucket='night'] #haze,
html[data-bucket='dusk'] #haze { opacity: .3; }
.wisp { opacity: .55; }
html[data-bucket='night'] .wisp { opacity: .3; }
html[data-bucket='dawn'] .wisp { opacity: .4; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: transparent;
}
.brand { font-weight: 700; letter-spacing: .2px; opacity: .92; }
.spacer { flex: 1; }
.badge {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-glass); border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.badge[data-mode='ok']   { color: #6fd8c8; }
.badge[data-mode='warn'] { color: #f0a49b; }

/* ---------- main container & cards ---------- */
main {
  max-width: 560px; margin: 0 auto;
  padding: 6px 14px calc(var(--nav-h) + 18px);
  min-height: 70vh;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  padding: 14px;
  margin-bottom: 12px;
  transition: background .9s ease, border-color .9s ease;
}
.sec { font-size: 15px; margin: 18px 6px 8px; font-weight: 700; }
.sec.inline { display: inline-block; margin: 0 0 10px; }
.page-title { font-size: 21px; margin: 6px 4px 14px; text-shadow: var(--title-glow); }
.muted { color: var(--muted); }
.small-p, .hint { color: var(--muted); font-size: 12.5px; margin: 8px 4px; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, monospace; }

/* ---------- buttons / inputs ---------- */
.btn {
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 10px 16px;
  font-size: 14px; font-weight: 500;
  background: var(--surface-glass);
  transition: transform .12s ease, filter .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #04222a; border: none; font-weight: 700;
  box-shadow: 0 6px 18px rgba(47, 185, 168, .26);
}
.btn.danger { background: rgba(224, 101, 94, .15); color: #f2b8b2; border-color: rgba(224, 101, 94, .35); }
html[data-scheme='light'] .btn.danger { color: #9c2f28; }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 7px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.icon-btn {
  background: var(--surface-glass); border: 1px solid var(--border);
  width: 38px; height: 38px; border-radius: 12px; font-size: 17px;
  display: grid; place-items: center;
}
.fld, select.sel, textarea.fld {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 13px;
  padding: 11px 13px;
  font-size: 15px; font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
.fld:focus, .sel:focus { border-color: var(--accent); }
textarea.fld { resize: vertical; }
label.lbl { display: block; font-size: 12.5px; color: var(--muted); margin: 0 4px 4px; }
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.row.spread { justify-content: space-between; }
.col { display: block; }
.col.gap > *+* { margin-top: 8px; }
.grow { flex: 1; }

.seg { display: inline-flex; background: var(--surface-glass); border: 1px solid var(--border); border-radius: 13px; padding: 3px; gap: 3px; }
.seg button {
  border: none; background: transparent; padding: 8px 13px;
  border-radius: 10px; font-size: 13.5px; font-weight: 500; color: var(--muted);
  transition: all .18s;
}
.seg button.on {
  background: linear-gradient(135deg, rgba(47, 185, 168, .9), rgba(61, 143, 176, .9));
  color: #04222a; font-weight: 700;
}
.seg.small button { padding: 6px 9px; font-size: 12.5px; }
.seg.wide { display: flex; } .seg.wide button { flex: 1; }

.checkline { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 10px 2px; }
.cal-flip-line { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin: 10px 2px; }

/* ---------- bottom nav + fab ---------- */
.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  display: flex;                    /* was a hardcoded 4-column grid — broke as soon as
                                        a 5th (admin) tab could be added at runtime */
  height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border-top: 1px solid var(--border);
}
.bottom-nav button {
  flex: 1 1 0;
  background: none; border: none;
  display: grid; place-items: center; gap: 2px;
  font-size: 11px; color: var(--muted); padding-top: 7px;
}
.bottom-nav button i { font-style: normal; font-size: 19px; line-height: 1; }
.bottom-nav button.on { color: var(--accent); font-weight: 700; }
.fab {
  position: fixed; z-index: 40;
  bottom: calc(var(--nav-h) + 14px);
  inset-inline-end: 18px;
  width: 58px; height: 58px; border-radius: 20px;
  border: none;
  font-size: 27px; font-weight: 300;
  background: linear-gradient(135deg, #2fb9a8, #3d8fb0);
  color: #04222a;
  box-shadow: 0 10px 26px rgba(30, 120, 130, .4);
  transition: transform .15s ease;
}
.fab:active { transform: scale(.94) rotate(-90deg); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%; transform: translateX(-50%) translateY(20px);
  /* Must render above .sheet-wrap (80) and .auth-root (70) — otherwise every
   * error toast fired while the add/edit sheet is open (invalid title, bad
   * date, network failure on save/delete, membership approve/reject errors…)
   * renders invisibly behind it, and it *looks* like nothing happened. */
  z-index: 90; opacity: 0; pointer-events: none;
  background: rgba(14, 20, 46, .92);
  color: var(--text);
  padding: 11px 18px; border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: all .25s ease; max-width: 86vw; text-align: center;
  backdrop-filter: blur(14px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast[data-kind='err'] { border-color: rgba(224, 101, 94, .45); }

/* ---------- today view ---------- */
.today-head .hero-line { display: flex; justify-content: space-between; align-items: center; margin: 10px 6px 2px; }
.greet { font-size: 14px; color: var(--muted); font-weight: 500; }
.moon-chip {
  font-size: 12.5px; padding: 4px 11px; border-radius: 999px;
  background: var(--surface-glass); border: 1px solid var(--border);
}
.date-header .dh-jalali { font-size: 23px; font-weight: 700; letter-spacing: .2px; }
.date-header .dh-gregorian { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.date-header .dh-gregorian .th-clock { color: var(--accent-2); font-weight: 500; }

.progress-card { display: flex; gap: 16px; align-items: center; }
.ring { width: 84px; height: 84px; transform: rotate(-90deg); flex-shrink: 0; }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring-bg { stroke: var(--border); }
.ring-fg { stroke: var(--accent); filter: drop-shadow(0 0 6px rgba(47, 185, 168, .5)); transition: stroke-dashoffset .7s ease; }
.progress-copy b { display: block; font-size: 15.5px; }
.progress-copy small { color: var(--muted); }

.quick-add { display: flex; gap: 9px; padding: 10px; }
.quick-add input { flex: 1; border: none; background: transparent; outline: none; color: inherit; font-size: 15px; }

.missed-card {
  background: rgba(224, 101, 94, .08);
  border: 1px dashed rgba(224, 101, 94, .4);
  padding: 4px 14px;
}
.missed-row { padding: 11px 0; border-bottom: 1px solid var(--border); }
.missed-row:last-child, .missed-more .missed-row:last-child { border-bottom: none; }
.missed-row p { margin: 0 0 9px; font-size: 13.5px; line-height: 1.8; }
.missed-more summary { cursor: pointer; font-size: 12.5px; color: var(--muted); padding: 9px 0; }

/* ---------- item rows ---------- */
.card.list { padding: 5px; }
.item-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--border);
}
.item-row:last-child { border-bottom: none; }
.check {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 9px; border: 2px solid var(--accent);
  background: transparent; font-size: 14px; color: #04222a;
  display: grid; place-items: center; font-weight: 700;
  transition: all .18s;
}
.check.static { border-style: solid; border-width: 0; font-size: 17px; opacity: .85; }
.item-row.event .check.static { color: #d9a441; }
.item-title { font-size: 15px; font-weight: 500; word-break: break-word; }
.item-row.done .item-title { text-decoration: line-through; opacity: .55; }
.item-note { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: pre-wrap; }
.item-chips { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.chip { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: var(--surface-glass); border: 1px solid var(--border); color: var(--muted); }
.chip.prio-1 { color: #6fd8c8; border-color: rgba(111, 216, 200, .35); }
.chip.prio-2 { color: #f0a49b; border-color: rgba(240, 164, 155, .45); }
.item-main { flex: 1; min-width: 0; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.cal-title { text-align: center; line-height: 1.25; }
.cal-title .main { font-size: 18px; font-weight: 700; }
.cal-title small { display: block; color: var(--muted); font-size: 12px; }
.row.tools { justify-content: center; gap: 8px; margin-bottom: 12px; }
.grid.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
.grid.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cell {
  position: relative; aspect-ratio: 1/1.06;
  border: 1px solid transparent; border-radius: 13px;
  background: var(--surface-glass);
  display: grid; place-content: center; gap: 0;
  padding-top: 2px;
}
.cell.blank { visibility: hidden; }
.cell b { font-size: 14.5px; font-weight: 600; }
.cell small { font-size: 9px; color: var(--muted); }
.cell.today { border-color: var(--accent-2); box-shadow: inset 0 0 0 1px var(--accent-2), 0 4px 14px rgba(217, 164, 65, .22); }
.cell.holiday .jnum { color: var(--holiday); font-weight: 800; }
.cell.holiday b.jnum { font-size: 16.5px; }
.cell.holiday small.jnum { font-size: 10.5px; }
.holiday-note { color: var(--holiday); font-weight: 700; font-size: 13px; margin: -4px 2px 10px; }
.miss-x {
  position: absolute; bottom: 2px; left: 2px;
  font-size: 14px; line-height: 1; font-weight: 700;
  color: var(--danger); pointer-events: none; z-index: 2;
}
.dots { position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); display: flex; gap: 2.5px; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-3); }
.dot.task { background: #2fb9a8; }
.dot.event { background: #d9a441; }
.dot.hot { box-shadow: 0 0 6px currentColor; }
.daysheet-head { margin-bottom: 10px; }

/* ---------- plans / goals ---------- */
.goal-chip {
  display: inline-block; margin: 3px;
  padding: 7px 13px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(217, 164, 65, .16), rgba(47, 185, 168, .13));
  border: 1px solid var(--border);
  font-size: 13px;
}
.agenda-group h3 { margin-top: 16px; }
.item-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.missed-stats { display: grid; grid-template-columns: 1fr 1fr; padding: 12px 6px; }
.ms-tile { text-align: center; background: none; border: none; padding: 2px 0; font: inherit; }
.ms-tile:disabled { cursor: default; }
.ms-tile + .ms-tile { border-inline-start: 1px solid var(--border); }
.ms-tile b { display: block; font-size: 24px; font-weight: 700; line-height: 1.3; }
.ms-tile b.bad { color: var(--danger); }
.ms-tile span { font-size: 12px; color: var(--muted); }
.goal-block + .goal-block, .goal-other { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.goal-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.goal-block .small-p { margin: 4px 2px 0; }
.goal-other summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.archive summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 22px 10px !important; }
.empty span { display: block; font-size: 30px; margin-bottom: 6px; }
.empty.small { padding: 16px 8px !important; font-size: 13px; }
.empty.small span { font-size: 20px; display: inline; margin-inline-end: 4px; }

/* ---------- sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(2, 5, 16, .55); backdrop-filter: blur(3px); opacity: 0; transition: opacity .28s; }
.sheet {
  position: relative; width: min(560px, 100%);
  max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface);
  backdrop-filter: blur(26px) saturate(160%);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  border: 1px solid var(--border); border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(0, 6, 24, .4);
  transform: translateY(100%); transition: transform .32s cubic-bezier(.32,.72,.36,1);
}
.sheet-wrap.open .sheet { transform: translateY(0); }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-handle { width: 44px; height: 4px; border-radius: 4px; background: var(--border); margin: 4px auto 8px; }
.sheet-title { font-size: 16px; font-weight: 700; margin: 2px 2px 10px; }
.confirm-msg { font-size: 14.5px; line-height: 1.8; }
.editor-actions { margin-top: 14px; }

/* ---------- auth ---------- */
.auth-root { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 18px; }
.auth-card { width: min(420px, 94vw); text-align: center; padding: 26px 22px; }
.logo { font-size: 26px; margin: 2px 0 4px; font-weight: 700;
  background: linear-gradient(135deg, #4fd0bd, #e8c169);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-card form { display: grid; gap: 9px; margin-top: 12px; }

/* ---------- settings ---------- */
.set-sec h3.inline { margin-bottom: 8px; }
.notif-status { font-size: 13.5px; margin-bottom: 9px; }
.okok { color: #6fd8c8; }
.warn { color: #f0a49b; }
.city-list { max-height: 46vh; overflow-y: auto; margin: 8px 0; display: grid; gap: 4px; }
.city-row { text-align: start; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-glass); font-size: 14px; }
.city-row small { color: var(--muted); margin-inline-start: 6px; }

/* ---------- admin: system logs panel ---------- */
.log-toolbar { margin-bottom: 10px; }
.log-toolbar .sel { width: auto; flex: 1 1 140px; padding: 8px 10px; font-size: 13px; }
.log-list { max-height: 52vh; overflow-y: auto; display: grid; gap: 8px; }
.log-row {
  background: var(--surface-glass); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px;
}
.log-badge {
  font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
}
.log-badge.error { color: #f2b8b2; background: rgba(224, 101, 94, .15); border-color: rgba(224, 101, 94, .35); }
.log-badge.warn { color: #f0d199; background: var(--gold-soft); border-color: rgba(217, 164, 65, .35); }
.log-badge.info { color: #6fd8c8; background: rgba(47, 185, 168, .12); border-color: rgba(47, 185, 168, .3); }
.log-scope { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.log-msg { font-size: 13.5px; margin-top: 3px; line-height: 1.5; word-break: break-word; }
.log-detail {
  margin-top: 8px; padding: 8px 10px; font-size: 11.5px; white-space: pre-wrap;
  word-break: break-word; background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 9px; max-height: 220px; overflow-y: auto; direction: ltr; text-align: left;
}
.adv { margin-top: 10px; font-size: 13.5px; color: var(--muted); }
details.adv summary { cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ============================================================
   Cinematic polish pass — micro-interactions & theme wiring.
   Every rule above is duration-capped by the reduced-motion
   guard (its !important wins over anything below).
   ============================================================ */

/* --- full-moon brightness lift (JS set --moon-lift; now it paints) --- */
#bgfx { transition: opacity .4s ease, filter 3s ease; }
html[data-scheme='dark'] #bgfx {
  filter: brightness(calc(1 + var(--moon-lift, 0) * 0.6))
          saturate(calc(1 + var(--moon-lift, 0) * 0.35));
}

/* --- slow aurora drift during dark periods (GPU-composited) --- */
html[data-scheme='dark'] .bg-layer::after {
  content: '';
  position: absolute; inset: -18%;
  background: radial-gradient(58% 42% at 72% 4%, rgba(47, 185, 168, .1), transparent 70%);
  animation: aurora-drift 52s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes aurora-drift {
  from { transform: translate3d(-2.5%, -1.5%, 0) scale(1); }
  to   { transform: translate3d(2.5%, 1.5%, 0) scale(1.07); }
}

/* --- toast: light-scheme surface --- */
html[data-scheme='light'] .toast { background: rgba(255, 255, 255, .95); }

/* --- done checkbox: filled turquoise + pop micro-interaction --- */
.item-row.done .check {
  background: var(--accent);
  border-color: transparent;
  color: #04222a;
}
.item-row { transition: background-color .2s ease; }
.item-row.pop .check { animation: check-pop .32s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes check-pop {
  0%   { transform: scale(.55); }
  60%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}

/* --- page entrance: staggered rise on TAB SWITCH only --- */
.page-in > * { animation: rise-in .34s cubic-bezier(.22, .9, .3, 1) both; }
.page-in > *:nth-child(2) { animation-delay: .045s; }
.page-in > *:nth-child(3) { animation-delay: .09s; }
.page-in > *:nth-child(4) { animation-delay: .135s; }
.page-in > *:nth-child(5) { animation-delay: .18s; }
.page-in > *:nth-child(6) { animation-delay: .225s; }
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
}

/* --- progress ring draws itself on page entry --- */
.page-in .ring-fg { animation: ring-draw .9s ease both; }
@keyframes ring-draw {
  from { stroke-dashoffset: 326.8; }   /* full circumference 2π·52 */
}

/* --- calendar: direction-aware month slide (RTL) --- */
.cal-title[data-anim] { animation: cal-fade .3s ease both; }
.grid.days[data-anim='next'] { animation: cal-next .32s ease both; }
.grid.days[data-anim='prev'] { animation: cal-prev .32s ease both; }
@keyframes cal-fade { from { opacity: 0; } }
@keyframes cal-next { from { opacity: 0; transform: translateX(-16px); } }
@keyframes cal-prev { from { opacity: 0; transform: translateX(16px); } }

/* --- sync badge flash --- */
.badge.flash { animation: badge-in .32s ease; }
@keyframes badge-in {
  from { opacity: 0; transform: translateY(-8px) scale(.92); }
}

/* --- bottom-nav active lift --- */
.bottom-nav button i { transition: transform .22s ease, filter .22s ease; }
.bottom-nav button.on i {
  transform: translateY(-2px) scale(1.12);
  filter: drop-shadow(0 0 8px rgba(47, 185, 168, .5));
}

/* --- hover polish (pointer devices only, never on touch) --- */
@media (hover: hover) {
  .btn:hover { filter: brightness(1.07); }
  .item-row:hover { background: rgba(140, 160, 220, .06); }
  .goal-chip { transition: transform .18s ease, border-color .18s ease; }
  .goal-chip:hover { transform: translateY(-2px); border-color: var(--accent-2); }
  .city-row:hover { border-color: var(--accent); }
  .fab { transition: transform .18s ease, box-shadow .2s ease; }
  .fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 32px rgba(30, 130, 140, .48); }
  .cell:hover { border-color: var(--border); filter: brightness(1.12); }
}

/* --- keyboard focus --- */
:where(button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- date-picker weekday hint line --- */
.dp-week { font-size: 12.5px; color: var(--muted); margin: 6px 2px 2px; }

/* Day/month/year selects must sit compactly on ONE row, not stack full-width
 * (the generic `select.sel { width:100% }` rule above would otherwise force
 * each of the 3 selects onto its own line). Higher specificity wins here. */
.dp.row.wrap { flex-wrap: nowrap; gap: 6px; }
.dp .sel { width: auto; flex: 1 1 0; min-width: 0; text-align: center; padding-left: 4px; padding-right: 4px; }
.dp .dp-month { flex: 1.7 1 0; }

.field-block { margin-top: 10px; }

/* Multi-select reminder chips */
.chips-multi { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip-opt {
  padding: 7px 12px; border-radius: 10px; font-size: 12.5px; font-weight: 500;
  background: var(--surface-glass);
  border: 1px solid var(--border); color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
}
.chip-opt.on {
  background: linear-gradient(135deg, rgba(47, 185, 168, .92), rgba(61, 143, 176, .92));
  color: #04222a; font-weight: 700; border-color: transparent;
}
.editor-actions { margin-top: 14px; }


/* --- boot splash --- */
#boot-splash {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: #060a1c;
}
#boot-splash .splash-inner { text-align: center; }
#boot-splash .moon-pulse { width: 54px; height: 54px; margin: 0 auto; animation: splash-pulse 1.7s ease-in-out infinite; }
#boot-splash .moon-pulse svg { width: 100%; height: 100%; }
#boot-splash .splash-fa { color: #93a0c2; margin-top: 10px; font-size: 14px; }
@keyframes splash-pulse {
  0%, 100% { transform: scale(1); opacity: .8; }
  50% { transform: scale(1.12); opacity: 1; }
}

/* --- desktop breathing room --- */
@media (min-width: 720px) {
  main { max-width: 640px; }
  .journal-shell { max-width: 460px; }
}

/* ================= ⚽ football: calendar badge + day-sheet card ================= */
/* Bigger + no white halo (a plain drop-shadow follows the logo's own alpha
   shape instead of boxing it in a white circle) and allowed to bleed past
   the cell's corner for more presence, per feedback — same top-inline-end
   anchor point as before, just bolder. */

.match-badge {
  position: absolute; top: -5px; inset-inline-end: -5px;
  display: flex; z-index: 2;
}
.match-badge img {
  width: 24px; height: 24px; border-radius: 50%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5));
  margin-inline-start: -9px;
}
.match-badge img:first-child { margin-inline-start: 0; }

.match-day-block { margin-bottom: 10px; }
.match-day-block:empty { margin-bottom: 0; }
.match-card {
  background: linear-gradient(160deg, rgba(47, 185, 168, .1), rgba(61, 143, 176, .08));
  border: 1px solid var(--border); border-radius: 15px;
  padding: 12px 13px; margin-bottom: 8px;
}
.match-card:last-child { margin-bottom: 0; }
.match-league {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--muted); margin-bottom: 9px;
}
.match-league-logo { width: 15px; height: 15px; object-fit: contain; border-radius: 3px; }
.match-round { margin-inline-start: auto; opacity: .8; }
.match-teams { display: flex; align-items: center; gap: 8px; }
.match-team {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center;
  gap: 6px; text-align: center; font-size: 12.5px; font-weight: 500;
}
.match-team-logo {
  width: 34px; height: 34px; object-fit: contain;
  background: #fff; border-radius: 50%; padding: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.match-center { flex-shrink: 0; min-width: 52px; text-align: center; }
.match-time { font-size: 17px; font-variant-numeric: tabular-nums; text-shadow: var(--title-glow); }
.match-score { font-size: 19px; font-weight: 700; letter-spacing: 1px; }
.match-venue { margin-top: 9px; font-size: 11.5px; color: var(--muted); text-align: center; }

/* ---------- ⚽ team picker sheet ---------- */
.fav-current, .fav-teams-box .fav-current {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px;
}
.team-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-glass); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 6px 4px 10px; font-size: 13px;
}
.team-chip.static { padding-inline-end: 10px; }
.team-logo-sm { width: 20px; height: 20px; border-radius: 50%; object-fit: contain; background: #fff; }
.team-chip-x {
  width: 18px; height: 18px; border-radius: 50%; border: none;
  background: rgba(224, 101, 94, .18); color: #f0a49b; font-size: 10px;
  display: grid; place-items: center; flex-shrink: 0;
}
.team-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  margin-top: 10px; max-height: 46vh; overflow-y: auto;
}
.team-row {
  display: flex; align-items: center; gap: 8px; text-align: start;
  padding: 9px 10px; border-radius: 13px;
  background: var(--surface-glass); border: 1px solid var(--border);
  font-size: 13px; position: relative;
}
.team-row.on {
  border-color: var(--accent); background: rgba(47, 185, 168, .14);
}
.team-row.disabled { opacity: .4; pointer-events: none; }
.team-logo-md { width: 28px; height: 28px; border-radius: 50%; object-fit: contain; background: #fff; flex-shrink: 0; }
.team-logo-md.placeholder { display: grid; place-items: center; font-size: 14px; background: var(--surface-glass); }
.team-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-check { color: var(--accent); font-weight: 700; flex-shrink: 0; }

/* ================= safe-dial time picker ================= */
/* Third redesign. v1 (stepper buttons) and v2 (sliders) both tested worse
   on a real device than expected — this one was prototyped and hand-tested
   as a standalone artifact first (including the rotation math specifically,
   since naive angle tracking silently loses whole revolutions on a fast
   spin) before being wired in here. Mechanism: two concentric rings you
   spin like a safe dial; whatever lands under the fixed pointer is selected.
   Revealed lazily behind "+ تعیین ساعت" so the form doesn't show it by default. */

.sd-container { display: flex; flex-direction: column; align-items: center; margin-top: 6px; }
.sd-readout { font-size: 22px; font-weight: 800; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.sd-legend { display: flex; gap: 14px; font-size: 10.5px; color: var(--muted); margin-bottom: 8px; }
.sd-legend span { display: flex; align-items: center; gap: 4px; }
.sd-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.sd-dot-min { background: var(--accent-3); }
.sd-dot-hour { background: var(--accent); }

.sd-pointer {
  width: 0; height: 0; margin: 0 auto 10px; position: relative; z-index: 6;
  border-left: 7px solid transparent; border-right: 7px solid transparent;
  border-top: 12px solid var(--accent-2);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5));
}
.sd-dial-wrap { display: flex; justify-content: center; margin-bottom: 14px; }
.sd-dial { position: relative; width: 250px; height: 250px; touch-action: none; user-select: none; }
.sd-face {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, rgba(255, 255, 255, .05), rgba(255, 255, 255, .01) 70%);
  border: 1px solid var(--border);
}
.sd-boundary { position: absolute; inset: 48px; border-radius: 50%; border: 1px dashed var(--border); pointer-events: none; }
.sd-hub { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px; border-radius: 50%; background: var(--muted); z-index: 3; }

.sd-num {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums; pointer-events: none;
}
.sd-num-min { width: 19px; height: 19px; font-size: 10px; font-weight: 600; color: var(--muted); }
.sd-num-hour { width: 24px; height: 24px; font-size: 13px; font-weight: 700; color: var(--muted); }
.sd-tick-only { width: 3px; height: 3px; border-radius: 50%; background: var(--border); padding: 0; }
.sd-num.active.sd-num-min { color: #04222a; background: var(--accent-3); border-radius: 50%; font-weight: 800; transform: translate(-50%, -50%) scale(1.15); }
.sd-num.active.sd-num-hour { color: #04222a; background: var(--accent); border-radius: 50%; font-weight: 800; transform: translate(-50%, -50%) scale(1.15); }
.sd-dial:not(.dragging) .sd-num { transition: left .3s cubic-bezier(.2, .8, .3, 1), top .3s cubic-bezier(.2, .8, .3, 1), transform .18s; }

.sd-boxes { display: flex; align-items: center; justify-content: center; gap: 8px; direction: ltr; margin-bottom: 12px; }
.sd-box { width: 56px; height: 44px; text-align: center; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sd-colon { font-size: 18px; font-weight: 700; color: var(--muted); }
.sd-box-col { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sd-box-label { font-size: 10px; color: var(--muted); }

.sd-ampm.seg { align-self: center; }
.sd-ampm button { min-width: 56px; opacity: .55; border: 1px solid transparent; }
.sd-ampm button.on {
  opacity: 1; font-weight: 700; color: #04222a;
  background: linear-gradient(135deg, rgba(47, 185, 168, .95), rgba(61, 143, 176, .95));
  box-shadow: 0 3px 10px rgba(47, 185, 168, .38);
}
.time-clear { margin-top: 6px; }

/* ================= 🎨 day highlights (e.g. shift days) ================= */
/* A tint alone (previous version, ~.16 opacity) washed out in daylight —
   phone screens under sunlight/glare need real contrast, not just a hint of
   color. Two layers now: a stronger fill PLUS a crisp same-hue ring, so it
   stays readable across lighting conditions without turning into a solid
   loud block. Hues kept clear of the app's own accents (turquoise/gold/lapis)
   and the danger red so nothing reads as an existing UI state. */

.cell.hl-violet { background: rgba(156, 143, 217, .34); box-shadow: inset 0 0 0 1.5px rgba(156, 143, 217, .85); }
.cell.hl-sage   { background: rgba(139, 176, 138, .34); box-shadow: inset 0 0 0 1.5px rgba(139, 176, 138, .85); }
.cell.hl-rose   { background: rgba(217, 143, 176, .34); box-shadow: inset 0 0 0 1.5px rgba(217, 143, 176, .85); }
/* Both cues stay visible when a day is ALSO today — the earlier version
   dropped the highlight entirely here (background:none + amber-only
   shadow), which silently erased any color a user had deliberately set.
   Nesting two inset rings (thin amber right at the edge, the highlight's
   own color just inside it) keeps both readable at once. */
.cell.hl-violet.today {
  background: rgba(156, 143, 217, .34);
  box-shadow: inset 0 0 0 1px var(--accent-2), inset 0 0 0 3px rgba(156, 143, 217, .85), 0 4px 14px rgba(217, 164, 65, .22);
}
.cell.hl-sage.today {
  background: rgba(139, 176, 138, .34);
  box-shadow: inset 0 0 0 1px var(--accent-2), inset 0 0 0 3px rgba(139, 176, 138, .85), 0 4px 14px rgba(217, 164, 65, .22);
}
.cell.hl-rose.today {
  background: rgba(217, 143, 176, .34);
  box-shadow: inset 0 0 0 1px var(--accent-2), inset 0 0 0 3px rgba(217, 143, 176, .85), 0 4px 14px rgba(217, 164, 65, .22);
}

.hl-picker { display: flex; align-items: center; gap: 9px; margin: 2px 0 12px; }
.hl-swatch {
  width: 26px; height: 26px; border-radius: 50%; border: none;
  flex-shrink: 0; padding: 0; transition: transform .12s;
}
.hl-swatch:active { transform: scale(.9); }
.hl-swatch.violet { background: rgba(156, 143, 217, .55); }
.hl-swatch.sage   { background: rgba(139, 176, 138, .55); }
.hl-swatch.rose   { background: rgba(217, 143, 176, .55); }
.hl-swatch.none {
  background: transparent; border: 2px dashed var(--border);
  display: grid; place-items: center; font-size: 11px; color: var(--muted);
}
.hl-swatch.violet.on { box-shadow: 0 0 0 2px rgba(156, 143, 217, .9); }
.hl-swatch.sage.on   { box-shadow: 0 0 0 2px rgba(139, 176, 138, .9); }
.hl-swatch.rose.on   { box-shadow: 0 0 0 2px rgba(217, 143, 176, .9); }
.hl-swatch.none.on   { border-style: solid; border-color: var(--muted); }

/* ================= 🕐 شیفت‌کاری: دکمه‌ی کوچک زیر تسک‌ها + لیست/ویرایش محل‌ها ================= */
.shift-day-block:empty { margin: 0; }
.shift-day-block { margin: 10px 0 14px; }
.sf-place-row { padding: 12px 13px; }
.sf-shift-row { padding: 12px 13px; margin-bottom: 10px; }
.sf-shift-row:last-child { margin-bottom: 0; }
.sf-color-picker { margin: 0; gap: 7px; }
.sf-color-picker .hl-swatch { width: 22px; height: 22px; }

/* ================= 😊 evening mood check-in ================= */

.btn.ghost.on {
  background: rgba(47, 185, 168, .16);
  border-color: rgba(47, 185, 168, .4);
  color: var(--accent);
}

.mood-q { font-size: 15px; font-weight: 600; text-align: center; margin: 4px 0 20px; line-height: 1.7; }
.mood-picker { display: flex; justify-content: space-between; gap: 6px; padding: 0 4px; }
.mood-emoji-btn {
  flex: 1; font-size: 32px; line-height: 1; padding: 10px 0; border-radius: 16px;
  background: var(--surface-glass); border: 1px solid var(--border); transition: transform .12s, background .12s;
}
.mood-emoji-btn:active { transform: scale(1.15); background: rgba(47, 185, 168, .16); }

.mood-media-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.mood-media-row { display: flex; gap: 8px; }
.mood-media-row .media-ac { flex: 1; }

/* ---------- media autocomplete (فیلم/موسیقی در چک-این مود) ---------- */
.media-ac { position: relative; }
.media-ac-list {
  position: fixed; z-index: 200;
  background: var(--surface-glass); border: 1px solid var(--border);
  border-radius: 13px; box-shadow: var(--shadow);
  overflow-y: auto; backdrop-filter: blur(10px);
}
.media-ac-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; }
.media-ac-item:hover { background: var(--gold-soft); }
.media-ac-item img, .media-ac-item .media-ac-noimg {
  width: 34px; height: 34px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: var(--input-bg);
}
.media-ac-item .media-ac-text { min-width: 0; }
.media-ac-item .media-ac-title { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-ac-item .media-ac-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* calendar cell badge — plain text emoji, no image/logo styling needed */
.mood-badge {
  position: absolute; bottom: 2px; inset-inline-start: 2px;
  font-size: 13px; line-height: 1; z-index: 2;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5));
}

/* day-sheet card */
.mood-day-block:empty { margin: 0; }
.mood-card {
  background: linear-gradient(160deg, rgba(217, 164, 65, .1), rgba(217, 143, 176, .08));
  border: 1px solid var(--border); border-radius: 15px;
  padding: 12px 13px; margin-bottom: 10px;
}
.mood-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.mood-card-emoji { font-size: 22px; }
.mood-card-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.mood-card-media { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.mood-media-item { font-size: 12.5px; color: var(--muted); }

/* settings: "enjoyed things" list */
.enjoyed-list { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; }
.enjoyed-row {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 12px; border-radius: 12px; background: var(--surface-glass); border: 1px solid var(--border);
}
.enjoyed-date { font-size: 11px; color: var(--muted); }
.enjoyed-text { font-size: 13.5px; }

/* ================= 👥 admin: member roster ================= */

.admin-user-row {
  padding: 9px 4px; border-bottom: 1px solid var(--border);
}
.admin-user-row:last-child { border-bottom: none; }
.badge-status {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; flex-shrink: 0;
}
.badge-status.approved { background: rgba(47, 185, 168, .16); color: var(--accent); }
.badge-status.pending { background: rgba(217, 164, 65, .16); color: var(--accent-2); }

/* ================= 📓 ژورنال روزانه — پوسته‌ی «آبرنگ شفق» تأییدشده =================
   ساختار عیناً از قالب تأییدشده کپی شده (jr- به‌جای پیشوندهای عمومی، تا با
   چیز دیگری تداخل نکند)؛ فقط لایه‌ی متن از contenteditable به textarea
   تغییر کرده تا صفحه‌بندیِ خط‌محور با selectionStart/scrollHeight ممکن شود.
   توکن‌های رنگ/سایه/شعاع همان‌هایی‌اند که بقیه‌ی برنامه استفاده می‌کند. */

.journal-overlay {
  /* بین شیتِ ویزارد (۸۰، چون این پوشش باید رویش بنشیند) و toast (۹۰، چون
   * toastِ «ذخیره شد»/«به سقف رسید» باید همیشه رویِ این پوشش دیده شود). */
  position: fixed; inset: 0; z-index: 85;
  display: flex; justify-content: center;
  background: rgba(2, 5, 16, .55); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .28s;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}
.journal-overlay.open { opacity: 1; }
.journal-shell {
  width: 100%; max-width: 420px; height: 100%;
  display: flex; flex-direction: column; padding: 14px 16px 18px; min-height: 0;
}
.journal-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.journal-topbar-title { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; }
.jr-topbar-spacer { width: 38px; }
.jr-readonly-badge {
  font-size: 12px; color: var(--muted); text-align: center;
  background: var(--surface-glass); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px 10px; margin-bottom: 10px;
}
.jr-frame-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; overflow-y: auto; }
.jr-frame {
  position: relative; width: 100%; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  padding: 12px;
}
.jr-measurer { position: absolute; inset: 12px; visibility: hidden; pointer-events: none; z-index: -1; }
.jr-frame-footer { display: flex; align-items: center; justify-content: space-between; padding: 10px 4px 2px; }
.jr-wc, .jr-page-label { font-size: 12px; }
.jr-pagenav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 8px; }
.jr-pagenav .icon-btn:disabled { opacity: .3; pointer-events: none; }
.jr-page-dots { display: flex; gap: 6px; }
.jr-page-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.jr-page-dot.on { background: var(--accent); }

.jr-paper {
  position: relative; aspect-ratio: 210 / 297; border-radius: 6px; overflow: hidden;
  background: var(--tint); color: var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 34px 100%, 0 calc(100% - 34px));
}
.jr-paper .jr-wash {
  position: absolute; inset-inline: 0; top: 0; height: 32%; z-index: 0; background: var(--wash);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 30%, transparent 96%);
  mask-image: linear-gradient(180deg, #000 0%, #000 30%, transparent 96%);
}
.jr-paper .jr-vignette { position: absolute; inset: 0; z-index: 0; background: var(--vignette); }
.jr-paper .jr-dogear {
  position: absolute; left: 0; bottom: 0; width: 34px; height: 34px; z-index: 2;
  background: var(--dogear); clip-path: polygon(0 100%, 100% 100%, 0 0); box-shadow: 1px -1px 6px rgba(0, 0, 0, .25) inset;
}
.jr-content { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; padding: 20px 18px 18px; }
.jr-dateline { font-size: 11.5px; opacity: .62; margin-bottom: 7px; font-weight: 500; }
.jr-hr { height: 1px; background: var(--ink); opacity: .14; margin: 0 0 2px; }
.jr-body {
  flex: 1; width: 100%; min-height: 0; resize: none; overflow-y: hidden;
  border: none; margin: 0; padding: 0; background-color: transparent; outline: none;
  -webkit-appearance: none; appearance: none;
  font-family: inherit; color: var(--ink); font-size: 14px; line-height: 27px;
  background-image: repeating-linear-gradient(0deg, transparent 0 16px, var(--rule) 16px 17px, transparent 17px 27px);
  background-position-y: 1px;
}
.jr-body::placeholder { color: var(--ink); opacity: .45; }
.jr-body[readonly] { cursor: default; }

/* پنج حالتِ مود — رنگ/محلِ لکه دقیقاً همان طرحِ تأییدشده، دست‌نخورده */
.jr-mood-1 { --tint: #e7e4dc; --ink: #33312c; --wash: rgba(150, 157, 172, .42); --rule: rgba(100, 108, 125, .3); --dogear: linear-gradient(135deg, #9aa3b3, #6c7488); }
.jr-mood-2 { --tint: #eae6d8; --ink: #3a362c; --rule: rgba(61, 143, 176, .28); --dogear: linear-gradient(135deg, #7fa8bd, #4f7a91);
  --vignette: radial-gradient(ellipse at center, transparent 58%, rgba(61, 143, 176, .36) 100%); }
.jr-mood-3 { --tint: #f1ead6; --ink: #3a3226; --rule: rgba(61, 143, 176, .22); --dogear: linear-gradient(135deg, #e9c46a, #b9862c);
  --wash: linear-gradient(100deg, rgba(217, 164, 65, .32), rgba(217, 143, 176, .24)); }
.jr-mood-4 { --tint: #f3ecd6; --ink: #3a2f1e; --rule: rgba(217, 164, 65, .28); --dogear: linear-gradient(135deg, #f3d488, #d9a441);
  --vignette: radial-gradient(ellipse at center, transparent 58%, rgba(217, 164, 65, .34) 100%); }
.jr-mood-5 { --tint: #f5efd9; --ink: #362d1c; --rule: rgba(217, 164, 65, .3); --dogear: linear-gradient(135deg, #ffe9a8, #d9a441);
  --vignette:
    radial-gradient(70% 70% at 0% 0%, rgba(217, 164, 65, .34), transparent 62%),
    radial-gradient(70% 70% at 100% 0%, rgba(217, 143, 176, .32), transparent 62%),
    radial-gradient(85% 85% at 50% 100%, rgba(47, 185, 168, .28), transparent 62%); }

/* روی صفحه‌ی تقویم: دکمه‌ی «ژورنال» داخلِ شیتِ روز */
.journal-btn-row { margin-top: 6px; }

/* تأییدِ خروجِ بدون ذخیره — فرزندِ خودِ journal-overlay (نه sheet مشترک)
   تا همیشه بالاتر از کاغذِ ژورنال بنشیند، نه پشتش. */
.jr-confirm-backdrop {
  position: fixed; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2, 5, 16, .6); padding: 20px;
}
.jr-confirm-box {
  width: 100%; max-width: 340px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; backdrop-filter: blur(18px) saturate(140%);
}
.jr-confirm-box p { margin: 0 0 14px; font-size: 14px; line-height: 1.8; text-align: center; }


