:root{
  --blue: #0094e9;
  --blue-dark: #0077bd;
  --blue-light: #cae6f8;
  --blue-pale: #eef7fd;
  --orange: #ff7f00;
  --orange-pale: #ffe8cc;
  --ink: #1a1a2e;
  --ink-soft: #4a4f5c;
  --gray: #666666;
  --gray-pale: #f4f4f4;
  --border: #dfe2e7;
  --green: #1e7d47;
  --green-pale: #e3f5ea;
  --red: #c0392b;
  --red-pale: #fbe4e2;
}

*{ box-sizing: border-box; }
body{
  margin: 0;
  background: #fbfbfa;
  color: var(--ink);
  font: 14px/1.5 -apple-system, "Segoe UI", sans-serif;
}

.topbar{
  border-bottom: 2px solid var(--blue);
  padding: 18px 28px;
}
.topbar-row{ display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logout-form{ display: flex; align-items: center; gap: 10px; margin: 0; }
.signed-in-as{ color: var(--gray); font-size: 0.78rem; }
.wordmark{ font-size: 1.1rem; font-weight: 700; color: var(--blue-dark); }
.wordmark.small{ font-size: 0.95rem; }
.wordmark .accent{ color: var(--orange); }
.wordmark .divider{ color: var(--gray); font-weight: 400; }

.brand{ display: flex; align-items: center; gap: 12px; }
.topbar-logo{ height: 44px; width: auto; display: block; }
.topbar-title{ font-size: 1.05rem; font-weight: 700; color: var(--blue-dark); }

.setup-note{ margin-top: 10px; color: var(--ink-soft); font-size: 0.8rem; }

.demo-banner{
  margin-top: 10px;
  background: var(--orange-pale);
  border-left: 4px solid var(--orange);
  color: #7a3d00;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
}

.tabs-row{ display: flex; gap: 8px; margin-bottom: 14px; }
.tab-btn{
  border: 1px solid var(--border); background: #fff; color: var(--ink-soft);
  border-radius: 20px; padding: 7px 16px; font-size: 0.82rem; font-weight: 600; cursor: pointer;
}
.tab-btn.active{ background: var(--blue); border-color: var(--blue); color: #fff; }
.tab-count{ opacity: 0.8; font-weight: 500; margin-left: 2px; }

.toolbar-row{ display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.search-input{
  flex: 1; max-width: 340px; border: 1px solid var(--border); border-radius: 6px;
  padding: 9px 12px; font-size: 0.85rem; color: var(--ink); background: #fff;
}
.search-input:focus{ outline: 2px solid var(--blue); outline-offset: 1px; }
.search-count{ margin: 0 0 12px; }
.page{ max-width: 980px; margin: 0 auto; padding: 28px; }
.page.narrow{ max-width: 460px; padding-top: 64px; }

table{ width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
thead th{
  text-align: left; background: var(--blue); color: #fff;
  font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 12px 16px; white-space: nowrap;
}
tbody td{ padding: 14px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr:nth-child(4n+1){ background: var(--gray-pale); }
.log-row td{ padding: 0 16px 10px; border-top: none; background: transparent !important; }
.log-row summary{ cursor: pointer; color: var(--gray); font-size: 0.78rem; }
.log-row pre{
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  font-size: 0.76rem; color: var(--ink-soft); background: var(--gray-pale);
  padding: 10px 12px; border-radius: 4px; margin: 6px 0 0;
}
.table-scroll{ width: 100%; overflow-x: auto; border-radius: 8px; }

.client-name{ font-weight: 600; }
.client-sub{ color: var(--gray); font-size: 0.8rem; }
.mono{ font-variant-numeric: tabular-nums; }
.amount{ font-weight: 600; }

.tier-pill, .status-pill{
  display: inline-block; padding: 4px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.tier-new{ background: var(--gray-pale); color: var(--ink-soft); }
.tier-returning{ background: var(--blue-pale); color: var(--blue-dark); }
.tier-trusted{ background: var(--blue-light); color: var(--blue-dark); }
.tier-flagged{ background: var(--orange-pale); color: #a05300; }

.status-gray{ background: var(--gray-pale); color: var(--ink-soft); }
.status-blue{ background: var(--blue-pale); color: var(--blue-dark); }
.status-orange{ background: var(--orange-pale); color: #a05300; }
.status-green{ background: var(--green-pale); color: var(--green); }
.status-red{ background: var(--red-pale); color: var(--red); }

.card-detail{ margin-top: 4px; color: var(--green); font-size: 0.72rem; font-variant-numeric: tabular-nums; }

/* Stands in for a "done!" confirmation after an action form's full-page reload lands back on
   the same row -- see the restore-scroll-position script in dashboard.html for why this exists. */
@keyframes rowFlash{
  0%{ background: var(--blue-light); }
  100%{ background: transparent; }
}
tr.row-flash{ animation: rowFlash 2.2s ease-out; }

.btn{
  border: none; border-radius: 5px; padding: 8px 14px;
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.btn-primary{ background: var(--blue); color: #fff; }
.btn-primary:hover{ background: var(--blue-dark); }
.btn-alert{ background: var(--orange); color: #fff; }
.btn-danger{ background: var(--red); color: #fff; }
.btn-danger:hover{ background: #a5311f; }
.btn-secondary{ background: var(--gray-pale); color: var(--ink); border: 1px solid var(--border); }
.btn.wide{ width: 100%; padding: 12px; font-size: 0.9rem; }

.actions{ display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.actions form{ margin: 0; display: flex; align-items: center; gap: 6px; }
.refund-note{ margin: 0; }
.refund-dollar{ color: var(--gray); font-size: 0.8rem; }
.refund-amount-input{
  width: 76px; border: 1px solid var(--border); border-radius: 5px;
  padding: 6px 8px; font-size: 0.8rem; font-variant-numeric: tabular-nums;
}
.refund-amount-input:focus{ outline: 2px solid var(--blue); outline-offset: 1px; }
.waiting, .done{ color: var(--gray); font-size: 0.8rem; }

.footnote{ margin-top: 20px; color: var(--gray); font-size: 0.8rem; }
.footnote code{ background: var(--gray-pale); padding: 1px 5px; border-radius: 3px; }

.card-page{
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 32px; text-align: center;
}
.card-page h1{ font-size: 1.3rem; margin: 14px 0 8px; }
.muted{ color: var(--gray); font-size: 0.85rem; }
.muted.small{ font-size: 0.76rem; margin-top: 14px; }
.fake-field{
  border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px;
  margin-top: 12px; font-size: 0.85rem; color: var(--ink-soft); text-align: left;
  font-variant-numeric: tabular-nums;
}
.fake-field-row{ display: flex; gap: 10px; }
.fake-field-row .fake-field{ flex: 1; }
form{ margin-top: 18px; }

/* Client-facing pages lead with the real logo rather than a text wordmark. */
.client-logo{ display:block; width:150px; max-width:60%; height:auto; margin:0 auto 4px; }

/* ---- Client receipt + tip page ------------------------------------------------------- */
.card-page.receipt{ text-align: left; }
.card-page.receipt .wordmark, .card-page.receipt h1, .card-page.receipt > .muted{ text-align: center; }

.notice{ border-radius: 6px; padding: 12px 14px; font-size: 0.85rem; margin-bottom: 18px; text-align: left; }
.notice-good{ background: var(--green-pale); color: var(--green); border-left: 4px solid var(--green); }
.notice-bad{ background: var(--red-pale); color: var(--red); border-left: 4px solid var(--red); }

.receipt-meta{ margin: 20px 0 0; display: grid; gap: 6px; }
.receipt-meta > div{ display: flex; justify-content: space-between; gap: 12px; font-size: 0.85rem; }
.receipt-meta dt{ color: var(--gray); margin: 0; }
.receipt-meta dd{ margin: 0; color: var(--ink); }

.receipt-items{ width: 100%; border: none; border-radius: 0; margin-top: 18px; background: transparent; }
.receipt-items td{ padding: 12px 0; border-top: 1px solid var(--border); vertical-align: top; }
.receipt-item-name{ font-weight: 600; }
.receipt-item-desc{ color: var(--gray); font-size: 0.78rem; margin-top: 4px; }
.receipt-item-amount{ text-align: right; white-space: nowrap; padding-left: 12px !important; }

.receipt-totals{ width: 100%; border: none; border-radius: 0; margin-top: 6px; background: transparent; }
.receipt-totals td{ padding: 8px 0; border-top: 1px solid var(--border); }
.receipt-totals td:last-child{ text-align: right; }
.receipt-total-row td{ font-weight: 700; font-size: 1.05rem; border-top: 2px solid var(--ink); }

.tip-block{ margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); text-align: center; }
.tip-block h2{ font-size: 1.05rem; margin: 0 0 6px; }
.tip-form{ margin-top: 16px; }
.tip-options{ display: flex; gap: 8px; margin-bottom: 10px; }
.tip-option{
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 8px; font-size: 0.95rem;
}
.tip-option:hover{ border-color: var(--blue); color: var(--blue-dark); }
.tip-option-sub{ font-size: 0.72rem; font-weight: 500; color: var(--gray); }

.tip-custom-form{ margin-top: 14px; }
.tip-custom-label{ display: block; color: var(--gray); font-size: 0.78rem; margin-bottom: 6px; }
.tip-custom-row{ display: flex; align-items: center; gap: 6px; justify-content: center; }
.tip-closed{ margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); text-align: center; }
.receipt-footer{ margin-top: 22px; text-align: center; }

@media (max-width: 420px){
  .tip-options{ flex-wrap: wrap; }
  .tip-option{ min-width: 30%; }
}

/* ---- Dashboard filters + paging ------------------------------------------------------ */
.filters-row{ display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 10px 0 6px; }
.filters-row label{ display: flex; flex-direction: column; gap: 3px; font-size: 0.75rem; color: var(--ink-soft); }
.filters-row select{ padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-size: 0.85rem; color: var(--ink); }
.pager{ display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.pager-buttons{ display: flex; gap: 8px; }
.btn:disabled{ opacity: 0.45; cursor: default; }
.off-schedule-note{ display: block; color: var(--red); font-weight: 600; font-size: 0.8rem; margin-bottom: 6px; }

/* ---- Receipt download / print --------------------------------------------------------- */
.receipt-download{ margin-top: 22px; text-align: center; }
.receipt-download p{ margin: 6px 0 0; }
/* The saved PDF is the receipt only: tip buttons and status banners are useless on paper,
   and a stale "Thank you for your tip" banner would be misleading in a filed copy. */
@media print{
  body{ background: #fff; }
  .no-print, .tip-block, .notice{ display: none !important; }
  .page{ padding: 0; max-width: none; }
  .card-page{ border: none; box-shadow: none; }
}
