/* ============================================================
   Yomi — מערכת עיצוב v2

   כיוון: "עוזר שקט". הממשק נסוג לאחור ומשאיר במרכז שלושה
   דברים בלבד — מה הבא בלוז, שיחה עם העוזר, ופעולה שממתינה
   לאישור. אינדיגו כמבטא (אמון, פוקוס), טורקיז לזמן פנוי,
   ענבר לאזהרה. שני מצבים — כהה ובהיר — לפי המערכת או בחירה.

   שלוש שכבות טוקנים: פרימיטיבים → סמנטי → רכיב.
   עומק על רקע כהה = בהירות משטח + גבול שיער, לא צל.
   ============================================================ */

:root {
  /* ---------- שכבה 1: פרימיטיבים (מצב כהה — ברירת מחדל) ---------- */
  --p-ink-950: #090a0f;
  --p-ink-900: #0d0f15;
  --p-ink-850: #14161f;
  --p-ink-800: #1b1e29;
  --p-ink-750: #242836;
  --p-ink-400: #7d8497;
  --p-ink-300: #a3aabb;
  --p-ink-50:  #eef0f6;

  --p-indigo: #8f8cff;
  --p-indigo-hi: #a9a6ff;
  --p-teal: #4fd8c4;
  --p-amber: #f6c25b;
  --p-rose: #ff8a9a;

  /* ---------- שכבה 2: סמנטי ---------- */
  --bg: #0d0f15;
  --surface: #14161f;
  --surface-2: #1b1e29;
  --surface-3: #242836;
  --text: #eef0f6;
  --muted: #a3aabb;
  --faint: #7d8497;

  --accent: #8f8cff;
  --accent-2: #4fd8c4;
  --accent-ink: #0d0b2e;
  --violet: #b9a4ff;
  --mint: #4fd8c4;
  --warn: #f6c25b;
  --danger: #ff8a9a;
  --ok: #6ee7a8;

  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .13);
  --accent-wash: rgba(143, 140, 255, .13);
  --accent-line: rgba(143, 140, 255, .38);
  --teal-wash: rgba(79, 216, 196, .12);
  --warn-wash: rgba(246, 194, 91, .13);
  --focus-ring: rgba(143, 140, 255, .6);
  --scrim: rgba(5, 6, 12, .66);
  --glass: rgba(13, 15, 21, .78);

  --brand: linear-gradient(135deg, #8f8cff 0%, #6c8cff 55%, #4fd8c4 130%);
  --brand-soft: linear-gradient(140deg, rgba(143,140,255,.16), rgba(79,216,196,.05) 70%);

  /* ---------- מרווח: רשת 4/8 ---------- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-12: 48px;

  /* ---------- רדיוס ---------- */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-pill: 9999px;

  /* ---------- תנועה ---------- */
  --dur-tap: 100ms;
  --dur-enter: 180ms;
  --dur-open: 260ms;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --ease-out: cubic-bezier(0, 0, .2, 1);

  /* צל רק לשכבות-על אמיתיות */
  --shadow: 0 18px 50px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.3);

  --font: "Rubik", "Heebo", -apple-system, "Segoe UI", system-ui, Arial, sans-serif;

  --nav-h: 68px;
  --rail-w: 96px;
  color-scheme: dark;
}

