/* =========================================================
   נוכחות ושכר — עיצוב
   תמיכה במצב בהיר/כהה: אוטומטי + מתג ידני (data-theme)
   ========================================================= */

/* ---------- בהיר (ברירת מחדל) ---------- */
:root {
  --bg: #eef1f8;
  --bg-grad-1: #eef1f8;
  --bg-grad-2: #e3e8f7;
  --card: #ffffff;
  --card-2: #f6f8fd;
  --text: #131722;
  --muted: #6b7384;
  --primary: #4f7cff;
  --primary-2: #7c5cff;
  --primary-press: #3d63e6;
  --on-primary: #ffffff;
  --danger: #e5484d;
  --success: #18a957;
  --border: #e7eaf1;
  --shadow: 0 6px 20px rgba(31, 45, 80, 0.08);
  --shadow-sm: 0 2px 8px rgba(31, 45, 80, 0.06);
  --radius: 18px;
  --tabbar-h: 66px;
  --header-h: 54px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* ניווט זכוכית צף */
  --nav-bg: rgba(255, 255, 255, 0.5);
  --nav-border: rgba(255, 255, 255, 0.55);
  --nav-shadow: 0 12px 32px rgba(31, 45, 80, 0.18), inset 0 1.5px 1.5px rgba(255, 255, 255, 0.85), inset 0 -10px 18px rgba(255, 255, 255, 0.1);
  --nav-active-bg: rgba(255, 255, 255, 0.7);
  --nav-active-shadow: inset 0 1.5px 1px rgba(255, 255, 255, 0.9), inset 0 -1px 2px rgba(0, 0, 0, 0.04), 0 3px 8px rgba(31, 45, 80, 0.14);
  --top-color: #eef1f8;
}

/* ---------- כהה (אוטומטי לפי מערכת) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0d14;
    --bg-grad-1: #0c1019;
    --bg-grad-2: #0a0d14;
    --card: #161b26;
    --card-2: #1d2330;
    --text: #eef1f6;
    --muted: #98a2b3;
    --primary: #6a8dff;
    --primary-2: #9a7bff;
    --primary-press: #5577f0;
    --border: #262d3b;
    --shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
    --nav-bg: rgba(20, 25, 35, 0.5);
    --nav-border: rgba(255, 255, 255, 0.14);
    --nav-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), inset 0 1.5px 1.5px rgba(255, 255, 255, 0.16);
    --nav-active-bg: rgba(255, 255, 255, 0.16);
    --nav-active-shadow: inset 0 1.5px 1px rgba(255, 255, 255, 0.3), 0 2px 6px rgba(0, 0, 0, 0.4);
    --top-color: #0c1019;
  }
}

/* ---------- כהה (מתג ידני) ---------- */
:root[data-theme="dark"] {
  --bg: #0a0d14;
  --bg-grad-1: #0c1019;
  --bg-grad-2: #0a0d14;
  --card: #161b26;
  --card-2: #1d2330;
  --text: #eef1f6;
  --muted: #98a2b3;
  --primary: #6a8dff;
  --primary-2: #9a7bff;
  --primary-press: #5577f0;
  --border: #262d3b;
  --shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
  --nav-bg: rgba(20, 25, 35, 0.5);
  --nav-border: rgba(255, 255, 255, 0.14);
  --nav-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), inset 0 1.5px 1.5px rgba(255, 255, 255, 0.16);
  --nav-active-bg: rgba(255, 255, 255, 0.16);
  --nav-active-shadow: inset 0 1.5px 1px rgba(255, 255, 255, 0.3), 0 2px 6px rgba(0, 0, 0, 0.4);
  --top-color: #0c1019;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", "Segoe UI", "Rubik", "Heebo", Arial, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
/* בדיוק כמו Life OS שעובד: html במלוא הגובה עם רקע אחיד — ממלא את כל המסך
   כולל אזור ה-safe-area התחתון, כך שאין "פס" בהיר בתחתית. */
