/* מול עצמי v2 — נייר חם, דיו כהה, ירוק אזוב אחד. */
:root {
  --paper: #f5f1e8;
  --paper-2: #ede7da;
  --surface: #fffdf8;
  --ink: #1d1b16;
  --ink-2: #57524a;
  --ink-3: #6f695e;
  --line: #e2dbcc;
  --accent: #2f6a4f;
  --accent-ink: #24523d;
  --accent-soft: #e2ece4;
  --danger: #a3401f;
  --h0: transparent;
  --h1: #e9e2d3;
  --h2: #d6e4d3;
  --h3: #acccaf;
  --h4: #6fa585;
  --h5: #2f6a4f;
  --shadow: 0 1px 2px rgba(60, 48, 25, .06), 0 4px 14px -6px rgba(60, 48, 25, .12);
  --shadow-lift: 0 2px 4px rgba(60, 48, 25, .06), 0 14px 34px -12px rgba(60, 48, 25, .22);
  --r: 16px;
  --r-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: 'Assistant', system-ui, sans-serif;
  --display: 'Frank Ruhl Libre', 'Times New Roman', serif;
  --tabbar: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body {
  margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 24px);
}
::selection { background: var(--accent-soft); color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3, p { margin: 0; }
h1, h2 { text-wrap: balance; }
.icon { width: 22px; height: 22px; flex: none; }
.icon.mini { width: 15px; height: 15px; vertical-align: -2px; margin-inline-start: 4px; color: var(--ink-3); }
.icon.tail { width: 18px; height: 18px; color: var(--ink-3); margin-inline-start: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; top: -40px; right: 12px; background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 12px; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.center { text-align: center; }
.fine { color: var(--ink-3); font-size: 13px; text-align: center; margin-top: 20px; }
.hidden { display: none !important; }

.app { max-width: 560px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px 0; }
main:focus { outline: none; }

/* ---------- כפתורים ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 12px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 15px;
  box-shadow: inset 0 0 0 1px var(--line); transition: transform .15s var(--ease), background .2s;
}
.btn:active { transform: scale(.98); }
.btn:hover { background: #fff; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(36, 82, 61, .25), 0 6px 16px -8px rgba(36, 82, 61, .55); }
.btn.primary:hover { background: var(--accent-ink); }
.btn.danger { background: var(--danger); color: #fff; box-shadow: none; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn .icon { width: 19px; height: 19px; }
.link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); font-weight: 600; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; min-height: 36px; }
.link .icon { width: 18px; height: 18px; }
.link.small { font-size: 13px; min-height: 30px; }
.danger-text { color: var(--danger) !important; }
.arrow { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--ink-2); transition: background .2s; }
.arrow:hover:not(:disabled) { background: var(--paper-2); }
.arrow:disabled { opacity: .3; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--ink-2); }
.icon-btn:hover { background: var(--paper-2); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--accent)); flex: none; display: inline-block; }
.dot.hollow { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }

/* ---------- סרגל ניווט ---------- */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20; display: flex; justify-content: center;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: rgba(250, 247, 240, .92);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 -1px 0 var(--line);
}
.tab {
  flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0;
  color: var(--ink-3); text-decoration: none; font-size: 12.5px; font-weight: 600; border-radius: 12px; position: relative;
}
.tab .icon { width: 24px; height: 24px; transition: transform .25s var(--ease); }
.tab.on { color: var(--accent-ink); }
.tab.on::before { content: ''; position: absolute; top: -6px; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.tab:active .icon { transform: scale(.9); }

/* ---------- היום ---------- */
.day-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 4px; margin-top: 4px; }
.day-title { display: flex; flex-direction: column; align-items: center; padding: 4px 8px; border-radius: 14px; transition: background .2s; }
.day-title:hover { background: var(--paper-2); }
.weekday { font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 1.1; letter-spacing: -.01em; }
.date { color: var(--ink-2); font-size: 15px; font-weight: 500; }

.week-strip { display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; margin: 14px -6px 0; }
.week-shift { height: 56px; display: grid; place-items: center; color: var(--ink-3); border-radius: 10px; }
.week-shift .icon { width: 18px; height: 18px; }
.week-shift:disabled { opacity: .25; }
.wd-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wd {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0 8px; border-radius: 14px;
  color: var(--ink-2); transition: background .2s, color .2s;
}
.wd small { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.wd strong { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wd i { width: 18px; height: 4px; border-radius: 2px; margin-top: 4px; background: var(--h1); }
.wd i.h0 { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.wd i.h2 { background: var(--h2); } .wd i.h3 { background: var(--h3); } .wd i.h4 { background: var(--h4); } .wd i.h5 { background: var(--h5); }
.wd.is-today strong { color: var(--accent-ink); }
.wd.on { background: var(--ink); color: var(--paper); }
.wd.on small, .wd.on strong { color: var(--paper); }
.wd.on i.h0, .wd.on i.h1 { background: rgba(245, 241, 232, .35); box-shadow: none; }
.wd:disabled { opacity: .35; }
.wd:hover:not(:disabled):not(.on) { background: var(--paper-2); }

.past-banner {
  display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 12px; border-radius: 12px;
  background: #f1e6cf; color: #6b4d12; font-size: 14px; font-weight: 600;
}
.past-banner .icon { width: 18px; height: 18px; }
.past-banner .link { margin-inline-start: auto; color: #6b4d12; font-size: 14px; min-height: 28px; }

.day-body { margin-top: 18px; }
.day-body.enter-next { animation: enterNext .34s var(--ease); }
.day-body.enter-prev { animation: enterPrev .34s var(--ease); }
@keyframes enterNext { from { opacity: 0; transform: translateX(-22px); } }
@keyframes enterPrev { from { opacity: 0; transform: translateX(22px); } }

.summary { display: flex; align-items: center; gap: 18px; padding: 4px 4px 16px; }
.score { display: flex; flex-direction: column; min-width: 92px; }
.score strong { font-family: var(--display); font-weight: 900; font-size: 60px; line-height: .95; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.score strong.none { font-size: 40px; color: var(--ink-3); }
.score span { font-size: 13px; color: var(--ink-3); font-weight: 600; margin-top: 4px; }
.summary-side { flex: 1; min-width: 0; }
.summary-side p { color: var(--ink-2); font-size: 15px; }
.summary-side b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.segbar { display: flex; gap: 3px; margin-top: 10px; }
.segbar i { flex: 1; height: 7px; border-radius: 4px; background: linear-gradient(to left, var(--c) calc(var(--p) * 100%), var(--paper-2) 0); }

.habits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.habit {
  position: relative; display: flex; align-items: center; background: var(--surface); border-radius: var(--r);
  box-shadow: var(--shadow); overflow: hidden; isolation: isolate;
}
.habit::before {
  content: ''; position: absolute; inset: 0; z-index: -1; transform-origin: right center; transform: scaleX(var(--p));
  background: color-mix(in srgb, var(--c) 9%, transparent); transition: transform .5s var(--ease);
}
.habit-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 13px 14px; text-align: right; min-height: 68px; }
.habit-icon {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface));
}
.habit-text { display: flex; flex-direction: column; min-width: 0; }
.habit-name { font-weight: 700; font-size: 16.5px; line-height: 1.3; }
.habit-meta { font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.habit-meta .wk { color: var(--ink-2); font-weight: 600; }
.subs-line { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.habit.done .habit-meta { color: var(--ink-2); }
.check { width: 64px; align-self: stretch; display: grid; place-items: center; flex: none; }
.check svg { width: 44px; height: 44px; }
.check circle { fill: none; stroke-width: 2.5; }
.ring-bg { stroke: var(--line); }
.habit:not(.part) .ring-p { display: none; }
.ring-p { stroke: var(--c); stroke-linecap: round; stroke-dasharray: calc(var(--p) * 100) 100; transform: rotate(-90deg); transform-origin: 22px 22px; transition: stroke-dasharray .5s var(--ease); }
.tick { fill: none; stroke: var(--ink-3); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: .35; stroke-dasharray: 1; stroke-dashoffset: 0; }
.check:hover .tick { opacity: .7; }
.habit.done .ring-bg { fill: var(--c); stroke: var(--c); }
.habit.done .tick { stroke: #fff; opacity: 1; }
.check:active svg { transform: scale(.92); }
.check svg { transition: transform .15s var(--ease); }

/* הרגע: סימון ביצוע — הרקע מתמלא מימין, העיגול נצבע והוי נכתב */
.habit.just-done::before { animation: fillIn .55s var(--ease); }
.habit.just-done .ring-bg { animation: popFill .45s var(--ease); }
.habit.just-done .tick { animation: drawTick .4s .12s var(--ease) both; }
.habit.just-done .check svg { animation: bump .45s var(--ease); }
@keyframes fillIn { from { transform: scaleX(0); } }
@keyframes popFill { from { fill: transparent; stroke: var(--line); } }
@keyframes drawTick { from { stroke-dashoffset: 1; } }
@keyframes bump { 40% { transform: scale(1.12); } }

.empty-line { color: var(--ink-3); padding: 16px; text-align: center; }

.not-yet { margin-top: 18px; padding: 14px 16px; border-radius: var(--r); background: var(--paper-2); }
.not-yet h2 { font-size: 14px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.not-yet.solo { background: var(--surface); box-shadow: var(--shadow); padding: 18px 16px; }
.not-yet.solo h2 { font-family: var(--display); font-size: 21px; color: var(--ink); }
.not-yet.solo p { color: var(--ink-2); font-size: 15px; margin: 6px 0 12px; }
.not-yet.solo .btn.wide { margin-bottom: 10px; }
.ny-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 15px; }
.ny-row small { color: var(--ink-3); }
.ny-row .btn { margin-inline-start: auto; }

.journal { margin-top: 26px; }
.journal h2, .card-title, .section-title { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.01em; }
.moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 12px 0 10px; }
.mood {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px 8px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow); font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  transition: background .2s, color .2s, transform .15s var(--ease);
}
.mood i { width: 12px; height: 12px; border-radius: 50%; }
.mood .m1 { background: #b04e2c; } .mood .m2 { background: #c98a3d; } .mood .m3 { background: #b9b08f; } .mood .m4 { background: #6fa585; } .mood .m5 { background: #2f6a4f; }
.mood:active { transform: scale(.96); }
.mood.on { background: var(--ink); color: var(--paper); }
.journal textarea, .field input:not([type=range]):not([type=radio]):not([type=checkbox]), .field select, .field textarea {
  width: 100%; border: 0; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  padding: 12px 14px; font-size: 16px; line-height: 1.5; resize: vertical; transition: box-shadow .2s;
}
.journal textarea:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
::placeholder { color: #8f887a; }
.saved { display: block; min-height: 20px; font-size: 13px; color: var(--accent-ink); font-weight: 600; }

/* ---------- ברוכים הבאים ---------- */
.welcome { padding-top: 22px; }
.welcome-date { color: var(--ink-3); font-weight: 600; font-size: 14px; }
.welcome h1 { font-family: var(--display); font-weight: 900; font-size: 40px; line-height: 1.08; letter-spacing: -.02em; margin-top: 6px; }
.lead { color: var(--ink-2); font-size: 17px; margin: 10px 0 22px; max-width: 34ch; }
.templates { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.template { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); text-align: right; transition: transform .15s var(--ease), box-shadow .2s; }
.template:hover { box-shadow: var(--shadow-lift); }
.template:active { transform: scale(.99); }
.template strong { display: block; font-size: 16px; }
.template small { color: var(--ink-3); font-size: 14px; }
.welcome .link { margin: 10px auto 0; display: flex; justify-content: center; }

/* ---------- עמודים ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 14px; }
.page-head h1 { font-family: var(--display); font-weight: 900; font-size: 36px; letter-spacing: -.02em; line-height: 1.1; }
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.card-title { font-size: 19px; margin-bottom: 12px; }
.section-title { margin: 30px 0 12px; }
.empty-card { text-align: center; padding: 28px 20px; }
.empty-card p { color: var(--ink-2); margin-bottom: 16px; max-width: 36ch; margin-inline: auto; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 12px; padding: 2px 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 36px; padding: 0 13px; border-radius: 999px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.chip.on { background: var(--ink); color: var(--paper); box-shadow: none; }

.month-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin: -6px -6px 8px; }
.month-nav h2 { text-align: center; font-family: var(--display); font-weight: 700; font-size: 20px; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.gh { text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-3); padding-bottom: 4px; }
.gc {
  position: relative; aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; font-size: 15px; font-weight: 600;
  font-variant-numeric: tabular-nums; background: var(--h0); color: var(--ink-2); transition: transform .15s var(--ease);
}
.gc.pad { pointer-events: none; }
.gc.h0 { color: var(--ink-3); }
.gc.h1 { background: var(--h1); } .gc.h2 { background: var(--h2); } .gc.h3 { background: var(--h3); color: var(--ink); }
.gc.h4 { background: var(--h4); color: #fff; } .gc.h5 { background: var(--h5); color: #fff; }
.gc:disabled { opacity: .35; }
.gc:active:not(:disabled) { transform: scale(.94); }
.gc.is-today span { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; font-weight: 800; }
.gc.sel { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); z-index: 1; }
.has-note { position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .7; }
.legend { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 12px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.legend i { width: 14px; height: 14px; border-radius: 4px; }
.legend .h1 { background: var(--h1); } .legend .h2 { background: var(--h2); } .legend .h3 { background: var(--h3); } .legend .h4 { background: var(--h4); } .legend .h5 { background: var(--h5); }
.legend span + i { margin-inline-start: 6px; }

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.detail-head h2 { font-family: var(--display); font-weight: 700; font-size: 20px; }
.detail-head p { color: var(--ink-3); font-size: 14px; font-weight: 600; }
.detail-list { list-style: none; margin: 0; padding: 0; }
.detail-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 0; border-top: 1px solid var(--paper-2); }
.dl-name { font-weight: 600; }
.dl-val { margin-inline-start: auto; color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.dl-note { flex-basis: 100%; color: var(--ink-2); font-size: 14px; padding-inline-start: 20px; }
.day-quote { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--paper); color: var(--ink-2); font-family: var(--display); font-size: 17px; line-height: 1.55; white-space: pre-wrap; }

.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stats3 div { display: flex; flex-direction: column; }
.stats3 strong { font-family: var(--display); font-weight: 900; font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats3 span { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.month-habits { list-style: none; margin: 0; padding: 0; }
.month-habits li { display: grid; grid-template-columns: 10px minmax(70px, 1fr) 2fr auto; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--paper-2); font-size: 15px; }
.mh-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-bar { height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.mh-bar i { display: block; height: 100%; background: var(--c); border-radius: 3px; margin-inline-start: 0; }
.mh-num { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- תובנות ---------- */
.week-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin: -4px -6px 10px; text-align: center; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.week-score { display: flex; align-items: center; gap: 18px; }
.week-score > strong { font-family: var(--display); font-weight: 900; font-size: 64px; line-height: .95; font-variant-numeric: tabular-nums; min-width: 90px; }
.week-score h2 { font-size: 15px; color: var(--ink-3); font-weight: 700; }
.week-score p { font-weight: 700; font-size: 17px; }
.week-score p.up { color: var(--accent-ink); }
.week-score p.down { color: var(--danger); }
.week-score small { color: var(--ink-3); font-size: 13px; }
.focus-list { list-style: none; margin: 0; padding: 0; counter-reset: f; }
.focus-list li { padding: 12px 0; border-top: 1px solid var(--paper-2); }
.focus-list li:first-child { border-top: 0; padding-top: 0; }
.fl-head { display: flex; align-items: center; gap: 10px; }
.fl-head strong { font-size: 16.5px; }
.fl-score { margin-inline-start: auto; font-family: var(--display); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.focus-list p { color: var(--ink-2); font-size: 14.5px; margin-top: 4px; padding-inline-start: 20px; max-width: 60ch; }
.wk-head, .wk-row { display: grid; grid-template-columns: minmax(64px, 1.6fr) repeat(7, 1fr) 40px; align-items: center; gap: 4px; }
.wk-head span { text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-3); }
.wk-row { padding: 6px 0; }
.wk-name { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc { height: 22px; border-radius: 6px; background: var(--paper-2); }
.wc.half { background: color-mix(in srgb, var(--c) 40%, var(--surface)); }
.wc.full { background: var(--c); }
.wc.off { background: transparent; box-shadow: inset 0 0 0 1px var(--paper-2); }
.wk-num { text-align: center; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; font-weight: 600; }
.bars { width: 100%; height: 90px; display: block; transform: scaleX(-1); }
.bars rect { fill: var(--line); }
.bars .h1 { fill: var(--h1); } .bars .h2 { fill: var(--h2); } .bars .h3 { fill: var(--h3); } .bars .h4 { fill: var(--h4); } .bars .h5 { fill: var(--h5); }
.bars-x { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.subs-block { margin-bottom: 12px; }
.subs-block h3 { font-size: 15px; margin-bottom: 6px; }
.sub-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sub-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--c) 10%, var(--surface)); font-size: 14px; font-weight: 600; }
.sub-chip b { font-variant-numeric: tabular-nums; color: var(--c); }
.sub-chip small { color: var(--ink-3); font-size: 12px; }
.sub-chip.none { background: var(--paper); color: var(--ink-3); }

/* ---------- הרגלים / הגדרות ---------- */
.group { margin-bottom: 18px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 6px; }
.group-head h2 { font-size: 14px; font-weight: 700; color: var(--ink-3); }
.hrow { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 6px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); text-align: right; transition: box-shadow .2s; }
.hrow:hover { box-shadow: var(--shadow-lift); }
.hrow-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.hrow-text strong { font-size: 16px; }
.hrow-text small { color: var(--ink-3); font-size: 13.5px; }
.hrow-w { font-weight: 700; color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.hrow .icon.tail { margin-inline-start: 0; }
.settings { padding: 4px 16px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--paper-2); width: 100%; text-align: right; }
.set-row:first-child { border-top: 0; }
.set-row.col { flex-direction: column; align-items: stretch; }
.set-row strong { display: block; font-size: 16px; }
.set-row small { display: block; color: var(--ink-3); font-size: 13.5px; }
.set-row p { color: var(--ink-2); font-size: 14.5px; margin-top: 8px; max-width: 62ch; }
.set-row summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.set-row summary::after { content: '+'; color: var(--ink-3); font-size: 20px; line-height: 1; }
.set-row[open] summary::after { content: '–'; }
.set-row .icon { color: var(--ink-3); }
.set-label { display: flex; justify-content: space-between; font-weight: 700; }
.set-label output { color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-bottom: 14px; }

input[type=range] { width: 100%; height: 32px; accent-color: var(--accent); margin: 4px 0 0; }

/* ---------- גיליון ---------- */
.sheet {
  width: min(560px, 100%); max-width: 100%; max-height: calc(var(--vh, 100dvh) - 20px); margin: auto auto 0; padding: 0;
  border: 0; border-radius: 22px 22px 0 0; background: var(--paper); color: var(--ink); overflow: auto; overscroll-behavior: contain;
  box-shadow: 0 -10px 40px -10px rgba(40, 30, 10, .3);
}
.sheet[open] { animation: sheetUp .32s var(--ease); }
.sheet::backdrop { background: rgba(29, 27, 22, .38); animation: fade .25s; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.sheet-body { padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 2px auto 6px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: -8px; background: var(--paper); padding: 6px 0 8px; z-index: 2; }
.sheet-head h2 { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 23px; }
.sheet-ic { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, var(--surface)); }
.sheet-sub { color: var(--ink-2); font-size: 15px; margin-bottom: 14px; }
.sheet-text { color: var(--ink-2); margin-bottom: 14px; }
.sheet-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
@media (min-width: 700px) {
  .sheet { margin: auto; border-radius: 22px; max-height: min(86vh, 820px); }
  .grab { display: none; }
}

.field { margin: 0 0 16px; border: 0; padding: 0; min-width: 0; }
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field.two .end { display: flex; align-items: flex-end; }
.label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 700; font-size: 15px; margin-bottom: 6px; padding: 0; }
.label small { font-weight: 500; color: var(--ink-3); font-size: 13px; }
.label output { color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.field > div > label:not(.label) { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.range-ends { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); }

.stepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; }
.stepper input { text-align: center; font-size: 22px !important; font-weight: 700; font-variant-numeric: tabular-nums; }
.step { height: 52px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; transition: transform .12s var(--ease); }
.step:active { transform: scale(.94); }
.quick { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.quick .chip { min-height: 34px; }

.subs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.sub-row { display: flex; align-items: center; gap: 10px; border-radius: 14px; transition: background .2s; }
.sub-row:not(.on) input[type=range], .sub-row:not(.on) output { display: none; }
.sub-row.on { flex-basis: 100%; background: var(--surface); box-shadow: var(--shadow); padding: 4px 4px 4px 12px; }
.sub-row input[type=range] { flex: 1; margin: 0; }
.sub-row output { width: 24px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.sub-toggle { position: relative; cursor: pointer; }
.sub-toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.sub-toggle span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 15px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; font-size: 15px; color: var(--ink-2); transition: background .2s, color .2s; }
.sub-toggle input:checked + span { background: var(--ink); color: var(--paper); box-shadow: none; }
.sub-toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-line input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.check-line { display: flex; align-items: center; gap: 10px; font-size: 15px; margin: 4px 0 6px; min-height: 40px; cursor: pointer; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--paper-2); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 10px; font-weight: 600; font-size: 15px; color: var(--ink-2); transition: background .2s, color .2s; }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.times { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-weight: 600; }
.times select { width: 90px !important; }

.swatches { display: flex; gap: 10px; }
.swatch { position: relative; width: 36px; height: 36px; border-radius: 50%; background: var(--c); cursor: pointer; }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--c); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 5px; }
.icon-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.icon-pick label { position: relative; cursor: pointer; }
.icon-pick input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.icon-pick label > span { height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); }
.icon-pick input:checked + span { background: var(--ink); color: var(--paper); box-shadow: none; }
.icon-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.focus-clock { font-family: var(--display); font-weight: 900; font-size: 72px; text-align: center; line-height: 1; margin: 10px 0 4px; font-variant-numeric: tabular-nums; }
.focus .field { margin-top: 18px; }

/* ---------- טוסט ---------- */
.toast {
  position: fixed; z-index: 40; left: 50%; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 14px);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 14px;
  max-width: calc(100% - 32px); width: max-content; padding: 11px 16px; border-radius: 14px; background: var(--ink); color: var(--paper);
  font-size: 15px; font-weight: 600; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .4); transition: opacity .25s, transform .3s var(--ease);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: #b7dcc3; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; }
dialog[open] ~ .toast { bottom: 24px; }