/* ---------- מצב בהיר: לפי המערכת, אלא אם נבחר כהה ---------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6fa; --surface: #ffffff; --surface-2: #f0f1f6; --surface-3: #e6e8f0;
    --text: #151826; --muted: #555c70; --faint: #6b7183;
    --accent: #5048e5; --accent-2: #0a7064; --accent-ink: #ffffff;
    --violet: #6d4fd8; --mint: #0a7064; --warn: #a35c00; --danger: #c22a45; --ok: #157a46;
    --line: rgba(20, 24, 40, .08); --line-strong: rgba(20, 24, 40, .16);
    --accent-wash: rgba(80, 72, 229, .09); --accent-line: rgba(80, 72, 229, .35);
    --teal-wash: rgba(11, 125, 111, .09); --warn-wash: rgba(163, 92, 0, .09);
    --focus-ring: rgba(80, 72, 229, .5); --scrim: rgba(20, 22, 35, .38);
    --glass: rgba(255, 255, 255, .82);
    --brand: linear-gradient(135deg, #5b53f0 0%, #4a6cf0 60%, #0f9d8a 130%);
    --brand-soft: linear-gradient(140deg, rgba(80,72,229,.09), rgba(11,125,111,.04) 70%);
    --shadow: 0 18px 50px rgba(30,34,60,.16), 0 2px 8px rgba(30,34,60,.08);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f5f6fa; --surface: #ffffff; --surface-2: #f0f1f6; --surface-3: #e6e8f0;
  --text: #151826; --muted: #555c70; --faint: #6b7183;
  --accent: #5048e5; --accent-2: #0a7064; --accent-ink: #ffffff;
  --violet: #6d4fd8; --mint: #0a7064; --warn: #a35c00; --danger: #c22a45; --ok: #157a46;
  --line: rgba(20, 24, 40, .08); --line-strong: rgba(20, 24, 40, .16);
  --accent-wash: rgba(80, 72, 229, .09); --accent-line: rgba(80, 72, 229, .35);
  --teal-wash: rgba(11, 125, 111, .09); --warn-wash: rgba(163, 92, 0, .09);
  --focus-ring: rgba(80, 72, 229, .5); --scrim: rgba(20, 22, 35, .38);
  --glass: rgba(255, 255, 255, .82);
  --brand: linear-gradient(135deg, #5b53f0 0%, #4a6cf0 60%, #0f9d8a 130%);
  --brand-soft: linear-gradient(140deg, rgba(80,72,229,.09), rgba(11,125,111,.04) 70%);
  --shadow: 0 18px 50px rgba(30,34,60,.16), 0 2px 8px rgba(30,34,60,.08);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  direction: rtl;
  /* עברית: line-height נדיב, בלי tracking */
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: var(--bg);
  background-image:
    radial-gradient(900px 480px at 85% -12%, var(--accent-wash), transparent 65%),
    radial-gradient(700px 420px at -10% 4%, var(--teal-wash), transparent 60%);
  background-attachment: fixed;
}

svg.i { width: 22px; height: 22px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 18px; height: 18px; }

#app { max-width: 640px; margin: 0 auto; padding: var(--s-4) var(--s-4) calc(var(--nav-h) + 120px); }

/* ---------- כותרת עליונה ---------- */
.top { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-5); min-height: 44px; }
.brand {
  width: 40px; height: 40px; border-radius: 13px; flex: 0 0 40px;
  background: var(--brand); display: grid; place-items: center; color: #fff;
}
.brand svg { width: 22px; height: 22px; }
.top h1 { font-size: 17px; font-weight: 700; letter-spacing: -.2px; line-height: 1.2; }
.top .sub { color: var(--muted); font-size: 12.5px; }
.spacer { flex: 1; }
.icon-btn {
  width: 44px; height: 44px; border-radius: var(--r-md); display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer;
  transition: background var(--dur-enter) var(--ease), color var(--dur-enter) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- כפתורים ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  min-height: 44px; padding: 10px var(--s-4); border-radius: var(--r-md); cursor: pointer; font: inherit;
  font-size: 14.5px; font-weight: 600; text-decoration: none;
  transition: transform var(--dur-tap) var(--ease), background var(--dur-enter) var(--ease),
              border-color var(--dur-enter) var(--ease), filter var(--dur-enter) var(--ease);
}
.btn:hover { border-color: var(--line-strong); background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 36px; padding: 6px 13px; font-size: 13.5px; border-radius: var(--r-sm); }
.btn.big { width: 100%; min-height: 54px; font-size: 16.5px; border-radius: var(--r-lg); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; filter: none; }

/* ---------- כרטיס ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s-5); margin-bottom: var(--s-3);
}
.card h3 { font-size: 16px; margin-bottom: var(--s-2); font-weight: 650; display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.card p { color: var(--muted); font-size: 14px; }
.card p + p { margin-top: var(--s-2); }

/* ---------- כותרות מקטע ---------- */
.sec-title {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: 13px; font-weight: 650; color: var(--muted); margin: var(--s-6) 0 var(--s-3);
}
.sec-title .spacer { flex: 1; }
.sec-title .link { color: var(--accent); font-weight: 600; background: none; border: 0; cursor: pointer; font: inherit; font-size: 13px; padding: 6px 4px; }

