/* ─── Tokens ─────────────────────────────────────────────── */
:root {
  --bg:          #f5efe6;
  --surface:     #fdfaf5;
  --surface-2:   #ede6da;
  --ink:         #2c1f14;
  --ink-2:       #6b5444;
  --accent:      #7a9e85;
  --accent-dk:   #5a7d64;
  --accent-soft: #d4e5d8;
  --danger:      #c0392b;
  --border:      rgba(44, 31, 20, 0.10);
  --border-md:   rgba(44, 31, 20, 0.16);
  --sh-sm:  0 2px 8px  rgba(84, 62, 43, 0.08);
  --sh-md:  0 6px 20px rgba(84, 62, 43, 0.10);
  --sh-lg:  0 16px 48px rgba(84, 62, 43, 0.18);
  --r:    14px;
  --r-sm: 8px;
  --r-lg: 22px;
  --r-xl: 28px;
  --tap:  56px;
  --safe-top:    env(safe-area-inset-top,    0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  color-scheme: light;
}

/* ─── Reset / Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;           /* no page scroll — ever */
  overscroll-behavior: none;  /* kill rubber-band / bounce */
  background: var(--bg);
  color: var(--ink);
}

button, input, textarea, select { font: inherit; color: inherit; }
button {
  border: none;
  cursor: pointer;
  background: none;
  touch-action: manipulation;          /* no 300ms delay on iOS */
  -webkit-tap-highlight-color: transparent; /* no tap flash */
}
a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea {
  outline: none;
  -webkit-appearance: none;           /* normalize iOS default styling */
}
textarea { resize: none; }

/* iOS Safari: prevent auto-zoom when focusing inputs with font-size < 16px */
@supports (-webkit-touch-callout: none) {
  .price-input { font-size: 16px; }
  .notes-input { font-size: 16px; }
}

/* ─── App Shell ──────────────────────────────────────────── */
#app {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

/* On tall desktops with a mouse: cap at iPhone size, center it, add phone chrome.
   pointer:fine excludes real iPads (touch). body.ipad-layout overrides below.
   min-width:800px excludes iPad-sized popups (768px wide) from getting phone chrome. */
@media (min-height: 880px) and (min-width: 800px) and (pointer: fine) {
  body {
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #app {
    top: 50%;
    transform: translate(-50%, -50%);
    height: 860px;
    border-radius: 44px;
    box-shadow: 0 0 0 10px #2a2a2a, 0 40px 80px rgba(0,0,0,0.5);
    overflow: hidden;
  }
}

/* ─── iPad layout (body.ipad-layout set by JS at ≥680px) ────────────────── */
body.ipad-layout {
  background: var(--bg);   /* reset dark phone-frame bg */
  display: block;
}
body.ipad-layout #app {
  position: fixed;
  inset: 0;
  transform: none;
  width: 100%;
  max-width: none;
  height: 100dvh;
  border-radius: 0;
  box-shadow: none;
}

/* Service grid: 2 cols portrait → 3 cols landscape → 4 cols large */
body.ipad-layout .service-grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) {
  body.ipad-layout .service-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
  body.ipad-layout .service-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Customer chip: left-aligned flex row with room for × change button */
body.ipad-layout .customer-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  overflow: visible;
  white-space: nowrap;
  font-size: 1rem;
}
body.ipad-layout .customer-chip small {
  display: inline;
  font-size: 0.82rem;
  font-weight: 400;
  /* opacity inherited from base .customer-chip small */
}

/* × change button — hidden on phone, pill-style on iPad */
.btn-change-cust { display: none; }
body.ipad-layout .btn-change-cust {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Sheets: cap width on iPad */
body.ipad-layout .sheet-panel {
  max-width: 600px;
  margin: 0 auto;
}

/* Edit-visit sheet on iPad: right-side panel, full height, checkout style */
body.ipad-layout #ev-sheet {
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-end;
}
body.ipad-layout #ev-sheet .sheet-panel {
  height: 100%;
  max-height: 100dvh;
  width: min(640px, 100%);
  max-width: none;
  margin: 0;
  border-radius: var(--r-xl) 0 0 var(--r-xl);
  transform: translateX(100%);
  padding-bottom: calc(var(--safe-bottom) + 12px);
}
body.ipad-layout #ev-sheet.open .sheet-panel {
  transform: translateX(0);
}

