/* רביעי שלנו — design tokens. Pastels: ורוד עתיק, לילך, מרווה, אפרסק, שמנת, תכלת */
/* רביעי שלנו — minimalist: white, #F5F7FA, deep blue #193858, smoky blue #88A8C7, light sky #DCEAF3.
   Pastels only where colour carries meaning (the calendar). */
:root {
  --bg: #ffffff; --bg2: #f5f7fa; --card: #ffffff; --ink: #193858; --ink-body: #26323f; --ink2: #5b6b7c; --line: #e3e9f0;
  --accent: #193858; --accent-ink: #ffffff; --accent2: #88a8c7; --hl: #dceaf3; --focus: #2f6db3;
  --rose-s: #f6e3e7; --lilac-s: #ece6f6; --sage-s: #e2eee3; --peach-s: #f6e1d7; --sky-s: #dceaf3; --cream: #f8f0df;
  --rose: #c98a97; --sage: #6f9a72; --peach: #d99a7e; --lilac: #a48bc8; --sky: #88a8c7;
  --ok: #2e7d4f; --warn: #a2541f;
  --shadow: none; --r: 16px;
  --day1: #f4dee6; --day2: #ddebe0; --day3: #dbe7f7; --day4: #e5dbf3; --day5: #f9ead2; --dayfight: #f1d6cc; --dayink: #2b3540;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1722; --bg2: #172231; --card: #131d2a; --ink: #e8eef5; --ink-body: #d5dee8; --ink2: #9fb0c2; --line: #263447;
    --accent: #dceaf3; --accent-ink: #0f1722; --accent2: #88a8c7; --hl: #1f3248; --focus: #88a8c7;
    --rose-s: #3a2a30; --lilac-s: #2f2a3d; --sage-s: #24342a; --peach-s: #3b2b24; --sky-s: #1f3248; --cream: #332c1f;
    --ok: #7cc79a; --warn: #e6a77f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1722; --bg2: #172231; --card: #131d2a; --ink: #e8eef5; --ink-body: #d5dee8; --ink2: #9fb0c2; --line: #263447;
  --accent: #dceaf3; --accent-ink: #0f1722; --accent2: #88a8c7; --hl: #1f3248; --focus: #88a8c7;
  --rose-s: #3a2a30; --lilac-s: #2f2a3d; --sage-s: #24342a; --peach-s: #3b2b24; --sky-s: #1f3248; --cream: #332c1f;
  --ok: #7cc79a; --warn: #e6a77f; color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Assistant", system-ui, sans-serif; font-size: 17px; line-height: 1.6; }
body { min-height: 100dvh; overflow-x: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select { font-size: 16px; } /* no iOS zoom */
a { color: var(--accent); }
#app { max-width: 560px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }

/* header */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 0 10px; background: linear-gradient(var(--bg) 75%, transparent); }
.top h1 { font-size: 22px; font-weight: 700; margin: 0; flex: 1; color: var(--ink); }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); display: grid; place-items: center; cursor: pointer; position: relative; flex: none; }
.iconbtn svg { width: 20px; height: 20px; }
.dot { position: absolute; top: 6px; left: 7px; width: 9px; height: 9px; border-radius: 50%; background: #c0392b; border: 2px solid var(--card); }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin: 0 0 14px; color: var(--ink-body); }
.card h2, .card h3 { color: var(--ink); }
.card.soft { box-shadow: none; }
.card.rose { background: var(--rose-s); } .card.lilac { background: var(--lilac-s); } .card.sage { background: var(--sage-s); }
.card.peach { background: var(--peach-s); } .card.sky { background: var(--sky-s); } .card.cream { background: var(--cream); }
.card h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.muted { color: var(--ink2); font-size: 14px; }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack > * + * { margin-top: 10px; }
.hr { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 99px; font-size: 13px; background: var(--bg2); color: var(--ink); white-space: nowrap; }
.pill.rose { background: var(--rose-s); } .pill.sage { background: var(--sage-s); } .pill.lilac { background: var(--lilac-s); } .pill.peach { background: var(--peach-s); } .pill.sky { background: var(--sky-s); }
.tile { background: var(--card); color: var(--ink); border-radius: 14px; padding: 14px; border: 1px solid var(--line); text-align: right; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-height: 92px; }
.tile .ic { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; }
.tile .ic svg { width: 19px; height: 19px; }
.tile b { font-weight: 600; font-size: 15px; }

/* buttons */
.btn { border: 0; border-radius: 12px; padding: 13px 18px; min-height: 48px; background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .15s, opacity .15s; }
.btn:active { transform: scale(.97); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--bg2); color: var(--ink); font-weight: 500; }
.btn.line { background: transparent; color: var(--ink); border: 1.5px solid var(--line); font-weight: 500; }
.btn.small { padding: 8px 13px; border-radius: 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px; font-weight: 500; }