/* ---------- ריאיון ---------- */
.progress-track { height: 4px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; margin-bottom: var(--s-5); }
.progress-track i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: var(--r-pill); transition: width .4s var(--ease); }
.step-badge {
  display: inline-flex; align-items: center; gap: var(--s-1); font-size: 12.5px; font-weight: 600;
  color: var(--accent); background: var(--accent-wash); border: 1px solid var(--accent-line);
  padding: 4px var(--s-3); border-radius: var(--r-pill); margin-bottom: var(--s-4);
}

/* ---------- צ'אט ---------- */
.chat { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }
.msg {
  max-width: 86%; padding: 12px 15px; border-radius: var(--r-lg); font-size: 15.5px;
  line-height: 1.6; animation: rise var(--dur-open) var(--ease-out); word-break: break-word;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg.agent {
  background: var(--surface); border: 1px solid var(--line);
  border-start-start-radius: 6px; align-self: flex-start;
}
.msg.user {
  background: var(--accent); color: var(--accent-ink); font-weight: 500;
  border-start-end-radius: 6px; align-self: flex-end;
}
.msg.warn { background: var(--warn-wash); border-color: transparent; color: var(--text); }
.msg .hint { color: var(--muted); font-size: 13px; margin-top: var(--s-2); font-weight: 400; }
.msg .who { font-size: 12px; color: var(--accent); font-weight: 650; margin-bottom: 3px; }
.msg.system { align-self: center; background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); font-size: 13.5px; }

.typing { display: inline-flex; gap: 5px; padding: 4px 2px; }
.typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  /* לולאת "מקליד" — מחוון מצב, לא מעבר; לכן מחוץ למגבלת ה-400ms */
  animation-name: blink; animation-duration: 1.1s; animation-iteration-count: infinite; animation-fill-mode: both;
}
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.composer {
  display: flex; gap: var(--s-2); align-items: center;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-xl);
  padding: 6px; transition: border-color var(--dur-enter) var(--ease), box-shadow var(--dur-enter) var(--ease);
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.composer input {
  flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text);
  padding: 10px 12px; font: inherit; font-size: 16px; min-height: 44px;
}
.composer input:focus { outline: none; }
.composer input::placeholder { color: var(--faint); }
.composer .btn { border-radius: calc(var(--r-xl) - 6px); }
.send-btn { width: 44px; padding: 0; }
.send-btn svg { transform: scaleX(-1); }

.choices { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-pill); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-size: 14px; font-weight: 500;
  min-height: 40px;
  transition: transform var(--dur-tap) var(--ease), border-color var(--dur-enter) var(--ease), color var(--dur-enter) var(--ease);
}
.chip:hover { border-color: var(--accent-line); color: var(--accent); }
.chip:active { transform: scale(.97); }

/* ---------- היום: כותרת ---------- */
.today-head { display: flex; align-items: center; gap: var(--s-4); margin-bottom: var(--s-4); }
.today-head .t-date { color: var(--muted); font-size: 13.5px; font-weight: 500; }
.today-head h2 { font-size: 26px; font-weight: 750; letter-spacing: -.5px; line-height: 1.2; }
.today-head .hero-text { flex: 1; min-width: 0; }

.ring { position: relative; width: 64px; height: 64px; flex: 0 0 64px; }
.ring svg { transform: rotate(-90deg); display: block; width: 64px; height: 64px; }
.ring .track { stroke: var(--surface-3); }
.ring .fill { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.ring .val .lbl { display: none; }

.stat-row { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); }
.streak-row { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); }
.streak-pill, .pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); padding: 3px 10px; border-radius: var(--r-pill); color: var(--muted);
}
.streak-pill.hot, .pill.hot { background: var(--warn-wash); border-color: transparent; color: var(--warn); }
.pill.ok { background: var(--teal-wash); border-color: transparent; color: var(--accent-2); }