html { background: var(--bg); height: 100%; }
/* דפוס app-shell שעובד: גוף בגובה 100dvh עם overflow:hidden, גלילה רק באזור הפנימי */
body {
  height: 100dvh;
  overflow: hidden;          /* בלי גלילת חלון → פס הניווט נשאר מקובע */
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg);
  transition: background .3s ease, color .3s ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* טקסט ניתן לבחירה רק בשדות קלט — שאר הממשק בהרגשת אפליקציה */
input, textarea { -webkit-user-select: text; user-select: text; }

/* ===== Header ===== */
.app-header {
  flex: 0 0 auto;
  z-index: 10;
  height: calc(var(--header-h) + var(--safe-top));
  padding: var(--safe-top) 16px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-bottom: none;
}
.app-header h1 {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.2px;
}
.theme-toggle {
  position: absolute;
  inset-inline-start: 12px;
  top: calc(var(--safe-top) + (var(--header-h) - 36px) / 2);
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-2);
  font-size: 18px;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
}
.theme-toggle:active { transform: scale(0.9) rotate(-12deg); }

/* ===== Main / tabs ===== */
#app {
  flex: 1 1 auto;
  min-height: 0;             /* קריטי: גלילה פנימית בתוך flex */
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;        /* מונע חריגה אופקית */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 96px);
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#app::-webkit-scrollbar { width: 0; height: 0; display: none; }
.tab { display: flex; flex-direction: column; gap: 14px; }
.tab:not(.hidden) { animation: tabIn .32s cubic-bezier(.22,.61,.36,1); }
.hidden { display: none !important; }

@keyframes tabIn {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to   { opacity: 1; transform: none; }
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}
.card h2 { margin: 0 0 14px; font-size: 16px; font-weight: 800; letter-spacing: -0.2px; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 6px 4px -2px;
}
.section-head h2 { font-size: 15px; margin: 0; font-weight: 800; }
.sh-left { display: flex; align-items: center; gap: 8px; }
.hours-pill {
  font-size: 12px; font-weight: 800; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 13%, transparent);
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.hours-pill:empty { display: none; }

.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }

/* ===== Shift card ===== */
.shift-card {
  text-align: center;
  display: flex; flex-direction: column; gap: 16px;
  position: relative;
  overflow: hidden;
}
.shift-card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(420px 180px at 50% 0%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 70%);
  pointer-events: none;
}
.shift-status {
  font-size: 14px; color: var(--muted); font-weight: 700;
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
}
.shift-status::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted); transition: background .3s;
}
.shift-status.active { color: var(--success); }
.shift-status.active::before {
  background: var(--success);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent);
  animation: livePulse 1.6s infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.timer {
  font-size: 50px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.earned {
  font-size: 15px; font-weight: 800;
  color: var(--success);
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
  min-height: 19px;
  margin-top: -6px;
}
.shift-hint {
  font-size: 13px; font-weight: 700; color: #b7791f;
  background: color-mix(in srgb, #f0b429 18%, transparent);
  border: 1px solid color-mix(in srgb, #f0b429 45%, transparent);
  border-radius: 10px; padding: 8px 12px;
}
.shift-card.running {
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--success) 22%, transparent), 0 10px 34px color-mix(in srgb, var(--success) 16%, transparent);
}
.shift-card.running .timer { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe {
  0%,100% { opacity: 1; }
  50% { opacity: .82; }
}

/* ===== Buttons ===== */
.btn {
  position: relative;
  display: block; width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card-2);
  color: var(--text);
  font-size: 16px; font-weight: 700;
  cursor: pointer; margin-top: 10px;
  transition: transform .08s ease, box-shadow .2s ease, filter .2s ease, background .2s ease;
}
.btn:first-child { margin-top: 0; }
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: var(--on-primary); border-color: transparent;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 38%, transparent);
}
.btn-primary:active { filter: brightness(.96); }
.btn-lg { padding: 19px; font-size: 18px; border-radius: 16px; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 8%, var(--card-2)); }
.btn.stop {
  background: linear-gradient(135deg, #ff6b6b, var(--danger));
  color: #fff; border-color: transparent;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--danger) 34%, transparent);
}

/* ===== Forms ===== */
.quick-form { display: flex; flex-direction: column; gap: 10px; }
input, select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--card-2);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}
/* תיקון iOS: שדות תאריך/חודש/שעה לא חורגים ולא נדחסים */
input[type="date"], input[type="month"], input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  text-align: start;
  line-height: 1.2;
  min-height: 48px;
  min-width: 0;
}
input[type="date"]::-webkit-date-and-time-value,
input[type="month"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
  text-align: start;
  margin: 0;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  margin-inline-start: auto;
  opacity: .6;
}

