:root {
  --relish-orange: #f5841f;
  --relish-purple: #7b4b94;
  --relish-teal: #2d9596;
  --relish-dark: #1a1a2e;
  --relish-light: #faf9f7;
  --relish-cream: #f5f3ef;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
}

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

html { overflow-x: hidden; }

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--relish-light);
  color: var(--relish-dark);
  line-height: 1.6;
  overflow-x: hidden;
}

.app-container { min-height: 100vh; display: flex; flex-direction: column; }

.header {
  background: linear-gradient(135deg, var(--relish-dark) 0%, #16213e 100%);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1001;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.header-left { display: flex; align-items: center; gap: 1rem; }
.logo-container { display: flex; align-items: center; gap: 0.75rem; }
.logo-container img { height: 40px; }

.company-badge {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  color: white;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.user-badge {
  background: linear-gradient(135deg, var(--relish-orange), var(--relish-purple));
  padding: 0.5rem 1rem;
  border-radius: 20px;
  color: white;
  font-weight: 500;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notification-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.notification-btn:hover { background: rgba(255,255,255,0.2); }

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--error);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logout-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  transition: all 0.2s;
  font-family: inherit;
}

.logout-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.5); }

.main-layout { display: flex; flex: 1; }

.sidebar {
  width: 240px;
  background: white;
  border-right: 1px solid #e5e5e5;
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 72px);
  position: sticky;
  top: 72px;
  overflow-y: auto;
  flex-shrink: 0;
  align-self: flex-start;
}

.nav-section { padding: 0 1rem; margin-bottom: 1.5rem; }

.nav-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.nav-item:hover { background: var(--relish-cream); color: var(--relish-dark); }

.nav-item.active {
  background: linear-gradient(135deg, rgba(245,132,31,0.1), rgba(123,75,148,0.1));
  color: var(--relish-purple);
  font-weight: 500;
}

.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  max-height: calc(100vh - 72px);
}

.page-header { margin-bottom: 2rem; }
.page-title { font-size: 1.75rem; font-weight: 600; color: var(--relish-dark); margin-bottom: 0.5rem; }
.page-subtitle { color: #666; font-size: 0.95rem; }

.card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  border: 1px solid #eee;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.card-body { padding: 1.5rem; }

.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; color: #444; margin-bottom: 0.5rem; }
.form-label-row { display: flex; justify-content: space-between; align-items: center; }

.form-input, .form-select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.2s;
  font-family: inherit;
}

.form-input:focus, .form-select:focus, textarea:focus {
  outline: none;
  border-color: var(--relish-purple);
  box-shadow: 0 0 0 3px rgba(123,75,148,0.1);
}

.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.form-row-4 { display: grid; grid-template-columns: 2fr 0.5fr 1fr 1fr auto; gap: 0.5rem; align-items: flex-end; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--relish-orange), var(--relish-purple));
  color: white;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245,132,31,0.3); }
