:root {
  --bg: #0b0f19;
  --surface: #131b2e;
  --surface-2: #1e293b;
  --surface-3: #334155;
  --line: #1e293b;
  --line-strong: #ffffff14;
  --border: #26334d;
  --text: #f8fafc;
  --ink: #f8fafc;
  --soft: #cbd5e1;
  --muted: #94a3b8;
  --accent: #525252;
  --accent-2: #3a3a3a;
  --accent-soft: rgba(255, 255, 255, 0.1);
  --accent-line: rgba(255, 255, 255, 0.3);
  --accent-text: #d4d4d4;
  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, 0.16);
  --ok-line: rgba(16, 185, 129, 0.38);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.16);
  --warn-line: rgba(245, 158, 11, 0.38);
  --danger: #f43f5e;
  --danger-soft: rgba(244, 63, 94, 0.16);
  --danger-line: rgba(244, 63, 94, 0.38);
  --ok-text: #34d399;
  --warn-text: #fbbf24;
  --danger-text: #fb7185;
  --accent-pale: #a3a3a3;
  --on-accent: #ffffff;
  --line-mid: #475569;
  --surface-deep: #090d16;
  --surface-deep-2: #0d1424;
  --glass: rgba(0, 0, 0, 0.25);
  --hover: rgba(255, 255, 255, 0.03);
  --bg-desktop: #060913;
  --bg-desktop-glow: #131d36;
  --scheme: dark;
  --bar: rgba(15, 23, 42, 0.94);
  --bar-shadow: 0 -8px 28px rgba(0, 0, 0, 0.6);
  --surface-tint: var(--surface-tint);
  --surface-tint-soft: var(--surface-tint-soft);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow: 0 10px 26px -4px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 20px 44px -8px rgba(0, 0, 0, 0.7);
  --shadow-accent: 0 10px 26px -4px rgba(0, 0, 0, 0.5);
  --font-display: 'Rubik', system-ui, -apple-system, sans-serif;
  --font-sans: 'Heebo', 'Rubik', system-ui, -apple-system, sans-serif;
  /* One family for everything; digits are made even-width (tabular) where times must line up */
  --font-mono: var(--font-sans);
}

/* Light theme: the same tokens, daylight values. JS sets data-theme (auto follows the phone). */
:root[data-theme="light"] {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #e9eef5;
  --surface-3: #d7dfe9;
  --line: #e2e8f0;
  --line-strong: #00000014;
  --border: #cbd5e1;
  --text: #0f172a;
  --ink: #0f172a;
  --soft: #334155;
  --muted: #64748b;
  --accent: #404040;
  --accent-2: #262626;
  --accent-soft: rgba(0, 0, 0, 0.08);
  --accent-line: rgba(0, 0, 0, 0.3);
  --accent-text: #262626;
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, 0.12);
  --ok-line: rgba(5, 150, 105, 0.35);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --warn-line: rgba(217, 119, 6, 0.35);
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, 0.10);
  --danger-line: rgba(225, 29, 72, 0.35);
  --ok-text: #047857;
  --warn-text: #b45309;
  --danger-text: #be123c;
  --accent-pale: #171717;
  --on-accent: #ffffff;
  --line-mid: #94a3b8;
  --surface-deep: #e9eef5;
  --surface-deep-2: #e9eef5;
  --glass: rgba(15, 23, 42, 0.06);
  --hover: rgba(15, 23, 42, 0.04);
  --bg-desktop: #e2e8f0;
  --bg-desktop-glow: #ffffff;
  --scheme: light;
  --bar: rgba(255, 255, 255, 0.94);
  --bar-shadow: 0 -8px 28px rgba(15, 23, 42, 0.12);
  --surface-tint: rgba(255, 255, 255, 0.96);
  --surface-tint-soft: rgba(255, 255, 255, 0.6);
  --shadow-sm: 0 1px 4px rgba(15, 23, 42, 0.08);
  --shadow: 0 8px 22px -6px rgba(15, 23, 42, 0.16);
  --shadow-lg: 0 18px 40px -10px rgba(15, 23, 42, 0.22);
  --shadow-accent: 0 8px 22px -6px rgba(0, 0, 0, 0.3);
}
:root[data-theme="light"] .glow { background: radial-gradient(circle, rgba(0, 0, 0, 0.10) 0%, transparent 70%); }

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  direction: rtl;
  color-scheme: var(--scheme);
}

@media (min-width: 768px) and (pointer: fine) {
  body {
    background: var(--bg-desktop);
    background-image: radial-gradient(circle at 50% 0%, var(--bg-desktop-glow) 0%, var(--bg-desktop) 75%);
    min-height: 100dvh;
    padding: 24px 16px;
  }
}

.app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}

@media (min-width: 768px) and (pointer: fine) {
  .app {
    min-height: calc(100dvh - 48px);
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
  }
}