.settings-form { display: flex; flex-direction: column; gap: 12px; }
.set-section {
  font-size: 12px; font-weight: 800; color: var(--primary);
  letter-spacing: .3px; margin: 8px 2px -2px;
  text-transform: none;
}
.set-section:first-child { margin-top: 0; }
.backup-info { font-size: 13px; color: var(--muted); margin: -2px 2px 12px; font-weight: 600; }
.backup-info.warn { color: #b7791f; font-weight: 800; }
.settings-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 700; }
.month-picker-card { display: flex; flex-direction: column; gap: 8px; }
.month-picker-card label { font-size: 14px; color: var(--muted); font-weight: 700; }

/* ===== Lists ===== */
.list { display: flex; flex-direction: column; gap: 9px; }
.list-item {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  animation: itemIn .3s ease backwards;
}
.li-fg {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  touch-action: pan-y;
  transition: transform .25s cubic-bezier(.22,.61,.36,1);
}
.li-swipe-bg {
  position: absolute; inset: 0;
  background: var(--danger);
}
.li-swipe-bg svg { position: absolute; top: 50%; right: 22px; transform: translateY(-50%); color: #fff; }
.list-item.will-delete .li-swipe-bg svg { animation: pop .3s ease; }

/* פריט פשוט (משמרות) — בלי סוייפ, לחיצה לעריכה */
.list-item.plain {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--border);
  padding: 12px 14px; cursor: pointer;
  transition: transform .12s ease, background .2s ease;
}
.list-item.plain:active { transform: scale(0.985); background: var(--card-2); }
.li-chev { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; opacity: .55; }
.list-item:nth-child(1) { animation-delay: .02s; }
.list-item:nth-child(2) { animation-delay: .05s; }
.list-item:nth-child(3) { animation-delay: .08s; }
.list-item:nth-child(4) { animation-delay: .11s; }
.list-item:nth-child(5) { animation-delay: .14s; }
@keyframes itemIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.list-item .li-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.list-item .li-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; }
.list-item .li-sub { font-size: 12px; color: var(--muted); }
.list-item .li-amt { font-weight: 800; white-space: nowrap; color: var(--primary); }
.empty { text-align: center; color: var(--muted); padding: 22px; font-size: 14px; }
.empty-state {
  text-align: center; padding: 34px 16px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  animation: itemIn .4s ease;
}
.empty-state svg { width: 46px; height: 46px; opacity: .45; margin-bottom: 2px; }
.es-title { font-weight: 800; font-size: 15px; color: var(--text); }
.es-sub { font-size: 13px; }
.day-banner { text-align: center; font-size: 13px; color: var(--muted); font-weight: 700; margin: -2px 0 0; }

.tag {
  display: inline-block; font-size: 11px; font-weight: 800;
  padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary);
  margin-inline-start: 7px;
}

