/* ==============================================================================
   CropVault - Cold Storage & Emergency Loan Linker
   Theme: Agricultural Fintech (Emerald, Mint, Golden Harvest, Crisp White)
   JNTUA Innovation Conclave Prototype
   ============================================================================== */

:root {
  /* Color Palette */
  --primary-900: #064e3b;
  --primary-800: #065f46;
  --primary-700: #047857;
  --primary-600: #059669;
  --primary-500: #10b981;
  --primary-400: #34d399;
  --primary-100: #d1fae5;
  --primary-50: #ecfdf5;

  --accent-gold: #d97706;
  --accent-gold-light: #fef3c7;
  --accent-blue: #0284c7;
  --accent-blue-light: #e0f2fe;

  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;

  --danger-600: #dc2626;
  --danger-50: #fef2f2;
  --danger-border: #fecaca;

  --success-600: #16a34a;
  --success-50: #f0fdf4;

  --white: #ffffff;
  --surface-card: #ffffff;
  --surface-bg: #f7faf8;

  /* Typography */
  --font-main: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.05);

  /* Border Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base & Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--surface-bg);
  color: var(--slate-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navigation */
.header {
  background: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-800) 60%, var(--primary-700) 100%);
  color: var(--white);
  padding: 0.75rem 1.5rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--primary-400);
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-text .tagline {
  font-size: 0.75rem;
  color: var(--primary-100);
  opacity: 0.9;
  font-weight: 400;
}

.conclave-badge {
  font-size: 0.68rem;
  background: rgba(217, 119, 6, 0.3);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fef08a;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
}

.nav-item {
  color: var(--primary-100);
  text-decoration: none;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition-fast);
  cursor: pointer;
  background: transparent;
  border: none;
}

.nav-item:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.12);
}

.nav-item.active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.2);
  font-weight: 600;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--white);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.status-badge[hidden] {
  display: none;
}

.status-badge:hover {
  background: rgba(0, 0, 0, 0.35);
}

.btn-sign-out {
  min-height: 40px;
  padding: 0.35rem 0.7rem;
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--white);
  white-space: nowrap;
}

.btn-sign-out:hover {
  background: rgba(0, 0, 0, 0.35);
}

.btn-sign-out[hidden],
.auth-gate[hidden] {
  display: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.78);
}

.auth-card {
  width: min(100%, 420px);
  padding: 1.75rem;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-xl);
}

.auth-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin-bottom: 0.85rem;
  border-radius: var(--radius-md);
  background: var(--primary-50);
  color: var(--primary-700);
  font-size: 1.2rem;
}

.auth-card h2 {
  margin-bottom: 0.3rem;
  color: var(--slate-900);
  font-size: 1.35rem;
}

.auth-card > p {
  margin-bottom: 1.25rem;
  color: var(--slate-600);
  font-size: 0.9rem;
}

.auth-card .form-group {
  margin-bottom: 0.9rem;
}

.auth-card .form-control {
  min-height: 44px;
}

.auth-error {
  color: var(--danger-600) !important;
  font-size: 0.82rem !important;
}

.auth-submit {
  width: 100%;
  min-height: 46px;
}

.auth-card .auth-note {
  margin: 1rem 0 0;
  font-size: 0.78rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary-400);
  box-shadow: 0 0 8px var(--primary-400);
  animation: pulse-dot 2s infinite;
}