/* ---------- הבא בתור ---------- */
.next-card {
  position: relative; overflow: hidden;
  background: var(--brand-soft), var(--surface); border: 1px solid var(--accent-line);
  border-radius: var(--r-xl); padding: var(--s-5); margin-bottom: var(--s-4);
}
.next-card .eyebrow { font-size: 12.5px; font-weight: 650; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.next-card .title { font-size: 19px; font-weight: 700; margin-top: 6px; line-height: 1.35; unicode-bidi: plaintext; }
.next-card .meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.next-card .count { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 650; }
.next-card.empty-next { border-color: var(--line); background: var(--surface); }

/* ---------- פעולות מהירות ---------- */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); }
.quick button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px 6px 12px; cursor: pointer; color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600;
  min-height: 84px;
  transition: border-color var(--dur-enter) var(--ease), transform var(--dur-tap) var(--ease), background var(--dur-enter) var(--ease);
}
.quick button:hover { border-color: var(--accent-line); background: var(--surface-2); }
.quick button:active { transform: scale(.97); }
.quick .qi { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-wash); color: var(--accent); }
.quick .qi.teal { background: var(--teal-wash); color: var(--accent-2); }

/* ---------- אג'נדה ---------- */
.day-label { font-size: 12.5px; font-weight: 650; color: var(--faint); margin: var(--s-4) 0 var(--s-2); }
.day-label:first-child { margin-top: 0; }
.task {
  display: flex; align-items: center; gap: var(--s-3); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px 14px; margin-bottom: var(--s-2); transition: border-color var(--dur-enter) var(--ease);
}
.task:hover { border-color: var(--line-strong); }
.task.done { opacity: .5; }
.task.done .t-text { text-decoration: line-through; }
.task .t-time {
  flex: 0 0 52px; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 650; text-align: center;
  color: var(--text); line-height: 1.25;
}
.task .t-time small { display: block; font-size: 11.5px; color: var(--faint); font-weight: 500; }
.task .bar { width: 3px; align-self: stretch; border-radius: 3px; background: var(--accent); flex: 0 0 3px; }
.task.ev .bar { background: var(--accent-2); }
.task.now { border-color: var(--accent-line); background: var(--accent-wash); }

.check {
  width: 26px; height: 26px; border-radius: 9px; border: 2px solid var(--line-strong); flex: 0 0 26px;
  display: grid; place-items: center; cursor: pointer; color: transparent; font-size: 14px;
  position: relative; transition: background var(--dur-enter) var(--ease), border-color var(--dur-enter) var(--ease);
}
/* שטח נגיעה 44x44 (WCAG 2.5.5) בלי לשנות את הגודל הנראה */
.check::after { content: ""; position: absolute; inset: -9px; }
.check:hover { border-color: var(--mint); }
.task.done .check { background: var(--mint); border-color: var(--mint); color: var(--bg); animation: pop .3s; }
@keyframes pop { 45% { transform: scale(1.25); } }
.task .t-body { flex: 1; min-width: 0; }
.t-text { font-size: 15.5px; font-weight: 500; line-height: 1.4; }
.t-when { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.t-when.soon { color: var(--warn); }
.t-del {
  opacity: .5; cursor: pointer; padding: 8px; border-radius: var(--r-sm); color: var(--muted);
  display: grid; place-items: center; min-width: 36px; min-height: 36px;
  transition: opacity var(--dur-enter) var(--ease), background var(--dur-enter) var(--ease);
}
.t-del:hover { opacity: 1; color: var(--danger); background: var(--surface-2); }

/* ---------- רצועת מעגלים ---------- */
.strip { display: flex; gap: var(--s-2); overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip .chip { flex: 0 0 auto; }
.strip .chip .n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- טקסט דו-כיווני ---------- */
.msg, .toast, .t-text, .chip, .cal-body b { unicode-bidi: plaintext; }
code, .mono, .bidi-iso { unicode-bidi: isolate; direction: ltr; }

/* ---------- נגישות: כפתורים + מיקוד מקלדת ---------- */
button.check, button.t-del { background: none; font: inherit; }
button.t-del { border: none; }
.task .t-body[role="button"] { cursor: pointer; border-radius: var(--r-sm); }
.world { cursor: pointer; }
.check:focus-visible, .t-del:focus-visible, .t-body:focus-visible, .world:focus-visible,
.btn:focus-visible, .sug:focus-visible, .chip:focus-visible, .nav-item:focus-visible,
.quick button:focus-visible, .icon-btn:focus-visible, .seg button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- מעגלים ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s-3); }
.world {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--s-4); position: relative; overflow: hidden;
  transition: border-color var(--dur-enter) var(--ease), background var(--dur-enter) var(--ease);
}
.world::before {
  content: ""; position: absolute; inset-block-start: 0; inset-inline: 0; height: 3px; background: var(--c, var(--accent)); opacity: .8;
}
.world:hover { border-color: var(--line-strong); background: var(--surface-2); }
.world .ic {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  font-size: 21px; background: var(--surface-2); margin-bottom: var(--s-3);
}
.world h3 { font-size: 15.5px; font-weight: 650; }
.world p { color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.45; }
.world .meta { display: flex; gap: 6px; margin-top: var(--s-3); flex-wrap: wrap; }