/* ─── Screens ────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;           /* fills #app exactly, not the viewport */
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  /* default: parked off-screen to the right */
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              opacity   0.24s cubic-bezier(0.4, 0, 0.2, 1);
}
.screen.active {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
.screen.slide-left {
  transform: translateX(-30%);
  opacity: 0;
  pointer-events: none;
}

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 18px) 20px 10px;
  background: var(--bg);
}
.topbar.slim {
  align-items: center;
  padding: calc(var(--safe-top) + 12px) 12px 10px;
  gap: 8px;
}
.brand {
  height: 36px;
  width: auto;
  display: block;
}
.env-badge {
  font-size: 0.58rem;
  font-weight: 800;
  color: #fff;
  background: #f0900a;
  padding: 2px 6px;
  border-radius: 100px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.date-pill {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  flex: 1;
  text-align: center;
}
.topbar-spacer { width: 40px; flex-shrink: 0; }

/* ─── Back button ────────────────────────────────────────── */
.btn-back {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  flex-shrink: 0;
  color: var(--ink);
}
.btn-back svg { width: 20px; height: 20px; }

/* ─── Customer chip (topbar) ─────────────────────────────── */
.customer-chip {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.customer-chip small {
  display: block;
  font-size: 0.74rem;
  font-weight: 400;
  /* inherit parent color so test-theme white topbar stays readable */
  opacity: 0.72;
}

/* ─── Search ─────────────────────────────────────────────── */
.search-wrap {
  flex-shrink: 0;
  position: relative;
  padding: 8px 16px 0;
}
.search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--ink-2);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: var(--tap);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 18px 0 44px;
  font-size: 1rem;
  box-shadow: var(--sh-sm);
  -webkit-appearance: none;
  appearance: none;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--sh-sm);
}

/* ─── Scroll panel (internal scroll only) ────────────────── */
.scroll-panel {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 16px 8px;
  scrollbar-width: none;        /* Firefox */
}
.scroll-panel::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.scroll-pad { height: 24px; }

/* ─── Customer list ──────────────────────────────────────── */
.customer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 16px;
  margin-bottom: 8px;
  box-shadow: var(--sh-sm);
  width: 100%;
  text-align: left;
  transition: background 0.15s, transform 0.1s;
}
.customer-item:active { transform: scale(0.98); background: var(--accent-soft); }
.customer-item strong { display: block; font-size: 1rem; font-weight: 700; }
.customer-item span   { font-size: 0.84rem; color: var(--ink-2); }

.empty-state {
  text-align: center;
  color: var(--ink-2);
  font-size: 0.9rem;
  padding: 40px 20px;
}

/* ─── Bottom bar ─────────────────────────────────────────── */
.bottom-bar {
  flex-shrink: 0;
  padding: 12px 16px calc(var(--safe-bottom) + 12px);
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.bottom-bar.single { }
.bottom-bar.cart-bar {
  display: none;     /* shown by JS */
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.cart-info { flex: 1; }
.cart-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 100px;
  padding: 2px 8px;
  margin-right: 6px;
}
.cart-sub {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  border-radius: var(--r-lg);
  font-size: 1rem;
  font-weight: 700;
  padding: 0 24px;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-primary  { background: var(--accent); color: #fff; box-shadow: var(--sh-sm); }
.btn-primary:active  { opacity: 0.85; transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.38; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border-md); box-shadow: var(--sh-sm); }
.btn-secondary:active { transform: scale(0.97); }
.full-width { width: 100%; }
.btn-link {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent-dk);
  padding: 4px 0;
}
.btn-link:active { opacity: 0.6; }

/* ─── Category strip ─────────────────────────────────────── */
.cat-strip {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px;
  scrollbar-width: none;
}
.cat-strip::-webkit-scrollbar { display: none; }
.cat-pill {
  flex-shrink: 0;
  height: 36px;
  padding: 0 16px;
  border-radius: 100px;
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s;
}
.cat-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}


/* ─── Service grid ───────────────────────────────────────── */
.service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  align-content: start;
}
.service-card {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r);
  padding: 14px 12px;
  text-align: left;
  box-shadow: var(--sh-sm);
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.service-card:active { transform: scale(0.97); }
.service-card.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.service-card .svc-name {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}
.service-card .svc-price {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent-dk);
}
.service-card .svc-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  display: none;
  place-items: center;
}
.service-card.selected .svc-check { display: grid; }
.service-card .svc-check::after {
  content: "";
  width: 6px;
  height: 10px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* ─── Checkout scroll panel ──────────────────────────────── */
/* ─── Checkout — fixed top (customer card + services label) ─ */
.co-top {
  flex-shrink: 0;
  padding: 10px 16px 0;
}
.co-services-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 0 6px;
}

/* ─── Checkout — scrollable items only ──────────────────────  */
.co-items {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 16px 8px;
  min-height: 0;   /* flex child must allow shrink below content size */
}
.co-items::-webkit-scrollbar { display: none; }