.glow {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 420px;
  height: 220px;
  background: radial-gradient(circle, rgba(128, 128, 128, 0.16) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.rays { display: none; }

.screen {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px 32px;
  min-height: 100dvh;
}

@media (min-width: 768px) and (pointer: fine) {
  .screen {
    min-height: calc(100dvh - 50px);
    padding: 22px 24px 36px;
  }
}

.screen.with-bar {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
@media (min-width: 768px) and (pointer: fine) {
  .screen.with-bar { padding-bottom: calc(136px + env(safe-area-inset-bottom)); }
}

/* Loading the next screen: the current one stays, dimmed, with a progress line at the top */
#app.busy .screen { opacity: 0.55; pointer-events: none; transition: opacity 0.2s ease 0.12s; }
#app.busy::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100; background: linear-gradient(90deg, transparent, var(--accent) 40%, var(--accent) 60%, transparent); background-size: 50% 100%; animation: busy-bar 1s linear infinite; }
@keyframes busy-bar { from { background-position: 200% 0; } to { background-position: -100% 0; } }

/* Date and time pickers in the Israeli format; the native input sits invisible on top and opens the picker */
.picker { position: relative; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; }
.picker-ic { width: 18px; height: 18px; color: var(--accent-text); flex-shrink: 0; display: inline-flex; }
.picker-ic svg { width: 18px; height: 18px; }
.picker-text { flex: 1; font-size: 1rem; font-weight: 600; color: var(--text); }
.picker input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0; cursor: pointer; }
.picker:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50dvh;
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
}

.ic {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.ic.chev {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

span > svg, button > svg, a > svg {
  width: 100%;
  height: 100%;
  max-width: 22px;
  max-height: 22px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

svg.map {
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 140px;
  display: block;
  border-radius: 12px;
  background: var(--surface-deep-2);
  border: 1px solid var(--border);
  padding: 6px;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 { font-size: 1.5rem; line-height: 1.25; }
h2 { font-size: 1.15rem; line-height: 1.3; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }

.big {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
}

.small { font-size: 0.86rem; line-height: 1.45; }
.tiny { font-size: 0.76rem; color: var(--muted); line-height: 1.45; text-align: center; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }

.num, .time, .mono, input[type="tel"], input[type="time"], input[type="date"], input[type="number"], .timeline .axis, .st-drive, .pin, .stat b.num, .picker-text {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.ltr { direction: ltr; unicode-bidi: embed; }

.mono {
  font-size: 0.82rem;
  background: var(--surface-deep);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  word-break: break-all;
  color: var(--accent-text);
  direction: ltr;
  text-align: left;
}

.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;
}

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.col.center, .stack.center { align-items: center; text-align: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }

.grid-2, .grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.topbar .title {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  min-width: 0;
}

.topbar .title b {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.topbar .title small {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
}

.topbar .spacer { width: 40px; height: 40px; flex-shrink: 0; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.icon-btn:hover { background: var(--surface-2); }
.icon-btn.boxed { background: var(--surface); border-color: var(--border); }
.icon-btn.boxed:hover { background: var(--surface-2); border-color: var(--accent-line); }

.segmented {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.segmented a, .segmented span {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: 9px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}

.segmented a:hover { color: var(--text); background: var(--hover); }
.segmented span.on, .segmented a.on {
  background: var(--accent-2);
  color: var(--on-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.card.next {
  background: linear-gradient(135deg, #2d9cf0 0%, #1d7fcc 100%);
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--on-accent);
  box-shadow: var(--shadow-accent);
}

.card.next .small, .card.next .muted, .card.next b, .card.next span { color: var(--on-accent); }
.card.next .btn { background: var(--on-accent) !important; color: #0b1a26 !important; border-color: var(--on-accent); font-weight: 700; box-shadow: var(--shadow-sm) !important; }
.card.next .btn:hover { background: #f1f5f9; }
.card.next .btn.ghost { background: rgba(255, 255, 255, 0.16); color: var(--on-accent); border-color: rgba(255, 255, 255, 0.3); }
.card.next .btn.ghost:hover { background: rgba(255, 255, 255, 0.25); }

.card.accent { background: linear-gradient(180deg, rgba(0, 0, 0, 0.16) 0%, var(--surface-tint) 100%); border-color: var(--accent-line); }
.card.warn { background: linear-gradient(180deg, rgba(245, 158, 11, 0.14) 0%, var(--surface-tint) 100%); border-color: var(--warn-line); }
.card.danger { background: linear-gradient(180deg, rgba(244, 63, 94, 0.15) 0%, var(--surface-tint) 100%); border-color: var(--danger-line); }

ol.dayline {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

ol.dayline::before {
  content: "";
  position: absolute;
  right: 11px;
  top: 20px;
  bottom: 20px;
  width: 2px;
  background: var(--border);
  z-index: 0;
}

li.st { position: relative; padding-right: 32px; display: flex; flex-direction: column; }

.st-dot {
  position: absolute;
  right: 2px;
  top: 16px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--line-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  color: var(--on-accent);
}

.st-dot .ic { width: 12px; height: 12px; }
li.st.st-next .st-dot { top: 22px; background: var(--accent); border-color: var(--accent-pale); box-shadow: 0 0 0 4px rgba(128, 128, 128, 0.25); }
li.st.st-done .st-dot { background: var(--ok); border-color: var(--ok); color: #052e16; }
li.st.st-late .st-dot { background: var(--warn); border-color: var(--warn); }
li.st.st-past .st-dot { background: var(--warn-soft); border-color: var(--warn); color: var(--warn-text); }
li.st.st-past .st-row { border-style: dashed; border-color: var(--warn-line); opacity: 0.85; }

.st-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 15px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.st-row:hover { border-color: var(--accent-line); background: var(--surface-2); transform: translateY(-1px); }
li.st.st-done .st-row { opacity: 0.65; background: var(--surface-tint-soft); }
li.st.st-late .st-row { border-color: var(--warn-line); }
.st-time { font-size: 0.96rem; font-weight: 700; color: var(--accent-text); min-width: 48px; }
.st-drive { font-family: var(--font-mono); font-size: 0.75rem; background: var(--surface-2); padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border); white-space: nowrap; }

.list-row, .visit {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  text-decoration: none;
  font-family: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.list-row:hover, .visit:hover { border-color: var(--accent-line); background: var(--surface-2); }
.list-row.soft, .visit.done { opacity: 0.72; }
.list-row.on { border-color: var(--ok-line); background: var(--ok-soft); }
.visit.late { border-color: var(--warn-line); }
.visit .time { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 54px; font-family: var(--font-mono); }
.visit .time span { font-size: 0.72rem; color: var(--muted); }
.visit .name { font-weight: 700; font-size: 1.1rem; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.visit .addr { font-size: 0.9rem; color: var(--soft); }
.list-row .lead { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--accent-text); flex-shrink: 0; }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent-text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar.off { background: var(--surface-2); border-color: var(--border); color: var(--muted); }

.log-icon { width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.log-icon.ok { background: var(--ok-soft); color: var(--ok-text); border: 1px solid var(--ok-line); }
.log-icon.no { background: var(--danger-soft); color: var(--danger-text); border: 1px solid var(--danger-line); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--soft);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.tag.ok { background: var(--ok-soft); color: var(--ok-text); border-color: var(--ok-line); }
.tag.warn { background: var(--warn-soft); color: var(--warn-text); border-color: var(--warn-line); }
.tag.danger { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-line); }
.tag.outline { background: transparent; color: var(--soft); border-color: var(--line-mid); }
.tag.badge { background: var(--accent-soft); color: var(--accent-pale); border-color: var(--accent-line); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: wrap; }

.chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--soft);
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.chip:hover { border-color: var(--accent-line); color: var(--text); }
.chip.on { background: var(--accent-2); color: var(--on-accent); border-color: var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); }

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.stat b.num { font-family: var(--font-mono); font-size: 1.55rem; font-weight: 800; color: var(--text); line-height: 1.15; }
.stat span { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.stat.ok { border-color: var(--ok-line); }
.stat.ok b.num { color: var(--ok-text); }
.stat.warn { border-color: var(--warn-line); }
.stat.warn b.num { color: var(--warn-text); }
.stat.danger { border-color: var(--danger-line); }
.stat.danger b.num { color: var(--danger-text); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent-2);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  line-height: 1.2;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.32);
}

.btn:hover { background: var(--accent); }
.btn:active { transform: scale(0.99); }
.btn:disabled { opacity: 0.48; pointer-events: none; }
.btn.ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); border-color: var(--line-mid); }
.btn.link { background: transparent; border-color: transparent; color: var(--accent-text); box-shadow: none; padding: 6px 10px; }
.btn.link:hover { background: rgba(128, 128, 128, 0.1); }
.btn.sm { padding: 7px 12px; font-size: 0.82rem; border-radius: 9px; }

input, select, textarea {
  width: 100%;
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  color-scheme: var(--scheme);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(128, 128, 128, 0.22);
}

input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { min-height: 88px; resize: vertical; }

.toggle {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--on-accent);
  transition: transform 0.2s ease;
}

.toggle.on { background: var(--accent-2); border-color: var(--accent); }
.toggle.on::after { transform: translateX(20px); }

.progress-strip {
  list-style: none;
  margin: 0;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.progress-strip li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.progress-strip li span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.progress-strip li span .ic { width: 13px; height: 13px; }
.progress-strip li.now { background: var(--accent-soft); color: var(--accent-pale); border: 1px solid var(--accent-line); }
.progress-strip li.now span { background: var(--accent-2); color: var(--on-accent); }
.progress-strip li.on { color: var(--ok-text); }
.progress-strip li.on span { background: var(--ok-soft); color: var(--ok-text); }
/* Each step is a button: tap a later step to mark it without sending a message */
.progress-strip li:has(button) { padding: 0; }
.progress-strip li button {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px;
  background: none;
  border: 0;
  border-radius: 10px;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.progress-strip li button:disabled { cursor: default; }
.progress-strip li:not(.on):not(.now) button:not(:disabled):hover { background: var(--hover); }

.action-tile {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--soft);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-tile:hover { border-color: var(--accent-line); color: var(--text); }
.action-tile.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-pale); }

.preview {
  background: var(--surface-deep);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.check {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--soft);
}

.check .ic, .check svg { width: 16px; height: 16px; }
.check.ok { background: var(--ok-soft); color: var(--ok-text); border: 1px solid var(--ok-line); }
.check.no { background: var(--danger-soft); color: var(--danger-text); border: 1px solid var(--danger-line); }

.reason {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
  background: var(--surface-2);
  color: var(--soft);
}

.reason .ic, .reason svg { width: 16px; height: 16px; flex-shrink: 0; }
.reason.ok { background: var(--ok-soft); color: var(--ok-text); border: 1px solid var(--ok-line); }
.reason.no { background: var(--danger-soft); color: var(--danger-text); border: 1px solid var(--danger-line); }

pre.text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}

.timeline { display: grid; grid-template-columns: 52px 1fr; gap: 8px; position: relative; margin: 6px 0; }
.timeline .axis { position: relative; font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); }
.timeline .axis span { position: absolute; right: 2px; transform: translateY(-50%); }
.timeline .track { position: relative; background: var(--surface-tint-soft); border-radius: 14px; border: 1px solid var(--border); overflow: hidden; }
.timeline .hour { position: absolute; left: 0; right: 0; height: 1px; background: rgba(51, 65, 85, 0.45); }
.timeline .rail { position: absolute; top: 0; bottom: 0; right: 14px; width: 2px; background: var(--border); }
.timeline .leg { position: absolute; right: 24px; font-size: 0.72rem; color: var(--muted); z-index: 2; }
.timeline .leg.late { color: var(--warn); }
.timeline .travel { position: absolute; right: 20px; left: 10px; box-sizing: border-box; display: flex; align-items: center; gap: 6px; padding: 0 8px; border-radius: 8px; border: 1px dashed var(--accent-line); background: repeating-linear-gradient(135deg, rgba(128, 128, 128, 0.14) 0 6px, rgba(128, 128, 128, 0.04) 6px 12px); color: var(--soft); font-size: 0.7rem; line-height: 1; white-space: nowrap; overflow: hidden; z-index: 2; }
.timeline .travel.late { border-color: var(--warn-line); background: repeating-linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0 6px, rgba(245, 158, 11, 0.05) 6px 12px); color: var(--warn-text); }
.timeline .travel .travel-ic { width: 14px; height: 14px; flex-shrink: 0; display: inline-flex; color: var(--accent-text); }
.timeline .travel .travel-ic svg { width: 14px; height: 14px; }
.timeline .travel.late .travel-ic { color: var(--warn-text); }
.timeline .planned { position: absolute; right: 20px; left: 10px; background: rgba(245, 158, 11, 0.12); border: 1px dashed var(--warn); border-radius: 8px; }
.timeline .block { position: absolute; right: 20px; left: 10px; background: var(--surface); border: 1px solid var(--accent-line); border-radius: 10px; padding: 6px 10px; display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); overflow: hidden; box-shadow: var(--shadow-sm); z-index: 3; }
.timeline .block.late { border-color: var(--warn); background: rgba(245, 158, 11, 0.28); }
.timeline .block.done { border-color: var(--ok-line); opacity: 0.72; }
.timeline .block .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.timeline .block .when { font-size: 0.74rem; color: var(--soft); white-space: nowrap; }
.timeline .squeeze { position: absolute; left: 0; right: 0; z-index: 1; pointer-events: none; background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(128, 128, 128, 0.18) 3px 4px); border-top: 1px dashed var(--line-mid); border-bottom: 1px dashed var(--line-mid); }
.timeline .now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 5; }
.timeline .now span { position: absolute; left: 8px; top: -10px; background: var(--danger); color: var(--on-accent); font-size: 0.68rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; }

.map-wrap { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-sm); background: #0f172a; }
#leaflet, .map-canvas { width: 100%; height: 320px; }
#googleWrap iframe { width: 100%; height: 320px; border: 0; display: block; background: #0f172a; }
.segmented span { cursor: pointer; }
.dot-legend { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.pin { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-2); color: var(--on-accent); font-family: var(--font-mono); font-weight: 800; font-size: 0.82rem; border: 2px solid var(--on-accent); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5); }
.pin.home { width: 18px; height: 18px; background: #10b981; }
.pin.late { background: var(--warn); }

.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { padding: 12px 15px; border-radius: 16px; font-size: 0.92rem; line-height: 1.5; max-width: 88%; }
.bubble.bot { background: var(--surface); border: 1px solid var(--border); color: var(--text); align-self: flex-start; border-top-right-radius: 4px; }
.bubble.me { background: var(--accent-2); color: var(--on-accent); align-self: flex-end; border-top-left-radius: 4px; }
.bubble.wide { max-width: 100%; width: 100%; }

.composer { display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 6px; }
.composer input { border: 0; background: transparent; flex: 1; padding: 8px 10px; }
.composer input:focus { box-shadow: none; background: transparent; }
.send-btn { width: 42px; height: 42px; border-radius: 10px; background: var(--accent-2); color: var(--on-accent); border: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.send-btn:hover { background: var(--accent); }

.progress, .dots { display: flex; align-items: center; justify-content: center; gap: 8px; }
.progress i, .dots i { width: 28px; height: 5px; border-radius: 999px; background: var(--surface-3); display: inline-block; }
.progress i.on, .dots i.on { background: var(--accent); }

.tabbar {
  position: fixed;
  right: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  padding: 0 12px env(safe-area-inset-bottom);
  pointer-events: none;
}

.tabbar .inner {
  pointer-events: auto;
  width: 100%;
  max-width: 600px;
  background: var(--bar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 6px 8px;
  box-shadow: var(--bar-shadow);
}

@media (min-width: 768px) and (pointer: fine) {
  .tabbar { bottom: 24px; }
  .tabbar .inner { border: 1px solid var(--border); border-radius: 20px; max-width: 560px; }
}

.tabbar .inner a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 4px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.tabbar .inner a:hover { color: var(--soft); }
.tabbar .inner a.on { color: var(--accent-text); background: var(--accent-soft); font-weight: 700; }

.tabbar .inner a.fab.plus {
  width: 46px;
  height: 46px;
  margin: 0 auto;
  padding: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, #4a4a4a 0%, #262626 100%);
  color: var(--on-accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.tabbar .inner a.fab.plus:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #5a5a5a 0%, #333333 100%);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 36px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.empty b { color: var(--text); font-family: var(--font-display); font-size: 1rem; }

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid var(--line-mid);
  padding: 11px 18px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  text-align: center;
}

/* ---- Rules the screens still use that the theme above does not define (kept from the previous stylesheet, dark colors) ---- */
.glow.hero { top: -40px; height: 320px; background: radial-gradient(circle, rgba(128, 128, 128, 0.34) 0%, rgba(128, 128, 128, 0.08) 45%, transparent 70%); }
.btn-row .btn.primary { flex: 1.4; }
.hr { height: 1px; background: var(--border); }
li.st.st-note { padding-right: 0; }
/* The drive between two stops on the day list */
li.st.st-leg { padding: 6px 32px 6px 0; min-height: 22px; justify-content: center; }
.st-leg-line { position: absolute; right: 11px; top: 0; bottom: 0; width: 2px; background: repeating-linear-gradient(to bottom, var(--accent-line) 0 4px, transparent 4px 8px); }
.st-leg-text { font-size: 0.74rem; color: var(--muted); line-height: 1.35; padding-right: 2px; }
li.st.st-leg.late .st-leg-text { color: var(--warn-text); }
li.st.st-leg.late .st-leg-line { background: repeating-linear-gradient(to bottom, var(--warn-line) 0 4px, transparent 4px 8px); }
.phone-mock { width: 236px; margin: 0 auto; border-radius: 28px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent-line); padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.phone-mock .r { display: flex; gap: 10px; align-items: center; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: 12px; }
.phone-mock .r.late { background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn-text); }
.phone-mock .cta { display: flex; align-items: center; justify-content: center; height: 34px; border-radius: 9px; background: var(--accent-2); color: var(--on-accent); font-size: 12px; font-weight: 700; }
.leaflet-container { font-family: inherit; background: #0f172a; }
.leaflet-popup-content-wrapper { border-radius: 10px; font-size: 13px; line-height: 1.45; background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { margin: 10px 12px; direction: rtl; text-align: right; }
.leaflet-control-attribution { font-size: 9px; }

/* In-app pop-up (bottom sheet): used instead of the browser's confirm/prompt */
.sheet-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(2, 6, 23, 0.72); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity 0.18s ease; }
.sheet-backdrop.open { opacity: 1; }
.sheet { width: 100%; max-width: 600px; background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; transform: translateY(24px); transition: transform 0.18s ease; box-shadow: var(--shadow-lg); }
.sheet-backdrop.open .sheet { transform: none; }
.sheet-grip { width: 42px; height: 4px; border-radius: 2px; background: var(--surface-3); margin: 0 auto 2px; }
.sheet-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; line-height: 1.3; }
.sheet-text { color: var(--soft); font-size: 0.95rem; line-height: 1.5; }
.sheet-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.sheet-btns .btn { height: 50px; font-size: 1rem; }
.btn.danger-btn { color: var(--danger-text); border-color: var(--danger-line); background: var(--danger-soft); }
@media (min-width: 768px) and (pointer: fine) { .sheet-backdrop { align-items: center; padding: 24px; } .sheet { border-radius: 22px; border-bottom: 1px solid var(--border); max-width: 440px; } }

/* Checkboxes inside a row label keep their natural size instead of stretching with the row */
label.row input[type="checkbox"] { flex: 0 0 auto; width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--accent); }

/* ---------- Glossy: monochrome. True black with a white accent in the dark theme, white with a black accent in the light one ---------- */
:root[data-theme="dark"] {
  --bg: #3a3a3a;
  --surface: rgba(0, 0, 0, 0.34);
  --surface-2: rgba(0, 0, 0, 0.46);
  --surface-3: rgba(0, 0, 0, 0.58);
  --border: rgba(255, 255, 255, 0.2);
  --line: rgba(255, 255, 255, 0.13);
  --text: #ffffff;
  --ink: #ffffff;
  --soft: #e6e9ee;
  --muted: #9ba1ab;
  --soft: #c9ced6;
  --accent: #4fb6ff;
  --accent-2: #2d9cf0;
  --accent-soft: rgba(79, 182, 255, 0.14);
  --accent-line: rgba(79, 182, 255, 0.45);
  --accent-text: #7fcbff;
  --accent-pale: #4fb6ff;
  --on-accent: #ffffff;
  --btn-text: #0b1a26;
  --ok: #3ddc97; --ok-text: #3ddc97;
  --warn: #ffb547; --warn-text: #ffb547;
  --danger: #ff6b6b; --danger-text: #ff8a8a; --danger-soft: #3a1f22;
  --shadow-accent: 0 10px 30px -6px rgba(45, 156, 240, 0.4);
  --glass-top: rgba(255, 255, 255, 0.06);
  --glass-bottom: rgba(0, 0, 0, 0.18);
  --glass-edge: rgba(255, 255, 255, 0.16);
  --glass-shine: rgba(255, 255, 255, 0.18);
  --btn-top: #4fb6ff; --btn-mid: #2d9cf0; --btn-bottom: #1d7fcc;
  --page-glow: radial-gradient(1200px 600px at 50% -10%, #30333a 0%, #26282d 45%, #1c1d20 100%);
  --bar: rgba(38, 40, 45, 0.96);
  --surface-deep: #1c1d20;
  --surface-deep-2: #26282d;
}
:root[data-theme="light"] {
  --accent: #111111;
  --accent-2: #000000;
  --accent-soft: rgba(0, 0, 0, 0.08);
  --accent-line: rgba(0, 0, 0, 0.3);
  --accent: #1d7fcc;
  --accent-2: #1668a8;
  --accent-soft: rgba(29, 127, 204, 0.12);
  --accent-line: rgba(29, 127, 204, 0.45);
  --accent-text: #1668a8;
  --accent-pale: #1d7fcc;
  --on-accent: #ffffff;
  --btn-text: #ffffff;
  --shadow-accent: 0 8px 22px -6px rgba(29, 127, 204, 0.4);
  --glass-top: rgba(255, 255, 255, 0.9);
  --glass-bottom: rgba(255, 255, 255, 0.6);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --glass-shine: rgba(255, 255, 255, 1);
  --btn-top: #2d9cf0; --btn-mid: #1d7fcc; --btn-bottom: #1668a8;
  --page-glow: radial-gradient(1200px 600px at 50% -10%, #e2e5ea 0%, #eef2f7 45%, #f1f5f9 100%);
}
:root[data-theme="dark"] .timeline .block, :root[data-theme="dark"] .card, :root[data-theme="dark"] .list-row, :root[data-theme="dark"] .visit, :root[data-theme="dark"] .st-row, :root[data-theme="dark"] .sheet, :root[data-theme="dark"] .bubble.bot, :root[data-theme="dark"] .empty, :root[data-theme="dark"] .stat, :root[data-theme="dark"] .action-tile {
  --surface: #1f4e6e; --surface-2: #25618a; --surface-3: #2b6f9c; --surface-tint: #1f4e6e; --surface-tint-soft: #25618a;
  --text: #f2f6fa; --ink: #f2f6fa; --soft: #e1ecf4; --muted: #bcd3e4;
  --border: rgba(169, 196, 216, 0.3); --line: rgba(169, 196, 216, 0.16); --line-mid: #4f85a8; --hover: rgba(255, 255, 255, 0.05);
  --glass-top: rgba(255, 255, 255, 0.1); --glass-bottom: rgba(255, 255, 255, 0.02); --glass-edge: rgba(169, 196, 216, 0.38); --glass-shine: rgba(255, 255, 255, 0.18);
  --accent: #4fb6ff; --accent-2: #2d9cf0; --accent-text: #8fd3ff; --accent-soft: rgba(79, 182, 255, 0.16); --accent-line: rgba(79, 182, 255, 0.5); --accent-pale: #4fb6ff; --on-accent: #ffffff;
  --btn-top: #4fb6ff; --btn-mid: #2d9cf0; --btn-bottom: #1d7fcc; --btn-text: #0b1a26; --shadow-accent: 0 8px 22px -6px rgba(45, 156, 240, 0.45);
  --ok-text: #5fe7ad; --warn-text: #ffc66b; --danger-text: #ff9a9a;
  color: var(--text);
}
:root[data-theme="light"] .timeline .block, :root[data-theme="light"] .card, :root[data-theme="light"] .list-row, :root[data-theme="light"] .visit, :root[data-theme="light"] .st-row, :root[data-theme="light"] .sheet, :root[data-theme="light"] .bubble.bot, :root[data-theme="light"] .empty, :root[data-theme="light"] .stat, :root[data-theme="light"] .action-tile {
  --surface: #e4f1fb; --surface-2: #d2e7f7; --surface-3: #bdd9f0; --surface-tint: #e4f1fb; --surface-tint-soft: #eef6fc;
  --soft: #1e293b; --muted: #3f4f63;
  --border: rgba(31, 78, 110, 0.3); --line: rgba(31, 78, 110, 0.16);
  --glass-top: rgba(255, 255, 255, 0.6); --glass-bottom: rgba(255, 255, 255, 0.2); --glass-edge: rgba(31, 78, 110, 0.3); --glass-shine: rgba(255, 255, 255, 0.8);
}
/* Blocked message, errors: one flat dark red box, no gradient */
:root[data-theme="dark"] .card.danger { background: #3a1f22; border-color: var(--danger); --text: #ffe4e4; --soft: #ffc9c9; --muted: #f0b3b3; }
:root[data-theme="light"] .card.danger { background: #fde8ea; border-color: var(--danger); }
/* Past or done visits fade back */
:root[data-theme="dark"] li.st.st-done .st-row, :root[data-theme="dark"] .visit.done { --surface: #30333a; --surface-tint-soft: #30333a; --text: #9ba1ab; --border: #3b3f47; }
/* Driving legs on the timeline in dark orange */
:root[data-theme="dark"] .timeline .travel, :root[data-theme="light"] .timeline .travel {
  background: repeating-linear-gradient(135deg, #f5a524 0 6px, #e0921a 6px 12px);
  border: 1px solid #b86e0a; color: #2a1b00;
}
:root[data-theme="dark"] .timeline .travel .travel-ic, :root[data-theme="light"] .timeline .travel .travel-ic { color: #2a1b00; }
:root[data-theme="dark"] .timeline .travel.late, :root[data-theme="light"] .timeline .travel.late {
  background: repeating-linear-gradient(135deg, rgba(220, 38, 38, 0.9) 0 6px, rgba(153, 27, 27, 0.9) 6px 12px);
  border-color: #7f1d1d; color: #fff1f1;
}
:root[data-theme="dark"] .timeline .travel.late .travel-ic, :root[data-theme="light"] .timeline .travel.late .travel-ic { color: #fecaca; }
html, body, .app { background: var(--page-glow); background-attachment: fixed; }
.card, .list-row, .st-row, .sheet, .timeline .track, .tabbar .inner {
  background: linear-gradient(180deg, var(--glass-top) 0%, var(--glass-bottom) 100%), var(--surface);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-shine), var(--shadow-sm);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
}
.btn:not(.ghost):not(.link), .segmented span.on, .chip.on, .tabbar .inner a.fab.plus {
  background: linear-gradient(180deg, var(--btn-top) 0%, var(--btn-mid) 45%, var(--btn-bottom) 100%);
  color: var(--btn-text, var(--on-accent)); border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 0 rgba(0, 0, 0, 0.15), var(--shadow-accent);
}
.btn:not(.ghost):not(.link) svg, .chip.on svg { color: inherit; }
.btn.ghost { background: linear-gradient(180deg, var(--glass-top), var(--glass-bottom)); border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-shine); }
.segmented { background: var(--glass-bottom); border: 1px solid var(--glass-edge); }
.tabbar { background: transparent; border: 0; box-shadow: none; }
.tabbar .inner a.on { color: var(--accent-text); background: transparent; box-shadow: none; }
input, select, textarea { background: var(--glass-bottom); border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12); }
li.st.st-next .st-dot { background: var(--btn-top); border-color: var(--accent-pale); box-shadow: 0 0 0 4px var(--accent-soft), 0 0 18px var(--accent-line); }
.topbar .brand { height: 44px; width: auto; max-width: 110px; flex-shrink: 0; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35)); }
.topbar .spacer { width: 96px; }
/* The drive between two visits, as a box on the day's timeline */
.drive-box { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 12px; border: 1px dashed rgba(245, 165, 36, 0.6); background: rgba(245, 165, 36, 0.14); }
.drive-box .drive-ic { width: 22px; height: 22px; color: #f5a524; flex-shrink: 0; }
.drive-box .drive-ic svg { width: 22px; height: 22px; }
li.st.st-leg.late .drive-box { border-color: var(--warn-line); background: var(--warn-soft); }
li.st.st-leg.late .drive-box .drive-ic { color: var(--warn-text); }

/* ---------- Accessibility menu and modes ---------- */
.a11y-fab { position: fixed; left: 12px; bottom: calc(104px + env(safe-area-inset-bottom)); z-index: 90; width: 48px; height: 48px; border-radius: 50%; border: 2px solid #ffffff; background: #3a3a3a; color: #ffffff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); cursor: pointer; padding: 0; }
.a11y-fab svg { width: 28px; height: 28px; }
/* In the app the menu sits under "עוד" and in the sign-in footers; a floating button would cover the main buttons */
.a11y-inline .a11y-fab { display: none; }
.a11y-backdrop { position: fixed; inset: 0; z-index: 95; background: rgba(0, 0, 0, 0.55); display: flex; align-items: flex-end; justify-content: center; }
.a11y-panel { width: 100%; max-width: 600px; max-height: 88dvh; overflow: auto; background: #0f172a; color: var(--text); border-radius: 20px 20px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.a11y-head { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.a11y-head b { font-family: var(--font-display); font-size: 1.15rem; flex: 1; }
.a11y-ic { width: 28px; height: 28px; color: var(--accent-text); } .a11y-ic svg { width: 28px; height: 28px; }
.a11y-x { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--text); font-size: 18px; cursor: pointer; }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; min-height: 48px; border-bottom: 1px solid var(--line); }
.a11y-row span:first-child { display: flex; flex-direction: column; gap: 2px; } .a11y-row small { color: var(--muted); font-size: 0.78rem; }
.a11y-row input[type="checkbox"] { width: 26px; height: 26px; flex: 0 0 auto; accent-color: var(--accent); }
.a11y-steps { display: flex; gap: 8px; } .a11y-steps button { min-width: 52px; height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 800; font-size: 1rem; cursor: pointer; }
.a11y-steps button:disabled { opacity: 0.4; cursor: default; }
.a11y-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; } .a11y-foot a { color: var(--accent-text); font-weight: 600; }
.a11y-reset { height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; }
/* Keyboard focus is always visible */
:focus-visible { outline: 3px solid #facc15; outline-offset: 2px; }
/* Text size */
html.a11y-text-1 { font-size: 18px; } html.a11y-text-2 { font-size: 20px; } html.a11y-text-3 { font-size: 23px; }
html.a11y-text-1 body, html.a11y-text-2 body, html.a11y-text-3 body { font-size: inherit; }
/* High contrast: black, white, yellow actions */
:root.a11y-contrast, :root.a11y-contrast[data-theme] { --bg: #000000; --surface: #000000; --surface-2: #111111; --surface-3: #222222; --border: #ffffff; --line: #777777; --text: #ffffff; --ink: #ffffff; --soft: #ffffff; --muted: #e5e5e5; --accent: #facc15; --accent-2: #eab308; --accent-soft: #1a1a00; --accent-line: #facc15; --accent-text: #fde047; --accent-pale: #fde047; --on-accent: #000000; --ok: #4ade80; --ok-text: #4ade80; --warn: #fbbf24; --warn-text: #fde047; --danger: #f87171; --danger-text: #f87171; --glass-top: #000; --glass-bottom: #000; --glass-edge: #ffffff; --glass-shine: transparent; --btn-top: #facc15; --btn-mid: #facc15; --btn-bottom: #facc15; --page-glow: #000000; --bar: #000000; --surface-tint: #000; --surface-tint-soft: #000; --glass: #111; --shadow-sm: none; --shadow: none; --shadow-lg: none; --shadow-accent: none; }
html.a11y-contrast .card, html.a11y-contrast .list-row, html.a11y-contrast .st-row, html.a11y-contrast .sheet, html.a11y-contrast .tabbar .inner { -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
html.a11y-contrast .tag { border-width: 2px; }
/* Highlighted links and buttons */
html.a11y-links a { text-decoration: underline; text-underline-offset: 3px; }
html.a11y-links .btn, html.a11y-links button { outline: 2px solid currentColor; outline-offset: -2px; }
/* Less motion, no blur */
html.a11y-motion *, html.a11y-motion *::before, html.a11y-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html.a11y-motion .card, html.a11y-motion .list-row, html.a11y-motion .st-row, html.a11y-motion .sheet, html.a11y-motion .tabbar .inner, html.a11y-motion .segmented { -webkit-backdrop-filter: none; backdrop-filter: none; }
html.a11y-motion .glow, html.a11y-motion .rays { display: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; } }
/* Readable font and spacing */
html.a11y-font, html.a11y-font body, html.a11y-font .topbar .title b, html.a11y-font .btn, html.a11y-font input, html.a11y-font button { font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif !important; }
html.a11y-spacing body { line-height: 1.8; letter-spacing: 0.04em; word-spacing: 0.12em; }
html.a11y-spacing p, html.a11y-spacing li { margin-bottom: 0.4em; }

:root[data-theme="light"] .a11y-panel { background: #ffffff; }
:root.a11y-contrast .a11y-panel { background: #000000; }
.a11y-panel { -webkit-backdrop-filter: none; backdrop-filter: none; }

/* Today's own actions: a row of chips under the header */
.day-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.day-actions .chip { text-decoration: none; padding: 8px 12px; min-height: 40px; }
.day-actions .chip svg { width: 18px; height: 18px; color: var(--accent-text); flex-shrink: 0; }

/* Timeline: a squeezed stretch is marked on the hour axis, and a squeezed visit carries a cut line */
.timeline .axis .axis-gap { right: 10px; font-size: 1rem; line-height: 1; color: var(--muted); }
/* A squeezed visit: a zigzag strip along its left edge (drawn shorter than its real length) */
.timeline .block .cut { position: absolute; top: 0; bottom: 0; left: 0; width: 7px; pointer-events: none; background: repeating-linear-gradient(135deg, var(--accent) 0 3px, transparent 3px 7px); opacity: 0.75; border-radius: 10px 0 0 10px; }
.timeline .block small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline .block .col { min-width: 0; }
.timeline .block.unclosed { border-style: dashed; border-color: var(--warn); opacity: 0.85; }

/* Password field with a show/hide button */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-left: 48px; }
.pw-eye { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pw-eye svg { width: 22px; height: 22px; }

/* Address suggestions under an address field */
.addr-list {
  position: fixed;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  overflow: hidden;
}
.addr-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  text-align: start;
  cursor: pointer;
}
.addr-opt:last-child { border-bottom: 0; }
.addr-opt:hover, .addr-opt:focus-visible { background: var(--hover); }
.addr-ic { width: 16px; height: 16px; flex-shrink: 0; color: var(--accent-text); display: block; }

/* WhatsApp buttons in WhatsApp green (white on the darker green reads in daylight). :not(.link) matches the weight of
   the general `.btn:not(.ghost):not(.link)` rule above, so the green wins instead of the blue. */
.btn.wa:not(.link) {
  background: linear-gradient(180deg, #25D366 0%, #128C7E 100%);
  border: 1px solid #0f7a6d;
  color: #fff;
  box-shadow: 0 6px 18px rgba(18, 140, 126, 0.32);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
}
.btn.wa:not(.link):hover { background: linear-gradient(180deg, #2be070 0%, #0f7a6d 100%); }
.btn.wa.ghost, .btn.wa.sm.ghost { background: linear-gradient(180deg, #25D366 0%, #128C7E 100%); color: #fff; }
.btn.wa:not(.link):disabled { background: #9fd9c0; border-color: #9fd9c0; box-shadow: none; color: #fff; }
.btn.wa:not(.link) svg, .btn.wa:not(.link) .ic { color: #fff; fill: currentColor; }
.wa-ic { display: inline-flex; color: #25D366; }

/* A hidden button stays hidden (.btn sets display) */
.btn[hidden] { display: none !important; }

/* Timeline: a drive with no room for its own box is a line inside the visit; "now" sits in the hours column */
.timeline .block .leg-in { display: flex; align-items: center; gap: 4px; font-size: 0.7rem; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline .block .leg-in.late { color: var(--warn-text); }
.timeline .block .leg-in .travel-ic { width: 12px; height: 12px; display: inline-flex; color: var(--accent-text); flex-shrink: 0; }
.timeline .block .leg-in .travel-ic svg { width: 12px; height: 12px; }
.timeline .axis .now-ax { right: 0; z-index: 6; background: var(--danger); color: var(--on-accent); font-weight: 700; font-size: 0.68rem; padding: 1px 5px; border-radius: 999px; }
.timeline .now span { display: none; }

/* A phone showing a desktop-width page is zoomed back to its own width (index.html): full-height areas use the zoomed
   height, so the typing bar and buttons stay on screen */
html.phone-desktop .app, html.phone-desktop .screen { min-height: calc(100dvh / var(--zf, 1)); }
/* Screens with a typing bar: the accessibility button sits above it instead of over the send button */
body:has(.composer) .a11y-fab { bottom: calc(176px + env(safe-area-inset-bottom)); }