/* ---------- המלצות ---------- */
.sug {
  display: flex; align-items: center; gap: var(--s-3); border: 1px dashed var(--line-strong);
  border-radius: var(--r-md); padding: 12px 14px; margin-bottom: var(--s-2); background: transparent;
}
.sug.solid { border-style: solid; background: var(--surface); }
.sug .ic { font-size: 22px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); flex: 0 0 40px; color: var(--accent); }
.sug .b { flex: 1; min-width: 0; }
.sug .b b { font-size: 14.5px; font-weight: 650; }
.sug .b small { display: block; color: var(--muted); font-size: 13px; margin-top: 1px; }

/* ---------- מצב ריק שמלמד ---------- */
.empty {
  text-align: center; padding: 26px 20px; border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg); color: var(--muted); font-size: 14px; line-height: 1.6;
}
.empty .big { font-size: 30px; display: block; margin-bottom: 8px; }
.empty b { color: var(--text); display: block; margin-bottom: 4px; font-size: 15.5px; }

/* ---------- ראש מסך ---------- */
.world-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-5); }
.world-head .ic {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: 0 0 52px;
  font-size: 26px; background: var(--surface-2); border: 1px solid var(--line); color: var(--accent);
}
.world-head h2 { font-size: 23px; font-weight: 750; letter-spacing: -.3px; line-height: 1.25; }
.world-head p { color: var(--muted); font-size: 14px; }
.back { margin-bottom: var(--s-3); margin-inline-start: -8px; }

/* ---------- ניווט: תחתון במובייל, מסילה בצד במחשב ---------- */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: var(--glass); backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--line);
  padding: 6px var(--s-3) calc(6px + env(safe-area-inset-bottom));
}
.nav-inner { max-width: 640px; margin: 0 auto; display: flex; gap: var(--s-1); }
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px var(--s-1); border-radius: var(--r-md); cursor: pointer; color: var(--muted);
  font-size: 11.5px; font-weight: 600; border: none; background: none; font-family: inherit;
  min-height: 52px; position: relative;
  transition: color var(--dur-enter) var(--ease);
}
.nav-item .ni {
  display: grid; place-items: center; width: 54px; height: 30px; border-radius: var(--r-pill);
  transition: background var(--dur-enter) var(--ease), transform var(--dur-tap) var(--ease);
}
.nav-item:hover { color: var(--text); }
/* מחוון אקטיבי כגלולה סביב האייקון */
.nav-item.active { color: var(--text); }
.nav-item.active .ni { background: var(--accent-wash); color: var(--accent); }
.nav-item:active .ni { transform: scale(.92); }
.nav-item .dot {
  position: absolute; inset-block-start: 6px; inset-inline-end: calc(50% - 22px);
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg);
}