/* ─── Checkout — fixed bottom (payment + notes + totals) ───── */
.co-bottom {
  flex-shrink: 0;
  padding: 10px 16px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.co-totals {
  margin-top: 0;   /* override default .totals-block margin-top: 18px */
}
.fee-mode-row {
  min-height: 0;
}
.fee-mode-row:empty {
  display: none;
}
.fee-mode-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 2px 0 6px;
}
.fee-mode-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  vertical-align: middle;
}
.fee-mode-pillbox {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  gap: 2px;
}
.fee-mode-pill {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}
.fee-mode-pill.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-sm);
}
.fee-mode-hint {
  font-size: 0.72rem;
  color: var(--ink-2);
}

/* ─── Checkout summary card ──────────────────────────────── */
.checkout-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--sh-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.checkout-summary-card .csc-name {
  font-size: 1rem;
  font-weight: 700;
}
.checkout-summary-card .csc-phone {
  font-size: 0.84rem;
  color: var(--ink-2);
  margin-top: 2px;
}
.checkout-summary-card .csc-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* ─── iPad inline checkout extras ───────────────────────── */
/* Hidden on phone, shown on iPad via body.ipad-layout */
.co-contact-section { display: none; }
body.ipad-layout .co-contact-section {
  display: block;
  padding: 10px 0 6px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}
.co-contact-heading {
  display: block;
  margin-bottom: 8px;
}
.co-contact-fields {
  display: flex;
  gap: 12px;
}
.co-contact-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.co-contact-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.co-contact-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  font-size: 0.9rem;
  color: var(--ink);
  width: 100%;
}
.co-contact-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.co-contact-input.has-value {
  background: var(--surface);
  color: var(--ink);
}
/* Plain-text display when customer already has the value */
.co-val {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  padding: 7px 2px;
  line-height: 1.2;
}

/* Inline notes — appended at bottom of checkout-items on iPad */
.co-notes-inline { display: none; }
body.ipad-layout .co-notes-inline {
  display: block;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
body.ipad-layout .co-notes-inline .section-label {
  margin-bottom: 6px;
}
body.ipad-layout .co-notes-inline .notes-input {
  width: 100%;
  resize: none;
}

/* Hide notes popup button on iPad (notes are inline) */
body.ipad-layout #btn-notes { display: none; }

/* ─── Section headers ────────────────────────────────────── */
.section-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 18px 0 8px;
}
.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.label-opt {
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  font-style: normal;
  color: var(--ink-2);
  opacity: 0.7;
}

/* ─── Checkout items ─────────────────────────────────────── */
.checkout-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ci-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 12px 10px;
  box-shadow: var(--sh-sm);
}
.ci-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.ci-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
}
.ci-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  color: var(--ink-2);
  flex-shrink: 0;
}
.ci-remove:active { color: var(--danger); }

.ci-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* qty stepper */
.qty-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 2px;
}
.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--surface);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  display: grid;
  place-items: center;
}
.qty-val {
  width: 28px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
}
/* price field */
.price-wrap {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}
.price-display {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  cursor: text;
  min-width: 72px;
  text-align: right;
}
.price-display:focus-within,
.price-display.editing {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.price-input {
  width: 72px;
  border: none;
  background: transparent;
  text-align: right;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}
/* tax toggle */
.tax-toggle {
  flex-shrink: 0;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tax-toggle.taxable {
  background: var(--accent-soft);
  color: var(--accent-dk);
  border-color: var(--accent);
}

.ci-line-total {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-2);
  text-align: right;
  margin-top: 6px;
}

/* ─── Payment pills ──────────────────────────────────────── */
.payment-row {
  display: flex;
  gap: 8px;
}
.pay-pill {
  flex: 1;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--r);
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-2);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pay-pill.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink-2);
}
.pay-pill-main {
  display: block;
  line-height: 1.1;
  text-align: center;
}
.pay-pill-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.68rem;
  font-weight: 600;
  color: inherit;
  opacity: 0.8;
  text-align: center;
}

/* ─── Notes ──────────────────────────────────────────────── */
.notes-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink);
  box-shadow: var(--sh-sm);
}
.notes-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ─── Totals block ───────────────────────────────────────── */
.totals-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-top: 0;
  box-shadow: var(--sh-sm);
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 0.9rem;
}
.total-row span  { color: var(--ink-2); }
.total-row strong { font-weight: 600; color: var(--ink-2); }
.total-row.grand {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 10px;
}
.total-row.grand span,
.total-row.grand strong { font-size: 1.05rem; font-weight: 800; color: var(--ink); }
.total-row.grand span { font-size: 1.05rem; font-weight: 800; color: var(--ink); }

