/* ============================================
   Stanly County EMS Payment Portal
   ============================================ */

:root {
  --primary: #1a3a5c;
  --primary-light: #2a5a8c;
  --primary-dark: #0f2440;
  --accent: #c0392b;
  --accent-hover: #a93226;
  --success: #27ae60;
  --warning: #f39c12;
  --error: #e74c3c;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #868e96;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  --white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-800);
  background: var(--gray-100);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */

.site-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  color: var(--white);
  padding: 0 2rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.header-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-title {
  display: flex;
  flex-direction: column;
}

.header-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.header-title span {
  font-size: 0.8rem;
  opacity: 0.8;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-admin:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-admin svg {
  width: 16px;
  height: 16px;
}

/* ---- Main Content ---- */

main {
  flex: 1;
  padding: 2.5rem 1.5rem;
}

.payment-container {
  max-width: 680px;
  margin: 0 auto;
}

.page-intro {
  text-align: center;
  margin-bottom: 2rem;
}

.page-intro h2 {
  font-size: 1.75rem;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-intro p {
  color: var(--gray-600);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
}

/* ---- Card / Panel ---- */

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.card + .card {
  margin-top: 1.5rem;
}

.card-header {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-header svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
  flex-shrink: 0;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
}

.card-body {
  padding: 1.5rem;
}

/* ---- Form Elements ---- */

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

.form-group {
  margin-bottom: 1.25rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group label .required {
  color: var(--error);
  margin-left: 2px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(42, 90, 140, 0.12);
}

.form-group input.input-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.form-group input::placeholder {
  color: var(--gray-400);
}

.form-group .field-error {
  font-size: 0.75rem;
  color: var(--error);
  margin-top: 0.25rem;
  min-height: 1rem;
}

/* ---- Clover iframe fields ---- */

.clover-field {
  height: 44px;
  padding: 0 0.875rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  display: flex;
  align-items: center;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.clover-field.clover-focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(42, 90, 140, 0.12);
}

.clover-field.clover-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.input-errors {
  font-size: 0.75rem;
  color: var(--error);
  margin-top: 0.25rem;
  min-height: 1rem;
}

/* ---- Amount Display ---- */

.amount-section {
  margin-top: 0.5rem;
}

.amount-input-wrapper {
  position: relative;
}

.amount-input-wrapper .currency-symbol {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-500);
  pointer-events: none;
}

.amount-input-wrapper input {
  padding-left: 1.75rem;
  font-size: 1.25rem;
  font-weight: 600;
}

/* ---- Submit Button ---- */

.submit-section {
  padding: 1.5rem;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.btn-pay {
  width: 100%;
  padding: 0.875rem 2rem;
  font-size: 1.0625rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--white);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 2px 8px rgba(192, 57, 43, 0.3);
}

.btn-pay:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(192, 57, 43, 0.4);
}

.btn-pay:active {
  transform: translateY(0);
}

.btn-pay:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-pay svg {
  width: 20px;
  height: 20px;
}

.btn-pay .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Security Notice ---- */

.security-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(39, 174, 96, 0.06);
  border: 1px solid rgba(39, 174, 96, 0.15);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--gray-700);
}

.security-notice svg {
  width: 16px;
  height: 16px;
  color: var(--success);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ---- Sample Invoice Button ---- */

.btn-sample-invoice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.625rem 1.25rem;
  background: var(--white);
  border: 1.5px solid var(--primary-light);
  border-radius: var(--radius);
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-sample-invoice:hover {
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow-md);
}

.btn-sample-invoice svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ---- Modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.modal-header h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--gray-800);
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1.5px solid var(--gray-300);
  border-radius: 50%;
  font-size: 1.375rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
}

.modal-close:hover {
  background: var(--error);
  border-color: var(--error);
  color: var(--white);
}