@media (min-width: 1000px) {
  .nav {
    top: 0; bottom: 0; right: 0; left: auto; width: var(--rail-w);
    border-top: 0; border-inline-end: 0; border-inline-start: 1px solid var(--line);
    padding: var(--s-6) var(--s-2);
  }
  .nav-inner { flex-direction: column; gap: var(--s-2); max-width: none; }
  .nav-item { flex: 0 0 auto; min-height: 64px; }
  /* התוכן מתמרכז ברוחב שנשאר אחרי המסילה — וגם הדוק, כדי שיעמדו באותו ציר */
  body.has-nav { padding-inline-start: var(--rail-w); }
  body.has-nav #app { max-width: 760px; padding-bottom: 140px; }
  body.has-nav .dock { inset-inline-start: var(--rail-w); bottom: 0; }
  body.has-nav .dock-inner { max-width: 712px; }
}

/* ---------- דוק: שאל את העוזר ---------- */
.dock {
  position: fixed; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); left: 0; right: 0; z-index: 55;
  padding: 10px 16px 12px;
  background: linear-gradient(to top, var(--bg) 55%, transparent);
}
.dock-inner { max-width: 592px; margin: 0 auto; }

/* ---------- טוסט: לכל היותר שלושה, נסגרים ביד ---------- */
#toasts {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 999;
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; gap: var(--s-3); align-items: flex-start;
  width: 100%; max-width: 440px;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-inline-start: 3px solid var(--accent);
  border-radius: var(--r-md); padding: 12px 12px 12px 14px; font-size: 14px; line-height: 1.5; color: var(--muted);
  box-shadow: var(--shadow); animation: toastIn .3s var(--ease-out);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast .tb { flex: 1; min-width: 0; white-space: pre-line; }
.toast b { display: block; color: var(--text); margin-bottom: 1px; font-size: 14.5px; font-weight: 650; }
.toast .x { background: none; border: 0; color: var(--faint); cursor: pointer; padding: 4px; border-radius: 8px; display: grid; place-items: center; }
.toast .x:hover { color: var(--text); background: var(--surface-3); }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } }

/* ---------- קונפטי ---------- */
.confetti {
  position: fixed; top: -14px; width: 8px; height: 12px; z-index: 1000;
  pointer-events: none; border-radius: 2px; animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(106vh) rotate(600deg); opacity: 0; } }

/* ---------- טפסים ---------- */
.row { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-3); align-items: center; }
input[type="text"], input[type="number"], input[type="password"], input[type="email"],
input[type="search"], input[type="tel"], input[type="url"], input[type="date"], input[type="time"], select {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 13px; border-radius: var(--r-sm); font: inherit; font-size: 15px; min-height: 44px;
  transition: border-color var(--dur-enter) var(--ease), box-shadow var(--dur-enter) var(--ease);
}
input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus,
input[type="email"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="url"]:focus,
input[type="date"]:focus, input[type="time"]:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring);
}
.field { display: flex; flex-direction: column; gap: 6px; margin-top: var(--s-3); }
.field label, .field .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select { width: 100%; }
.field .pill { align-self: flex-start; }
.field-row { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.field-row .field { flex: 1 1 130px; min-width: 0; }

/* בורר מקטעים */
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; gap: 3px; }
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 600;
  border-radius: calc(var(--r-md) - 3px); min-height: 38px; cursor: pointer; padding: 4px 6px;
  transition: background var(--dur-enter) var(--ease), color var(--dur-enter) var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

.badge {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 650; padding: 2px 9px; border-radius: var(--r-pill);
  background: var(--accent-wash); color: var(--accent); border: 1px solid transparent;
}
.badge.ok { background: var(--teal-wash); color: var(--accent-2); }
.badge.off { background: var(--surface-2); color: var(--muted); }
.hidden { display: none !important; }
.kv { display: flex; gap: var(--s-2); font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kv:last-of-type { border-bottom: 0; }
.kv b { color: var(--muted); font-weight: 600; min-width: 76px; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

/* ---------- הגדרות: קבוצות מתקפלות ---------- */
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: var(--s-3); overflow: hidden; }
.group > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-5); font-weight: 650; font-size: 15.5px; min-height: 60px;
}
.group > summary::-webkit-details-marker { display: none; }
.group > summary small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.group > summary .chev { margin-inline-start: auto; color: var(--faint); transition: transform var(--dur-enter) var(--ease); }
.group[open] > summary .chev { transform: rotate(180deg); }
.group > summary .gi { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-wash); color: var(--accent); flex: 0 0 36px; }
.group .card { border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0; background: transparent; }

