/* PoolSheet — mobile-first, big tap targets, plain language. */
:root {
  --blue: #0b6e99;
  --blue-dark: #085a80;
  --ink: #17303c;
  --muted: #5c7480;
  --line: #d7e3e8;
  --bg: #f4f8fa;
  --card: #ffffff;
  --good: #177245;
  --warn: #b45309;
  --bad: #b3261e;
  --amber: #f5b301;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.45;
  padding-bottom: 92px;
}
button, input, select, textarea { font: inherit; }
a { color: var(--blue); }

/* ---------- top bar / tab bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--blue); color: #fff;
  padding: 12px 16px;
}
.topbar-name { display: block; font-weight: 700; font-size: 19px; }
.topbar-sub { display: block; font-size: 13px; opacity: .85; }
.logout-form { margin: 0; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-btn {
  flex: 1; min-height: 58px; border: 0; background: none;
  font-size: 15px; font-weight: 600; color: var(--muted);
  border-top: 3px solid transparent; cursor: pointer;
}
.tab-btn.active { color: var(--blue); border-top-color: var(--blue); }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 10px; }

/* ---------- layout & cards ---------- */
#main { max-width: 760px; margin: 0 auto; padding: 14px 14px 6px; }
.tab-page h2 { font-size: 22px; margin: 6px 0 12px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 12px;
}
.stat-row { display: flex; gap: 10px; }
.stat {
  flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; text-align: center;
}
.stat .num { font-size: 24px; font-weight: 800; color: var(--blue-dark); }
.stat .lbl { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:active { background: var(--blue-dark); }
.btn-good { background: var(--good); border-color: var(--good); color: #fff; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.6); color: #fff; min-height: 40px; }
.btn-small { min-height: 40px; padding: 6px 12px; font-size: 15px; }
.btn-big { width: 100%; font-size: 18px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn-row .btn { flex: 1; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
textarea { min-height: 72px; }
.notice { background: #e6f4ea; border: 1px solid #a3d9b1; color: #14532d; border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.error { background: #fdecea; border: 1px solid #f2b8b5; color: var(--bad); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 36px 16px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 26px 22px; }
.brand { font-size: 34px; font-weight: 800; color: var(--blue); text-align: center; }
.brand-sub { text-align: center; color: var(--muted); margin-bottom: 8px; }
.auth-card h1 { font-size: 22px; text-align: center; }
.auth-link { text-align: center; }
.powered { text-align: center; color: var(--muted); font-size: 13px; margin-top: 18px; }

/* ---------- week strip & stops ---------- */
.week-strip { display: flex; gap: 6px; margin-bottom: 12px; }
.day-chip {
  flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 8px 2px; text-align: center; cursor: pointer; min-height: 62px;
}
.day-chip .dow { font-size: 13px; color: var(--muted); font-weight: 700; }
.day-chip .cnt { font-size: 17px; font-weight: 800; }
.day-chip .none { font-size: 12px; color: var(--muted); }
.day-chip.selected { border-color: var(--blue); background: #e8f3f8; }
.day-chip.today { box-shadow: inset 0 0 0 2px var(--amber); }
.stop-card { display: flex; gap: 10px; align-items: flex-start; }
.stop-num {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.stop-main { flex: 1; min-width: 0; }
.stop-name { font-weight: 700; font-size: 18px; }
.stop-addr { color: var(--muted); font-size: 15px; }
.chip {
  display: inline-block; font-size: 13px; font-weight: 700; border-radius: 999px;
  padding: 2px 10px; background: #eef3f5; color: var(--muted);
}
.chip.in_progress { background: #fef3c7; color: var(--warn); }
.chip.completed { background: #e6f4ea; color: var(--good); }
.chip.skipped { background: #fdecea; color: var(--bad); }
.drag-handle {
  flex: 0 0 auto; cursor: grab; touch-action: none; user-select: none;
  font-size: 22px; color: var(--muted); padding: 6px 8px; min-height: 48px;
}
.stop-card.dragging { opacity: .5; }
.stop-card.drop-target { outline: 2px dashed var(--blue); }
.order-btns { display: flex; flex-direction: column; gap: 4px; }
.order-btns .btn { min-height: 36px; padding: 2px 10px; }

/* ---------- sheet (service form / dialogs) ---------- */
#sheet {
  position: fixed; inset: 0; z-index: 40; background: rgba(10, 30, 40, .5);
  display: flex; align-items: flex-end; justify-content: center;
}
#sheet .sheet-card {
  background: #fff; width: 100%; max-width: 760px; max-height: 92vh;
  overflow-y: auto; border-radius: 18px 18px 0 0; padding: 18px 16px 28px;
}
.check-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.check-row input { width: 26px; height: 26px; min-height: 26px; }
.reading-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.flag-ok { color: var(--good); font-weight: 700; }
.flag-low, .flag-high { color: var(--warn); font-weight: 700; }
.chem-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 8px; }
.chem-row select { flex: 2; }
.chem-row input { flex: 1; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.money-num { font-weight: 800; }

/* ---------- route view toggle & map (Phase 2a) ---------- */
.view-toggle {
  display: flex; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; margin-bottom: 12px; background: #fff;
}
.vt-btn {
  flex: 1; min-height: 48px; border: 0; background: #fff; cursor: pointer;
  font-weight: 600; color: var(--muted);
}
.vt-btn + .vt-btn { border-left: 1px solid var(--line); }
.vt-btn.active { background: var(--blue); color: #fff; }
#route-map {
  height: 340px; border-radius: 14px; border: 1px solid var(--line);
  background: #e8f3f8; z-index: 0;
}
.pin-wrap { background: none; border: none; }
.pin {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue); color: #fff; font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .45);
}
.pin.selected { background: var(--amber); color: var(--ink); transform: scale(1.18); }
.stop-card.selected { outline: 3px solid var(--amber); }
.pin-card { margin-top: 12px; }
.pin-card-num { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pin-card-name { font-size: 23px; font-weight: 800; line-height: 1.2; }
.chip.demo { background: #fef3c7; color: var(--warn); }
.demo-card { border-color: var(--amber); }

/* ---------- photos, quotes (Phase 2b) ---------- */
.photo-kind { margin: 12px 0 6px; font-size: 15px; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-cell img {
  width: 100%; border-radius: 10px; border: 1px solid var(--line);
  display: block; aspect-ratio: 4 / 3; object-fit: cover; background: #e8f3f8;
}
.photo-cell .btn { width: 100%; margin-top: 6px; }
.photo-add { margin-top: 8px; cursor: pointer; }
.chip.sent { background: #e8f3f8; color: var(--blue-dark); }
.chip.accepted { background: #e6f4ea; color: var(--good); }
.chip.declined { background: #fdecea; color: var(--bad); }
.chip.converted { background: #e6f4ea; color: var(--good); }
.quote-item-row { display: flex; gap: 8px; margin-top: 8px; }
.quote-item-row input { min-height: 48px; }