.modal-body {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.modal-body canvas {
  width: 100%;
  height: auto;
  display: block;
}

.modal-footer {
  padding: 0.875rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.modal-footer p {
  font-size: 0.8125rem;
  color: var(--gray-600);
  text-align: center;
}

.modal-footer strong {
  color: var(--primary);
}

@media (max-width: 640px) {
  .modal-content {
    max-height: 85vh;
  }

  .btn-sample-invoice {
    font-size: 0.8125rem;
    padding: 0.5rem 1rem;
  }
}

/* ---- Toast / Alerts ---- */

.toast-container {
  position: fixed;
  top: 84px;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 380px;
}

.toast.toast-success { background: var(--success); }
.toast.toast-error { background: var(--error); }
.toast.toast-warning { background: var(--warning); color: var(--gray-900); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- Footer ---- */

.site-footer {
  background: var(--primary-dark);
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  padding: 1.25rem 1.5rem;
  font-size: 0.8125rem;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ---- Admin Page ---- */

.admin-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  padding: 1.5rem;
}

.admin-login-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.admin-login-header {
  background: var(--gray-50);
  padding: 2rem 2rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--gray-200);
}

.admin-login-header .logo-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  overflow: hidden;
}

.admin-login-header .logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-login-header h1 {
  font-size: 1.25rem;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.admin-login-header p {
  color: var(--gray-600);
  font-size: 0.875rem;
}

.admin-login-body {
  padding: 2rem;
}

.admin-login-body .form-group {
  margin-bottom: 1.25rem;
}

.admin-login-body .form-group label {
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.875rem;
}

.btn-login {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--white);
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}

.btn-login:hover {
  background: var(--primary-light);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.admin-login-footer {
  text-align: center;
  padding: 0 2rem 1.5rem;
}

.admin-login-footer a {
  color: var(--primary);
  font-size: 0.875rem;
  text-decoration: none;
}

.admin-login-footer a:hover {
  text-decoration: underline;
}

.login-error {
  background: rgba(231, 76, 60, 0.08);
  border: 1px solid rgba(231, 76, 60, 0.2);
  color: var(--error);
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
  display: none;
}

/* ---- Admin Dashboard ---- */

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-user-badge {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

/* --- Avatar dropdown menu --- */

.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  background: transparent;
  border: none;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
  color: var(--white);
}

.user-menu-trigger:hover,
.user-menu-trigger:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.user-menu-trigger .menu-caret {
  width: 14px;
  height: 14px;
  opacity: 0.75;
  transition: transform 0.2s ease;
}

.user-menu.open .menu-caret {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 240px;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--gray-200);
  padding: 0.4rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 1000;
}

.user-menu.open .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-header {
  padding: 0.75rem 1rem 0.65rem;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 0.4rem;
}

.user-dropdown-header .dropdown-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.25;
}

.user-dropdown-header .dropdown-role {
  display: block;
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.125rem;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.55rem 1rem;
  border: none;
  background: transparent;
  color: var(--gray-700);
  font-size: 0.875rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.user-dropdown-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--gray-500);
}

.user-dropdown-item:hover,
.user-dropdown-item:focus-visible {
  background: var(--gray-100);
  color: var(--gray-900);
  outline: none;
}

.user-dropdown-item:hover svg,
.user-dropdown-item:focus-visible svg {
  color: var(--primary);
}

.user-dropdown-item.danger {
  color: #c0392b;
}

.user-dropdown-item.danger svg {
  color: #c0392b;
}

.user-dropdown-item.danger:hover {
  background: #fdecea;
  color: #c0392b;
}

.user-dropdown-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 0.35rem 0;
}

@media (max-width: 640px) {
  .user-menu-trigger .user-info-mini { display: none; }
  .user-dropdown { min-width: 210px; }
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.2);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.02em;
}

.user-info-mini {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name-mini {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--white);
}

.user-role-mini {
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.65);
}

.dashboard-container {
  max-width: 1100px;
  margin: 0 auto;
}

.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--primary);
}

.welcome-text h2 {
  font-size: 1.375rem;
  color: var(--gray-900);
  font-weight: 700;
  margin-bottom: 0.125rem;
}

.welcome-text p {
  color: var(--gray-500);
  font-size: 0.875rem;
}

.welcome-date {
  font-size: 0.875rem;
  color: var(--gray-500);
  font-weight: 500;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-icon-blue {
  background: rgba(42, 90, 140, 0.1);
  color: var(--primary-light);
}

.stat-icon-green {
  background: rgba(39, 174, 96, 0.1);
  color: var(--success);
}

.stat-icon-purple {
  background: rgba(142, 68, 173, 0.1);
  color: #8e44ad;
}

.stat-icon-orange {
  background: rgba(243, 156, 18, 0.1);
  color: var(--warning);
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.3;
}

.table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
}

.table-empty p {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-top: 1rem;
  margin-bottom: 0.25rem;
}

.table-empty span {
  font-size: 0.8125rem;
  color: var(--gray-400);
}

.quick-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  color: var(--gray-700);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
}

.action-btn:hover:not(:disabled) {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-btn svg {
  width: 16px;
  height: 16px;
}

/* ---- Payments Table ---- */

.payment-count {
  font-size: 0.8125rem;
  color: var(--gray-500);
  font-weight: 500;
}

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

.payments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.payments-table thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.payments-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}

.payments-table tbody tr:last-child td {
  border-bottom: none;
}

.payments-table tbody tr:hover {
  background: var(--gray-50);
}

.cell-primary {
  font-weight: 500;
  color: var(--gray-800);
}

.cell-secondary {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 1px;
}

.cell-amount {
  font-weight: 600;
  color: var(--gray-900);
  white-space: nowrap;
}

.invoice-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: rgba(42, 90, 140, 0.08);
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--primary);
  font-family: 'SFMono-Regular', Consolas, monospace;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.625rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-completed {
  background: rgba(39, 174, 96, 0.1);
  color: #1e8449;
}

.status-pending {
  background: rgba(243, 156, 18, 0.12);
  color: #b7791f;
}

.status-failed {
  background: rgba(231, 76, 60, 0.1);
  color: var(--error);
}

/* ---- Table Action Buttons ---- */

.cell-center {
  text-align: center;
}

.cell-actions {
  white-space: nowrap;
}

.tbl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1.4;
}

.tbl-btn svg {
  width: 14px;
  height: 14px;
}

