:root {
  --bg-primary: #F5F7FA;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F1F4F8;
  --card-bg: #FFFFFF;
  --card-border: #E4E8EE;
  --card-hover-border: #B9C6D6;

  --hdfc-blue: #00509E;
  --hdfc-dark-blue: #003C77;
  --hdfc-red: #ED1C24;
  --accent-blue: #00509E;
  --accent-cyan: #0E7490;
  --accent-indigo: #4F46E5;

  --text-main: #1A2332;
  --text-muted: #5B6B7F;
  --text-dim: #8A97A8;

  --status-success: #15803D;
  --status-success-bg: #E9F7EE;
  --status-warning: #B45309;
  --status-warning-bg: #FDF3E3;
  --status-danger: #DC2626;
  --status-danger-bg: #FDEBEB;
  --status-info: #0369A1;
  --status-info-bg: #E8F4FB;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-card: 0 1px 2px rgba(15, 35, 65, 0.05), 0 4px 14px rgba(15, 35, 65, 0.04);
  --shadow-pop: 0 8px 24px rgba(15, 35, 65, 0.10);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Iconify icons */
iconify-icon {
  display: inline-block;
  font-size: 16px;
  vertical-align: -0.15em;
  line-height: 1;
  flex-shrink: 0;
}

.tab-btn iconify-icon { font-size: 15px; }
.card-title iconify-icon { font-size: 19px; color: var(--hdfc-blue); }
.btn-primary-action iconify-icon { font-size: 16px; }
.btn-secondary-action iconify-icon, .btn-header iconify-icon { font-size: 15px; }
.upi-app-btn iconify-icon { font-size: 15px; }
.qr-status-indicator iconify-icon { font-size: 15px; }
.toast iconify-icon { font-size: 17px; }
.pm-test-btn iconify-icon { font-size: 13px; }

/* App Header */
header.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--card-border);
  padding: 12px 28px;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bank-logo {
  background: var(--hdfc-blue);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 7px;
}

.bank-logo-text {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}

.bank-logo-tag {
  background: var(--hdfc-red);
  color: white;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.divider {
  width: 1px;
  height: 26px;
  background: var(--card-border);
}

.merchant-meta {
  display: flex;
  flex-direction: column;
}

.merchant-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.merchant-id-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
  background: #ECF8FA;
  padding: 1px 6px;
  border-radius: 4px;
}

.header-status-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--status-success-bg);
  color: var(--status-success);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-success);
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.btn-header {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-header:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border-color: var(--card-hover-border);
}

/* Main Container */
main.main-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* Page Intro */
.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.page-intro h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 4px;
}

.page-intro p {
  color: var(--text-muted);
  font-size: 13.5px;
  max-width: 640px;
}

.stat-strip {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 10px 4px;
}

.stat-item {
  padding: 2px 18px;
  border-right: 1px solid var(--card-border);
  min-width: 0;
}

.stat-item:last-child {
  border-right: none;
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 1px;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.stat-val.ok { color: var(--status-success); }

/* Navigation Tabs */
.tabs-navigation {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 28px;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.15s ease;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--hdfc-blue);
  border-bottom-color: var(--hdfc-blue);
}

.tab-badge {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.tab-btn.active .tab-badge {
  background: #E8F0F9;
  color: var(--hdfc-blue);
}

/* Tab Panels */
.tab-panel {
  display: none;
  animation: fadeIn 0.25s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Grid Layout for Forms and Preview */
.two-column-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .two-column-grid {
    grid-template-columns: 1fr;
  }
}

/* Card */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-card);
}

.card-header-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--card-border);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid #D8DFE8;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input::placeholder {
  color: var(--text-dim);
}

.form-input:focus {
  border-color: var(--hdfc-blue);
  box-shadow: 0 0 0 3px rgba(0, 80, 158, 0.12);
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235B6B7F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding-right: 36px;
}

/* Amount Selector Pills */
.amount-selector-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.amount-pill {
  flex: 1;
  min-width: 70px;
  background: var(--bg-secondary);
  border: 1px solid #D8DFE8;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 13.5px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.amount-pill:hover {
  border-color: var(--hdfc-blue);
  color: var(--hdfc-blue);
}

.amount-pill.active {
  background: #E8F0F9;
  border-color: var(--hdfc-blue);
  color: var(--hdfc-blue);
}

/* Buttons */
.btn-primary-action {
  width: 100%;
  background: var(--hdfc-blue);
  border: none;
  border-radius: var(--radius-sm);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 700;
  padding: 13px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s;
}

.btn-primary-action:hover {
  background: var(--hdfc-dark-blue);
}

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

