* { box-sizing: border-box; }

:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --text: #1b1f23;
  --muted: #667085;
  --border: #d0d5dd;
  --primary: #111827;
  --primary-soft: #e5e7eb;
  --success-bg: #ecfdf3;
  --success-text: #027a48;
  --warning-bg: #fff7ed;
  --warning-text: #b54708;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

body { margin: 0; background: var(--bg); color: var(--text); font-family: Arial, Helvetica, sans-serif; }
.app-body { min-height: 100vh; }
.page-content { padding: 16px 16px 110px; }
.splash-body { background: linear-gradient(180deg, #111827 0%, #1f2937 100%); color: white; }
.splash-content { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-content { min-height: 100vh; display: flex; align-items: center; }
.container { max-width: 820px; margin: 0 auto; }

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.highlight {
  background: #eacf0f;
  color: #000;
  padding: 1px 3px;
  border-radius: 3px;
}
.splash-card, .login-card { max-width: 420px; width: 100%; margin-left: auto; margin-right: auto; }
.splash-card { text-align: center; color: #111; }

input, select, button, .button {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 16px;
}

input, select { padding: 12px 14px; margin-top: 8px; margin-bottom: 12px; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

button.secondary { background: var(--primary-soft); color: var(--text); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.helper { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.error-box, .success-box { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.error-box { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; }
.success-box { background: #ecfdf3; color: #027a48; border: 1px solid #abefc6; }

.user-chip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.user-chip-link { color: inherit; }

.install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 88px;
  z-index: 1000;
  background: rgba(17, 24, 39, 0.97);
  color: #fff;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,.2);
}
.install-banner.hidden { display: none; }
.install-banner-text p { margin: 6px 0 0; color: #d1d5db; }
.install-banner-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  z-index: 999;
}
.bottom-nav.bottom-nav-admin { grid-template-columns: repeat(5, 1fr); }

.bottom-nav-link {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; border-radius: 12px; background: var(--primary); color: #fff;
  text-decoration: none; font-size: 14px; font-weight: bold;
}
.bottom-nav-link:active { transform: scale(0.98); }

.scanner-header { display: flex; flex-direction: column; gap: 12px; }
.scanner-header h2 { margin: 0; }
.scanner-actions { display: grid; gap: 10px; }

#reader, #pastorReader { width: 100%; overflow: hidden; border-radius: 14px; margin-top: 12px; }
.person-card-header { display: flex; flex-direction: column; gap: 8px; }
.person-card-header h3 { margin: 0; font-size: 22px; }

.status-badge {
  display: inline-flex; align-self: flex-start; border-radius: 999px;
  padding: 6px 10px; font-size: 13px; font-weight: bold;
}
.status-checked { background: var(--success-bg); color: var(--success-text); }
.status-open { background: var(--warning-bg); color: var(--warning-text); }

.person-grid { display: grid; gap: 6px; margin-top: 12px; }
.person-grid p, .identity-line { margin: 0; line-height: 1.45; }

.card-actions { margin-top: 14px; }
.card-actions-stack { display: grid; gap: 8px; }

.error-card { border: 1px solid #fda29b; }
.results-summary-card { border: 2px solid var(--border); }
.duplicate-card { border: 2px solid #d0d5dd; }

.status-overlay {
  position: fixed; inset: 0; z-index: 9999; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease; display: flex; align-items: center; justify-content: center;
}
.status-overlay.show { opacity: 1; }
.status-overlay-content { text-align: center; color: #fff; padding: 24px; }
.status-icon { font-size: 96px; line-height: 1; font-weight: bold; margin-bottom: 12px; }
.status-message { font-size: 30px; font-weight: bold; letter-spacing: 0.3px; }
.status-success { background: rgba(34, 197, 94, 0.94); }
.status-warning { background: rgba(250, 204, 21, 0.94); }
.status-error { background: rgba(239, 68, 68, 0.94); }

@media (min-width: 720px) {
  .scanner-header { flex-direction: row; align-items: center; justify-content: space-between; }
  .scanner-actions { grid-template-columns: repeat(2, minmax(140px, 1fr)); width: 320px; }
  .person-card-header { flex-direction: row; align-items: center; justify-content: space-between; }
  .person-grid { grid-template-columns: 1fr 1fr; column-gap: 20px; }
  .install-banner { left: auto; right: 16px; width: 360px; }
}


.dashboard-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-card h2 {
  margin: 8px 0 0;
  font-size: 30px;
}

.dashboard-label {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.action-grid {
  display: grid;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
}

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

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

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

@media (min-width: 720px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .action-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}


.stats-total-row td {
  background: #f8fafc;
}

.revenue-addon-row td {
  color: #667085;
  font-style: normal;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 12px;
}
.checkbox-row input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.warning-box {
  background: #fffaeb;
  color: #b54708;
  border: 1px solid #fedf89;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.revenue-addon-row td {
  color: #667085;
  font-style: normal;
}

textarea[readonly] {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 14px;
  margin-top: 8px;
  margin-bottom: 12px;
  resize: vertical;
  background: #f8fafc;
}

details summary {
  cursor: pointer;
  margin-bottom: 12px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 12px;
}
.checkbox-row input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.form-section {
  margin-bottom: 18px;
  padding-top: 4px;
}
.form-section h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

/* === Shake the Gates Theme === */

body {
  background: linear-gradient(135deg, #15485c, #1f6b87);
}

.card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

h1, h2 {
  color: #15485c;
}

button,
.button {
  background: #eacf0f;
  color: #15485c;
  font-weight: 600;
  border-radius: 12px;
  transition: all 0.15s ease;
}

button:hover,
.button:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}

button:active,
.button:active {
  transform: translateY(0px);
}

.button.secondary {
  background: #434549;
  color: #ffffff;
}

input, select {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

input:focus, select:focus {
  border-color: #eacf0f;
  outline: none;
}

.app-header {
  background: #15485c;
  color: #ffffff;
  padding: 12px 16px;
  font-weight: 600;
}

.page-content {
  padding-top: 12px;
}

/* subtle card hover */
.card:hover {
  transform: translateY(-2px);
  transition: transform 0.15s ease;
}


/* === UI Polish Update === */

h1, h2 {
  color: #1f2937;
  font-weight: 700;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 20px;
}

.card {
  color: #1f2937;
}

.page-content {
  padding-bottom: 96px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.10);
  z-index: 999;
  backdrop-filter: blur(8px);
}

.bottom-nav.bottom-nav-admin {
  grid-template-columns: repeat(5, 1fr);
}

.bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  border-radius: 14px;
  background: transparent;
  color: #434549;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  gap: 4px;
  transition: all 0.15s ease;
}

.bottom-nav-link:hover {
  color: #15485c;
  background: rgba(21, 72, 92, 0.06);
  transform: translateY(-1px);
}

.bottom-nav-link.active {
  color: #15485c;
  background: rgba(234, 207, 15, 0.18);
}

.bottom-nav-link.active .bottom-nav-icon {
  transform: scale(1.05);
}

.bottom-nav-icon {
  font-size: 18px;
  line-height: 1;
}

.bottom-nav-label {
  line-height: 1.1;
}

@media (min-width: 720px) {
  .bottom-nav {
    max-width: 820px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-radius: 18px 18px 0 0;
  }
}


.revenue-fee-row td {
  color: #667085;
  font-style: italic;
}


/* === Full UI Cleanup === */

.page-content {
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: 122px;
}

.user-chip {
  margin-top: 6px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.10);
  z-index: 999;
  backdrop-filter: blur(8px);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.bottom-nav.bottom-nav-admin .bottom-nav-links {
  grid-template-columns: repeat(5, 1fr);
}

.bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border-radius: 14px;
  background: transparent;
  color: #434549;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  gap: 4px;
  transition: all 0.15s ease;
}

.bottom-nav-link:hover {
  color: #15485c;
  background: rgba(21, 72, 92, 0.06);
  transform: translateY(-1px);
}

.bottom-nav-link.active {
  color: #15485c;
  background: rgba(234, 207, 15, 0.18);
}

.bottom-nav-icon {
  font-size: 18px;
  line-height: 1;
}

.bottom-nav-label {
  line-height: 1.1;
}

.bottom-nav-footer {
  text-align: center;
  font-size: 10px;
  color: #9ca3af;
  margin-top: 6px;
  letter-spacing: 0.3px;
  font-weight: 500;
}

@media (min-width: 720px) {
  .bottom-nav {
    max-width: 820px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-radius: 18px 18px 0 0;
  }
}


/* Footer Under Menu Fix */
.bottom-nav {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
}

.bottom-nav-links {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 8px;
  width: 100%;
}

.bottom-nav.bottom-nav-admin .bottom-nav-links {
  grid-template-columns: repeat(5, 1fr) !important;
}

.bottom-nav-footer {
  display: block !important;
  width: 100% !important;
  text-align: center;
  font-size: 10px;
  color: #9ca3af;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid #f1f5f9;
}
ADD THIS TO THE BOTTOM OF assets/style.css

.expandable-card-header {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left; /* ← THIS is key */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.expandable-card-title-wrap h3 {
  margin: 0;
  text-align: left; /* ensures name stays left */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.expandable-card-title-wrap {
  flex: 1;
  min-width: 0;
}


.expandable-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.expand-indicator {
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
  color: #15485c;
}

.expandable-card-body {
  display: none;
  margin-top: 12px;
}

.expandable-card.expanded .expandable-card-body {
  display: block;
}
