/* Shared stylesheet across index.html (merchant PWA), admin.html (Lead
   Harvest control panel), and signup.html (public customer enrollment).
   Kept intentionally plain — no framework, no build step. */

:root {
  --color-bg: #f7f7f8;
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
  --color-muted: #6b6b6b;
  --color-primary: #1a56db;
  --color-border: #e2e2e5;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

.screen {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
}

button.primary,
a.primary {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.muted {
  color: var(--color-muted);
  font-size: 14px;
}

/* Admin control panel — wider than the mobile-first .screen container used
   by the merchant PWA and signup page. */

.admin-shell {
  max-width: 960px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px 20px 60px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.top-bar h1 {
  font-size: 20px;
  margin: 0;
}

button.secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

button.secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.danger {
  background: #fff;
  color: #b91c1c;
  border: 1px solid #f3caca;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

button.link {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  text-decoration: underline;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}

.admin-table tr:hover td {
  background: #fafafa;
  cursor: pointer;
}

.admin-table.static tr:hover td {
  cursor: default;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge.active {
  background: #dcfce7;
  color: #166534;
}

.badge.suspended {
  background: #fef3c7;
  color: #92400e;
}

.badge.cancelled {
  background: #f3f4f6;
  color: #4b5563;
}

.badge.draft {
  background: #dbeafe;
  color: #1e40af;
}

.badge.published {
  background: #dcfce7;
  color: #166534;
}

.badge.superseded {
  background: #f3f4f6;
  color: #4b5563;
}

.error-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}

.success-banner {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}

.section {
  margin-top: 28px;
}

.section h2 {
  font-size: 16px;
  margin-bottom: 12px;
}

.slot-preview {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  object-fit: cover;
  background: var(--color-bg);
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

/* Merchant PWA — PIN entry, home, scan, mobile entry, punch card, admin
   overview (index.html/index.js). */

#pin-input {
  width: 100%;
  padding: 14px;
  font-size: 24px;
  text-align: center;
  letter-spacing: 8px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 24px;
}

.home-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px 16px;
  font-size: 32px;
  cursor: pointer;
}

.home-btn span {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.template-card {
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.template-card.selected {
  border-color: var(--color-primary);
  border-width: 2px;
}

.scan-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 12px;
}

.scan-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  inset: 15%;
  border: 3px solid #fff;
  border-radius: 12px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.punch-card {
  border-radius: var(--radius);
  padding: 20px;
  color: #fff;
  margin-top: 16px;
}

.punch-card-header {
  font-size: 18px;
  font-weight: 700;
}

.punch-card-sub {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 14px;
}

.punch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 10px;
}

.punch-slot {
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  cursor: pointer;
}

.punch-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.punch-slot.filled {
  background: rgba(255, 255, 255, 0.9);
}

.confirm-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.stat-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
}

.stat-label {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 4px;
}

/* Customer signup page (signup.html/signup.js) */

.consent-group label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

.consent-group input[type="checkbox"] {
  width: auto;
  margin-top: 2px;
}

.wallet-pending {
  margin-top: 16px;
  border-style: dashed;
}

/* Admin messaging section (message rules) */

.weekday-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.rule-body-preview {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
