/* Pacific Blue Pool Care — customer PWA
   Warm sand + lagoon teal. Mobile-first, installable. */
:root {
  --ink: #10242c;
  --ink-soft: #3d555e;
  --muted: #6b7f86;
  --line: rgba(16, 36, 44, 0.1);
  --sand: #f3eee6;
  --sand-2: #e8e0d2;
  --paper: #fbfaf7;
  --white: #ffffff;
  --deep: #0b3a4a;
  --deep-2: #0f4a5c;
  --teal: #147a8a;
  --aqua: #2eb8c8;
  --aqua-2: #7ee0ea;
  --gold: #e8b86d;
  --danger: #b42318;
  --ok: #1b7a4a;
  --shadow: 0 10px 30px rgba(11, 58, 74, 0.12);
  --radius: 18px;
  --font: "Outfit", system-ui, sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: calc(64px + env(safe-area-inset-bottom, 0px));
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--sand);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { max-width: 100%; display: block; }
a { color: var(--teal); }
.app { min-height: 100%; }
.hidden { display: none !important; }

/* ===== Login ===== */
.login {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(11,58,74,0.35) 0%, rgba(11,58,74,0.72) 48%, #0b3a4a 100%),
    url("../images/hero-water.jpg") center/cover no-repeat;
  color: #fff;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 22px calc(28px + env(safe-area-inset-bottom, 0px));
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand img { width: 48px; height: 48px; border-radius: 12px; }
.login-brand h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.login-brand small { display: block; font-family: var(--font); font-size: 0.72rem; opacity: 0.75; font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; }
.login-hero { margin-top: auto; padding-top: 48px; }
.login-hero p.kicker {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--aqua-2);
  margin-bottom: 10px;
}
.login-hero h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 8vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  max-width: 16ch;
}
.login-card {
  margin-top: 28px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 22px;
  padding: 20px 18px 18px;
  box-shadow: var(--shadow);
}
.login-card label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin: 10px 0 6px;
}
.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
.login-card input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20,122,138,0.15); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border-radius: 14px;
  padding: 13px 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.btn-primary { background: var(--deep); color: #fff; }
.btn-primary:hover { background: var(--deep-2); }
.btn-primary:disabled { opacity: 0.55; }
.btn-ghost {
  background: transparent;
  color: var(--teal);
  border: 1px solid rgba(20,122,138,0.25);
}
.btn-danger { background: #fff; color: var(--danger); border: 1px solid rgba(180,35,24,0.2); }
.login-card .btn-primary { margin-top: 16px; }
.login-error { color: var(--danger); font-size: 0.85rem; margin-top: 8px; min-height: 1.2em; }
.demo-hint {
  margin-top: 14px;
  background: var(--sand);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.demo-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  background: #fff;
  padding: 1px 5px;
  border-radius: 4px;
}
.demo-hint + .demo-hint { margin-top: 8px; }

/* ===== Shell ===== */
.shell {
  min-height: 100dvh;
  padding-bottom: var(--nav-h);
  background: var(--sand);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: color-mix(in srgb, var(--sand) 86%, transparent);
  backdrop-filter: blur(14px);
}
.topbar .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar img.mark { width: 36px; height: 36px; border-radius: 10px; }
.topbar .who h1 {
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .who span { display: block; font-size: 0.72rem; color: var(--muted); }
.pill {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #fff;
  color: var(--teal);
  border-radius: 999px;
  padding: 4px 8px;
  border: 1px solid var(--line);
}
.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(251,250,247,0.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 0;
}
.nav button svg { width: 22px; height: 22px; }
.nav button.active { color: var(--deep); }
.view { padding: 8px 16px 24px; display: none; }
.view.active { display: block; }

/* ===== Cards / typography ===== */
.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  min-height: 200px;
  color: #fff;
  padding: 22px 20px 18px;
  background: #0b3a4a center/cover no-repeat;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.hero-card::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,58,74,0.15), rgba(11,58,74,0.78));
}
.hero-card > * { position: relative; z-index: 1; }
.hero-card .label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--aqua-2);
  margin-bottom: 4px;
}
.hero-card h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.85rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.hero-card p { margin-top: 6px; font-size: 0.9rem; opacity: 0.9; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 22px 2px 10px;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 14px 14px;
  box-shadow: 0 1px 0 rgba(16,36,44,0.04);
  border: 1px solid rgba(16,36,44,0.05);
}
.card + .card { margin-top: 10px; }
.card-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.thumb {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--sand-2);
}
.card h3 { font-size: 1rem; font-weight: 650; letter-spacing: -0.02em; }
.card .meta { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.amount { font-weight: 700; letter-spacing: -0.02em; }
.amount.due { color: var(--deep); }
.amount.paid { color: var(--ok); }
.status {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 8px;
}
.status.open { background: #fff3d6; color: #8a5a00; }
.status.paid { background: #e3f6ea; color: var(--ok); }
.status.done { background: #e7f6f8; color: var(--teal); }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.stat {
  background: var(--paper);
  border-radius: 16px;
  padding: 14px;
  border: 1px solid rgba(16,36,44,0.05);
}
.stat b { display: block; font-size: 1.15rem; letter-spacing: -0.03em; }
.stat span { font-size: 0.75rem; color: var(--muted); }

/* ===== Visit detail ===== */
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--teal);
  margin-bottom: 8px;
  padding: 4px 0;
}
.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.photo-grid img, .photo-grid .photo {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 14px;
  background: var(--sand-2);
}
.photo-grid img:first-child, .photo-grid .photo:first-child {
  grid-column: 1 / -1;
  aspect-ratio: 16/10;
}
.check-list { list-style: none; margin: 8px 0 0; }
.check-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
.check { width: 20px; height: 20px; border-radius: 6px; flex: 0 0 auto; margin-top: 1px; display: grid; place-items: center; }
.check.on { background: var(--teal); color: #fff; }
.check.off { background: #fff; border: 1px solid var(--line); color: transparent; }
.chem-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.chem {
  background: var(--sand);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.chem b { display: block; font-size: 0.95rem; }
.chem span { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* ===== Booking ===== */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head h3 { font-family: var(--serif); font-weight: 500; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}
.cal-grid .dow { font-size: 0.68rem; color: var(--muted); font-weight: 650; padding: 6px 0; }
.cal-grid button.day {
  aspect-ratio: 1;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
}
.cal-grid button.day:disabled { color: #c5cdcf; }
.cal-grid button.day.avail:hover { background: #e7f6f8; }
.cal-grid button.day.selected { background: var(--deep); color: #fff; }
.cal-grid button.day.today { box-shadow: inset 0 0 0 1.5px var(--teal); }
.field { margin-top: 12px; }
.field label { display: block; font-size: 0.75rem; font-weight: 650; color: var(--muted); margin-bottom: 6px; }
.field select, .field textarea, .field input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
.field textarea { min-height: 88px; resize: vertical; }
.booked-list { margin-top: 8px; }
.toast {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(var(--nav-h) + 12px);
  background: var(--deep);
  color: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 40;
  font-size: 0.9rem;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
}
.toast.show { transform: none; opacity: 1; }

/* ===== Pay / Stripe test checkout ===== */
.pay-banner {
  background: #fff8e6;
  color: #6a4b00;
  border: 1px solid #f0d48a;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.8rem;
  margin-bottom: 12px;
}
.checkout {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(16,36,44,0.46);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.checkout-sheet {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
}
.checkout-sheet h3 { font-family: var(--serif); font-weight: 500; font-size: 1.4rem; }
.checkout-sheet .sub { color: var(--muted); font-size: 0.85rem; margin: 4px 0 14px; }
.stripe-mark {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.75rem; color: var(--muted); margin-bottom: 8px;
}
.card-fields { display: grid; gap: 8px; }
.card-fields input {
  width: 100%;
  border: 1px solid #d6dce0;
  border-radius: 10px;
  padding: 12px;
  background: #fafbfc;
}
.card-fields .row { display: grid; grid-template-columns: 1fr 1fr 0.8fr; gap: 8px; }
.checkout-sheet .btn-primary { margin-top: 14px; }

/* ===== Tech ===== */
.tech-hero { margin-bottom: 14px; }
.check-edit li { cursor: pointer; }
.photo-add {
  display: grid;
  place-items: center;
  border: 1.5px dashed rgba(20,122,138,0.4);
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 650;
  background: #fff;
}
.photo-add input { display: none; }
.chem-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chem-edit label { font-size: 0.72rem; color: var(--muted); font-weight: 650; }
.chem-edit input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; margin-top: 4px; }

.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,0.88);
  display: grid; place-items: center;
  padding: 24px;
}
.lightbox img { max-height: 90dvh; border-radius: 8px; }
.account p { color: var(--ink-soft); font-size: 0.92rem; }
.account .card + .card { margin-top: 10px; }

@media (min-width: 720px) {
  .shell, .login { max-width: 480px; margin: 0 auto; }
  body { background: #d9e2e4; }
  .shell { box-shadow: var(--shadow); }
  .nav, .topbar { max-width: 480px; left: 50%; transform: translateX(-50%); width: 100%; }
  .checkout-sheet { border-radius: 22px; margin-bottom: 24px; }
}