/* ===== Summary ===== */
.total-card {
  text-align: center; border: none; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 14px 34px color-mix(in srgb, var(--primary) 40%, transparent);
  position: relative; overflow: hidden;
}
.total-card::after {
  content: ""; position: absolute; top: -40%; inset-inline-end: -10%;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.14);
}
.total-card { position: relative; }
/* אייקון לוח-שנה קטן בפינה — שכבת input שקופה מעליו פותחת את הבורר */
.cal-wrap {
  position: absolute; top: 14px; inset-inline-start: 14px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  z-index: 2;
}
.cal-wrap svg { width: 19px; height: 19px; color: #fff; }
.share-wrap {
  position: absolute; top: 14px; inset-inline-end: 14px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff; cursor: pointer; z-index: 2;
  transition: transform .12s ease;
}
.share-wrap svg { width: 19px; height: 19px; }
.share-wrap:active { transform: scale(0.9); }
.cal-wrap .cal-input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  min-height: 0; padding: 0; margin: 0;
  opacity: 0; border: none; background: transparent;
  -webkit-appearance: none; appearance: none;
  cursor: pointer; color-scheme: dark;
}
.total-month {
  position: relative; z-index: 1;
  font-size: 15px; font-weight: 800; opacity: .96;
  margin-bottom: 4px;
}
.total-label { font-size: 14px; opacity: .92; font-weight: 700; }
.total-amount { font-size: 44px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
/* יעד חודשי — פס התקדמות בתוך כרטיס הסה״כ */
.goal-wrap { margin-top: 14px; position: relative; z-index: 1; }
.goal-bar { height: 8px; border-radius: 999px; background: rgba(0,0,0,0.22); overflow: hidden; }
.goal-fill { height: 100%; border-radius: 999px; background: #fff; width: 0%; transition: width .6s cubic-bezier(.22,.61,.36,1); }
.goal-text { font-size: 12px; font-weight: 700; opacity: .95; margin-top: 7px; }

/* כפתורי הוספה מהירה במסך המשמרת */
.quick-add { display: flex; gap: 10px; }
.qa-btn {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--card); border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 16px; padding: 12px 8px; box-shadow: var(--shadow-sm);
  font-family: inherit; color: var(--text); cursor: pointer;
  transition: transform .08s ease, background .2s ease;
}
.qa-btn:active { transform: scale(0.95); background: var(--card-2); }
.qa-ico {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  border-radius: 13px; color: var(--primary); margin-bottom: 3px;
}
.qa-ico svg { width: 23px; height: 23px; }
.qa-num {
  font-size: 19px; font-weight: 800; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1.2;
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  height: 23px; display: flex; align-items: center; justify-content: center;
}
.qa-label { font-size: 12px; color: var(--muted); font-weight: 700; }

/* מקלדת סכום (אביזרים) */
.ap-display { font-size: 42px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; margin: 2px 0; color: var(--primary); }
.ap-sub { text-align: center; font-size: 12px; margin-bottom: 16px; }
.ap-keys { gap: 12px; }
.ap-keys .key { height: 56px; font-size: 22px; }

/* צ'יפים סטטיסטיים בסיכום */
.stats-row { display: flex; gap: 10px; }
.stat-chip {
  flex: 1; min-width: 0; background: var(--card); border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 14px; padding: 12px 8px; box-shadow: var(--shadow-sm); text-align: center;
}
.sc-val { display: block; font-size: 18px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.sc-lbl { display: block; font-size: 11px; color: var(--muted); font-weight: 700; margin-top: 3px; }

/* גרף דונאט */
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut { width: 132px; height: 132px; border-radius: 50%; flex-shrink: 0; position: relative; }
.donut::after { content: ""; position: absolute; inset: 26px; border-radius: 50%; background: var(--card); }
.legend { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lg-item { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.lg-dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.lg-label { flex: 1; }
.lg-val { color: var(--muted); font-variant-numeric: tabular-nums; }

/* תובנות */
#insights { display: flex; flex-direction: column; gap: 12px; }
.insight { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 600; line-height: 1.45; color: var(--text); animation: itemIn .4s ease backwards; }
.insight .ins-ico { font-size: 18px; flex-shrink: 0; line-height: 1.4; }
.insight:nth-child(1) { animation-delay: .04s; }
.insight:nth-child(2) { animation-delay: .11s; }
.insight:nth-child(3) { animation-delay: .18s; }
.insight:nth-child(4) { animation-delay: .25s; }

/* אנימציית "פופ" משמחת לערכים שמתעדכנים */
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.32); } 100% { transform: scale(1); } }
.pop { animation: pop .4s cubic-bezier(.34, 1.56, .64, 1); }

/* תגובת לחיצה קופצנית לכל הכפתורים והאלמנטים הלחיצים */
.btn, .qa-btn, .keypad .key, .nav-arrow, .share-wrap, .cal-wrap, .theme-toggle,
.tab-btn, .link-btn, .av-opt {
  transition: transform .14s cubic-bezier(.34, 1.56, .64, 1), background .2s ease, box-shadow .2s ease, filter .2s ease, color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.li-fg { cursor: pointer; }
.cal-wrap:active { transform: scale(0.9); }
.btn:active { transform: scale(0.96); }
.btn-lg:active { transform: scale(0.97); }

.brk-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 10px; }
.brk-row:last-child { border-bottom: none; padding-bottom: 2px; }
.brk-row:last-child .brk-label, .brk-row:last-child .brk-amt { font-size: 18px; font-weight: 800; }
.brk-row > div:first-child { min-width: 0; }
.brk-row .brk-label { font-weight: 700; }
.brk-row .brk-detail { font-size: 12px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.brk-row .brk-amt { font-weight: 800; white-space: nowrap; }

/* ===== Tabbar — גלולת זכוכית צפה (Liquid Glass) ===== */
.tabbar {
  position: fixed;
  left: 0; right: 0; margin: 0 auto;
  bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) - 12px));
  width: min(372px, calc(100vw - 52px));
  display: flex; gap: 4px; padding: 7px;
  background: var(--nav-bg);
  backdrop-filter: blur(22px) saturate(185%) brightness(1.05);
  -webkit-backdrop-filter: blur(22px) saturate(185%) brightness(1.05);
  border: 1px solid var(--nav-border);
  border-radius: 26px;
  box-shadow: var(--nav-shadow);
  z-index: 40;
}
.tab-btn {
  flex: 1; background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-family: inherit; cursor: pointer;
  padding: 7px 0 5px; border-radius: 18px;
  transition: background .22s ease, box-shadow .22s ease, color .2s ease;
}
.tab-btn:active { opacity: .65; }
.tab-btn:active .nav-icon { transform: scale(0.9); }
.nav-icon { height: 23px; display: flex; align-items: center; justify-content: center; transition: transform .18s ease; }
.nav-icon svg { width: 22px; height: 22px; color: var(--muted); transition: color .2s; }
.nav-label { font-size: 9.5px; font-weight: 600; color: var(--muted); transition: color .15s; }
.tab-btn.active {
  background: var(--nav-active-bg);
  box-shadow: var(--nav-active-shadow);
}
.tab-btn.active .nav-icon svg { color: var(--primary); }
.tab-btn.active .nav-icon { transform: scale(1.06); }
.tab-btn.active .nav-label { color: var(--primary); font-weight: 800; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 30px);
  left: 50%;
  background: var(--text); color: var(--card);
  padding: 12px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 700; z-index: 50;
  box-shadow: var(--shadow);
  display: inline-flex; align-items: center; gap: 14px;
  transform: translateX(-50%) translateY(0);
  transition: opacity .3s ease, transform .3s ease;
  white-space: nowrap;
}
.toast-undo {
  background: none; border: none; cursor: pointer; font-family: inherit;
  color: #6aa3ff; font-weight: 800; font-size: 14px; padding: 0;
}
.toast.hidden { opacity: 0; transform: translateX(-50%) translateY(16px); pointer-events: none; }