/* ---------- מסך פתיחה ---------- */
.splash { text-align: center; padding: 28px 0 10px; }
.splash-logo {
  width: 84px; height: 84px; border-radius: 28px; margin: 0 auto 24px;
  background: var(--brand); display: grid; place-items: center; color: #fff;
  box-shadow: 0 20px 50px rgba(108, 140, 255, .35); animation: rise .4s var(--ease-out);
}
.splash-logo svg { width: 44px; height: 44px; }
.splash h2 { font-size: 32px; font-weight: 800; letter-spacing: -.8px; line-height: 1.2; margin-bottom: 12px; }
.splash h2 em { font-style: normal; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.splash-sub { color: var(--muted); font-size: 16px; line-height: 1.6; margin-bottom: 24px; }
.splash .btn.big { margin-bottom: 8px; }
.props { display: grid; grid-template-columns: 1fr; gap: var(--s-2); margin: var(--s-6) 0 var(--s-4); text-align: start; }
.prop {
  display: flex; align-items: center; gap: var(--s-3); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px;
}
.prop .pi { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-wash); color: var(--accent); flex: 0 0 40px; }
.prop b { font-size: 14.5px; display: block; font-weight: 650; }
.prop small { color: var(--muted); font-size: 13px; display: block; }
@media (min-width: 560px) { .props { grid-template-columns: 1fr 1fr; } }
@media (max-height: 640px) {
  .splash-logo { width: 60px; height: 60px; margin-bottom: 14px; }
  .splash h2 { font-size: 25px; }
}

/* ---------- יחד: מציאת זמן משותף ---------- */
.steps { counter-reset: step; }
.step-card { position: relative; padding-inline-start: 56px; }
.step-card::before {
  counter-increment: step; content: counter(step);
  position: absolute; inset-inline-start: 18px; inset-block-start: 20px;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-wash); color: var(--accent); font-weight: 700; font-size: 13.5px;
}
.slot {
  display: flex; align-items: center; gap: var(--s-3); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: var(--s-2);
}
.slot .sd { flex: 0 0 52px; text-align: center; line-height: 1.2; }
.slot .sd b { display: block; font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }
.slot .sd small { font-size: 12px; color: var(--muted); }
.slot .sb { flex: 1; min-width: 0; }
.slot .sb b { font-size: 15.5px; font-variant-numeric: tabular-nums; }
.slot .sb small { display: block; color: var(--accent-2); font-size: 13px; font-weight: 600; }
.slot.chosen { border-color: var(--accent-line); background: var(--accent-wash); }
.status-line { display: flex; gap: var(--s-2); align-items: flex-start; font-size: 13.5px; color: var(--muted); margin-top: var(--s-3); }

/* ---------- חיבור לשרת ונסיעות ---------- */
.tr-results { margin-top: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); text-align: start; }
.tr-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px 14px;
}
.tr-row .tr-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tr-row .tr-name { font-weight: 650; }
.tr-row .tr-sub { font-size: 13px; color: var(--muted); }
.tr-row .tr-price {
  font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap;
  background: var(--accent-wash); color: var(--accent); padding: 4px 11px; border-radius: var(--r-pill); font-size: 13px;
}
.tr-row .tr-price.unknown { background: var(--surface-3); color: var(--muted); font-weight: 600; }
.tr-note { font-size: 13px; color: var(--muted); padding: 4px 2px; text-align: start; }

/* ---------- כרטיס המוח ---------- */
.brain-status { margin-top: var(--s-2); min-height: 20px; font-size: 14px; }
.brain-status.ok { color: var(--ok); }
.brain-status.err { color: var(--danger); }
.fine {
  margin-top: var(--s-3); font-size: 13px; line-height: 1.6; color: var(--muted);
  border-inline-start: 2px solid var(--line-strong); padding-inline-start: 10px;
}