/* forms */
label.f { display: block; margin: 0 0 12px; }
label.f > span { display: block; font-size: 14px; color: var(--ink2); margin: 0 0 5px; }
.in { width: 100%; border: 1.5px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 14px; outline: none; }
.in:focus { border-color: var(--accent); }
textarea.in { min-height: 96px; resize: vertical; line-height: 1.6; }
.seg { display: flex; background: var(--bg2); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 11px; cursor: pointer; font-size: 14px; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(25,56,88,.12); font-weight: 600; color: var(--ink); }
.seg button { min-height: 42px; color: var(--ink2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: var(--card); border-radius: 99px; padding: 7px 13px; cursor: pointer; font-size: 14px; }
.chip.on { background: var(--hl); border-color: var(--accent2); font-weight: 600; color: var(--ink); }
.chip { min-height: 40px; color: var(--ink); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.switch input { appearance: none; width: 48px; height: 28px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: right .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { right: 23px; }

/* bottom nav */
.nav { position: fixed; bottom: 0; inset-inline: 0; z-index: 30; display: flex; justify-content: center; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.nav .in-nav { display: flex; width: 100%; max-width: 560px; justify-content: space-around; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; color: var(--ink2); text-decoration: none; padding: 4px 8px; border-radius: 12px; min-width: 56px; }
.nav a svg { width: 23px; height: 23px; }
.nav a.on { color: var(--accent); font-weight: 600; }

/* modal / sheet */
.veil { position: fixed; inset: 0; z-index: 50; background: rgba(40, 20, 30, .35); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { background: var(--bg); color: var(--ink-body); width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; border-radius: 26px 26px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); animation: up .28s cubic-bezier(.2, .9, .3, 1.1); }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 12px; font-size: 19px; }
.toast { position: fixed; bottom: calc(92px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 14px; z-index: 60; font-size: 14px; animation: up .25s; max-width: 90vw; text-align: center; }
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateY(30px); opacity: 0 } }
@keyframes pop { 0% { transform: scale(.85); opacity: 0 } 70% { transform: scale(1.03) } 100% { transform: scale(1); opacity: 1 } }
.pop { animation: pop .35s ease-out both; }
.screen { animation: fade .25s; }

/* greeting */
.hello { padding: 6px 2px 14px; }
.hello .hi { font-size: 28px; font-weight: 700; margin: 0; color: var(--ink); letter-spacing: -.2px; }
.avatars { display: flex; }
.av { width: 40px; height: 40px; border-radius: 50%; background: var(--hl); color: var(--ink); display: grid; place-items: center; font-weight: 600; font-size: 15px; overflow: hidden; border: 2.5px solid var(--bg); flex: none; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.avatars .av + .av { margin-inline-start: -12px; background: var(--bg2); }

/* calendar — צובי מעבר */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .wd { text-align: center; font-size: 13px; color: var(--ink2); padding: 4px 0; }
.cal .d { aspect-ratio: 1; border-radius: 14px; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 15px; cursor: pointer; color: var(--ink); position: relative; transition: transform .15s; }
.cal .d:active { transform: scale(.93); }
.cal .d.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal .d.calm { color: var(--dayink); }
.cal .d.fight { background: var(--dayfight); color: var(--dayink); }
.cal .d svg { width: 15px; height: 15px; opacity: .75; }
.cal .d.future { opacity: .35; pointer-events: none; }

/* envelope */
.env { position: relative; aspect-ratio: 1.55; border-radius: 16px; background: var(--rose-s); overflow: hidden; display: grid; place-items: center; box-shadow: var(--shadow); }
.env::before { content: ""; position: absolute; inset: 0 0 auto; height: 58%; background: color-mix(in srgb, var(--rose) 35%, transparent); clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform .7s ease; z-index: 2; }
.env.open::before { transform: rotateX(180deg); }
.env .seal { z-index: 3; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 3px 10px rgba(0,0,0,.15); transition: opacity .3s; }
.env.open .seal { opacity: 0; }
.env.lilac { background: var(--lilac-s); } .env.lilac::before { background: color-mix(in srgb, var(--lilac) 35%, transparent); }
.env.sage { background: var(--sage-s); } .env.sage::before { background: color-mix(in srgb, var(--sage) 35%, transparent); }
.env.peach { background: var(--peach-s); } .env.peach::before { background: color-mix(in srgb, var(--peach) 35%, transparent); }
.env.sky { background: var(--sky-s); } .env.sky::before { background: color-mix(in srgb, var(--sky) 35%, transparent); }
.env.cream { background: var(--cream); } .env.cream::before { background: color-mix(in srgb, #d8b67a 35%, transparent); }
.paper { background: var(--card); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); white-space: pre-wrap; line-height: 1.8; animation: pop .5s .35s both; }

/* timer */
.timer { font-size: 54px; font-weight: 300; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.progress { height: 6px; background: var(--bg2); border-radius: 9px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 9px; transition: width .4s; }

/* misc */
.empty { text-align: center; padding: 26px 10px; color: var(--ink2); }
.empty svg { width: 36px; height: 36px; color: var(--accent2); margin-bottom: 6px; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.notice { font-size: 13px; color: var(--ink2); background: var(--bg2); border-radius: 14px; padding: 10px 13px; }
.bar-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.bar-row:last-child { border: 0; }
.wheel-wrap { position: relative; width: min(300px, 80vw); aspect-ratio: 1; margin: 6px auto 14px; }
.wheel { width: 100%; height: 100%; border-radius: 50%; transition: transform 3.2s cubic-bezier(.15, .85, .2, 1); box-shadow: var(--shadow); }
.wheel-pin { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border: 12px solid transparent; border-top: 20px solid var(--accent); z-index: 2; }
@media print {
  .nav, .top .iconbtn, .noprint { display: none !important; }
  body { background: #fff; color: #222; } .card { box-shadow: none; border: 1px solid #eee; break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* accessibility + offline */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; top: -60px; right: 12px; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 10px; z-index: 99; }
.skip:focus { top: 10px; }
.netbar { position: fixed; top: env(safe-area-inset-top); inset-inline: 0; z-index: 40; text-align: center; font-size: 13px; padding: 5px 10px; background: var(--hl); color: var(--ink); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--bg2); color: var(--ink2); }
.tag.fact { background: var(--sage-s); color: var(--ink); } .tag.report { background: var(--sky-s); color: var(--ink); } .tag.suggest { background: var(--cream); color: var(--ink); }
.quiet-mode .nav, .quiet-mode .top .iconbtn:not(.keep) { display: none !important; }
.quiet-mode .toast { display: none !important; }
@media (min-width: 900px) {
  #app { max-width: 760px; }
  .grid-wide { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
}
