:root {
  --ink: #1c1917;
  --muted: #6b6560;
  --line: #e6e6e0;
  --bg: #ffffff;
  --panel: #ffffff;
  --brand: #4d7c0f;
  --brand-dark: #3f6212;
  --brand-light: #84cc16;
  --brand-tint: #f7fee7;
  --success: #15803d;
  --success-bg: #dcfce7;
  --error: #b91c1c;
  --error-bg: #fee2e2;
  --warning: #92400e;
  --warning-bg: #fef3c7;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---- header ---- */
.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 100;
}
.site-header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 40px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img {
  width: 38px; height: 38px; object-fit: contain;
  backface-visibility: visible; /* shows the mirrored back face instead of hiding it */
}

/* Corner-bracket hover effect, ported from the Photobook App: two crop-mark
   style brackets (top-right, bottom-left) that elongate on hover, growing
   toward each other around the whole logo + name. Client-side header only
   (scoped to .site-header) - the admin sidebar's brand link keeps its
   plain look. */
.site-header .brand {
  position: relative;
  padding: 6px 16px;
}
.site-header .brand::before,
.site-header .brand::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--brand);
  transition: width 0.35s ease-in-out, height 0.35s ease-in-out;
}
.site-header .brand::before {
  top: -6px;
  right: -6px;
  border-width: 2px 2px 0 0; /* top + right edge */
  border-top-right-radius: 6px;
}
.site-header .brand::after {
  bottom: -6px;
  left: -6px;
  border-width: 0 0 2px 2px; /* bottom + left edge */
  border-bottom-left-radius: 6px;
}
.site-header .brand:hover::before,
.site-header .brand:hover::after {
  width: 50%; /* horizontal edge reaches the halfway point of the brand block; right/left stay anchored so it grows toward the middle */
  height: 56px; /* vertical edge elongates ~4x on hover; top/bottom stay anchored so it grows toward the middle */
}

/* Logo does a continuous 360deg mirror spin while the brand block is
   hovered. rotateY turns the logo around its vertical axis (left edge
   leads, moving left-to-right) so partway through the turn you see its
   mirrored back face, like a spinning coin, rather than a flat 2D
   rotation. */
.brand:hover img {
  animation: brand-logo-spin 4s linear infinite;
}
@keyframes brand-logo-spin {
  to { transform: perspective(400px) rotateY(360deg); }
}
.nav-links { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.nav-links a { color: var(--ink); font-weight: 500; text-decoration: none; }
.nav-links a:hover { color: var(--brand-dark); text-decoration: none; }

/* "About"/"Animal Care" dropdowns - stay open for exactly as long as the pointer/focus is
   over the toggle word or the menu itself. No margin-top gap between them (the menu sits
   flush at top: 100%) - a gap there is a dead zone where the pointer is over neither box,
   which breaks :hover before the mouse ever reaches the links. Opens with a gradual 0.5s
   grow-down (max-height); the transition lives only on the :hover/:focus-within rule, so
   closing (the base rule has no transition) is instant instead of lagging shut. */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  position: absolute; top: 100%; left: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  min-width: 190px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  z-index: 20;
  overflow: hidden;
  max-height: 0; opacity: 0; padding: 0 6px;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  max-height: 280px; opacity: 1; padding: 6px;
  transition: max-height 0.5s ease, opacity 0.5s ease, padding 0.5s ease;
}
.nav-dropdown-menu a {
  display: block; padding: 8px 10px; border-radius: 6px; font-weight: 500;
}
.nav-dropdown-menu a:hover { background: var(--brand-tint); text-decoration: none; }

/* ---- layout ---- */
main.page { padding: 32px 0 64px; }
.site-footer {
  padding: 24px 0; text-align: center; color: var(--muted); font-size: 0.85rem;
  border-top: 1px solid var(--line); margin-top: 40px;
}

/* ---- alerts / flash ---- */
.alert {
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 0.92rem;
}
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--error-bg); color: var(--error); }

/* ---- buttons ---- */
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  font-weight: 600; font-size: 0.92rem; cursor: pointer; background: var(--brand); color: #fff;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn-secondary { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: #f3f4f1; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; text-align: center; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ---- forms ---- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.88rem; }
.field .hint { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search],
input[type=number], input[type=datetime-local], input[type=date], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.95rem; font-family: inherit; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, input[type=tel]:focus,
input[type=number]:focus, input[type=datetime-local]:focus, input[type=date]:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(132, 204, 22, 0.25);
}
.form-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; max-width: 560px;
}
.form-card.wide { max-width: 760px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }

/* ---- client login/register pages - centers the form-card on the page (the shared
   .container is much wider and left-aligns block content by default) ---- */
.auth-page { max-width: 420px; margin: 24px auto 48px; }
.auth-page h1, .auth-page > p { text-align: center; }

/* ---- "or" divider + Google sign-in button (client login/register only) ---- */
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: 0.82rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 600; font-size: 0.92rem; cursor: pointer;
}
.btn-google:hover { border-color: var(--brand); background: var(--brand-tint); }
.btn-google svg { width: 18px; height: 18px; }
.checkbox-row input { width: auto; }

/* ---- page/section toolbars + stat tiles (used by both the admin panel and the client dashboard) ---- */
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px 20px; }
.admin-section { margin-bottom: 32px; }
.admin-section h2 { font-size: 1.1rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
@media (max-width: 460px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card {
  display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; color: inherit; text-decoration: none;
}
.stat-card .value { font-size: 1.6rem; font-weight: 700; }
.stat-card .label { color: var(--muted); font-size: 0.82rem; }
a.stat-card:hover { border-color: var(--brand); text-decoration: none; }

/* ---- cards / grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; padding: 20px;
}
.card h3 { font-size: 1.05rem; }
.price { font-weight: 700; color: var(--brand-dark); }
.muted { color: var(--muted); font-size: 0.85rem; }

/* ---- staff/associate photos (public Staff & Associates page + admin previews) - rounded square, not circular ---- */
.staff-photo {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: 16px; margin-bottom: 12px; background: var(--brand-tint);
}
.admin-photo-preview {
  width: 120px; height: 120px; object-fit: cover; border-radius: 12px;
  display: block; margin-bottom: 8px; border: 1px solid var(--line);
}

/* ---- hero ---- */
.hero {
  background: linear-gradient(135deg, var(--brand-tint), var(--bg));
  border: 1px solid var(--line);
  border-radius: var(--radius); padding: 48px 32px; margin-bottom: 36px;
  display: flex; align-items: center; gap: 32px; flex-wrap: wrap;
}
.hero-text { flex: 1; min-width: 260px; }
.hero-text h1 { font-size: 2rem; }
.hero img.logo { width: 140px; height: 140px; object-fit: contain; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
th { background: var(--brand-tint); font-weight: 600; }
tr:last-child td { border-bottom: none; }

/* ---- inline row actions (a link + one or more one-button forms, kept on one line) ---- */
.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; white-space: nowrap; }
.row-actions form { display: inline; }
/* Accounts list: up to five action buttons per row - a little tighter so a row stays on one line. */
.accounts-table th, .accounts-table td { padding-left: 10px; padding-right: 10px; }
.accounts-table .row-actions { gap: 6px; }

/* ---- status badges ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; text-transform: capitalize; white-space: nowrap; line-height: 1.4; }
.badge-pending, .badge-unpaid, .badge-vet_assigned, .badge-awaiting_verification { background: var(--warning-bg); color: var(--warning); }
.badge-confirmed, .badge-reviewed, .badge-under_review { background: #dbeafe; color: #1e40af; }
.badge-completed, .badge-paid, .badge-success, .badge-waived, .badge-accepted { background: var(--success-bg); color: var(--success); }
.badge-cancelled, .badge-failed, .badge-rejected { background: var(--error-bg); color: var(--error); }

/* ---- uploader (virtual consultation media) ---- */
.uploader { border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; }
.uploader.dragover { border-color: var(--brand); background: var(--brand-tint); }
.file-list { margin-top: 10px; font-size: 0.85rem; color: var(--muted); }

/* ---- media gallery ---- */
.media-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.media-grid img, .media-grid video { width: 140px; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* ---- farm-visit estimate box ---- */
.estimate-box {
  background: var(--brand-tint); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 20px; margin: 16px 0;
}
.estimate-box .line { display: flex; justify-content: space-between; font-size: 0.92rem; padding: 3px 0; }
.estimate-box .total { font-weight: 700; font-size: 1.05rem; border-top: 1px solid rgba(0,0,0,0.1); margin-top: 8px; padding-top: 8px; }

.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: start; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* ---- Community Involvement: intro + evenly spaced program cards ----
   Wider screens: image beside the text, alternating sides. Phones: image on top at
   full card width, text below - every card the same padding and the same gap apart. */
.page-intro { margin-bottom: 0; line-height: 1.65; }
.section-heading { margin: 36px 0 16px; }
.program-list { display: grid; gap: 24px; }
.program-card {
  display: grid; grid-template-columns: 1fr 1fr; align-items: stretch;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.program-card.no-media { grid-template-columns: 1fr; }
.program-card-media { min-height: 240px; }
.program-card-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.program-card.reverse .program-card-media { order: 2; }
.program-card-body { padding: 24px 28px; align-self: center; }
.program-card-body h3 { margin: 0 0 10px; font-size: 1.2rem; }
.program-card-body p { margin: 0; line-height: 1.65; }
@media (max-width: 700px) {
  .program-card { grid-template-columns: 1fr; }
  .program-card.reverse .program-card-media { order: 0; }
  .program-card-media { min-height: 0; }
  .program-card-media img { height: 190px; }
  .program-card-body { padding: 18px 18px 20px; }
  .section-heading { margin: 28px 0 14px; }
  .program-list { gap: 18px; }
}

/* ---- Privacy Policy / Terms of Use ---- */
.legal { line-height: 1.65; }
.legal h2 { font-size: 1.1rem; margin: 26px 0 8px; }
.legal ul { padding-left: 20px; margin: 0 0 12px; }
.legal li { margin-bottom: 6px; }
.footer-links { margin-top: 6px; }
.footer-links a { color: inherit; text-decoration: underline; }

/* ---- Contact us: label / value rows ---- */
.contact-details { display: grid; grid-template-columns: max-content 1fr; gap: 12px 24px; margin: 0; }
.contact-details dt { font-weight: 600; color: var(--muted); }
.contact-details dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .contact-details { grid-template-columns: 1fr; gap: 2px; }
  .contact-details dd { margin-bottom: 12px; }
  .contact-details dd:last-child { margin-bottom: 0; }
}

/* ---- M-Pesa STK Push phone prompt (appears inline under a "Pay now" button) ---- */
.mpesa-prompt {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-top: 10px; max-width: 360px;
}
.mpesa-prompt label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.85rem; }
.mpesa-prompt-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.mpesa-cancel-btn {
  background: none; border: none; padding: 0; color: var(--muted); font-size: 0.85rem;
  cursor: pointer; text-decoration: underline;
}
.mpesa-error { color: var(--error); font-size: 0.85rem; margin-top: 8px; }
.mpesa-status { font-size: 0.9rem; }

/* ---- shared floating glass modal backdrop - used by the manual-Till poster below and the
   generic delete-confirmation dialog (see initConfirmDelete() in app.js) ---- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(28, 25, 23, 0.4);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
  animation: till-backdrop-in 0.18s ease-out;
}

/* ---- manual M-Pesa Till poster - floats as a glassy modal over the page (see ManualTillController) ---- */
.till-poster {
  position: relative;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(28, 25, 23, 0.3), 0 2px 8px rgba(28, 25, 23, 0.08);
  padding: 22px 24px; width: 100%; max-width: 380px;
  animation: till-poster-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.till-modal-close {
  position: absolute; top: -14px; right: -14px; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line); border-radius: 50%;
  box-shadow: 0 4px 10px rgba(28, 25, 23, 0.2);
  font-size: 1.2rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0;
}
.till-modal-close:hover { color: var(--ink); border-color: var(--muted); }
.till-poster-badge {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; border-radius: 8px; padding: 12px 16px; text-align: center; margin-bottom: 14px;
}
.till-poster-label { display: block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.9; }
.till-poster-number { display: block; font-size: 1.9rem; font-weight: 800; letter-spacing: 0.05em; margin-top: 2px; }
.till-poster-steps { margin: 0 0 14px; padding-left: 20px; font-size: 0.85rem; color: var(--ink); }
.till-poster-steps li { margin-bottom: 4px; }
.till-poster label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.85rem; }
.till-poster-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 14px; }
.till-poster-actions .till-submit-btn, .till-poster-actions .till-done-btn { width: 100%; }
.till-cancel-btn {
  background: none; border: none; padding: 4px 8px; width: auto; text-align: center;
  color: var(--muted); font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: color 0.15s ease;
}
.till-cancel-btn:hover, .till-cancel-btn:focus-visible { color: var(--brand-dark); }
@keyframes till-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes till-poster-in { from { opacity: 0; transform: scale(0.94) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ---- Daraja payment popup - checkout-style card: channel rail on the left, merchant
   header with the client's email + amount, one screen at a time in the body
   (form -> waiting -> success/failed). See startDarajaPayment() in app.js. ---- */
.pay-popup-backdrop {
  background: rgba(15, 23, 12, 0.72);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  flex-direction: column;
}
.pay-popup-shell {
  position: relative; width: 100%; max-width: 560px;
  animation: till-poster-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.pay-popup {
  display: grid; grid-template-columns: 150px 1fr;
  background: #fff; border-radius: 8px; overflow: hidden;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
  min-height: 360px;
}
.pay-popup-close {
  position: absolute; top: -12px; right: -12px; z-index: 1;
  width: 30px; height: 30px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: none; color: var(--ink);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-size: 1.25rem; line-height: 1; cursor: pointer;
}
.pay-popup-close:hover { color: var(--error); }

.pay-popup-rail { background: #f5f6f3; border-right: 1px solid var(--line); padding: 20px 0; }
.pay-popup-rail-title {
  margin: 0 0 10px; padding: 0 18px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.pay-popup-channel {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 18px; border: none; background: none; text-align: left;
  font: inherit; font-size: 0.88rem; font-weight: 600; color: var(--muted); cursor: default;
  border-left: 3px solid transparent;
}
.pay-popup-channel.is-active { background: #fff; color: var(--brand-dark); border-left-color: var(--brand); }
.pay-popup-channel-icon { display: inline-flex; color: var(--brand); }

.pay-popup-main { display: flex; flex-direction: column; min-width: 0; }
.pay-popup-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 24px; border-bottom: 1px solid var(--line);
}
.pay-popup-logo { height: 38px; width: auto; }
.pay-popup-meta { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; }
.pay-popup-email {
  font-size: 0.78rem; color: var(--muted);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pay-popup-amount { font-size: 0.9rem; color: var(--ink); }
.pay-popup-amount strong { color: var(--brand); font-weight: 800; }

.pay-popup-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px; }
.pay-popup-lead { margin: 0 0 18px; text-align: center; font-size: 0.95rem; font-weight: 600; color: var(--ink); }
.pay-popup-field { display: block; }
.pay-popup-field-label { display: block; margin-bottom: 6px; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.pay-popup-input {
  width: 100%; box-sizing: border-box; padding: 12px 14px;
  border: 1px solid #d4d4ce; border-radius: 6px; background: #fff;
  font: inherit; font-size: 1rem; letter-spacing: 0.03em; color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pay-popup-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(77, 124, 15, 0.18); }
.pay-popup-account {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--brand); border-radius: 6px; background: var(--brand-tint);
}
.pay-popup-account-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%; background: #fff; color: var(--brand);
}
.pay-popup-account-number { display: block; font-size: 1.05rem; font-weight: 700; letter-spacing: 0.04em; color: var(--ink); }
.pay-popup-account-label { display: block; font-size: 0.75rem; color: var(--muted); }
.pay-popup-form .pay-popup-link { display: block; margin: 14px auto 0; }
.pay-popup-error { margin: 8px 0 0; font-size: 0.82rem; color: var(--error); }
.pay-popup-submit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 18px; padding: 13px 16px;
  border: none; border-radius: 6px; background: var(--brand); color: #fff;
  font: inherit; font-size: 0.98rem; font-weight: 700; cursor: pointer;
  transition: background 0.15s ease;
}
.pay-popup-submit:hover:not(:disabled) { background: var(--brand-dark); }
.pay-popup-submit:disabled { opacity: 0.75; cursor: wait; }
.pay-popup-hint { margin: 12px 0 0; text-align: center; font-size: 0.78rem; color: var(--muted); line-height: 1.45; }

.pay-popup-status { text-align: center; }
.pay-popup-status-title { margin: 14px 0 6px; font-size: 1.05rem; color: var(--ink); }
.pay-popup-status-text { margin: 0; font-size: 0.88rem; color: var(--muted); line-height: 1.5; }
.pay-popup-actions { margin-top: 6px; }
.pay-popup-spinner {
  display: inline-block; width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid var(--brand-tint); border-top-color: var(--brand);
  animation: pay-popup-spin 0.9s linear infinite;
}
.pay-popup-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 54px; height: 54px; border-radius: 50%;
}
.pay-popup-icon.is-success { background: var(--success-bg); color: var(--success); }
.pay-popup-icon.is-failed { background: var(--error-bg); color: var(--error); }
.pay-popup-link {
  margin-top: 16px; padding: 4px; border: none; background: none;
  font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--brand); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.pay-popup-secured {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin: 14px 0 0; font-size: 0.78rem; color: rgba(255, 255, 255, 0.85);
}
.pay-popup-secured strong { color: #fff; }
@keyframes pay-popup-spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .pay-popup { grid-template-columns: 1fr; min-height: 0; }
  .pay-popup-rail { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-right: none; border-bottom: 1px solid var(--line); }
  .pay-popup-rail-title { margin: 0; padding: 0; }
  .pay-popup-channel { width: auto; padding: 6px 12px; border-left: none; border-radius: 6px; }
  .pay-popup-header, .pay-popup-body { padding-left: 18px; padding-right: 18px; }
  .pay-popup-close { top: -10px; right: -6px; }
}

/* ---- generic delete-confirmation dialog - same floating glass look as the Till poster,
   shown before any [data-confirm-delete] form submits (see initConfirmDelete() in app.js) ---- */
.confirm-dialog {
  position: relative;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(28, 25, 23, 0.3), 0 2px 8px rgba(28, 25, 23, 0.08);
  padding: 24px; width: 100%; max-width: 360px; text-align: center;
  animation: till-poster-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.confirm-dialog p { margin: 0 0 18px; font-size: 0.95rem; color: var(--ink); line-height: 1.5; }
.confirm-dialog-actions { display: flex; gap: 10px; justify-content: center; }

.spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(0,0,0,0.15);
  border-top-color: var(--brand); border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- booking time-slot picker (appointments/farm-visits) ---- */
.slot-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.slot-btn {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink); font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.slot-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-dark); }
.slot-btn.selected { background: var(--brand); color: #fff; border-color: var(--brand); }
.slot-btn:disabled, .slot-btn.slot-taken {
  background: var(--line); color: var(--muted); text-decoration: line-through; cursor: not-allowed;
}

/* ---- "View" / "View receipt" / report / "Edit" links - outlined rounded rectangle, bold text.
   On hover/focus the theme green sweeps in from the left and the text turns white. ---- */
a.link-pill {
  display: inline-block; padding: 4px 12px;
  border: 1.5px solid var(--brand); border-radius: 8px;
  background-color: transparent;
  background-image: linear-gradient(var(--brand), var(--brand));
  background-repeat: no-repeat; background-position: left center; background-size: 0% 100%;
  color: var(--brand-dark); font-weight: 700; line-height: 1.35;
  text-decoration: none; white-space: nowrap;
  transition: background-size 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.25s ease, border-color 0.25s ease;
}
a.link-pill:hover, a.link-pill:focus-visible {
  background-size: 100% 100%; border-color: var(--brand); color: #fff; text-decoration: none;
}
@media (prefers-reduced-motion: reduce) {
  a.link-pill, .site-header .nav-links, .admin-sidebar-nav { transition: none !important; }
}

/* ---- super admin: account search (Clients / Accounts pages) and account details ---- */
.account-search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
.account-search input[type="search"] { flex: 1 1 260px; max-width: 420px; }
.account-search-clear { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.account-details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.account-details dt { font-weight: 600; color: var(--muted); }
.account-details dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .account-details { grid-template-columns: 1fr; gap: 2px; }
  .account-details dd { margin-bottom: 8px; }
}

/* ======================================================================
   Responsive layout, by device class:
     phones          < 600px
     small tablets   600 - 767px
     large tablets   768 - 1023px   (phones + tablets use the menu button)
     laptops         1024 - 1599px  (full navigation bar)
     large monitors  1600 - 2399px
     TVs / 4K        2400px and up
   ====================================================================== */

/* Menu button - hidden on laptops and up; shared by the client header and the admin sidebar. */
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px; padding: 0 10px; flex-shrink: 0;
  background: transparent; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.nav-toggle-bar { display: block; height: 2px; border-radius: 2px; background: var(--ink); transition: transform 0.2s ease, opacity 0.2s ease; }
.nav-open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.admin-sidebar .nav-toggle { border-color: rgba(255, 255, 255, 0.45); }
.admin-sidebar .nav-toggle-bar { background: #fff; }

/* ---- phones + tablets: collapsible client navigation ---- */
@media (max-width: 1023.98px) {
  .site-header .bar { padding: 10px 24px; flex-wrap: wrap; gap: 8px; }
  .site-header .nav-toggle { display: inline-flex; }
  /* Slides down/up over 0.5s: max-height animates from 0 to the menu's measured
     height (--nav-open-h, set by initNavToggles() in app.js, capped to the screen). */
  .site-header .nav-links {
    display: flex; width: 100%; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 2px;
    padding: 0; border-top: 1px solid transparent; margin-top: 0;
    max-height: 0; overflow: hidden; visibility: hidden;
    transition: max-height 0.5s ease, padding 0.5s ease, margin-top 0.5s ease, border-color 0.5s ease, visibility 0s linear 0.5s;
  }
  .site-header.nav-open .nav-links {
    padding: 8px 0 12px; border-top-color: var(--line); margin-top: 6px;
    max-height: var(--nav-open-h, calc(100vh - 80px)); visibility: visible; transition-delay: 0s;
  }
  .site-header.nav-open .nav-links.nav-settled { overflow-y: auto; }
  .site-header .nav-links > a,
  .site-header .nav-dropdown > a { display: block; padding: 11px 6px; font-size: 1rem; }
  .site-header .nav-links > .btn,
  .site-header .nav-links form .btn { display: block; width: 100%; text-align: center; margin-top: 8px; padding: 11px; }
  .site-header .nav-links form { display: block !important; }
  /* Dropdowns become plain indented lists - no hover on touch screens. */
  .nav-dropdown-menu {
    position: static; max-height: none; opacity: 1; padding: 0 0 6px 14px;
    border: 0; border-left: 2px solid var(--brand-tint); border-radius: 0; box-shadow: none; min-width: 0;
  }
  .nav-dropdown:hover .nav-dropdown-menu,
  .nav-dropdown:focus-within .nav-dropdown-menu { max-height: none; padding: 0 0 6px 14px; transition: none; }
  .nav-dropdown-menu a { padding: 9px 10px; color: var(--muted); }
  /* The brackets' hover growth would overflow a narrow header. */
  .site-header .brand:hover::before,
  .site-header .brand:hover::after { width: 14px; height: 14px; }
  main.page { padding: 24px 0 48px; }
}

/* ---- phones ---- */
@media (max-width: 599.98px) {
  .site-header .bar { padding: 8px 14px; }
  .site-header .brand { padding: 6px 10px; gap: 8px; font-size: 1rem; }
  .brand img { width: 32px; height: 32px; }
  .container { padding: 0 14px; }
  main.page { padding: 18px 0 40px; }
  h1 { font-size: 1.45rem; }
  .hero { gap: 18px; }
  .hero-text h1 { font-size: 1.55rem; }
  .hero img.logo { width: 96px; height: 96px; }
  .form-card { padding: 18px 16px; }
  .admin-toolbar { align-items: flex-start; }
  .row-actions { flex-wrap: wrap; }
  table { font-size: 0.86rem; }
  th, td { padding: 8px 10px; }
  .till-poster, .confirm-dialog { padding: 20px 16px; }
  .account-search input[type="search"] { max-width: none; }
  /* 16px inputs stop iOS Safari from zooming into a field on focus. */
  input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search],
  input[type=number], input[type=datetime-local], input[type=date], textarea, select { font-size: 16px; }
}
@media (max-width: 359.98px) {
  .site-header .brand-name { font-size: 0.9rem; }
}

/* ---- large monitors ---- */
@media (min-width: 1600px) {
  .container { max-width: 1280px; }
  .site-header .bar { padding: 16px 56px; }
}

/* ---- TVs / 4K: scale everything up (rem/em-based sizes follow the root size) ---- */
@media (min-width: 2400px) {
  html { font-size: 125%; }
  .container { max-width: 1600px; }
  .brand img { width: 48px; height: 48px; }
}
@media (min-width: 3400px) {
  html { font-size: 150%; }
  .container { max-width: 2000px; }
}