.status-dot.offline {
  background-color: #fbbf24;
  box-shadow: 0 0 8px #fbbf24;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Banner Alert */
.demo-banner {
  background: linear-gradient(90deg, #fef3c7 0%, #fffbeb 100%);
  border-bottom: 1px solid #fde68a;
  color: #92400e;
  padding: 0.5rem 1.5rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.demo-banner-content {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}

.demo-banner strong {
  font-weight: 700;
}

.demo-banner .badge-pill {
  background: #f59e0b;
  color: #ffffff;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
}

/* Main Container */
.main-content {
  max-width: 1280px;
  width: 100%;
  margin: 1.5rem auto 3rem;
  padding: 0 1.25rem;
  flex: 1;
}

/* Section Tabs */
.view-section {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.view-section.active {
  display: block;
}

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

/* Section Titles */
.section-header {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-header-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-header-title h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.02em;
}

.section-subtitle {
  color: var(--slate-500);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary-700);
  color: var(--white);
  box-shadow: 0 2px 4px rgba(4, 120, 87, 0.25);
}

.btn-primary:hover {
  background-color: var(--primary-800);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(4, 120, 87, 0.3);
}

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

.btn-secondary {
  background-color: var(--white);
  color: var(--slate-700);
  border-color: var(--slate-200);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background-color: var(--slate-50);
  border-color: var(--slate-400);
}

.btn-amber {
  background-color: var(--accent-gold);
  color: var(--white);
  box-shadow: 0 2px 4px rgba(217, 119, 6, 0.25);
}

.btn-amber:hover {
  background-color: #b45309;
}

.btn-outline-primary {
  background-color: transparent;
  color: var(--primary-700);
  border-color: var(--primary-600);
}

.btn-outline-primary:hover {
  background-color: var(--primary-50);
}

.btn-danger-outline {
  background-color: transparent;
  color: var(--danger-600);
  border-color: var(--danger-border);
}

.btn-danger-outline:hover {
  background-color: var(--danger-50);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

/* Stat Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background-color: var(--primary-600);
}

.stat-card.amber::before {
  background-color: var(--accent-gold);
}

.stat-card.blue::before {
  background-color: var(--accent-blue);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-info .stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
  margin-bottom: 0.3rem;
}

.stat-info .stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.1;
  font-family: var(--font-main);
}

.stat-info .stat-sub {
  font-size: 0.75rem;
  color: var(--primary-700);
  font-weight: 600;
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background-color: var(--primary-50);
  color: var(--primary-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-card.amber .stat-icon {
  background-color: var(--accent-gold-light);
  color: var(--accent-gold);
}

.stat-card.blue .stat-icon {
  background-color: var(--accent-blue-light);
  color: var(--accent-blue);
}

/* Dashboard 2-column layout */
.dashboard-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 960px) {
  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--slate-100);
}

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--slate-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Form Styling */
.form-grid-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.5rem;
}

@media (max-width: 880px) {
  .form-grid-layout {
    grid-template-columns: 1fr;
  }
}

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

.form-group label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 0.35rem;
}

.form-group label .required {
  color: var(--danger-600);
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  background-color: var(--white);
  color: var(--slate-800);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-control.is-invalid {
  border-color: var(--danger-600);
  background-color: var(--danger-50);
}

.invalid-feedback {
  font-size: 0.75rem;
  color: var(--danger-600);
  margin-top: 0.25rem;
  display: none;
}

.form-control.is-invalid + .invalid-feedback {
  display: block;
}

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

.input-with-hint {
  position: relative;
}

.input-hint-pill {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary-700);
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  margin-top: 0.3rem;
  display: inline-block;
}

/* Quality Metric Gauge / Sliders */
.metric-box {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 0.75rem;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.metric-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-700);
}

.metric-value-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--primary-100);
  color: var(--primary-800);
}

.metric-hint {
  font-size: 0.72rem;
  color: var(--slate-500);
  margin-top: 0.25rem;
}

/* Grade Selection Cards */
.grade-selector-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.grade-option {
  position: relative;
}

.grade-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.grade-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 0.3rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--white);
  transition: all var(--transition-fast);
  text-align: center;
}

.grade-card .grade-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--slate-800);
}

.grade-card .grade-sub {
  font-size: 0.66rem;
  color: var(--slate-500);
}

.grade-option input[type="radio"]:checked + .grade-card {
  border-color: var(--primary-600);
  background: var(--primary-50);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.grade-option input[type="radio"]:checked + .grade-card .grade-name {
  color: var(--primary-800);
}

/* Form Action Buttons Bar */
.form-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--slate-200);
}

/* Table Design */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.records-table th {
  background-color: var(--slate-50);
  color: var(--slate-600);
  font-weight: 600;
  padding: 0.85rem 1rem;
  border-bottom: 1.5px solid var(--slate-200);
  white-space: nowrap;
}

.records-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-700);
  vertical-align: middle;
}

.records-table tbody tr {
  transition: background-color var(--transition-fast);
}

.records-table tbody tr:hover {
  background-color: #f8fafc;
}

.receipt-id-tag {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary-800);
  background: var(--primary-50);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary-100);
  display: inline-block;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 600;
}

.badge-grade-a-plus {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-grade-a {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge-grade-b {
  background-color: #fefce8;
  color: #854d0e;
  border: 1px solid #fef08a;
}

.badge-grade-c {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Search and Filters Bar */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-input-wrapper i {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400);
}

.search-input-wrapper input {
  padding-left: 2.3rem;
}

.filter-select {
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--slate-700);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--slate-500);
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--slate-300);
  margin-bottom: 0.75rem;
}

.empty-state h4 {
  font-size: 1.1rem;
  color: var(--slate-700);
  margin-bottom: 0.3rem;
}

/* Modal Overlay & Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--white);
  border-radius: var(--radius-lg);
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-dialog {
  transform: scale(1);
}

.modal-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--slate-50);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--slate-800);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--slate-400);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--slate-700);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--slate-200);
  background: var(--slate-50);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* ==============================================================================
   OFFICIAL DIGITAL RECEIPT LAYOUT (Voucher Style)
   ============================================================================== */
.receipt-paper {
  background: #ffffff;
  border: 2px dashed #059669;
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  position: relative;
  color: #1e293b;
}