/* ---------- מסך העוזר: צ'אט במסך מלא ---------- */
#agent-view { display: flex; flex-direction: column; min-height: calc(100vh - 200px); }
#agent-view .chat { flex: 1; margin-bottom: var(--s-2); }
.agent-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.agent-head .av { width: 44px; height: 44px; border-radius: 15px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: 0 0 44px; }
.agent-head h2 { font-size: 18px; font-weight: 700; line-height: 1.25; }
.agent-head .sub { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.agent-head .sub::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.agent-head .sub.on::before { background: var(--ok); }
.agent-compose {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); z-index: 5;
  padding-top: var(--s-2); background: linear-gradient(to top, var(--bg) 70%, transparent);
}
@media (min-width: 1000px) { .agent-compose { bottom: 16px; } }

.cal-list { display: flex; flex-direction: column; gap: var(--s-2); }
.cal-item {
  display: flex; gap: var(--s-3); align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px;
}
.cal-item.now { border-color: var(--accent-line); background: var(--accent-wash); }
.cal-when { flex: 0 0 64px; text-align: center; border-inline-end: 1px solid var(--line); padding-inline-end: var(--s-3); }
.cal-when b { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.cal-when span { display: block; font-size: 15px; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-body { flex: 1; min-width: 0; }
.cal-body b { font-size: 15px; font-weight: 600; word-break: break-word; }
.cal-body small { display: block; color: var(--muted); font-size: 12.5px; }
.cal-body .cal-rep { color: var(--violet); }
.cal-empty { text-align: center; padding: 24px 18px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }
.cal-empty-ic { font-size: 30px; margin-bottom: 8px; }
.cal-empty b { display: block; font-size: 15.5px; margin-bottom: 4px; }
.cal-empty p { color: var(--muted); font-size: 14px; line-height: 1.55; max-width: 40ch; margin: 0 auto; }

/* ---------- שער אישור: גיליון תחתון ---------- */
.approve {
  position: fixed; inset: 0; z-index: 900;
  background: var(--scrim); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center; padding: 12px;
  animation: fadeIn .2s var(--ease-out);
}
@keyframes fadeIn { from { opacity: 0; } }
.approve-card {
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-xl); padding: var(--s-6); max-width: 460px; width: 100%;
  box-shadow: var(--shadow); animation: sheetUp .26s var(--ease-out);
  margin-bottom: env(safe-area-inset-bottom);
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 600px) { .approve { align-items: center; } }
.approve-card .ap-ic { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--accent-wash); color: var(--accent); margin-bottom: var(--s-3); }
.approve-card .ap-ic.money { background: var(--warn-wash); color: var(--warn); }
.approve-card h3 { font-size: 19px; font-weight: 750; margin-bottom: var(--s-3); }
.approve-detail {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 4px 14px; font-family: inherit; font-size: 14.5px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; color: var(--text); margin-bottom: var(--s-3);
}
.approve-detail .ar { display: flex; gap: var(--s-3); padding: 9px 0; border-bottom: 1px solid var(--line); }
.approve-detail .ar:last-child { border-bottom: 0; }
.approve-detail .ar b { color: var(--muted); font-weight: 500; min-width: 64px; }
.approve-detail .ar span { flex: 1; unicode-bidi: plaintext; }
.approve-note { color: var(--muted); font-size: 13px; margin-bottom: var(--s-4); display: flex; gap: 6px; align-items: flex-start; }
.approve-actions { display: flex; gap: var(--s-2); }
.approve-actions .btn { flex: 1; min-height: 50px; }

/* ---------- רספונסיבי ---------- */
@media (min-width: 560px) {
  #app { padding-top: var(--s-6); padding-inline: var(--s-6); }
}
@media (max-width: 380px) {
  .quick { grid-template-columns: repeat(2, 1fr); }
  .today-head h2 { font-size: 22px; }
}

/* טקסט לקוראי מסך בלבד */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* קישור דילוג: מוסתר עד שמגיעים אליו במקלדת */
.skip-link {
  position: absolute; inset-block-start: -60px; inset-inline-start: 12px; z-index: 1000;
  background: var(--surface-2); color: var(--text); border: 2px solid var(--accent);
  padding: 10px 16px; border-radius: var(--r-sm); font-weight: 700; text-decoration: none;
  transition: inset-block-start .15s;
}
.skip-link:focus { inset-block-start: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .typing i { animation: none; opacity: .6; }
}
