/* לבונה גינון – tokens from design/DESIGN.md (the mockups are the source of truth) */
:root {
  --bg: #F5F4EE;
  --surface: #FFFFFF;
  --surface-2: #F7F6F0;
  --line: #E2E1D8;
  --line-soft: #ECEBE3;
  --line-btn: #D9D8CE;
  --ink: #1B2A21;
  --ink-2: #3C4C41;
  --muted: #55655A;
  --brand: #24563A;
  --brand-dark: #163826;
  --on-brand-muted: #D6E6DA;

  /* status: dot / tag background / tag text */
  --st-pending: #E0B230;  --st-pending-soft: #FBF0C9;  --st-pending-ink: #6B4F00;
  --st-done:    #2E8B57;  --st-done-soft:    #DDEFE2;  --st-done-ink:    #1E6B3A;
  --st-extra:   #7B4FB0;  --st-extra-soft:   #ECE3F7;  --st-extra-ink:   #5B2F94;
  --st-missed:  #C9412E;  --st-missed-soft:  #F8DDD8;  --st-missed-ink:  #A12C1B;
  --st-none:    #A3A99F;

  --font-body: Heebo, 'Segoe UI', Arial, sans-serif;
  --font-head: Rubik, Heebo, 'Segoe UI', Arial, sans-serif;
  --r-card: 20px;
  --r-kpi: 18px;
  --r-item: 14px;
  --r-btn: 12px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font-body); }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
button { font-family: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--font-head); line-height: 1.25; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; font-family: var(--font-body); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- environment strip (dev builds only) ---------- */

.env-strip {
  position: sticky; top: 0; z-index: 1100;
  background: #E8822A; color: #fff; text-align: center;
  font-size: 13px; font-weight: 700; padding: 4px 12px; letter-spacing: .02em;
}

/* ---------- header (desktop) ---------- */