/* ─── New Customer Sheet ─────────────────────────────────── */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}
.sheet.open { pointer-events: auto; }
.sheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(44, 31, 20, 0);
  transition: background 0.3s;
}
.sheet.open .sheet-scrim { background: rgba(44, 31, 20, 0.45); }
.sheet-panel {
  position: relative;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 16px 20px calc(var(--safe-bottom) + 24px);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--sh-lg);
}
.sheet.open .sheet-panel { transform: translateY(0); }
.sheet-notch {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-2);
  margin: 0 auto 20px;
}
.sheet-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 18px;
}
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 0.76rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }
.req { color: var(--accent-dk); }
.text-input {
  height: 52px;
  border: 1px solid var(--border-md);
  border-radius: var(--r);
  background: var(--bg);
  padding: 0 14px;
  font-size: 1rem;
  color: var(--ink);
}
.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 10px;
  margin-top: 4px;
}

/* ─── Today button (customer topbar) ────────────────────── */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-history-icon {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: var(--sh-sm);
  color: var(--ink-2);
}
.btn-history-icon svg { width: 18px; height: 18px; }
.btn-history-icon:active { background: var(--accent-soft); }
.today-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 100px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--bg);
}

/* ─── History list ───────────────────────────────────────── */
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: var(--sh-sm);
  transition: background 0.12s, transform 0.1s;
}
.history-item:active { background: var(--accent-soft); transform: scale(0.98); }
.hi-left { flex: 1; min-width: 0; }
.hi-time { font-size: 0.72rem; font-weight: 700; color: var(--ink-2); letter-spacing: 0.04em; margin-bottom: 2px; }
.hi-name { font-size: 1rem; font-weight: 700; color: var(--ink); }
.hi-svc  { font-size: 0.8rem; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hi-right { flex-shrink: 0; text-align: right; }
.hi-total { font-size: 1rem; font-weight: 700; color: var(--ink); }
.hi-pay   { font-size: 0.76rem; color: var(--ink-2); margin-top: 2px; }

/* ─── Edit visit sheet ───────────────────────────────────── */
.sheet-tall {
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}
.ev-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 16px;
  flex-shrink: 0;
}
.ev-cname { font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.ev-meta  { font-size: 0.8rem; color: var(--ink-2); margin-top: 3px; }
.btn-ev-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--ink-2);
}
.btn-ev-close svg { width: 18px; height: 18px; }
.ev-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 0 8px;
}
.ev-scroll::-webkit-scrollbar { display: none; }
.ev-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 16px 0 8px;
}
.ev-totals { margin-top: 16px; }
.ev-actions {
  flex-shrink: 0;
  padding: 12px 0 calc(var(--safe-bottom) + 12px);
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* ─── Pull-to-refresh indicator ─────────────────────────── */
.ptr-indicator {
  overflow: hidden;
  height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--ink-2);
  flex-shrink: 0;
}

/* ─── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 90px);
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 100px;
  box-shadow: var(--sh-md);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 200;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { background: var(--accent-dk); }
.toast.error   { background: var(--danger); }

/* ─── Edit sheet service picker ──────────────────────────── */
.ev-service-picker {
  padding: 0 16px 4px;
}
.ev-svc-list {
  margin-top: 8px;
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: 12px;
  overflow: hidden;
  max-height: 240px;
  overflow-y: auto;
}
.ev-svc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  background: #fff;
  border: none;
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.07));
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.ev-svc-item:last-child { border-bottom: none; }
.ev-svc-item:active { background: var(--surface-2, #f0f0eb); }
.ev-svc-name { font-weight: 600; color: var(--ink); }
.ev-svc-price { color: var(--ink-2); font-size: 0.82rem; }

/* ─── Shadow / Baton indicator — centered pill in topbar ──────── */
#shadow-indicator {
  position: fixed;
  top: calc(var(--safe-top, 0px) + 20px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px 0 14px;
  background: #0a7874;         /* teal — contrasts against cream prod bg */
  border-radius: 100px;
  cursor: pointer;
  user-select: none;
  color: #fff;
  white-space: nowrap;
}
#shadow-status-text {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
#btn-pass-baton {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  pointer-events: none;
  color: rgba(255,255,255,0.75);
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
#btn-pass-baton svg { width: 16px; height: 16px; }
#shadow-indicator:hover { opacity: 0.88; }

/* ─── Shadow / Baton watcher mode ──────────────────────────── */
/* Disable all interactive elements except the Pass button */
.shadow-watching button:not(#btn-pass-baton),
.shadow-watching input,
.shadow-watching select,
.shadow-watching textarea {
  pointer-events: none;
  opacity: 0.82;
}