.tbl-btn-approve {
  background: rgba(39, 174, 96, 0.1);
  color: #1e8449;
}

.tbl-btn-approve:hover {
  background: var(--success);
  color: var(--white);
}

.tbl-btn-decline {
  background: rgba(231, 76, 60, 0.1);
  color: var(--error);
}

.tbl-btn-decline:hover {
  background: var(--error);
  color: var(--white);
}

.tbl-btn-view {
  background: rgba(42, 90, 140, 0.08);
  color: var(--primary);
}

.tbl-btn-view:hover {
  background: var(--primary);
  color: var(--white);
}

.tbl-btn-cancel {
  background: var(--gray-100);
  color: var(--gray-600);
}

.tbl-btn-cancel:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.cell-actions .tbl-btn + .tbl-btn {
  margin-left: 0.375rem;
}

/* Pending row highlight */

.row-pending {
  background: rgba(243, 156, 18, 0.04);
}

.row-pending:hover {
  background: rgba(243, 156, 18, 0.08) !important;
}

/* ---- Billing Bridge Toggle ---- */

.bb-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  cursor: pointer;
}

.bb-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.bb-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 22px;
  transition: background 0.25s ease;
}

.bb-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.bb-toggle input:checked + .bb-slider {
  background: var(--success);
}

.bb-toggle input:checked + .bb-slider::before {
  transform: translateX(16px);
}

.bb-toggle input:disabled + .bb-slider {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- Review Modal Detail Grid ---- */

.review-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.review-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.review-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
}

.review-value {
  font-size: 0.9375rem;
  color: var(--gray-800);
  font-weight: 500;
}

/* ---- Role Badges ---- */

.role-badge {
  display: inline-block;
  padding: 0.2rem 0.625rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.role-admin {
  background: rgba(142, 68, 173, 0.1);
  color: #7d3c98;
}

.role-staff {
  background: rgba(42, 90, 140, 0.08);
  color: var(--primary);
}

.you-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  background: var(--primary);
  color: var(--white);
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-left: 0.375rem;
}

/* ---- Responsive ---- */

@media (max-width: 640px) {
  .site-header {
    padding: 0 1rem;
  }

  .header-inner {
    height: 64px;
  }

  .header-title h1 {
    font-size: 1rem;
  }

  .header-title span {
    font-size: 0.7rem;
  }

  .btn-admin span {
    display: none;
  }

  main {
    padding: 1.5rem 1rem;
  }

  .page-intro h2 {
    font-size: 1.375rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .card-body {
    padding: 1.25rem;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .admin-user-badge .user-info-mini {
    display: none;
  }

  .quick-actions {
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Reports Page Styles
   ============================================ */

/* ---- Report Tab Selector ---- */

.report-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.report-tab {
  padding: 0.5rem 1.125rem;
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.report-tab:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.report-tab.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(26, 58, 92, 0.25);
}

/* ---- Filters ---- */

.filter-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-group input,
.filter-group select {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition);
}

.filter-group input:focus,
.filter-group select:focus {
  border-color: var(--primary-light);
}

/* ---- Report Table Enhancements ---- */

.report-table {
  font-size: 0.8125rem;
}

.totals-row {
  background: var(--gray-50);
  border-top: 2px solid var(--gray-300);
}

.totals-row td {
  padding-top: 0.875rem !important;
  padding-bottom: 0.875rem !important;
}

.row-danger {
  background: rgba(231, 76, 60, 0.04);
}

.row-danger:hover {
  background: rgba(231, 76, 60, 0.08) !important;
}

/* ---- Percentage Bars ---- */

.pct-bar {
  position: relative;
  background: var(--gray-100);
  border-radius: 4px;
  height: 22px;
  overflow: hidden;
  min-width: 100px;
}

.pct-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(42, 90, 140, 0.15);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.pct-fill-green {
  background: rgba(39, 174, 96, 0.15);
}

.pct-bar span {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-700);
}

/* ---- Print Styles ---- */

@media print {
  body {
    background: white;
    font-size: 11pt;
  }

  .site-header,
  .site-footer,
  .report-selector,
  #filters-card,
  .btn-admin,
  .tbl-btn {
    display: none !important;
  }

  main {
    padding: 0;
  }

  .dashboard-container {
    max-width: 100%;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

  .stats-row {
    grid-template-columns: repeat(4, 1fr);
  }

  .stat-card {
    box-shadow: none;
    border: 1px solid #ddd;
  }

  #report-output {
    display: block !important;
  }

  #report-summary {
    display: grid !important;
  }

  .report-table th,
  .report-table td {
    font-size: 9pt;
    padding: 4px 6px;
  }
}

/* ---- Reports Responsive ---- */

@media (max-width: 768px) {
  .filter-row {
    grid-template-columns: 1fr 1fr;
  }

  .report-selector {
    gap: 0.375rem;
  }

  .report-tab {
    font-size: 0.75rem;
    padding: 0.4rem 0.875rem;
  }
}

@media (max-width: 480px) {
  .filter-row {
    grid-template-columns: 1fr;
  }
}
