/* ==========================================================================
   AgraSadasya — Warm Heritage UI + Responsive QA-Guardian Safe Layout
   ========================================================================== */

:root {
  --crimson: #9B1B30;
  --crimson-dark: #7A1425;
  --crimson-soft: #FDF2F4;
  --gold: #C88A2E;
  --gold-soft: #FEF8EC;
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --border: #E7DFD5;
  --border-strong: #D2C6B8;
  --ink: #1E1B18;
  --muted: #665E57;
  --success: #166534;
  --success-bg: #DCFCE7;
  --info: #1D4ED8;
  --info-bg: #DBEAFE;
  --warn: #9A3412;
  --warn-bg: #FFEDD5;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 10px rgba(30, 27, 24, 0.06);
  --shadow-lg: 0 12px 36px rgba(30, 27, 24, 0.14);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', 'Noto Sans Devanagari', system-ui, -apple-system, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  height: auto;
  overflow-y: visible;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
button, a, input, select, textarea { touch-action: manipulation; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  text-decoration: none;
  white-space: normal;
  max-width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 0.86rem; }
.btn-lg { min-height: 48px; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-primary { background: var(--crimson); color: #fff; }
.btn-primary:hover { background: var(--crimson-dark); }

.btn-whatsapp { background: #16A34A; color: #fff; }
.btn-whatsapp:hover { background: #15803D; }

.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--bg); border-color: var(--crimson); color: var(--crimson); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(0,0,0,0.05); color: var(--ink); }

.btn-danger { background: #FEE2E2; color: #B91C1C; border-color: #FECACA; }
.btn-danger:hover { background: #FECACA; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #14532D; }

/* Inputs */
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px; /* Prevents iOS Safari zoom */
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: 82px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px rgba(155, 27, 48, 0.12);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.86rem; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 0.78rem; color: var(--muted); }
.form-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
  font-size: 0.88rem;
  font-weight: 500;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
}
.toast {
  background: #1E1B18;
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  animation: fadeSlide 0.2s ease;
}
.toast.toast-success { background: #166534; }
.toast.toast-error { background: #991B1B; }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   LOGIN SCREEN
   ========================================================================== */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top, #F9E9EC 0%, var(--bg) 55%);
}
.login-card {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
}
.login-header { text-align: center; margin-bottom: 22px; }
.login-logo { width: 72px; height: 64px; object-fit: contain; margin-bottom: 8px; }
.login-header h1 { margin: 0; font-size: 1.6rem; color: var(--crimson); }
.login-hi { margin: 4px 0 2px; font-weight: 600; font-size: 0.95rem; font-family: 'Noto Sans Devanagari', sans-serif; }
.login-sub { margin: 0; font-size: 0.86rem; color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 14px; }

.quick-login-box {
  margin-top: 18px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.quick-label { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.quick-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-btn {
  flex: 1 1 140px;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.pill-btn:hover { border-color: var(--crimson); color: var(--crimson); }

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.login-divider::before, .login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ==========================================================================
   TOPBAR & NAVIGATION
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFBF6 100%);
  border-top: 4px solid var(--crimson);
  border-bottom: 2px solid #E5C99A;
  padding: 9px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(155, 27, 48, 0.07);
}
.topbar-left { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; overflow: hidden; }
.topbar-crest {
  width: 46px;
  height: 44px;
  border-radius: 10px;
  border: 1.5px solid #DFC28E;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(155, 27, 48, 0.1);
}
.topbar-titles { min-width: 0; overflow: hidden; }
.topbar-logo { width: 100%; height: 100%; object-fit: contain; }
.topbar-name {
  font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.18rem;
  color: var(--crimson);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-sub { font-size: 0.78rem; font-weight: 600; color: #6B4E2E; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.login-crest {
  width: 82px;
  height: 76px;
  margin: 0 auto 10px;
  border-radius: 14px;
  border: 2px solid #DFC28E;
  background: #fff;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(155, 27, 48, 0.12);
}
.login-sanstha {
  margin: 0;
  font-family: 'Noto Sans Devanagari', sans-serif;
  font-size: 1.38rem;
  font-weight: 700;
  color: var(--crimson);
}

.desktop-nav { display: flex; align-items: center; gap: 6px; }
.nav-tab {
  min-height: 40px;
  padding: 0 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-tab:hover { background: var(--bg); color: var(--ink); }
.nav-tab.active { background: var(--crimson-soft); color: var(--crimson); }
.nav-count {
  background: var(--crimson);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 999px;
}

.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.user-chip { display: flex; align-items: center; gap: 8px; }
.role-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--crimson-soft);
  color: var(--crimson);
  text-transform: uppercase;
}
.role-badge.role-field { background: var(--gold-soft); color: #925B0E; }
.user-name { font-size: 0.86rem; font-weight: 600; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 20px 40px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h2 { margin: 0 0 4px; font-size: 1.4rem; }
.page-head p { margin: 0; font-size: 0.92rem; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Cards & Badges */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card-accent {
  border-left: 5px solid var(--crimson);
  background: linear-gradient(135deg, #FFFFFF 65%, #FFF8F0 100%);
}
.card-head-row { margin-bottom: 14px; }
.card-head-row h3 { margin: 6px 0 4px; font-size: 1.12rem; }
.card-head-row p { margin: 0; font-size: 0.88rem; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}
.badge-gold { background: var(--gold-soft); color: #925B0E; }
.badge-neutral { background: #F3EFEA; color: #575049; }
.badge-submitted { background: #FEF3C7; color: #92400E; }
.badge-verified { background: var(--info-bg); color: var(--info); }
.badge-sent { background: #EDE9FE; color: #6D28D9; }
.badge-assigned { background: var(--success-bg); color: var(--success); }

/* Share Hero */
.share-hero h3 { margin: 8px 0 6px; font-size: 1.18rem; }
.share-link-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.link-input {
  flex: 1 1 280px;
  background: var(--bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem;
}
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.share-options-row {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-strong);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.inline-field { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; font-weight: 600; color: var(--muted); }

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.kpi-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 1.55rem; font-weight: 700; color: var(--ink); margin-top: 4px; }
.kpi-value.accent { color: var(--crimson); }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.chip.active { background: var(--crimson); color: #fff; border-color: var(--crimson); }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 300px; }
.filter-row select { flex: 1 1 160px; max-width: 240px; }
.search-box { flex: 1 1 240px; max-width: 360px; }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data-table th {
  text-align: left;
  padding: 11px 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data-table tr:hover td { background: #FCFBF9; }
.cell-title { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
}

/* ==========================================================================
   MEMBERSHIP APPLICATION FORM (Shared by Public Link, Direct Entry & Edit)
   ========================================================================== */
.member-form { display: flex; flex-direction: column; gap: 20px; }
.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: #FFFEFC;
}
.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--crimson);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.form-grid .span-2 { grid-column: 1 / -1; }

.fee-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.fee-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: #fff;
}
.fee-option input[type="radio"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin-top: 2px;
  accent-color: var(--crimson);
}
.fee-option.selected { border-color: var(--crimson); background: var(--crimson-soft); }
.fee-option strong { display: block; font-size: 0.96rem; }
.fee-option span { font-size: 0.82rem; color: var(--muted); }

/* Proposer Autocomplete */
.proposer-suggest-wrap { position: relative; }
.proposer-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 220px;
  overflow-y: auto;
}
.proposer-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}
.proposer-item:hover { background: var(--crimson-soft); }

/* Photo Upload & Signature Pad */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.upload-box {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  background: #fff;
}
.photo-preview {
  width: 90px;
  height: 112px;
  object-fit: cover;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  margin: 0 auto 8px;
  display: block;
  background: var(--bg);
}
.sig-wrap {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 10px;
}
.sig-canvas {
  width: 100%;
  height: 110px;
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  touch-action: none;
  background: #FFFEFC;
  display: block;
}
.sig-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.bank-info-box {
  background: var(--gold-soft);
  border: 1px solid #F0D9B1;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.84rem;
}
.bank-info-box summary { font-weight: 700; cursor: pointer; color: #7C4A0A; }
.bank-info-box ul { margin: 8px 0 0; padding-left: 18px; }

.form-submit-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: 8px;
}

/* ==========================================================================
   PUBLIC APPLY SHELL (Option 2)
   ========================================================================== */
.public-shell { min-height: 100vh; padding-bottom: 40px; }
.public-header {
  background: linear-gradient(135deg, var(--crimson) 0%, #6D1020 100%);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.public-brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 54px; height: 48px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.hi-title { font-size: 1.25rem; font-weight: 700; font-family: 'Noto Sans Devanagari', sans-serif; }
.sub-title { font-size: 0.86rem; opacity: 0.92; font-family: 'Noto Sans Devanagari', sans-serif; }
.referrer-pill {
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}
.public-main { max-width: 820px; margin: 20px auto 0; padding: 0 16px; }
.leadership-strip {
  background: #FFF9EE;
  border-bottom: 1px solid #EBD8B7;
  color: #4A2B0A;
  padding: 8px 18px;
  font-size: 0.84rem;
  font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
}
.leadership-strip strong { color: var(--crimson); }
.login-leadership {
  margin-top: 10px;
  padding: 10px 12px;
  background: #FFF9EE;
  border: 1px solid #EBD8B7;
  border-radius: 10px;
  font-size: 0.82rem;
  font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
  line-height: 1.55;
  color: #4A2B0A;
}
.login-leadership strong { color: var(--crimson); }
.success-hero {
  text-align: center;
  padding: 28px 20px;
}
.success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  font-size: 1.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

/* ==========================================================================
   ADMIN PANEL
   ========================================================================== */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}
.inline-add-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.user-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 16, 14, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.modal-panel {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-sm { max-width: 480px; }
.modal-lg { max-width: 860px; }
.modal-a4 { max-width: 920px; }

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.modal-header h3 { margin: 0; font-size: 1.08rem; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-body { padding: 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
.modal-footer-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.stack-form { display: flex; flex-direction: column; gap: 14px; }

.wa-send-bar {
  padding: 10px 18px;
  background: #F0FDF4;
  border-bottom: 1px solid #BBF7D0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wa-send-inputs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.wa-send-inputs input {
  flex: 1 1 220px;
  max-width: 320px;
  min-height: 38px;
  padding: 6px 10px;
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.report-print-sheet {
  font-family: 'Inter', 'Noto Sans Devanagari', sans-serif;
  color: #1A1A1A;
  padding: 8mm;
}
.report-print-sheet h2 { margin: 0 0 4px; color: #9B1B30; font-size: 16pt; }
.report-print-sheet table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 9pt; }
.report-print-sheet th, .report-print-sheet td { border: 1px solid #CCC; padding: 5px 7px; text-align: left; }
.report-print-sheet th { background: #F4E1E7; color: #7A1425; }

/* Hyperlinks in Reports */
.form-link {
  color: var(--crimson);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.form-link:hover { color: var(--crimson-dark); }

/* New Forms Pipeline Status Bar — Train Live Status Style */
.status-bar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.status-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.status-bar-title { font-weight: 700; font-size: 0.96rem; color: var(--ink); }

.train-pipeline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  padding: 4px 0 2px;
}
.tp-station {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  background: none;
  border: none;
  padding: 0 2px;
  cursor: pointer;
  font-family: inherit;
}
.tp-station::before {
  content: "";
  position: absolute;
  top: 15px;
  left: 0;
  right: 50%;
  height: 4px;
  background: #E2DBD2;
  z-index: 1;
}
.tp-station::after {
  content: "";
  position: absolute;
  top: 15px;
  left: 50%;
  right: 0;
  height: 4px;
  background: #E2DBD2;
  z-index: 1;
}
.tp-station:first-child::before { display: none; }
.tp-station:last-child::after { display: none; }
.tp-station.has-passed::before,
.tp-station.has-passed::after { background: #16A34A; }
.tp-station.is-active::before { background: #16A34A; }

.tp-node {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #D5CCC2;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  transition: transform 0.15s, border-color 0.15s;
}
.tp-station:hover .tp-node { transform: scale(1.08); border-color: var(--crimson); }
.tp-station.has-passed .tp-node {
  background: #16A34A;
  border-color: #16A34A;
  color: #fff;
}
.tp-station.is-active .tp-node {
  background: var(--crimson);
  border-color: var(--crimson);
  color: #fff;
  box-shadow: 0 0 0 5px rgba(155, 27, 48, 0.18);
  animation: livePulse 1.8s infinite;
}
.tp-label {
  margin-top: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.tp-sub {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Per-Form Compact Train Live Status Linear Track */
.live-track {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-top: 8px;
  min-width: 240px;
  max-width: 310px;
}
.lt-stop {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}
.lt-stop::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 0;
  right: 50%;
  height: 3px;
  background: #E2DBD2;
  z-index: 1;
}
.lt-stop::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  right: 0;
  height: 3px;
  background: #E2DBD2;
  z-index: 1;
}
.lt-stop:first-child::before { display: none; }
.lt-stop:last-child::after { display: none; }
.lt-stop.done::before,
.lt-stop.done::after { background: #16A34A; }
.lt-stop.live::before { background: #16A34A; }

.lt-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid #CFC6BC;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}
.lt-stop.done .lt-dot {
  background: #16A34A;
  border-color: #16A34A;
}
.lt-stop.live .lt-dot {
  background: var(--crimson);
  border-color: var(--crimson);
  box-shadow: 0 0 0 4px rgba(155, 27, 48, 0.2);
  animation: livePulse 1.8s infinite;
}
.lt-name {
  margin-top: 4px;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.15;
}
.lt-stop.done .lt-name { color: #166534; }
.lt-stop.live .lt-name { color: var(--crimson); font-weight: 700; }

@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(155, 27, 48, 0.32); }
  70%  { box-shadow: 0 0 0 7px rgba(155, 27, 48, 0); }
  100% { box-shadow: 0 0 0 0 rgba(155, 27, 48, 0); }
}

@media (max-width: 640px) {
  .live-track { min-width: 0; width: 100%; max-width: none; }
  .tp-node { width: 26px; height: 26px; font-size: 0.72rem; }
  .tp-station::before, .tp-station::after { top: 12px; }
  .tp-label { font-size: 0.68rem; }
}

/* Accounts & BRS */
.bank-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.bank-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bank-card-name { font-weight: 700; font-size: 0.94rem; color: var(--ink); }
.bank-card-no { font-size: 0.78rem; color: var(--muted); }
.bank-card-bal { font-size: 1.35rem; font-weight: 700; color: var(--crimson); }
.bank-card-meta { font-size: 0.78rem; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }

.tx-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 12px;
}
.tx-form-grid .span-2 { grid-column: span 2; }
.tx-form-grid .span-full { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
@media (max-width: 640px) {
  .tx-form-grid .span-2 { grid-column: span 1; }
  .tx-form-grid .span-full .btn { width: 100%; }
}

.brs-stmt-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.reconcile-check {
  width: 20px;
  height: 20px;
  min-height: 20px;
  accent-color: var(--success);
  cursor: pointer;
}

/* Money Receipt Printable Sheet */
.money-receipt-sheet {
  background: #fff;
  color: #1A1A1A;
  font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
  padding: 6px;
}
.mr-border {
  border: 2px solid #9B1B30;
  border-radius: 8px;
  padding: 16px 18px;
  background: #FFFEFC;
}
.mr-header {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid #DFC28E;
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.mr-logo { width: 64px; height: 58px; object-fit: contain; flex-shrink: 0; }
.mr-org { flex: 1; text-align: center; }
.mr-title { font-size: 17pt; font-weight: 700; color: #9B1B30; }
.mr-unit { font-size: 9.2pt; font-weight: 600; color: #333; }
.mr-leaders { font-size: 8.2pt; color: #5A3A14; margin-top: 2px; }
.mr-banner {
  background: #9B1B30;
  color: #fff;
  text-align: center;
  font-weight: 700;
  padding: 5px;
  border-radius: 4px;
  font-size: 10.5pt;
  margin-bottom: 12px;
}
.mr-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 9.5pt;
  margin-bottom: 10px;
}
.mr-highlight { color: #9B1B30; font-weight: 700; }
.mr-table { width: 100%; border-collapse: collapse; font-size: 9.8pt; }
.mr-table th, .mr-table td { border: 1px solid #D9C9B8; padding: 8px 10px; text-align: left; }
.mr-table th { width: 32%; background: #FAF3EC; color: #4A2B0A; font-weight: 700; }
.mr-amount { font-size: 14pt; font-weight: 700; color: #166534; }
.mr-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.mr-note { font-size: 8.2pt; color: #555; line-height: 1.5; }
.mr-sign { text-align: center; min-width: 190px; }
.mr-sign-line { border-bottom: 1px solid #333; height: 28px; margin-bottom: 4px; }

/* ==========================================================================
   A4 PRE-FILLED HINDI FORM (आवेदन - पत्र 'क')
   ========================================================================== */
.a4-scroll-stage {
  background: #525659;
  padding: 16px;
  overflow: auto;
}
.a4-stage { display: flex; justify-content: center; }

.abas-a4-sheet {
  width: 204mm;
  min-width: 204mm;
  flex-shrink: 0;
  background: #fff;
  color: #1A1A1A;
  padding: 6mm 8mm 5mm;
  font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
  font-size: 9.4pt;
  line-height: 1.22;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
  position: relative;
}

.a4-top-header {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1.8px solid #A61C3C;
  padding-bottom: 4px;
  margin-bottom: 4px;
}
.a4-logo { width: 62px; height: 55px; object-fit: contain; flex-shrink: 0; }
.a4-org-text { flex: 1; text-align: center; }
.a4-org-name { font-size: 18pt; font-weight: 700; color: #1F2430; line-height: 1.12; }
.a4-org-reg { font-size: 8pt; color: #A61C3C; font-weight: 600; margin-top: 1px; }
.a4-org-addr { font-size: 8.2pt; color: #222; font-weight: 600; }
.a4-org-contact { font-size: 8pt; color: #333; }

.a4-banner {
  background: #B01E44;
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 10pt;
  padding: 2px 10px;
  border-radius: 3px;
  margin: 3px auto 4px;
}
.a4-banner-sm { max-width: 190px; }

.a4-top-grid {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.a4-top-left { flex: 1; }
.a4-subtitle { text-align: center; font-weight: 700; font-size: 10.6pt; margin-bottom: 0; }
.a4-subrule { text-align: center; font-size: 8.4pt; color: #333; margin-bottom: 4px; }

.a4-meta-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 4px;
}
.a4-meta-col { flex: 1; }
.a4-red-label { color: #B01E44; font-weight: 700; font-size: 8.8pt; margin-bottom: 1px; }
.a4-box {
  border: 1px solid #888;
  min-height: 21px;
  padding: 1px 6px;
  font-weight: 600;
  font-size: 9pt;
  background: #fff;
  display: flex;
  align-items: center;
}
.a4-formno-wrap { display: flex; gap: 4px; }
.a4-formno-prefix {
  border: 1px solid #888;
  padding: 1px 5px;
  font-weight: 700;
  font-size: 8.8pt;
  background: #F9F7F4;
  display: flex;
  align-items: center;
}
.a4-formno-val { flex: 1; }

.a4-photos { display: flex; gap: 6px; flex-shrink: 0; }
.a4-photo-box {
  width: 31mm;
  height: 38mm;
  border: 1.2px dashed #B01E44;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 7.4pt;
  color: #555;
  overflow: hidden;
  padding: 2px;
  background: #FFFCFD;
}
.a4-photo-box img { width: 100%; height: 100%; object-fit: cover; }

.a4-to-block { font-size: 8.8pt; margin: 2px 0; }
.a4-to-dest { color: #B01E44; font-weight: 700; padding-left: 14px; }

.a4-intro-line { font-size: 8.7pt; margin: 3px 0 4px; line-height: 1.38; }
.a4-inline-box {
  display: inline-block;
  border: 1px solid #888;
  padding: 0 8px;
  min-width: 86px;
  font-weight: 700;
  text-align: center;
  margin: 0 3px;
}

.a4-section-heading {
  color: #B01E44;
  font-weight: 700;
  font-size: 9.6pt;
  margin: 2px 0 3px;
}

.a4-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 3.5px;
  font-size: 8.7pt;
}
.a4-lbl { white-space: nowrap; font-weight: 600; color: #222; }
.a4-val {
  flex: 1;
  border: 1px solid #999;
  min-height: 19px;
  padding: 1px 5px;
  font-weight: 600;
  font-size: 8.8pt;
  display: flex;
  align-items: center;
}
.a4-subnote { font-size: 7pt; color: #555; text-align: center; margin-top: -2px; margin-bottom: 3px; }

.a4-date-boxes { display: inline-flex; align-items: center; gap: 2px; }
.a4-dbox {
  border: 1px solid #999;
  min-width: 21px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 8.4pt;
  padding: 0 2px;
}
.a4-dbox-yr { min-width: 38px; }

.a4-decl { font-size: 8.3pt; line-height: 1.36; margin: 3px 0; }
.a4-sig-img { max-height: 24px; max-width: 130px; object-fit: contain; }

.a4-office-banner {
  background: #B01E44;
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 9.2pt;
  padding: 2px;
  margin: 4px 0 4px;
}

.a4-gotra-line { font-size: 7.3pt; color: #333; margin: 3px 0; line-height: 1.28; }
.a4-bank-title { font-size: 7.9pt; color: #B01E44; font-weight: 700; margin-top: 2px; }
.a4-bank-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 7.6pt;
  margin: 1px 0 3px;
}
.a4-bank-grid td { padding: 1px 3px; }
.a4-fee-note {
  text-align: center;
  font-size: 7.8pt;
  font-weight: 700;
  color: #B01E44;
  border-top: 1px solid #E5B8C4;
  border-bottom: 1px solid #E5B8C4;
  padding: 2px 4px;
  margin: 3px 0 4px;
}

.a4-receipt {
  border: 1.2px solid #777;
  padding: 4px 7px;
  background: #FDFBFC;
}
.a4-receipt-head {
  background: #F4E1E7;
  color: #B01E44;
  font-weight: 700;
  text-align: center;
  font-size: 8.6pt;
  padding: 1.5px;
  margin: -4px -7px 4px;
  border-bottom: 1px solid #D9B3BE;
}

/* ==========================================================================
   MOBILE BOTTOM NAV & RESPONSIVE RULES (QA-UI-GUARDIAN)
   ========================================================================== */
.mobile-bottom-nav { display: none; }

@media (max-width: 980px) {
  .desktop-nav { display: none; }
  .user-name { display: none; }
  .app-main { padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); }
  .topbar { padding: 10px 14px; }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
  }
  .m-nav-btn {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 2px;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
  }
  .m-nav-btn.active { color: var(--crimson); background: var(--crimson-soft); }
  .m-nav-icon { font-size: 1.15rem; line-height: 1; }
}

@media (max-width: 640px) {
  .card { padding: 14px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .inline-add-form { grid-template-columns: 1fr; }
  .filter-row select, .search-box { max-width: none; width: 100%; }
  .share-actions { width: 100%; }
  .share-actions .btn { flex: 1 1 140px; }

  /* Convert data tables into clean vertical stacked cards on phones */
  table.data-table, table.data-table thead, table.data-table tbody, table.data-table tr, table.data-table td {
    display: block;
    width: 100%;
  }
  table.data-table thead { display: none; }
  table.data-table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
    background: #fff;
  }
  table.data-table td {
    border: none;
    padding: 4px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    text-align: right;
  }
  table.data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--muted);
    text-align: left;
    flex-shrink: 0;
  }
  table.data-table td.td-actions {
    display: block;
    text-align: left;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
  }
  table.data-table td.td-actions::before { display: none; }
  .row-actions .btn { flex: 1 1 120px; }
}

/* ==========================================================================
   VERSION BADGE & COPYRIGHT FOOTER
   ========================================================================== */
.app-version-pill {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(155, 27, 48, 0.12);
  color: var(--crimson);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.topbar-sub .app-version-pill {
  background: rgba(155, 27, 48, 0.10);
  color: var(--crimson);
  border: 1px solid rgba(155, 27, 48, 0.24);
  font-size: 0.68rem;
  padding: 0px 6px;
}
.login-footer {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.app-footer {
  margin-top: 28px;
  padding: 14px 12px 10px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer-copy {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.45;
}
.footer-support {
  font-size: 0.8rem;
  color: var(--ink);
  margin-bottom: 5px;
}
.footer-support a {
  color: var(--crimson);
  font-weight: 700;
  text-decoration: none;
}
.footer-support a:hover { text-decoration: underline; }
.footer-credit {
  margin-top: 3px;
  font-size: 0.62rem;
  color: #9A9086;
  letter-spacing: 0.03em;
}

/* ==========================================================================
   HOME DASHBOARD
   ========================================================================== */
.home-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.home-hero-title {
  margin: 6px 0 4px;
  font-size: 1.32rem;
  color: var(--crimson);
}
.home-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.home-action-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.home-action-card:hover {
  transform: translateY(-2px);
  border-color: var(--crimson);
  box-shadow: var(--shadow-lg);
}
.home-action-icon { font-size: 1.65rem; line-height: 1; }
.home-action-title { font-size: 1.02rem; font-weight: 700; color: var(--ink); }
.home-action-desc { font-size: 0.84rem; color: var(--muted); line-height: 1.4; }
.home-support-bar {
  background: #FFF8F0;
  border: 1px solid #F3D9B1;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink);
}
.home-support-bar a { color: var(--crimson); text-decoration: none; }
.home-support-bar a:hover { text-decoration: underline; }
@media (max-width: 760px) {
  .m-nav-btn { font-size: 0.64rem; padding: 6px 2px; min-width: 0; }
  .m-nav-icon { font-size: 1.05rem; }
}

/* ==========================================================================
   FINAL SUBMIT CONFIRMATION MODAL (GREEN TICK)
   ========================================================================== */
.submit-confirm-body {
  text-align: center;
  padding: 28px 22px 22px !important;
}
.confirm-tick-circle {
  width: 74px;
  height: 74px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #16A34A, #15803D);
  box-shadow: 0 8px 22px rgba(22, 163, 74, 0.30);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: confirmPop 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes confirmPop {
  0% { transform: scale(0.5); opacity: 0; }
  80% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.confirm-title {
  margin: 0 0 14px;
  font-size: 1.24rem;
  color: #14532D;
}
.confirm-formno-box {
  background: #F0FDF4;
  border: 1.5px solid #86EFAC;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.confirm-formno-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #166534;
}
.confirm-formno-val {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--crimson);
  margin-top: 2px;
}
.confirm-applicant-meta {
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 3px;
}
.confirm-message {
  margin: 0 0 20px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
}
.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.confirm-actions .btn {
  width: 100%;
}

/* ==========================================================================
   PRINT STYLES — CRISP SINGLE-PAGE A4 PDF
   ========================================================================== */
.print-only { display: none; }

@media print {
  @page { size: A4 portrait; margin: 5mm; }
  body > *:not(#print-only-container) { display: none !important; }
  #print-only-container {
    display: block !important;
    background: #fff !important;
  }
  .abas-a4-sheet {
    width: 100% !important;
    min-height: auto !important;
    box-shadow: none !important;
    padding: 4mm 6mm !important;
  }
}
