/* PHONEIL - brand: clean black/white with coral accent, mobile-first RTL */

/* Heebo - modern Hebrew typeface, served locally from /fonts */
@font-face { font-family: 'Heebo'; font-weight: 400; font-display: swap; src: url('/fonts/heebo-hebrew-400-normal.woff2') format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 500; font-display: swap; src: url('/fonts/heebo-hebrew-500-normal.woff2') format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 600; font-display: swap; src: url('/fonts/heebo-hebrew-600-normal.woff2') format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 700; font-display: swap; src: url('/fonts/heebo-hebrew-700-normal.woff2') format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 800; font-display: swap; src: url('/fonts/heebo-hebrew-800-normal.woff2') format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 900; font-display: swap; src: url('/fonts/heebo-hebrew-900-normal.woff2') format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 400; font-display: swap; src: url('/fonts/heebo-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+FFFD; }
@font-face { font-family: 'Heebo'; font-weight: 500; font-display: swap; src: url('/fonts/heebo-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+FFFD; }
@font-face { font-family: 'Heebo'; font-weight: 600; font-display: swap; src: url('/fonts/heebo-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+FFFD; }
@font-face { font-family: 'Heebo'; font-weight: 700; font-display: swap; src: url('/fonts/heebo-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+FFFD; }
@font-face { font-family: 'Heebo'; font-weight: 800; font-display: swap; src: url('/fonts/heebo-latin-800-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+FFFD; }
@font-face { font-family: 'Heebo'; font-weight: 900; font-display: swap; src: url('/fonts/heebo-latin-900-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+FFFD; }

:root {
  --ink: #14151a;
  --ink-soft: #4b4e57;
  --muted: #9aa0ab;
  --line: #e8eaee;
  --bg: #f7f8fa;
  --card: #ffffff;
  --coral: #f0705a;
  --coral-soft: #fdeae6;
  --coral-dark: #d95540;
  --green: #22b573;
  --green-soft: #e3f7ed;
  --red: #e5484d;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 21, 26, .05), 0 8px 24px -12px rgba(20, 21, 26, .12);
  --nav-h: 64px;
}

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

html { font-size: 16px; }

body {
  font-family: "Heebo", "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 1rem; color: var(--ink); }

/* ---------- splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 100;
  background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px;
  transition: opacity .5s ease, visibility .5s;
}
#splash.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#splash svg { width: min(78vw, 460px); height: auto; }
#splash .logo-path {
  fill: none;
  stroke-width: 5.5;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}
#splash .slogan {
  font-weight: 800;
  font-size: clamp(.95rem, 4vw, 1.3rem);
  letter-spacing: .02em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .6s ease, transform .6s ease;
}
#splash.slogan-in .slogan { opacity: 1; transform: none; }
#splash .slogan .dash { color: var(--coral); font-weight: 900; padding: 0 .1em; }
#splash .skip-hint {
  position: absolute; bottom: 26px;
  color: var(--muted); font-size: .8rem;
  opacity: 0; animation: fadeIn .8s ease 1.6s forwards;
}

@keyframes fadeIn { to { opacity: 1; } }

/* ---------- login ---------- */
#login-view {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; gap: 34px;
  background:
    radial-gradient(1200px 500px at 50% -10%, var(--coral-soft), transparent 60%),
    var(--bg);
}
#login-view .mini-logo { width: min(70vw, 340px); }
#login-view form {
  width: 100%; max-width: 380px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px; display: flex; flex-direction: column; gap: 14px;
}
#login-view h1 { font-size: 1.15rem; font-weight: 700; text-align: center; }

/* ---------- app shell ---------- */
#app-view { display: none; }
body.logged-in #app-view { display: block; }

header.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
header.topbar .brand { height: 22px; display: block; }
header.topbar .who {
  display: flex; align-items: center; gap: 10px;
  font-size: .85rem; color: var(--ink-soft); font-weight: 600;
}
header.topbar .who .branch-chip {
  background: var(--coral-soft); color: var(--coral-dark);
  border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 700;
}

main {
  max-width: 860px; margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
}

/* bottom navigation */
nav.bottomnav {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 30;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
}
nav.bottomnav button {
  flex: 1; max-width: 110px;
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .68rem; font-weight: 700;
  transition: color .15s;
}
nav.bottomnav button svg { width: 23px; height: 23px; stroke-width: 1.9; }
nav.bottomnav button.active { color: var(--coral-dark); }
nav.bottomnav button.active svg { filter: drop-shadow(0 3px 6px rgba(240, 112, 90, .35)); }

/* ---------- generic UI ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 14px;
}
.card h2 { font-size: 1.02rem; font-weight: 800; margin-bottom: 12px; }
.card h3 { font-size: .9rem; font-weight: 700; margin: 14px 0 8px; color: var(--ink-soft); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: .82rem; font-weight: 700; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; background: #fff;
  outline: none; transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--coral); box-shadow: 0 0 0 3px rgba(240, 112, 90, .15);
}
.field input[type=number] { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.15rem; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.btn {
  border: none; border-radius: 14px; cursor: pointer;
  font-weight: 800; font-size: 1rem;
  padding: 13px 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s, box-shadow .15s, background .15s;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--ink); color: #fff;
  box-shadow: 0 8px 20px -8px rgba(20, 21, 26, .5);
}
.btn-primary:hover { background: #000; }
.btn-coral {
  background: var(--coral); color: #fff;
  box-shadow: 0 8px 20px -8px rgba(240, 112, 90, .6);
}
.btn-coral:hover { background: var(--coral-dark); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: .85rem; border-radius: 11px; }
.btn-icon {
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 6px; border-radius: 8px; line-height: 0;
}
.btn-icon:hover { color: var(--red); background: #fbeaea; }

.row-flex { display: flex; gap: 10px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.pill-tabs { display: flex; gap: 6px; background: #eef0f3; border-radius: 999px; padding: 4px; width: max-content; max-width: 100%; overflow-x: auto; }
.pill-tabs button {
  border: none; background: none; cursor: pointer;
  border-radius: 999px; padding: 8px 16px;
  font-weight: 700; font-size: .85rem; color: var(--ink-soft);
  white-space: nowrap;
}
.pill-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }

.muted { color: var(--muted); font-size: .85rem; }
.error-text { color: var(--red); font-size: .85rem; font-weight: 600; }
.hint-warn {
  background: #fff8e6; border: 1px solid #f5dfa1; color: #8a6d1a;
  border-radius: 12px; padding: 10px 14px; font-size: .85rem; font-weight: 600;
}

.empty-state { text-align: center; color: var(--muted); padding: 36px 10px; font-weight: 600; }
.empty-state .big { font-size: 2rem; margin-bottom: 8px; }

/* month picker bar */
.month-bar { display: flex; align-items: center; justify-content: center; gap: 4px; margin-bottom: 14px; }
.month-bar button {
  border: none; background: #fff; cursor: pointer; color: var(--ink-soft);
  width: 38px; height: 38px; border-radius: 12px; box-shadow: var(--shadow);
  font-size: 1.1rem; font-weight: 800;
}
.month-bar .label { font-weight: 800; font-size: 1.02rem; min-width: 140px; text-align: center; }

/* ---------- calendar ---------- */
.day-row {
  border-radius: 15px; padding: 13px 16px; margin-bottom: 9px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; position: relative;
  border: 1.5px solid transparent;
  transition: transform .12s, box-shadow .15s, border-color .15s;
  animation: rowIn .25s ease both;
}
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } }
.day-row:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.day-row .daynum {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: rgba(255, 255, 255, .65);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 900; line-height: 1.05;
}
.day-row .daynum .dow { font-size: .6rem; font-weight: 700; opacity: .75; }
.day-row .info { flex: 1; min-width: 0; }
.day-row .info .line1 { font-weight: 800; font-size: .95rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.day-row .info .line2 { font-size: .8rem; opacity: .8; font-weight: 600; margin-top: 2px; }
.day-row .profit-big { font-weight: 900; font-size: 1.12rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-row.missing { background: #f0f1f4; color: var(--muted); border: 1.5px dashed #d5d8de; }
.day-row.selected { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(20, 21, 26, .25); }
.day-row .checkmark {
  width: 24px; height: 24px; border-radius: 999px; flex-shrink: 0;
  border: 2px solid rgba(0, 0, 0, .25); background: rgba(255, 255, 255, .7);
  display: none; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 900; color: #fff;
}
body.select-mode .day-row .checkmark { display: flex; }
.day-row.selected .checkmark { background: var(--ink); border-color: var(--ink); }
.record-badge {
  background: #ffd76b; color: #6b4d00;
  font-size: .68rem; font-weight: 900; border-radius: 999px; padding: 2px 8px;
  box-shadow: 0 2px 6px rgba(255, 190, 40, .4);
}

/* selection summary bar */
#select-summary {
  position: fixed; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px);
  right: 12px; left: 12px; z-index: 40;
  max-width: 620px; margin: 0 auto;
  background: var(--ink); color: #fff;
  border-radius: 18px; padding: 13px 16px;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .5);
  opacity: 0; visibility: hidden; transform: translateY(20px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
#select-summary.show { opacity: 1; visibility: visible; transform: none; }
#select-summary .sums { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; font-weight: 700; }
#select-summary .sums b { font-size: .95rem; font-variant-numeric: tabular-nums; }
#select-summary .sums .profit b { color: #7dffc0; }

/* ---------- dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 15px 16px;
}
.stat .label { font-size: .74rem; font-weight: 800; color: var(--muted); margin-bottom: 5px; }
.stat .value { font-size: 1.35rem; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .sub { font-size: .72rem; color: var(--muted); font-weight: 600; margin-top: 3px; }
.stat.hero { border-top: 3px solid var(--coral); }
.stat.hero .value { color: var(--coral-dark); }
.stat.profit-hero { border-top: 3px solid var(--green); }
.stat.profit-hero .value { color: var(--green); }

.progress-wrap { margin: 10px 0 4px; }
.progress-head { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 800; margin-bottom: 6px; }
.progress-track { height: 14px; background: #eef0f3; border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--coral), #ffb45e);
  width: 0; transition: width .8s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 0 10px rgba(240, 112, 90, .5);
}
.progress-fill.done { background: linear-gradient(90deg, var(--green), #6fe0a8); box-shadow: 0 0 10px rgba(34, 181, 115, .5); }

.branch-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.branch-card { border: 1.5px solid var(--line); border-radius: 14px; padding: 13px; }
.branch-card .bname { font-weight: 900; margin-bottom: 8px; }
.branch-card .kv { display: flex; justify-content: space-between; font-size: .82rem; padding: 3px 0; font-weight: 600; }
.branch-card .kv .v { font-weight: 800; font-variant-numeric: tabular-nums; }

.chart-box { position: relative; height: 240px; }

/* ---------- lists / tables ---------- */
.list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 4px; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 700; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .sub { font-size: .76rem; color: var(--muted); font-weight: 600; }
.list-row .amount { font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }

.badge {
  border-radius: 999px; padding: 3px 10px; font-size: .72rem; font-weight: 800;
  background: #eef0f3; color: var(--ink-soft);
}
.badge.coral { background: var(--coral-soft); color: var(--coral-dark); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.gray { background: #eef0f3; color: var(--muted); }

/* dynamic line editors (expenses / hours) */
.line-editor { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; flex-wrap: wrap; }
.line-editor input { border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 12px; min-width: 0; }
.line-editor input:focus { border-color: var(--coral); outline: none; }
.line-editor .desc { flex: 2; }
.line-editor .num { flex: 1; width: 70px; font-weight: 700; font-variant-numeric: tabular-nums; }
.line-editor .chk-inline { display: flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.line-editor .chk-inline input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--coral); }
.line-editor .check-date { flex: 1; min-width: 130px; }

/* photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; margin-top: 10px; }
.photo-grid .ph {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  background: #eef0f3; border: 1px solid var(--line);
}
.photo-grid .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid .ph .file-chip {
  width: 100%; height: 100%; display: flex; flex-direction: column; gap: 4px;
  align-items: center; justify-content: center; font-size: .62rem; font-weight: 700;
  color: var(--ink-soft); padding: 4px; text-align: center; word-break: break-all;
}
.photo-grid .ph .rm {
  position: absolute; top: 4px; left: 4px;
  width: 22px; height: 22px; border-radius: 999px; border: none; cursor: pointer;
  background: rgba(0, 0, 0, .55); color: #fff; font-weight: 900; line-height: 0;
}

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 16, 20, .45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-back.show { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--card); width: 100%; max-width: 640px;
  border-radius: 22px 22px 0 0;
  max-height: 88dvh; overflow-y: auto;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(40px); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.modal-back.show .modal { transform: none; }
.modal .modal-handle { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }

@media (min-width: 700px) {
  .modal-back { align-items: center; padding: 20px; }
  .modal { border-radius: 22px; }
}

/* ---------- toast ---------- */
#toast {
  position: fixed; top: 14px; right: 50%; transform: translate(50%, -80px); z-index: 90;
  background: var(--ink); color: #fff;
  border-radius: 999px; padding: 11px 22px;
  font-weight: 700; font-size: .9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  max-width: 90vw; text-align: center;
}
#toast.show { transform: translate(50%, 0); }
#toast.err { background: var(--red); }
#toast.ok { background: var(--green); }

/* ---------- celebration ---------- */
#celebrate-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: none; align-items: center; justify-content: center; flex-direction: column; gap: 12px;
  background: rgba(255, 255, 255, .88); backdrop-filter: blur(4px);
  text-align: center; padding: 20px;
}
#celebrate-overlay.show { display: flex; }
#celebrate-overlay .big-emoji { font-size: 4rem; animation: pop .5s cubic-bezier(.2, .8, .2, 1); }
#celebrate-overlay h2 { font-size: 1.5rem; font-weight: 900; }
#celebrate-overlay p { color: var(--ink-soft); font-weight: 700; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
#confetti-canvas { position: fixed; inset: 0; z-index: 85; pointer-events: none; }

/* ---------- reminders banner ---------- */
.reminder-banner {
  background: linear-gradient(135deg, #fff3ef, #ffe9e2);
  border: 1.5px solid #ffd2c5;
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 12px;
}
.reminder-banner .txt { flex: 1; font-size: .88rem; font-weight: 700; color: #96422f; }
.reminder-banner .txt .sub { font-size: .76rem; font-weight: 600; opacity: .8; margin-top: 2px; }

/* goal mini widget (employee) */
.goal-mini { margin-bottom: 14px; }

/* personal dashboard motivational banner (employee) */
.mydash-hero { background: linear-gradient(135deg, var(--coral-soft), #fff); border: 1.5px solid var(--coral-soft); }
.mydash-msg { font-size: 1rem; font-weight: 800; line-height: 1.5; text-align: center; }

@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  html { font-size: 17px; }
}