/* ===== כפתורי טקסט / חצים ===== */
.link-btn {
  background: none; border: none; cursor: pointer;
  color: var(--primary); font-weight: 800; font-size: 14px; font-family: inherit;
  padding: 4px 6px; border-radius: 8px;
}
.link-btn:active { opacity: .6; }
.month-sub { margin: -6px 4px 2px; }

/* ===== טופס בתוך גיליון ===== */
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 12px; }
.row2 { display: flex; gap: 10px; }
.row2 .fld { flex: 1 1 0; min-width: 0; }
.row2 .fld input { width: 100%; box-sizing: border-box; }

/* ===== Bottom sheet modal ===== */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); animation: fadeBg .25s ease; }
@keyframes fadeBg { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: relative;
  width: 100%; max-width: 640px;
  background: var(--card);
  border-radius: 26px 26px 0 0;
  padding: 12px 18px calc(18px + var(--safe-bottom));
  box-shadow: 0 -10px 40px rgba(0,0,0,.25);
  animation: sheetUp .32s cubic-bezier(.22,.61,.36,1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-handle { width: 42px; height: 5px; border-radius: 999px; background: var(--border); margin: 2px auto 14px; }
.sheet h2 { margin: 0 0 16px; font-size: 18px; font-weight: 800; text-align: center; }
.sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
.sheet-actions .btn { margin-top: 0; }

/* ===== סקירה שנתית + גרף ===== */
.year-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.year-head h2 { margin: 0; font-size: 17px; font-weight: 800; }
.nav-arrow {
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--card-2); color: var(--text);
  font-size: 22px; line-height: 1; cursor: pointer; font-family: inherit;
  display: grid; place-items: center; transition: transform .12s ease, background .2s;
}
.nav-arrow:active { transform: scale(.9); }
.year-total {
  display: inline-block; margin-bottom: 14px;
  font-size: 12px; font-weight: 800; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 13%, transparent);
  padding: 3px 11px; border-radius: 999px;
}
.chart { display: flex; align-items: flex-end; gap: 5px; height: 150px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; min-width: 0; cursor: pointer; }
.bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar {
  width: 72%; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  min-height: 0; transition: height .5s cubic-bezier(.22,.61,.36,1);
}
.bar.empty { background: var(--border); }
.bar.current { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent); filter: saturate(1.25) brightness(1.08); }
.bar-lbl { font-size: 9px; color: var(--muted); font-weight: 700; }
.bar-col.current .bar-lbl { color: var(--primary); }