.btn-secondary-action {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid #D8DFE8;
  color: var(--text-main);
  font-family: var(--font-sans);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-secondary-action:hover {
  background: var(--bg-tertiary);
  border-color: var(--card-hover-border);
}

/* Dynamic QR Display Card */
.qr-preview-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qr-box-frame {
  position: relative;
  background: #FFFFFF;
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  display: inline-block;
  margin-bottom: 18px;
}

.qr-image-display {
  display: block;
  max-width: 260px;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.qr-center-brand-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #FFFFFF;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-center-brand-overlay img, .qr-center-brand-overlay span {
  font-size: 11px;
  font-weight: 800;
  color: var(--hdfc-blue);
  letter-spacing: -0.02em;
}

.qr-amount-header {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.qr-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 18px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.qr-status-indicator.listening {
  background: var(--status-info-bg);
  color: var(--status-info);
}

.qr-status-indicator.success {
  background: var(--status-success-bg);
  color: var(--status-success);
}

.qr-status-indicator.error {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}

.radar-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(3, 105, 161, 0.25);
  border-top-color: var(--status-info);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

/* UPI Intent Apps Grid */
.upi-apps-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  width: 100%;
}

.upi-app-btn {
  background: var(--bg-secondary);
  border: 1px solid #D8DFE8;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  text-decoration: none;
}

.upi-app-btn:hover {
  border-color: var(--hdfc-blue);
  color: var(--hdfc-blue);
  background: #F5F8FC;
}

/* Meta Data List */
.meta-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 14px;
}

.meta-summary-table tr {
  border-bottom: 1px solid #EEF1F5;
}

.meta-summary-table tr:last-child {
  border-bottom: none;
}

.meta-summary-table td {
  padding: 9px 0;
}

.meta-summary-table td.label {
  color: var(--text-dim);
  font-weight: 500;
  text-align: left;
}

.meta-summary-table td.val {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-main);
  word-break: break-all;
}

/* Action button bar */
.actions-bar-row {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 16px;
}

/* Payment Methods Grid */
.pm-categories-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.pm-category-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.pm-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.pm-category-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.pm-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.pm-instrument-card {
  background: var(--bg-primary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s;
}

.pm-instrument-card:hover {
  border-color: var(--hdfc-blue);
}

.pm-inst-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 3px;
}

.pm-inst-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.pm-test-btn {
  margin-top: 12px;
  background: var(--bg-secondary);
  border: 1px solid #D8DFE8;
  color: var(--hdfc-blue);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.15s;
}

.pm-test-btn:hover {
  background: var(--hdfc-blue);
  border-color: var(--hdfc-blue);
  color: #FFFFFF;
}

/* Test Cards Box */
.test-cards-box {
  background: #F0F6FC;
  border: 1px dashed #A9C4E4;
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 24px;
}

.test-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.test-card-item {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.test-card-brand {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--hdfc-blue);
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.test-card-num {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-main);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.copy-mini-btn {
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 5px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  padding: 3px 8px;
  transition: all 0.15s;
}

.copy-mini-btn:hover {
  color: var(--hdfc-blue);
  border-color: var(--hdfc-blue);
}

.test-card-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Inspector JSON Viewer */
.json-viewer-box {
  background: #F7F9FB;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  max-height: 480px;
  overflow-y: auto;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Event Log List */
.events-stream-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 550px;
  overflow-y: auto;
}

.event-log-item {
  background: var(--bg-primary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.event-type-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: #E8F0F9;
  color: var(--hdfc-blue);
  white-space: nowrap;
}

.event-timestamp {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--text-dim);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-pop);
  animation: slideIn 0.25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 380px;
}

.toast.success { border-left-color: var(--status-success); }
.toast.success > :first-child { color: var(--status-success); }
.toast.info { border-left-color: var(--accent-blue); }
.toast.info > :first-child { color: var(--accent-blue); }
.toast.error { border-left-color: var(--status-danger); }
.toast.error > :first-child { color: var(--status-danger); }

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

/* Footer */
footer.app-footer {
  border-top: 1px solid var(--card-border);
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
  margin-top: 48px;
}

.footer-credit-link {
  color: var(--hdfc-blue);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.footer-credit-link iconify-icon {
  font-size: 13px;
}

.footer-credit-link:hover {
  text-decoration: underline;
}

/* Utility */
.text-success { color: var(--status-success); }
.text-warning { color: var(--status-warning); }
.text-danger { color: var(--status-danger); }
.text-accent { color: var(--hdfc-blue); }

@media (max-width: 768px) {
  header.app-header { padding: 12px 16px; }
  main.main-layout { padding: 20px 14px; }
  .glass-card { padding: 20px; }
  .page-intro h1 { font-size: 19px; }
  .stat-strip { flex-wrap: wrap; }
  .stat-item { padding: 6px 14px; }
}