.topbar {
  max-width: 1320px; margin: 0 auto; padding: 28px 24px 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.logo {
  width: 48px; height: 48px; border-radius: 14px; background: var(--brand); color: var(--bg);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.brand-name { display: block; font-family: var(--font-head); font-size: 26px; font-weight: 700; line-height: 1.2; }
.brand-sub { display: block; font-size: 14px; color: var(--muted); }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.nav-top { display: flex; gap: 4px; margin-inline-end: 6px; }
.nav-top a {
  min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: var(--r-btn);
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.nav-top a:hover { background: var(--line-soft); color: var(--ink); }
.nav-top a.active { color: var(--brand); font-weight: 700; background: var(--surface); border: 1px solid var(--line); }
.btn-link {
  background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline;
  min-height: 44px; padding: 0 6px; display: inline-flex; align-items: center;
}

/* ---------- bottom nav (phone) ---------- */

.nav-bottom {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 1000;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 8px 8px calc(18px + env(safe-area-inset-bottom));
}
.nav-bottom a {
  display: flex; align-items: center; justify-content: center; min-width: 64px; min-height: 44px;
  font-size: 13px; color: var(--muted); text-decoration: none;
}
.nav-bottom a.active { color: var(--brand); font-weight: 700; }

/* ---------- layout ---------- */

#app { max-width: 1320px; margin: 0 auto; padding: 20px 24px 48px; }
.view { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.row-top { align-items: flex-start; }
.col { flex: 1 1 520px; min-width: 0; }
.col-wide { flex: 2 1 640px; min-width: 0; }
.col-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.card-sub { font-size: 13px; color: var(--muted); }
.side-card { gap: 10px; }
.side-card h2 { font-size: 18px; }

.btn {
  height: 44px; padding: 0 18px; border-radius: var(--r-btn); border: none;
  background: var(--brand); color: #fff; font-size: 15px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-btn); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-big { width: 100%; height: 52px; font-size: 16px; }

.tag {
  display: inline-flex; align-items: center; flex-shrink: 0; font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.tag-pending { background: var(--st-pending-soft); color: var(--st-pending-ink); }
.tag-done    { background: var(--st-done-soft);    color: var(--st-done-ink); }
.tag-extra   { background: var(--st-extra-soft);   color: var(--st-extra-ink); }
.tag-missed  { background: var(--st-missed-soft);  color: var(--st-missed-ink); }
.tag-cancelled { background: var(--line-soft); color: var(--muted); }
.tag-warn    { background: var(--st-pending-soft); color: var(--st-pending-ink); font-size: 12px; padding: 3px 10px; }
.tag-soon    { background: var(--line-soft); color: var(--muted); font-size: 12px; padding: 3px 10px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

.loading, .empty { padding: 40px; text-align: center; color: var(--muted); }
.empty-small { font-size: 14px; color: var(--muted); }
.error-box { background: var(--st-missed-soft); color: var(--st-missed-ink); border-radius: var(--r-btn); padding: 14px 16px; }
.toast {
  position: fixed; inset-inline: 16px; bottom: 96px; z-index: 2000; margin: 0 auto; max-width: 420px;
  padding: 14px 18px; border-radius: var(--r-btn); color: #fff; background: var(--st-missed-ink);
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.soon {
  border: 1px dashed #A9B3A6; border-radius: var(--r-btn); padding: 14px; text-align: center;
  color: var(--muted); font-size: 14px; background: var(--surface-2);
}

/* ---------- login ---------- */

.login { min-height: calc(100vh - 68px); display: grid; place-items: center; }
.login-card { width: 100%; max-width: 400px; text-align: center; padding: 32px 28px; align-items: center; }
.login-card .logo { width: 56px; height: 56px; }
.login form { display: flex; flex-direction: column; gap: 14px; width: 100%; text-align: start; margin-top: 6px; }
.login label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.login input, .search {
  font: inherit; font-size: 16px; height: 48px; padding: 0 14px; border: 1px solid var(--line-btn);
  border-radius: var(--r-btn); background: #fff; width: 100%; color: var(--ink);
}
.login input:focus, .search:focus { outline: 3px solid var(--st-done-soft); border-color: var(--brand); }
.form-error { color: var(--st-missed-ink); margin: 0; min-height: 1.2em; font-weight: 500; }

/* ---------- KPIs ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-kpi);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px;
}
.kpi-label { font-size: 14px; color: var(--muted); }
.kpi-value { font-family: var(--font-head); font-size: 34px; font-weight: 700; line-height: 1.2; }
.kpi-sub { font-size: 13px; color: var(--muted); }
.kpi-sub.alert { color: var(--st-missed-ink); font-weight: 500; }
.kpi-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.kpi-brand .kpi-label, .kpi-brand .kpi-sub { color: var(--on-brand-muted); }
.progress { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--st-done); border-radius: 999px; }

/* ---------- map ---------- */

.map { height: 420px; border-radius: var(--r-item); border: 1px solid var(--line); background: #EEF1E6; direction: ltr; z-index: 0; }
.leaflet-container { font: inherit; }
.popup { direction: rtl; text-align: right; min-width: 160px; font-family: var(--font-body); }
.popup-title { font-weight: 700; display: block; margin-bottom: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- weekly plan ---------- */

.day-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.day-tab {
  min-height: 52px; padding: 6px 14px; border-radius: var(--r-btn); cursor: pointer; text-align: right;
  border: 1px solid var(--line-btn); background: var(--surface); color: var(--ink);
}
.day-tab[aria-selected="true"] { border-color: var(--brand); background: var(--brand); color: #fff; }
.day-tab b { display: block; font-size: 15px; font-weight: 700; }
.day-tab small { display: block; font-size: 12px; }
.day-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.day-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line-soft);
  border-radius: var(--r-item); color: var(--ink); text-decoration: none;
}
.day-item:hover { background: var(--surface-2); color: var(--ink); }
.status-bar { width: 6px; align-self: stretch; border-radius: 6px; flex: none; }
.week-plan .day-item { background: var(--surface); }
.week-plan .item-title { display: block; color: var(--ink); text-decoration: none; }
.week-plan .item-title:hover { color: var(--brand); text-decoration: underline; }
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-label { font-weight: 700; min-width: 84px; text-align: center; }
.plan-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-toolbar .btn-ghost[aria-pressed="true"] { border-color: var(--brand); color: var(--brand); background: var(--surface-2); }
.order-btn {
  width: 44px; height: 44px; flex: none; border-radius: var(--r-btn); border: 1px solid var(--line-btn);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.order-btn:hover { background: var(--surface-2); }
.order-btn:disabled { opacity: .35; cursor: default; }
.order-btn[aria-expanded="true"] { border-color: var(--brand); background: var(--surface-2); }
.order-btns { display: flex; gap: 6px; flex: none; }
.order-num { font-weight: 700; color: var(--muted); min-width: 1.2em; text-align: center; flex: none; }
.plan-item { display: flex; flex-direction: column; }
.plan-item.is-cancelled .day-item { opacity: .65; }
.plan-item.is-cancelled .item-title { text-decoration: line-through; }
.plan-item.is-hidden .day-item { border-style: dashed; }
.plan-item:has(.item-actions) .day-item { border-radius: var(--r-item) var(--r-item) 0 0; border-color: var(--line); }
.item-actions {
  display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; background: var(--surface-2);
  border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r-item) var(--r-item);
}
.add-visit {
  display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-item);
}
.row-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.input.input-date { width: auto; min-width: 170px; }
.chip-btn:disabled { opacity: .45; cursor: default; }
.btn-danger { background: var(--st-missed); }
.btn-danger:hover { background: var(--st-missed-ink); }
.item-main { flex: 1; min-width: 0; }
.item-title { font-size: 16px; font-weight: 500; }
.item-sub { font-size: 13px; color: var(--muted); }

/* ---------- quote funnel ---------- */

.funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.funnel-col { background: var(--surface-2); border-radius: var(--r-item); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.funnel-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 15px; }
.funnel-head span:last-child { color: var(--muted); }
.quote-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-btn);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
}
.quote-name { font-size: 15px; font-weight: 500; }
.quote-meta { font-size: 13px; color: var(--muted); }
.quote-meta.won { color: var(--st-done-ink); }
.quote-meta.late { color: var(--st-missed-ink); font-weight: 500; }

.side-list { margin: 0; padding: 0 18px 0 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.side-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.side-row:last-child { border-bottom: 0; }

/* ---------- green header (phone screens) ---------- */

.hero {
  background: var(--brand); color: #fff; padding: 22px 20px 18px; display: flex; flex-direction: column; gap: 12px;
  border-radius: var(--r-card);
}
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hero-kicker { font-size: 14px; color: var(--on-brand-muted); }
.hero-title { font-family: var(--font-head); font-size: 24px; font-weight: 700; color: #fff; }
.hero-count { font-family: var(--font-head); font-size: 22px; font-weight: 700; }
.hero-hint { font-size: 13px; color: var(--on-brand-muted); }
.hero .progress { background: rgba(255,255,255,.25); }
.hero .progress > span { background: #fff; }
.hero-back { color: var(--on-brand-muted); font-size: 14px; text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; align-self: flex-start; }
.hero-back:hover { color: #fff; }
.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-on-brand { background: rgba(255,255,255,.18); color: #fff; }
.day-arrows { display: flex; gap: 6px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); background: transparent;
  color: #fff; font-size: 18px; cursor: pointer; flex: none; display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ---------- today ---------- */

.view-today, .view-client { max-width: 640px; margin: 0 auto; gap: 14px; }
.visit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.visit-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.visit-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.visit-name { font-size: 17px; font-weight: 700; color: var(--ink); text-decoration: none; }
.visit-name:hover { color: var(--brand); }
.visit-addr { font-size: 13px; color: var(--muted); }
.visit-note { font-size: 14px; color: var(--ink-2); }
.status-pill {
  flex-shrink: 0; min-height: 44px; padding: 0 14px; border-radius: 999px; border: none; cursor: pointer;
  font-size: 14px; font-weight: 700; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .08s;
}
.status-pill:active { transform: scale(.96); }
.status-pill.is-saving { opacity: .7; }
.actions { display: flex; gap: 8px; }
.actions > * {
  flex: 1; height: 44px; border-radius: var(--r-btn); border: 1px solid var(--line-btn); background: var(--surface);
  font-size: 14px; color: var(--ink); display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; cursor: pointer; gap: 6px;
}
.actions > a:hover { background: var(--surface-2); color: var(--ink); }
.actions > [aria-disabled="true"], .actions > :disabled { color: var(--muted); cursor: not-allowed; background: var(--surface-2); }
/* "today" for the CEO: the top of each card is one button (opens the status panel), 18px / 52px */
.view-today .visit-card { padding: 0; gap: 0; overflow: hidden; border-inline-start: 8px solid var(--st-pending); }
.view-today .visit-done { border-inline-start-color: var(--st-done); }
.view-today .visit-extra { border-inline-start-color: var(--st-extra); }
.view-today .visit-missed { border-inline-start-color: var(--st-missed); }
.visit-main {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; padding: 16px; text-align: right;
  background: none; border: 0; font: inherit; color: inherit; font-size: 18px;
}
button.visit-main { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.visit-main:hover { background: var(--surface-2); }
.view-today .visit-name { font-size: 20px; }
.view-today .visit-addr, .view-today .visit-note { font-size: 18px; color: var(--ink-2); }
.visit-status { font-size: 18px; font-weight: 700; padding: 6px 14px; border-radius: 999px; }
.visit-tap { color: var(--brand); font-weight: 700; text-decoration: underline; }
.view-today .actions { flex-wrap: wrap; padding: 0 16px 16px; }
.view-today .actions > * { flex: 1 1 40%; height: 52px; font-size: 18px; }

/* status panel (visit-sheet.js) – at the bottom of the screen, above the bottom nav and the map */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 2000; }
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 2001; max-height: 88vh; overflow-y: auto;
  max-width: 560px; margin: 0 auto; background: var(--surface); border-radius: 18px 18px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 -4px 24px rgba(0,0,0,.2); font-size: 18px;
}
.sheet h2 { font-size: 22px; }
.sheet .btn-big { height: auto; min-height: 52px; font-size: 18px; }
.sheet-hint { font-size: 18px; color: var(--ink-2); }
.sheet-q { font-size: 20px; font-weight: 700; font-family: var(--font-head); }
.sheet-input { font-size: 18px; min-height: 52px; }
.sheet-choices { display: flex; flex-direction: column; gap: 10px; }
.sheet-choice {
  min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 18px;
  border-radius: var(--r-btn); border: 2px solid transparent; font: 700 20px/1.2 var(--font-head); cursor: pointer; text-align: right;
}
.sheet-choice small { font: 400 16px/1 var(--font-body); }
.sheet-choice[aria-pressed="true"] { border-color: currentColor; }
.sheet-done    { background: var(--st-done-soft);    color: var(--st-done-ink); }
.sheet-extra   { background: var(--st-extra-soft);   color: var(--st-extra-ink); }
.sheet-missed  { background: var(--st-missed-soft);  color: var(--st-missed-ink); }
.sheet-pending { background: var(--st-pending-soft); color: var(--st-pending-ink); }
.sheet-reasons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sheet-reason {
  min-height: 60px; border-radius: var(--r-btn); border: 2px solid var(--line-btn); background: var(--surface); color: var(--ink);
  font: 700 18px/1.2 var(--font-head); cursor: pointer; padding: 6px 10px;
}
.sheet-reason[aria-pressed="true"] { border-color: var(--st-missed); background: var(--st-missed-soft); }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.sheet-actions > * { flex: 1 1 160px; }
.actions-big > * { height: 48px; font-size: 15px; font-weight: 500; }
.actions-big > .primary { background: var(--brand); color: #fff; border: none; }
.actions-big > .primary:hover { background: var(--brand-dark); color: #fff; }

/* ---------- client card ---------- */

.task-card { background: var(--st-extra-soft); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.task-kicker { font-size: 13px; font-weight: 700; color: var(--st-extra-ink); }
.task-text { font-size: 16px; font-weight: 500; color: #2E1A4D; }
.task-sub { font-size: 13px; color: #4A2B78; }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.section h2 { font-size: 17px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; font-size: 14px; margin: 0; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.facts > div { min-width: 0; }
.history-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.history-date { width: 44px; color: var(--muted); flex: none; }
.history-text { flex: 1; min-width: 0; }
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photos > * {
  aspect-ratio: 1; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--ink-2); text-align: center; padding: 6px;
}
.photo-before { background: #E4EBDD; }
.photo-after { background: #D3E2C9; }
.photo-add { border: 1px dashed #A9B3A6; background: var(--surface); font-size: 13px; color: var(--muted); }
.site-row { border-top: 1px solid var(--line-soft); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.site-row:first-of-type { border-top: 0; padding-top: 0; }
.site-row h3 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.contact-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.contact-row:last-child { border-bottom: 0; }
.contact-links { margin-inline-start: auto; display: flex; gap: 10px; }

/* ---------- clients list ---------- */

.client-list { padding: 4px 0; gap: 0; }
.client-row {
  display: grid; grid-template-columns: 2fr 1.5fr 90px 140px; gap: 12px; align-items: center;
  padding: 12px 20px; border-bottom: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; min-height: 52px;
}
.client-row:last-child { border-bottom: 0; }
.client-row:hover { background: var(--surface-2); color: var(--ink); }
.client-row .end { text-align: end; font-weight: 500; }
.is-inactive { opacity: .55; }

/* ---------- edit forms (site, contact, password) ---------- */

.view-site-edit, .view-contact-edit, .view-client-new, .view-visit-new, .view-password { max-width: 640px; margin: 0 auto; gap: 14px; }

/* add visit: client list with search, big day buttons, "move or add?" question */
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.pick-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 52px; padding: 8px 14px;
  border: 1px solid var(--line-btn); border-radius: var(--r-btn); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 16px; font-weight: 500; text-align: right; cursor: pointer;
}
.pick-row:hover { border-color: var(--brand); background: var(--surface-2); }
.picked { font-size: 18px; }
.day-buttons { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.day-btn {
  min-height: 72px; border: 1px solid var(--line-btn); border-radius: var(--r-item); background: var(--surface); color: var(--ink);
  font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.day-btn b { font-family: var(--font-head); font-size: 22px; }
.day-btn small { font-size: 13px; color: var(--muted); }
.day-btn[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.day-btn[aria-pressed="true"] small { color: var(--on-brand-muted); }
.day-btn:disabled { opacity: .4; cursor: default; }
.conflict-box {
  background: var(--st-pending-soft); color: var(--st-pending-ink); border-radius: var(--r-item); padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.conflict-box p { margin: 0; font-size: 16px; font-weight: 500; }
.conflict-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.narrow { max-width: 480px; width: 100%; margin: 0 auto; }
.edit-head { display: flex; flex-direction: column; gap: 4px; }
.back-link { font-size: 14px; text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; align-self: flex-start; }
.edit-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; border-radius: var(--r-btn); }
.field-label { font-weight: 500; font-size: 14px; }
.field-hint { font-size: 13px; color: var(--muted); display: block; }
.field-focus { outline: 3px solid var(--st-pending); outline-offset: 6px; }
.input {
  font: inherit; font-size: 16px; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line-btn);
  border-radius: var(--r-btn); background: #fff; width: 100%; color: var(--ink);
}
textarea.input { resize: vertical; }
.input:focus { outline: 3px solid var(--st-done-soft); border-color: var(--brand); }
.btn-small { height: 36px; min-height: 36px; padding: 0 12px; font-size: 14px; flex: none; }
/* "עדכון ביצוע" in the weekly plan – used by the CEO on her phone */
.btn-status { height: auto; min-height: 52px; font-size: 18px; padding: 0 16px; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* choices as buttons (radio chips) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 52px; padding: 0 14px;
  border: 1px solid var(--line-btn); border-radius: var(--r-btn); background: var(--surface); font-weight: 500; cursor: pointer;
}
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--st-done-soft); outline-offset: 2px; }

/* on/off switch row */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px;
  padding: 8px 0; cursor: pointer; position: relative;
}
.switch-label { font-weight: 500; display: block; }
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 52px; height: 30px; border-radius: 999px; background: var(--line-btn); position: relative; flex: none; transition: background .15s; }
.switch::after {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: inset-inline-start .15s;
}
.switch-input:checked + .switch { background: var(--st-done); }
.switch-input:checked + .switch::after { inset-inline-start: 25px; }
.switch-input:focus-visible + .switch { outline: 3px solid var(--st-done-soft); outline-offset: 2px; }

/* save / cancel stays reachable on a long form */
.save-bar {
  position: sticky; bottom: 0; z-index: 10; display: flex; gap: 10px;
  background: var(--bg); padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
}
.save-bar .btn { flex: 1; height: 52px; font-size: 16px; }
.save-bar .btn:disabled { opacity: .7; }

.toast-ok { background: var(--st-done-ink); }
.toast-info { background: var(--ink-2); }

/* change log */
.change-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.change-list > li { border-bottom: 1px solid var(--line-soft); padding-bottom: 10px; }
.change-list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.change-meta { font-size: 13px; color: var(--muted); }
.change-meta strong { color: var(--ink); }
.change-fields { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.change-old { text-decoration: line-through; color: var(--muted); }

/* ---------- missing details ---------- */

.kpi-link { color: inherit; text-decoration: none; }
.kpi-link:hover { border-color: var(--brand); color: inherit; }
.filter-chips { gap: 8px; }
.chip-btn {
  min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-btn); background: var(--surface);
  font: inherit; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; color: var(--ink);
}
.chip-btn[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-count { font-size: 12px; background: var(--line-soft); color: var(--ink-2); border-radius: 999px; padding: 1px 8px; }
.chip-btn[aria-pressed="true"] .chip-count { background: rgba(255,255,255,.2); color: #fff; }
.missing-list { display: flex; flex-direction: column; }
.missing-row { padding: 12px 0; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
.missing-row:last-child { border-bottom: 0; }
.missing-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.missing-name { font-weight: 700; color: var(--ink); text-decoration: none; }
.missing-items { display: flex; flex-wrap: wrap; gap: 8px; }
.missing-chip {
  min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: var(--r-btn);
  background: var(--st-missed-soft); color: var(--st-missed-ink); font-weight: 500; text-decoration: none;
}
.missing-chip:hover { color: var(--st-missed-ink); filter: brightness(.97); }
.missing-chip.is-current { outline: 2px solid var(--st-missed); }

/* ---------- schedule proposal (#/schedule): words and big buttons, one colour per day ---------- */

.view-schedule { max-width: 980px; margin: 0 auto; gap: 14px; }
.schedule-status { font-size: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-item); padding: 12px 14px; }
.day-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.day-tile {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; min-height: 84px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-item); color: var(--ink); text-decoration: none;
}
.day-tile:hover { border-color: var(--brand); color: var(--ink); }
.day-tile b { font-size: 15px; }
.day-tile span:last-child { font-size: 13px; color: var(--muted); }
.day-chip {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  color: #fff; font-weight: 700; font-family: var(--font-head); flex: none;
}
.day-chip-small { width: 22px; height: 22px; font-size: 12px; }
.schedule-map { height: 360px; }
.day-pin-wrap { background: none; border: none; }
.day-pin {
  display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); color: #fff; font: 700 12px/1 var(--font-body);
}
.schedule-days { display: flex; flex-direction: column; gap: 14px; }
.schedule-day { gap: 10px; }
.day-total { font-weight: 700; font-size: 15px; }
.load-bar { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.load-bar span { display: block; height: 100%; border-radius: 999px; }
.schedule-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.schedule-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--r-item);
}
.schedule-site { min-width: 0; flex: 1 1 220px; }
.schedule-site .item-title { color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 500; }
.schedule-site .item-title:hover { color: var(--brand); text-decoration: underline; }
.schedule-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.schedule-tags:empty { display: none; }
.tag-new { background: var(--st-done-soft); color: var(--st-done-ink); font-size: 12px; padding: 3px 10px; }
.tag-moved { background: var(--st-pending-soft); color: var(--st-pending-ink); font-size: 12px; padding: 3px 10px; }
.tag-missing { background: var(--st-missed-soft); color: var(--st-missed-ink); font-size: 12px; padding: 3px 10px; text-decoration: none; }
.schedule-move { display: flex; align-items: center; gap: 8px; }
.move-label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.move-days { display: flex; gap: 6px; }
.move-day {
  width: 46px; height: 46px; border-radius: var(--r-btn); border: 1px solid var(--line-btn); background: var(--surface);
  color: var(--ink); font: 700 16px/1 var(--font-head); cursor: pointer;
}
.move-day:hover:not(:disabled) { border-color: var(--brand); background: var(--surface-2); }
.move-day[aria-pressed="true"] { color: #fff; cursor: default; }
.move-week { width: auto; padding: 0 14px; font-size: 15px; }
.schedule-manual { border: 2px dashed var(--st-missed); }

/* "ימים קבועים" – built by the CEO on her phone: text 18px and up, buttons 52px, no dragging */
.week-fixed-days { min-height: 56px; height: auto; font-size: 18px; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.view-schedule { font-size: 18px; }
.view-schedule h1 { font-size: 26px; }
.view-schedule h2 { font-size: 22px; }
.view-schedule .btn-big { height: auto; min-height: 52px; font-size: 18px; }
.view-schedule .back-link { font-size: 18px; min-height: 44px; display: inline-flex; align-items: center; }
.view-schedule .schedule-status { font-size: 18px; }
.view-schedule .tag { font-size: 16px; padding: 4px 10px; }
.view-schedule .save-bar .btn { font-size: 18px; }
.fd-note { font-size: 18px; color: var(--muted); }
.fd-note:empty { display: none; }
.fd-ask p { font-size: 18px; }
.fd-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.fd-actions > * { flex: 1 1 180px; }
.fd-summary { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.fd-sum-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 56px; padding: 8px 16px;
  color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-soft);
}
.fd-sum-row:last-child { border-bottom: 0; }
.fd-sum-row b { min-width: 96px; }
.fd-sum-row span:last-child { color: var(--ink-2); }
.fd-dot { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.fd-day-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.fd-day-head span { font-weight: 700; }
.fd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.fd-empty { color: var(--muted); }
.fd-site {
  width: 100%; min-height: 64px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: right;
  padding: 12px 14px; border: 1px solid var(--line-btn); border-radius: var(--r-item); background: var(--surface);
  font: inherit; color: var(--ink); cursor: pointer;
}
.fd-site:hover:not(:disabled) { border-color: var(--brand); background: var(--surface-2); }
.fd-site-name { font-weight: 700; font-size: 19px; }
.fd-site-sub { color: var(--ink-2); }
.fd-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.fd-site-action { color: var(--brand); font-weight: 700; text-decoration: underline; }
/* bottom panel (day of one client / summary before saving) – above the bottom nav and the map */
.fd-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 2000; }
.fd-sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 2001; max-height: 88vh; overflow-y: auto;
  max-width: 560px; margin: 0 auto; background: var(--surface); border-radius: 18px 18px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 -4px 24px rgba(0,0,0,.2); font-size: 18px;
}
.fd-sheet h2 { font-size: 22px; }
.fd-sheet .btn-big { height: auto; min-height: 52px; font-size: 18px; }
.fd-q { font-size: 20px; font-family: var(--font-head); margin-top: 4px; }
.fd-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fd-choices-2 { grid-template-columns: repeat(2, 1fr); }
.fd-choice {
  min-height: 56px; border-radius: var(--r-btn); border: 2px solid var(--line-btn); background: var(--surface); color: var(--ink);
  font: 700 18px/1.2 var(--font-head); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.fd-choice small { font: 400 16px/1.2 var(--font-body); }
.fd-choice:hover { border-color: var(--brand); }
.fd-confirm-line { margin: 0; font-size: 20px; font-weight: 700; }
.fd-confirm-list { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- responsive ---------- */

@media (max-width: 700px) {
  .topbar { padding: 16px 16px 0; flex-wrap: nowrap; }
  .brand-sub { font-size: 13px; }
  .topbar-actions .btn, .nav-top { display: none; }
  .nav-bottom a { min-width: 56px; }
  .topbar-actions { flex-wrap: nowrap; gap: 2px; }
  /* above the bottom nav */
  .save-bar { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .brand-name { font-size: 22px; }
  .logo { width: 40px; height: 40px; }
  #app { padding: 16px 16px 100px; }
  /* Phone screens with their own green header (as in the mockups) */
  body[data-route="today"] .topbar, body[data-route="client"] .topbar { display: none; }
  body[data-route="today"] #app, body[data-route="client"] #app { padding-top: 0; }
  .hero { border-radius: 0 0 var(--r-card) var(--r-card); margin: 0 -16px; }
  .map { height: 320px; }
  .client-row { grid-template-columns: 1fr auto; padding: 12px 16px; }
  .client-row > :nth-child(2), .client-row > :nth-child(3) { display: none; }
  .card { padding: 16px; }
  /* weekly plan on the phone: status tag under the name, so the action button keeps its 44px */
  .week-plan .day-item { flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; }
  .week-plan .day-item .tag { order: 3; font-size: 12px; padding: 3px 10px; }
  .week-plan .day-item > .order-btn, .week-plan .day-item > .order-btns, .week-plan .day-item > .btn-small { order: 4; }
  .week-plan .order-btns { flex-direction: column; }
  .week-plan .item-main { flex-basis: 0; }
  /* days in one row that scrolls sideways, instead of five rows */
  .week-plan .day-tabs { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .week-plan .day-tab { flex: none; }
  .plan-toolbar .btn { flex: 1 1 auto; }
  /* schedule on the phone: the label on its own line, the five day buttons share the full width */
  .schedule-move { width: 100%; flex-wrap: wrap; gap: 4px; }
  .move-label { width: 100%; }
  .move-days { flex: 1 1 100%; min-width: 0; gap: 6px; }
  .move-day { flex: 1 1 0; width: auto; min-width: 0; height: 48px; }
  .day-tile { min-height: 76px; padding: 8px 2px; }
  .day-tile b { font-size: 13px; }
  .day-tile span:last-child { font-size: 12px; }
  .schedule-map { height: 280px; }
}
@media (min-width: 701px) {
  .nav-bottom { display: none !important; }
}