.receipt-header-strip {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #065f46;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.receipt-brand-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.receipt-brand-logo {
  width: 50px;
  height: 50px;
  background: #047857;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  border-radius: 8px;
}

.receipt-titles h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #064e3b;
  letter-spacing: -0.01em;
  margin: 0;
}

.receipt-titles p {
  font-size: 0.78rem;
  color: #475569;
  font-weight: 500;
}

.receipt-meta-box {
  text-align: right;
}

.receipt-id-number {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  color: #047857;
  background: #ecfdf5;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  border: 1px solid #a7f3d0;
  display: inline-block;
  margin-bottom: 0.2rem;
}

.receipt-date-label {
  font-size: 0.74rem;
  color: #64748b;
}

.receipt-columns {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
  .receipt-columns {
    grid-template-columns: 1fr;
  }
}

.receipt-details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.receipt-details-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid #f1f5f9;
}

.receipt-details-table td.label-cell {
  font-weight: 600;
  color: #475569;
  width: 42%;
  background-color: #fafbfc;
}

.receipt-details-table td.val-cell {
  color: #0f172a;
  font-weight: 600;
}

.receipt-qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.receipt-qr-box {
  width: 140px;
  height: 140px;
  background: #ffffff;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.receipt-qr-box img, .receipt-qr-box canvas {
  max-width: 100% !important;
  height: auto !important;
}

.qr-caption {
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 500;
}

/* Quality Matrix on Receipt */
.receipt-photo-card {
  margin-top: 0.65rem;
  padding: 0.45rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  text-align: center;
  width: 140px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.receipt-photo-img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.receipt-photo-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: #065f46;
  margin-top: 0.25rem;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.photo-dropzone {
  border: 1.5px dashed var(--slate-300);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  background: var(--slate-50);
  transition: all var(--transition-fast);
  cursor: pointer;
  margin-top: 0.35rem;
}

.photo-dropzone:hover {
  border-color: var(--primary-600);
  background: var(--primary-50);
}

.table-crop-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--slate-200);
}

.receipt-quality-matrix {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  text-align: center;
}

@media (max-width: 580px) {
  .receipt-quality-matrix {
    grid-template-columns: repeat(2, 1fr);
  }
}

.quality-cell .q-label {
  font-size: 0.7rem;
  color: #166534;
  font-weight: 600;
  text-transform: uppercase;
}

.quality-cell .q-val {
  font-size: 1.05rem;
  font-weight: 800;
  color: #064e3b;
}

/* Emergency Loan Linker Strip on Receipt */
.loan-linker-strip {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #fcd34d;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.loan-linker-text h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.loan-linker-text p {
  font-size: 0.75rem;
  color: #78350f;
}

.loan-eligible-amount {
  text-align: right;
  white-space: nowrap;
}

.loan-amount-badge {
  font-size: 1.15rem;
  font-weight: 800;
  color: #92400e;
  font-family: var(--font-mono);
}

/* Regulatory Disclaimer Box */
.receipt-disclaimer-box {
  background: #fff1f2;
  border: 1.5px solid #fecdd3;
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  margin-top: 1rem;
  text-align: center;
}

.receipt-disclaimer-box .disclaimer-title {
  color: #be123c;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.receipt-disclaimer-box .disclaimer-desc {
  font-size: 0.7rem;
  color: #9f1239;
  line-height: 1.35;
}

.receipt-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px dashed #cbd5e1;
  font-size: 0.75rem;
  color: #64748b;
}

.signature-block {
  text-align: center;
  width: 180px;
}

.signature-line {
  border-top: 1px solid #94a3b8;
  margin-top: 2rem;
  padding-top: 0.25rem;
  font-weight: 600;
  color: #334155;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toast {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary-600);
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 300px;
  max-width: 420px;
  animation: slideInRight 0.25s ease-out;
  color: var(--slate-800);
}

.toast.toast-error {
  border-left-color: var(--danger-600);
}

.toast.toast-warning {
  border-left-color: var(--accent-gold);
}

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