/* ===== מתג בהגדרות ===== */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; font-size: 15px; color: var(--text); }
.switch-row input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--primary); }

/* ===== מסך פתיחה (Splash) ===== */
#splash {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .45s ease;
}
#splash.hide { opacity: 0; pointer-events: none; }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 16px; animation: splashPop .55s cubic-bezier(.34,1.56,.64,1); }
.splash-icon { width: 92px; height: 92px; border-radius: 22px; box-shadow: 0 12px 34px color-mix(in srgb, var(--primary) 35%, transparent); }
.splash-name { font-size: 19px; font-weight: 800; color: var(--text); letter-spacing: -.2px; }
@keyframes splashPop { from { opacity: 0; transform: scale(.86); } to { opacity: 1; transform: none; } }

/* ===== מסך נעילת קוד ===== */
.lock {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--safe-top) + 24px) 24px calc(var(--safe-bottom) + 24px);
}
.lock-inner { width: 100%; max-width: 300px; text-align: center; }
.lock-icon { font-size: 38px; }
.lock-title { font-size: 20px; font-weight: 800; margin: 12px 0 22px; }
.pin-dots { display: flex; gap: 16px; justify-content: center; margin-bottom: 12px; }
.pin-dots .dot { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--muted); transition: background .15s, border-color .15s; }
.pin-dots .dot.filled { background: var(--primary); border-color: var(--primary); }
.pin-err { color: var(--danger); font-weight: 700; font-size: 14px; min-height: 20px; margin-bottom: 10px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; direction: ltr; }
.keypad .key {
  height: 62px; border-radius: 16px;
  border: none; background: var(--card-2);
  color: var(--text); font-size: 25px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: transform .08s ease, background .15s ease;
}
.keypad .key:active { transform: scale(0.94); background: color-mix(in srgb, var(--primary) 20%, var(--card-2)); }
.keypad .key-empty { background: none; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