.btn-secondary { background: var(--relish-cream); color: var(--relish-dark); border: 1px solid #ddd; }
.btn-secondary:hover { background: #eee; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-group { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }

.table th {
  text-align: left;
  padding: 1rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  border-bottom: 2px solid #eee;
  background: var(--relish-cream);
}

.table td { padding: 1rem; border-bottom: 1px solid #eee; font-size: 0.9rem; }
.table tr:hover { background: rgba(245,243,239,0.5); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: capitalize;
}

.status-pending { background: rgba(245,158,11,0.1); color: var(--warning); }
.status-approved { background: rgba(59,130,246,0.1); color: var(--info); }
.status-awaiting_payee_otp { background: rgba(123,75,148,0.1); color: var(--relish-purple); }
.status-awaiting_document { background: rgba(59,130,246,0.15); color: #2563eb; }
.status-completed { background: rgba(16,185,129,0.1); color: var(--success); }
.status-awaiting_payment { background: rgba(245,158,11,0.18); color: #b45309; font-weight: 600; }
.status-paid { background: rgba(5,150,105,0.15); color: #065f46; font-weight: 600; }
.status-rejected { background: rgba(239,68,68,0.1); color: var(--error); }

.otp-container { display: flex; gap: 0.75rem; justify-content: center; margin: 1.5rem 0; flex-wrap: wrap; }

.otp-input {
  width: 50px;
  height: 60px;
  border: 2px solid #ddd;
  border-radius: 12px;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  font-family: 'Space Mono', monospace;
}

.otp-input:focus {
  outline: none;
  border-color: var(--relish-purple);
  box-shadow: 0 0 0 3px rgba(123,75,148,0.1);
}

/* OTP Actions Container - Mobile Friendly */
.otp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 2rem 1rem;
  box-sizing: border-box;
  overflow-y: auto;
}

.modal {
  background: white;
  border-radius: 16px;
  max-width: 500px;
  width: calc(100% - 2rem);
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  margin: auto;
  flex-shrink: 0;
}

.modal-lg { max-width: 700px; }

.modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: white;
  gap: 0.5rem;
  box-sizing: border-box;
  width: 100%;
  min-height: 60px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-header .modal-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.25rem; 
  font-weight: 600; 
  margin: 0;
}

.modal-header > div {
  flex-shrink: 0;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1 1 auto;
  box-sizing: border-box;
  min-height: 0;
}
.modal-close { 
  background: none; 
  border: none; 
  cursor: pointer; 
  color: #888; 
  padding: 0.5rem; 
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.modal-close:hover {
  color: #333;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  background: white;
}

.voucher-preview {
  background: white;
  border: 2px solid #ccc;
  border-radius: 8px;
  padding: 1.5rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
}

.voucher-header {
  text-align: center;
  border-bottom: 2px solid #333;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.voucher-company { font-size: 1.1rem; font-weight: 700; color: var(--relish-purple); }
.voucher-address { font-size: 0.75rem; color: #666; margin-top: 0.25rem; }
.voucher-title { font-size: 1.25rem; font-weight: 700; color: var(--relish-orange); margin-top: 0.75rem; letter-spacing: 0.1em; }

.voucher-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 1rem; }
.voucher-meta-item { display: flex; gap: 0.5rem; }
.voucher-meta-label { color: #666; }
.voucher-meta-value { font-weight: 600; }

.voucher-total { text-align: right; margin-top: 1rem; border-top: 2px solid #333; padding-top: 0.5rem; font-size: 1.1rem; font-weight: 700; }

.voucher-signatures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px dashed #ccc;
}

.voucher-signature { text-align: center; font-size: 0.8rem; }
.voucher-signature-line { 
  border-bottom: 1px solid #333; 
  min-height: 60px; 
  margin-bottom: 0.5rem; 
  display: flex; 
  align-items: flex-end; 
  justify-content: center; 
  padding-bottom: 0.35rem;
  padding-top: 0.25rem;
}
.voucher-signature-label { color: #666; font-weight: 500; }
.signature-verified { color: var(--success); font-size: 0.75rem; font-weight: 600; }

.otp-section {
  margin-top: 1.5rem;
  text-align: center;
  padding: 1.5rem;
  background: var(--relish-cream);
  border-radius: 12px;
}

.otp-section p { margin-bottom: 0.5rem; }

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--relish-dark) 0%, #16213e 50%, var(--relish-purple) 100%);
  padding: 2rem;
}

.login-card {
  background: white;
  border-radius: 24px;
  padding: 3rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo img { width: 160px; height: auto; }
.login-title { text-align: center; font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
.login-subtitle { text-align: center; color: #666; margin-bottom: 2rem; }

.login-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: var(--relish-cream);
  padding: 0.35rem;
  border-radius: 10px;
}

.login-tab {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.login-tab.active {
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  color: var(--relish-purple);
}

.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: rgba(239,68,68,0.1); color: var(--error); }
.alert-success { background: rgba(16,185,129,0.1); color: var(--success); }

.reg-success { text-align: center; }
.reg-success svg { margin-bottom: 1rem; }
.reg-success h3 { margin-bottom: 0.5rem; }
.reg-success p { color: #666; margin-bottom: 1.5rem; }

.notifications-panel {
  position: fixed;
  top: 72px;
  right: 0;
  width: 380px;
  max-height: calc(100vh - 72px);
  background: white;
  border-left: 1px solid #eee;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 99;
  overflow-y: auto;
}

.notifications-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: white;
}

.notification-item { padding: 1rem 1.5rem; border-bottom: 1px solid #eee; cursor: pointer; transition: background 0.2s; }
.notification-item:hover { background: var(--relish-cream); }
.notification-item.unread { background: rgba(59,130,246,0.05); }
.notification-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.25rem; }
.notification-message { font-size: 0.85rem; color: #666; }
.notification-time { font-size: 0.75rem; color: #999; margin-top: 0.5rem; }

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

.stat-card { background: white; border-radius: 16px; padding: 1.5rem; border: 1px solid #eee; }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.stat-icon.orange { background: rgba(245,132,31,0.1); color: var(--relish-orange); }
.stat-icon.purple { background: rgba(123,75,148,0.1); color: var(--relish-purple); }
.stat-icon.teal { background: rgba(45,149,150,0.1); color: var(--relish-teal); }
.stat-icon.green { background: rgba(16,185,129,0.1); color: var(--success); }

.stat-value { font-size: 2rem; font-weight: 700; color: var(--relish-dark); }
.stat-label { font-size: 0.85rem; color: #666; margin-top: 0.25rem; }

.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: white;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 300px;
  animation: slideIn 0.3s ease;
}

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

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--error); }
.toast.info { border-left: 4px solid var(--info); }
.toast.warning { border-left: 4px solid #f59e0b; background: #fffbeb; max-width: 480px; white-space: pre-wrap; word-break: break-all; }

.empty-state { text-align: center; padding: 3rem; color: #888; }
.empty-state svg { margin-bottom: 1rem; opacity: 0.3; }

/* Full-page / section loading container */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  min-height: 180px;
  gap: 0.75rem;
  color: #9ca3af;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}


.text-center { text-align: center; }
.text-muted { color: #666; }
.text-mono { font-family: 'Space Mono', monospace; }
.fw-600 { font-weight: 600; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .sidebar { display: none; }
}

/* Mobile Menu */
.mobile-menu-btn {
  display: none;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
}

.mobile-menu-btn:hover {
  background: rgba(255,255,255,0.2);
}

.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  animation: fadeIn 0.2s ease-in-out;
}

.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: white;
  z-index: 201;
  overflow-y: auto;
  animation: slideIn 0.3s ease-out;
  box-shadow: 4px 0 12px rgba(0,0,0,0.15);
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid #eee;
}

.mobile-menu-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--relish-dark);
}

.mobile-menu-close {
  background: transparent;
  border: none;
  color: var(--relish-dark);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s;
}

.mobile-menu-close:hover {
  background: var(--relish-cream);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@media (max-width: 1024px) {
  .mobile-menu-btn {
    display: flex;
  }
}

@media (max-width: 768px) {
  .header { padding: 1rem; }
  .main-content { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .voucher-signatures { grid-template-columns: 1fr; }
  .company-badge { display: none; }
}

/* PWA Install Banner */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, var(--relish-purple), var(--relish-orange));
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
  z-index: 1000;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.pwa-install-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.pwa-install-icon {
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-install-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.pwa-install-text {
  font-size: 0.85rem;
  opacity: 0.9;
}

.pwa-install-actions {
  display: flex;
  gap: 0.75rem;
}

/* Page Header Enhancement */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    gap: 1rem;
  }
  
  .page-header .btn {
    width: 100%;
  }
  
  .pwa-install-banner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .pwa-install-actions {
    width: 100%;
  }
  
  .pwa-install-actions .btn {
    flex: 1;
  }
}

/* Mobile OTP Section Improvements */
@media (max-width: 480px) {
  .otp-container {
    gap: 0.4rem;
  }
  
  .otp-input {
    width: 40px;
    height: 50px;
    font-size: 1.25rem;
    border-radius: 8px;
  }
  
  .otp-section {
    padding: 1rem;
  }
  
  .otp-section p {
    font-size: 0.9rem;
  }
  
  /* Ensure OTP action buttons are visible and stack on mobile */
  .otp-section > div:last-child,
  .otp-section div[style*="display:flex"],
  .otp-section div[style*="display: flex"] {
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100%;
  }
  
  .otp-section .btn {
    width: 100% !important;
    justify-content: center;
  }
}

/* Mobile Modal Improvements */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 0.5rem;
    align-items: center;
    justify-content: center;
  }
  
  .modal {
    max-height: calc(100vh - 1rem);
    border-radius: 12px;
    margin: auto;
    width: calc(100% - 1rem);
    max-width: calc(100% - 1rem);
  }
  
  .modal-lg {
    max-width: calc(100% - 1rem);
  }
  
  .modal-header {
    padding: 0.75rem 1rem;
    min-height: 50px;
  }
  
  .modal-title {
    font-size: 1rem;
  }
  
  .modal-header .btn-sm {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }
  
  /* Hide button text on small screens, show only icons */
  .modal-header .btn-text {
    display: none;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .modal-footer {
    padding: 0.75rem 1rem;
  }
  
  .modal-footer .btn {
    flex: 1;
    min-width: calc(50% - 0.5rem);
  }
  
  .modal-close {
    padding: 0.25rem;
  }
}

/* Very Small Screens (below 480px) */
@media (max-width: 480px) {
  .modal-footer {
    flex-direction: column;
    align-items: stretch;
  }
  
  .modal-footer .btn {
    width: 100%;
    min-width: 100%;
  }

  /* Nested button containers inside modal-footer should also stack */
  .modal-footer > div {
    flex-wrap: wrap;
    width: 100%;
  }

  .modal-footer > div > .btn {
    flex: 1;
    min-width: calc(50% - 0.25rem);
    width: auto;
  }
  
  .btn-group {
    flex-direction: column;
  }
  
  .btn-group .btn {
    width: 100%;
  }
}

/* Mobile Table Improvements */
@media (max-width: 768px) {
  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
  }
  
  .table-container {
    width: 100%;
    max-width: 100%;
  }

  /* Ensure any bare table wrapper also scrolls horizontally instead of overflowing */
  .voucher-narration-table,
  .card-body > div {
    max-width: 100%;
    overflow-x: auto;
  }
}

/* Mobile Notifications Panel */
@media (max-width: 768px) {
  .notifications-panel {
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
  }
}

/* Mobile Toast Notifications */
@media (max-width: 768px) {
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
  
  .toast {
    min-width: auto;
    width: 100%;
  }
}

/* Mobile Header Improvements */
@media (max-width: 768px) {
  .header-right {
    gap: 0.5rem;
  }
  
  .user-badge {
    display: none;
  }
  
  .logout-btn span {
    display: none;
  }
  
  .logout-btn {
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    justify-content: center;
  }
}

/* Mobile Voucher Preview */
@media (max-width: 480px) {
  .voucher-preview {
    padding: 1rem;
    font-size: 0.75rem;
  }
  
  .voucher-meta {
    grid-template-columns: 1fr;
  }
  
  .voucher-company {
    font-size: 0.95rem;
  }
  
  .voucher-title {
    font-size: 1rem;
  }
}

/* Mobile Stats Grid */
@media (max-width: 480px) {
  .stats-grid {
    gap: 0.75rem;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .stat-label {
    font-size: 0.8rem;
  }
}

/* Mobile Login Card */
@media (max-width: 480px) {
  .login-container {
    padding: 1rem;
  }
  
  .login-card {
    padding: 1.5rem;
    border-radius: 16px;
  }
  
  .login-title {
    font-size: 1.25rem;
  }
  
  .login-subtitle {
    font-size: 0.9rem;
  }
}

/* Mobile Form Improvements */
@media (max-width: 768px) {
  .form-row-4 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Mobile Card Improvements */
@media (max-width: 480px) {
  .card {
    border-radius: 12px;
    margin-bottom: 1rem;
  }
  
  .card-header {
    padding: 1rem;
  }
  
  .card-title {
    font-size: 1rem;
  }
  
  .card-body {
    padding: 1rem;
  }
}

/* Mobile Page Title */
@media (max-width: 480px) {
  .page-title {
    font-size: 1.35rem;
  }
  
  .page-subtitle {
    font-size: 0.85rem;
  }
}

/* Print Styles */
@media print {
  body { background: white; }
  .header, .sidebar, .modal-overlay, .modal-header, .modal-footer, .toast-container, .pwa-install-banner, .otp-section { display: none !important; }
  .main-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .voucher-preview { 
    break-inside: avoid; 
    border: none;
    padding: 0;
    width: 100%;
  }
  .voucher-signatures {
    grid-template-columns: repeat(3, 1fr);
  }
  .modal {
    position: static;
    max-width: 100%;
    max-height: none;
    box-shadow: none;
    border: none;
  }
  .modal-body {
    padding: 0;
    overflow: visible;
  }
}

/* Narration Items Table Styles - Enhanced Sequential Entry */
.narration-table-container {
  background: #fffbeb;
  border: 2px solid #f59e0b;
  border-radius: 8px;
  padding: 1rem;
}

.narration-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.narration-table th {
  background: #f59e0b;
  color: white;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
}

.narration-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #fcd34d;
  vertical-align: middle;
}

.narration-table tbody tr:nth-child(even) {
  background: #fffbeb;
}

.narration-table tbody tr:nth-child(odd) {
  background: white;
}

.narration-table tfoot td {
  padding: 12px;
  border-top: 2px solid #f59e0b;
  background: #fef3c7;
}

.narration-input {
  padding: 8px 12px !important;
  font-size: 0.95rem !important;
  border-radius: 6px !important;
  border-color: #f59e0b !important;
}

.narration-input:focus {
  border-color: #f59e0b !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2) !important;
}

/* Sequential Entry Styling */
.sequential-entry-form {
  background: white;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #fcd34d;
  margin-bottom: 1rem;
}

.sequential-entry-form .form-label {
  font-size: 0.85rem;
  color: #92400e;
}

/* Amount in Words Box */
.amount-in-words {
  background: #fffbeb;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid #fcd34d;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
}

.amount-in-words strong {
  color: #92400e;
}

/* Status badge for draft */
.status-badge.status-draft {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* Mobile responsive for narration table */
@media (max-width: 768px) {
  .narration-table-container {
    overflow-x: auto;
    padding: 0.75rem;
  }
  
  .narration-table {
    min-width: 500px;
  }
  
  .narration-table th,
  .narration-table td {
    padding: 6px;
    font-size: 0.8rem;
  }
  
  .narration-input {
    font-size: 0.8rem !important;
    padding: 4px 6px !important;
  }
}

/* ===== Mobile Lock Screen ===== */
.lock-screen-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1a1a2e 0%, #16213e 55%, #3a1c5e 100%);
  padding: 1.5rem;
}
.lock-screen-card {
  background: white;
  border-radius: 28px;
  padding: 2.5rem 1.75rem 2rem;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
  animation: lockSlideUp 0.35s ease-out;
}
@keyframes lockSlideUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lock-screen-avatar {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--relish-orange), var(--relish-red));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem; font-weight: 700;
  margin: 0 auto 1rem;
  box-shadow: 0 4px 18px rgba(245,132,31,0.3);
}
.lock-screen-name {
  font-size: 1.25rem; font-weight: 700; color: #1a1a2e; margin: 0 0 0.2rem;
}
.lock-screen-company {
  font-size: 0.82rem; color: #999; margin: 0 0 0.75rem;
}
.lock-screen-subtitle {
  font-size: 0.88rem; color: #666; margin: 0 0 1.25rem;
}
.lock-screen-signout {
  background: none; border: none; color: #aaa;
  font-size: 0.78rem; cursor: pointer; margin-top: 1rem;
  display: flex; align-items: center; justify-content: center;
  gap: 5px; font-family: inherit; transition: color 0.2s; width: 100%;
}
.lock-screen-signout:hover { color: var(--relish-red); }

/* PIN dots */
.pin-dots {
  display: flex; justify-content: center; gap: 14px; margin: 0 auto 1.25rem;
}
.pin-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #ccc; background: transparent;
  transition: all 0.18s ease;
}
.pin-dot.filled {
  background: var(--relish-orange); border-color: var(--relish-orange);
  transform: scale(1.15);
}
@keyframes pinShake {
  0%,100%  { transform: translateX(0); }
  20%,60%  { transform: translateX(-8px); }
  40%,80%  { transform: translateX(8px); }
}
.pin-shake { animation: pinShake 0.45s ease-in-out; }
.pin-shake .pin-dot.filled { background: var(--relish-red); border-color: var(--relish-red); }

@media (max-width: 400px) {
  .lock-screen-card { padding: 2rem 1.25rem 1.75rem; border-radius: 22px; }
}

/* ===== Suspense Voucher Mobile Fixes ===== */

/* Page action-bar: wrap cleanly and don't overflow on small phones */
.suspense-action-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 480px) {
  .suspense-action-bar {
    width: 100%;
  }

  .suspense-action-bar .btn {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    font-size: 0.78rem;
    padding: 0.5rem 0.6rem;
  }
}

/* Settlement entries table — always scrollable, never forces horizontal overflow */
.settlements-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -1px; /* bleed to card edge */
}

/* Suspense info grid — single column on small phones */
@media (max-width: 480px) {
  .suspense-info-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Admin panel cards — ensure the heading row wraps on small screens */
@media (max-width: 480px) {
  .suspense-panel-header {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .suspense-panel-header .btn {
    width: 100%;
    justify-content: center;
  }
}

/* HOA corrections table header — hide less important columns on phones */
@media (max-width: 600px) {
  .hoa-table-col-sub,
  .hoa-table-col-reason {
    display: none;
  }
}

/* Page header back-button + title row on mobile */
@media (max-width: 600px) {
  .suspense-detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .suspense-detail-header > div:first-child {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .page-title {
    font-size: 1.1rem;
    word-break: break-word;
  }
}

/* Stat cards — 2 per row on very small screens */
@media (max-width: 360px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Voucher list table — hide lower-priority columns on phones */
@media (max-width: 600px) {
  .table th:nth-child(5),
  .table td:nth-child(5) {
    display: none;
  }
}

/* Make main-content take full height properly on iOS Safari */
@supports (-webkit-touch-callout: none) {
  .main-content {
    max-height: calc(100vh - 72px);
    -webkit-overflow-scrolling: touch;
  }
}