/* Verification Card */
.verification-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.verification-status-header {
  background: linear-gradient(135deg, #065f46 0%, #047857 100%);
  color: #ffffff;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-badge-verified {
  background: #ecfdf5;
  color: #065f46;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Loan Calculator Section Cards */
.loan-calculator-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.5rem;
}

@media (max-width: 880px) {
  .loan-calculator-grid {
    grid-template-columns: 1fr;
  }
}

.loan-benefit-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.loan-benefit-list {
  list-style: none;
  margin-top: 0.75rem;
}

.loan-benefit-list li {
  font-size: 0.85rem;
  color: #065f46;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.loan-benefit-list li i {
  color: #10b981;
  margin-top: 0.2rem;
}

/* Footer */
.footer {
  background: var(--slate-900);
  color: var(--slate-400);
  padding: 2rem 1.5rem;
  margin-top: auto;
  font-size: 0.82rem;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

.footer-links a {
  color: var(--slate-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--white);
}

@media (max-width: 820px) {
  .header {
    padding: 0.65rem 0.85rem;
  }

  .header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
  }

  .brand-text h1 {
    font-size: 1.15rem;
  }

  .brand-text .tagline {
    font-size: 0.68rem;
  }

  .header-inner nav {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .nav-links {
    width: max-content;
    gap: 0.25rem;
  }

  .nav-item {
    min-height: 44px;
    padding: 0.55rem 0.7rem;
    white-space: nowrap;
  }

  .status-badge {
    padding: 0.35rem 0.55rem;
    white-space: nowrap;
  }

  .main-content {
    width: 100%;
    margin: 1rem auto 2rem;
    padding: 0 0.85rem;
  }

  .dashboard-layout > * {
    min-width: 0;
  }

  .section-header {
    align-items: flex-start;
  }

  .section-header-title h2 {
    font-size: 1.35rem;
  }

  .section-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .stat-card {
    min-width: 0;
    gap: 0.5rem;
    padding: 1rem;
  }

  .stat-info .stat-value {
    font-size: 1.5rem;
    overflow-wrap: anywhere;
  }

  .stat-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    font-size: 1.2rem;
  }

  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .form-grid-layout,
  .loan-calculator-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .form-actions-bar {
    flex-wrap: wrap;
  }

  .form-actions-bar .btn {
    flex: 1 1 100%;
    min-height: 44px;
  }

  .table-toolbar {
    align-items: stretch;
  }

  .search-input-wrapper {
    flex-basis: 100%;
    min-width: 0;
  }

  .filter-select {
    flex: 1 1 140px;
    min-width: 0;
    min-height: 44px;
  }

  .records-table {
    min-width: 680px;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-dialog {
    width: 100%;
    max-width: none;
    max-height: 94dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .receipt-paper {
    padding: 1rem;
  }

  .receipt-header-strip {
    gap: 0.75rem;
  }

  .receipt-titles h2 {
    font-size: 1.1rem;
  }

  .receipt-id-number {
    font-size: 0.82rem;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 480px) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .header-inner nav {
    grid-column: 1;
  }

  .header-inner .status-badge {
    justify-self: start;
  }

  .main-content {
    padding: 0 0.65rem;
  }

  .section-header-title h2 {
    font-size: 1.2rem;
  }

  .section-subtitle {
    font-size: 0.82rem;
  }

  .stats-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
  }

  .stat-card {
    padding: 0.85rem 1rem;
  }

  .card {
    padding: 0.85rem;
    border-radius: var(--radius-md);
  }

  .card-header {
    align-items: flex-start;
    gap: 0.5rem;
  }

  .card-header h3 {
    font-size: 1rem;
  }

  .grade-selector-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recent-row-hover {
    flex-wrap: wrap;
  }

  .recent-row-hover > div:first-child {
    min-width: 0;
    flex: 1 1 100%;
  }

  .recent-row-hover > div:first-child > div:last-child {
    min-width: 0;
  }

  .recent-row-hover > div:first-child > div:last-child > div:first-child {
    flex-wrap: wrap;
  }

  .recent-row-hover .receipt-id-tag {
    overflow-wrap: anywhere;
  }

  .recent-row-hover > div:last-child {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .loan-linker-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .receipt-header-strip {
    flex-direction: column;
  }

  .receipt-meta-box {
    text-align: left;
  }

  .footer {
    padding: 1.5rem 1rem;
  }

  .footer-inner,
  .footer-links {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Print styles for the clean digital voucher */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }

  .header,
  .demo-banner,
  .nav-links,
  .section-actions,
  .modal-header,
  .modal-footer,
  .toast-container,
  .footer,
  .btn,
  .table-toolbar,
  .main-content > *:not(#receipt-modal-container) {
    display: none !important;
  }

  .modal-overlay {
    position: static !important;
    background: none !important;
    backdrop-filter: none !important;
    display: block !important;
    padding: 0 !important;
    opacity: 1 !important;
  }

  .modal-dialog {
    box-shadow: none !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
  }

  .modal-body {
    padding: 0 !important;
  }

  .receipt-paper {
    border: 2px solid #000000 !important;
    box-shadow: none !important;
    padding: 1.5cm !important;
    width: 100% !important;
    page-break-inside: avoid;
  }

  .receipt-id-number {
    border: 1px solid #000000 !important;
    color: #000000 !important;
    background: none !important;
  }

  .receipt-disclaimer-box {
    border: 1px solid #000000 !important;
    background: none !important;
    color: #000000 !important;
  }

  .receipt-disclaimer-box .disclaimer-title,
  .receipt-disclaimer-box .disclaimer-desc {
    color: #000000 !important;
  }
}
