@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Corporate Fintech Palette */
  --bg-gradient-1: #f1f5f9;
  --bg-gradient-2: #e2e8f0;
  --card-bg: #ffffff;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  --border-focus: #94a3b8;
  
  --primary: #0f172a; 
  --primary-hover: #334155;
  
  --danger: #b91c1c; 
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-muted: #991b1b;
  
  --success: #047857; 
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  
  --warn-bg: #fffbeb;
  --warn-border: #fde68a;
  --warn-text: #78350f;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2));
  color: var(--text-main);
  min-height: 100svh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  /* FIXED: Removed the 70px gap at the top */
  padding-top: calc(16px + env(safe-area-inset-top));
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}

/* The Main Card */
.card {
  width: min(520px, 100%);
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
  padding: 32px;
  border: 1px solid #f1f5f9;
}

/* Typography */
h1 { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 6px; letter-spacing: -0.5px; }
h2 { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 6px; letter-spacing: -0.3px; }
.sub { text-align: center; font-size: 13px; color: var(--text-muted); font-weight: 500; margin-bottom: 24px; }

/* Form Elements */
label { display: block; font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
input, select, textarea {
  width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--border-light);
  background: #f8fafc; font-size: 15px; font-weight: 500; font-family: inherit;
  transition: all 0.2s; color: var(--text-main);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.05);
}
.field { margin-bottom: 20px; }
.err { display: none; font-size: 12px; color: var(--danger); margin-top: 6px; font-weight: 600; }
input.invalid, select.invalid { border-color: var(--danger-border); background: var(--danger-bg); }

/* Buttons */
.btn {
  width: 100%; padding: 16px; border-radius: 12px; border: none;
  font-size: 15px; font-weight: 700; cursor: pointer; transition: all 0.2s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border: 1px solid var(--border-light); color: var(--text-main); margin-top: 12px; }
.btn-ghost:hover { background: #f8fafc; }

/* Bank Selector */
.bank-select { max-height: 350px; overflow-y: auto; padding-right: 4px; }
.bank-select::-webkit-scrollbar { width: 4px; }
.bank-select::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.bank-select button {
  width: 100%; margin: 6px 0; padding: 16px; border-radius: 12px;
  border: 1px solid var(--border-light); background: #fff; cursor: pointer;
  font-weight: 600; font-size: 15px; text-align: left; color: var(--text-main); 
  display: flex; justify-content: space-between; align-items: center;
}
.bank-select button:hover { border-color: var(--border-focus); background: #f8fafc; }

/* Loader */
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--border-light);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 1s linear infinite; margin: 0 auto 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader { text-align: center; font-weight: 600; margin: 16px 0; color: var(--text-main); font-size: 16px; }
.progress-wrap { background: #e2e8f0; border-radius: 999px; height: 6px; overflow: hidden; margin-top: 24px; }
.progress-bar { height: 100%; width: 0%; background: var(--primary); transition: width 0.3s ease; }
.progress-label { font-size: 12px; text-align: right; color: var(--text-muted); margin-top: 8px; font-weight: 600; }

.hidden { display: none !important; }
.pill { background: #f8fafc; color: var(--text-muted); padding: 8px 12px; border-radius: 8px; text-align: center; font-weight: 600; margin-bottom: 24px; font-size: 12px; border: 1px solid var(--border-light); }

/* Official Receipt UI */
.official-receipt {
  border: 1px solid var(--border-light);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  margin-bottom: 24px;
}

.receipt-header {
  padding: 24px;
  text-align: center;
  border-bottom: 1px dashed var(--border-light);
}

.receipt-header.decline { background: var(--danger-bg); }
.receipt-header.success { background: var(--success-bg); }

.receipt-status-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.receipt-title {
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.receipt-title.decline { color: var(--danger); }
.receipt-title.success { color: var(--success); }

.receipt-amount {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -1px;
  margin-top: 12px;
  color: var(--text-main);
}

.receipt-body {
  padding: 24px;
}

.data-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
}
.data-row:last-child { border-bottom: none; }
.data-label { color: var(--text-muted); font-weight: 500; }
.data-value { font-weight: 700; color: var(--text-main); text-align: right; max-width: 65%; line-height: 1.4; }
.data-value.error-text { color: var(--danger); }

/* Invoice Action Box */
.action-invoice {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}
.action-header {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}
.action-split {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.action-split .label { font-size: 14px; font-weight: 600; color: var(--text-main); }
.action-split .value { font-size: 18px; font-weight: 900; color: var(--danger); }

/* Regulatory Fine Print */
.regulatory-print {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: justify;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* Modals & Admin Lists */
.admin-list { max-height: 250px; overflow-y: auto; border: 1px solid var(--border-light); border-radius: 12px; margin-bottom: 16px; background: #fff; }
.admin-list-item { padding: 14px; border-bottom: 1px solid var(--border-light); cursor: pointer; font-size: 13px; font-weight: 600; }
.admin-list-item.selected { background: var(--primary); color: #fff; }
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(15, 23, 42, 0.6); padding: 24px; z-index: 9999; backdrop-filter: blur(4px); }
.modal.open { display: flex; }
.modal-card { width: min(480px, 100%); background: var(--card-bg); border-radius: 20px; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); }
.modal-head { padding: 20px; border-bottom: 1px solid var(--border-light); background: #f8fafc; display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-weight: 800; font-size: 15px; }
.modal-body { padding: 24px; font-size: 14px; }
