/* ==========================================================================
   AgriStack Farmer ID Card Studio Stylesheet
   DocConvert.online - Professional 3-Column Layout & CR80 PVC Card Engine
   ========================================================================== */

:root {
  --studio-bg: #f3f4f6;
  --panel-bg: #ffffff;
  --border-color: #e5e7eb;
  --primary-green: #15803d;
  --dark-green: #14532d;
  --gold-accent: #f59e0b;
  --text-main: #1f2937;
  --text-muted: #64748b;
  --card-w: 450px;
  --card-h: 284px;
  --radius-card: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--studio-bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   1. APP TOPBAR & CONTROLS
   ========================================================================== */
.app-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.topbar-left {
  display: flex;
  align-items: center;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #0f172a;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  color: #ffffff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.brand-name span {
  font-size: 0.82rem;
  font-weight: 600;
  background: #dcfce7;
  color: #166534;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Topbar Center Actions (Buttons matching reference) */
.topbar-center-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-save-front,
.btn-save-back {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

.btn-save-front:hover,
.btn-save-back:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.paper-selector-wrap {
  position: relative;
}

.paper-select {
  padding: 7px 12px;
  font-size: 0.83rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  cursor: pointer;
  outline: none;
}

.paper-select:focus {
  border-color: #15803d;
  box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.15);
}

.btn-print-main {
  background: #15803d;
  color: #ffffff;
  padding: 7px 16px;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(21, 128, 61, 0.25);
}

.btn-print-main:hover {
  background: #166534;
}

.btn-sample {
  background: transparent;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.8rem;
  padding: 6px 12px;
}

.btn-sample:hover {
  background: #f1f5f9;
  color: #334155;
}

/* ==========================================================================
   2. 3-COLUMN MAIN STUDIO LAYOUT
   ========================================================================== */
.studio-layout {
  display: grid;
  grid-template-columns: 290px 1fr 260px;
  gap: 16px;
  padding: 16px;
  flex: 1;
  max-width: 1540px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 1200px) {
  .studio-layout {
    grid-template-columns: 280px 1fr;
  }
  .land-panel {
    grid-column: span 2;
  }
}

@media (max-width: 860px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }
  .land-panel {
    grid-column: span 1;
  }
  .topbar-center-actions {
    justify-content: center;
    width: 100%;
    margin-top: 8px;
  }
  .app-topbar {
    flex-direction: column;
    gap: 10px;
  }
}

/* Side Panels Generic */
.side-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  max-height: calc(100vh - 90px);
}

.panel-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
}

.panel-header h3 {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #334155;
}

/* ==========================================================================
   3. LEFT ENTRY PANEL
   ========================================================================== */
.entry-panel {
  overflow-y: auto;
}

.entry-form {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-field label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #475569;
  text-transform: uppercase;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auto-trans-hint {
  font-size: 0.63rem;
  font-weight: 700;
  color: #16a34a;
  letter-spacing: 0.01em;
  text-transform: none;
}

.translating-indicator {
  font-size: 0.63rem;
  font-weight: 700;
  color: #2563eb;
  letter-spacing: 0.01em;
  text-transform: none;
  animation: pulseTranslate 1.2s infinite ease-in-out;
}

@keyframes pulseTranslate {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.form-control {
  width: 100%;
  padding: 6px 9px;
  font-size: 0.82rem;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: #15803d;
  box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.12);
}

.state-select {
  font-weight: 600;
  background-color: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.name-hindi-input {
  font-family: 'Noto Sans Devanagari', -apple-system, sans-serif;
  font-weight: 600;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.id-highlight-input {
  font-weight: 700;
  color: #15803d;
  letter-spacing: 0.03em;
}

.address-textarea {
  resize: vertical;
  min-height: 52px;
  font-size: 0.78rem;
  line-height: 1.35;
}

.file-input-box input[type="file"] {
  font-size: 0.75rem;
  color: #64748b;
  width: 100%;
}

/* ==========================================================================
   4. CENTER: CARDS VIEWPORT & LIVE PREVIEW
   ========================================================================== */
.cards-viewport {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  overflow-y: auto;
  padding: 8px 12px;
}

.cards-container {
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-items: center;
  width: 100%;
}

@media (min-width: 1350px) {
  .cards-container {
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

/* Standard ISO CR80 Smart Card (Scaled for crisp screen display) */
.agri-card {
  width: var(--card-w);
  height: var(--card-h);
  background: #ffffff;
  border-radius: var(--radius-card);
  border: 1px solid #d1d5db;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  user-select: none;
  background-image: radial-gradient(circle at 50% 50%, rgba(22, 163, 74, 0.02) 0%, rgba(255, 255, 255, 1) 70%);
}

/* Subtle background watermark (Paddy / AgriStack motif) */
.agri-card::before {
  content: "";
  position: absolute;
  top: 45px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 140px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' opacity='0.035'><circle cx='50' cy='50' r='45' fill='none' stroke='%2315803d' stroke-width='4'/><path d='M50 15v70M25 50h50M32 32l36 36M68 32L32 68' stroke='%2315803d' stroke-width='2'/></svg>") no-repeat center;
  background-size: contain;
  pointer-events: none;
  z-index: 1;
}

/* Gold Accent Line Below Header (Matching Reference Image) */
.card-header-divider {
  height: 2px !important;
  background: #d97706 !important;
  background-color: #d97706 !important;
  border-top: 1px solid #d97706 !important;
  width: 100%;
  z-index: 3;
}

/* Top Header Bar */
.card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 8px;
  background: #ffffff;
  z-index: 2;
  height: 38px;
  flex-shrink: 0;
  border-bottom: 2px solid #d97706;
}

/* AgriStack Logo (Official High-Resolution Vector Graphic) */
.agristack-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 32px;
  width: 98px;
  flex-shrink: 0;
}

.agristack-official-img {
  height: 24px;
  max-width: 98px;
  object-fit: contain;
  display: block;
}

/* Back Card specific logo & seal compactness */
.card-back .agristack-logo-wrap {
  width: 78px;
}
.card-back .agristack-official-img {
  height: 20px;
  max-width: 78px;
}
.card-back .card-emblem-wrap {
  width: 28px;
}
.card-back .state-seal-img {
  height: 26px;
  width: auto;
  max-width: 28px;
  object-fit: contain;
}

/* Center Titles (Exact Match with Reference Image) */
.card-gov-titles {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  padding: 0 4px;
  overflow: visible;
  white-space: nowrap;
}

/* भारत सरकार - Vibrant Saffron Orange & Room for Top Matras/Velanti */
.gov-hi-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #ea580c; /* Official Saffron Orange */
  font-family: 'Noto Sans Devanagari', -apple-system, sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.35;
  padding-top: 2px;
  display: inline-block;
  overflow: visible;
}

/* Government of India - Rich Green */
.gov-en-title {
  font-size: 0.70rem;
  font-weight: 700;
  color: #15803d; /* Official Rich Green */
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.15;
}

/* कृषि एवं किसान कल्याण मंत्रालय - Single Line Fit with Top Diacritic Breathing Room */
.ministry-hi {
  font-size: 0.69rem;
  font-weight: 800;
  color: #ea580c; /* Official Saffron Orange */
  font-family: 'Noto Sans Devanagari', -apple-system, sans-serif;
  letter-spacing: -0.01em;
  white-space: nowrap;
  line-height: 1.35;
  padding-top: 2px;
  display: inline-block;
  overflow: visible;
}

/* MINISTRY OF AGRI & FARMERS WELFARE - Rich Green Single Line */
.ministry-en {
  font-size: 0.52rem;
  font-weight: 700;
  color: #15803d; /* Official Rich Green */
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.15;
}

/* Right National Emblem / State Seal */
.card-emblem-wrap {
  width: 32px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.national-emblem-img {
  height: 32px;
  width: auto;
  object-fit: contain;
  display: block;
}

.state-seal-img {
  height: 28px;
  width: 28px;
  object-fit: contain;
  display: block;
}

/* ==========================================================================
   FRONT CARD BODY LAYOUT (Optimized to prevent QR collision & cutoffs)
   ========================================================================= */
.card-front {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-front-body {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  gap: 6px;
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 2;
}

/* Vertical Date on Left Edge */
.card-vertical-left {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.50rem;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1px;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Photo Box */
.card-photo-box {
  width: 70px;
  height: 86px;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  overflow: hidden;
  background: #f8fafc;
  align-self: center;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.card-photo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Details Grid - Optimized Space & Typography */
.card-details-grid {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 0 4px;
}

.c-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  line-height: 1.15;
}

.c-lbl {
  font-size: 0.59rem;
  font-weight: 700;
  color: #475569;
}

.c-val {
  font-size: 0.65rem;
  color: #0f172a;
  font-weight: 500;
  word-break: break-word;
}

.name-row .c-val {
  white-space: normal;
  line-height: 1.35;
  padding-top: 2px;
  overflow: visible;
}

.name-en-row .c-val {
  white-space: normal;
  line-height: 1.15;
  max-height: 2.3em;
  overflow: hidden;
}

.val-bold {
  font-weight: 700;
  color: #0f172a;
}

.val-hindi-name {
  font-size: 0.70rem;
  font-weight: 800;
  color: #047857;
  font-family: 'Noto Sans Devanagari', 'Noto Sans Tamil', 'Noto Sans Telugu', 'Noto Sans Kannada', 'Noto Sans Gujarati', 'Noto Sans Gurmukhi', 'Noto Sans Bengali', 'Noto Sans Malayalam', 'Noto Sans Oriya', 'Nirmala UI', -apple-system, sans-serif !important;
  line-height: 1.35;
  display: inline-block;
  padding-top: 1px;
  overflow: visible;
}

/* QR Code Box */
.card-qr-box {
  width: 64px;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #ffffff;
  padding: 2px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
}

#frontQrContainer {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#frontQrContainer img,
#frontQrContainer canvas {
  width: 60px !important;
  height: 60px !important;
  display: block;
}

/* Farmer ID Banner (Dark Green Ribbon) - Fixed Height Never Cut Off */
.card-farmer-id-banner {
  background: #14532d;
  color: #ffffff;
  height: 20px;
  flex-shrink: 0;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.70rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  z-index: 2;
}

.card-farmer-id-banner b {
  font-weight: 900;
  color: #fef08a;
  margin-left: 5px;
  letter-spacing: 0.07em;
  font-size: 0.74rem;
}

/* Bottom State Registry Line - Pinned & Never Cut Off */
.card-bottom-state-bar {
  background: #f0fdf4;
  border-top: 1px solid #bbf7d0;
  height: 18px;
  flex-shrink: 0;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 800;
  color: #166534;
  letter-spacing: 0.03em;
  z-index: 2;
}

/* ==========================================================================
   BACK CARD BODY LAYOUT (Pinned Footer & Scalable Land Table)
   ========================================================================== */
.card-back {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-back-body {
  display: flex;
  align-items: stretch;
  padding: 4px 6px;
  gap: 5px;
  flex: 1;
  min-height: 0;
  z-index: 2;
}

.card-back-main-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.card-address-block {
  font-size: 0.58rem;
  line-height: 1.25;
  color: #1e293b;
  background: #f8fafc;
  padding: 2px 5px;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  word-break: break-word;
  max-height: 38px;
  overflow: hidden;
  flex-shrink: 0;
}

.card-address-block b {
  color: #0f172a;
  font-weight: 800;
}

/* Card Land Table - Responsive to Item Count */
.card-table-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid #14532d;
  border-radius: 3px;
  background: #ffffff;
}

.card-land-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.61rem;
  text-align: center;
}

.card-land-table thead {
  background: #15803d;
  color: #ffffff;
}

.card-land-table th {
  padding: 2.5px 3px;
  font-weight: 700;
  font-size: 0.59rem;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
  letter-spacing: 0.02em;
}

.card-land-table th:last-child {
  border-right: none;
}

.card-land-table td {
  padding: 2px 3px;
  font-size: 0.60rem;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  color: #0f172a;
}

.card-land-table td:last-child {
  border-right: none;
}

.card-land-table .compact-row td {
  padding: 1px 2px;
  font-size: 0.54rem;
}

.card-land-table .summary-row td {
  padding: 1px 2px;
  font-size: 0.55rem;
  background: #f0fdf4;
}

.card-land-table tbody tr:last-child td {
  border-bottom: none;
}

.card-land-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

/* Back Card Footer Bar - ALWAYS PINNED & NEVER HIDDEN */
.card-back-footer-bar {
  background: #f8fafc;
  border-top: 1.5px solid #d97706 !important; /* Prominent gold line above footer */
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.56rem;
  z-index: 2;
  height: 22px;
  flex-shrink: 0;
  margin-top: auto;
}

/* User Specific Branding: BACK SIDE BOTTOM LEFT HAMARE WEBSITE KA LOGO WITH ADDRESS */
.docconvert-back-branding {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #1e293b;
  font-weight: 700;
}

.docconvert-mini-logo {
  width: 13px;
  height: 13px;
  background: #15803d;
  color: #ffffff;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 900;
}

.docconvert-brand-name {
  font-size: 0.58rem;
  color: #334155;
}

.brand-url-text {
  color: #15803d;
}

.footer-helpline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #047857;
  font-weight: 700;
}

.footer-portal-url {
  font-weight: 700;
  color: #1e3a8a;
  letter-spacing: 0.01em;
}

/* Guidance Notice */
.print-guide-notice {
  font-size: 0.78rem;
  color: #475569;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 8px 14px;
  border-radius: 6px;
  max-width: 600px;
  text-align: center;
}

/* ==========================================================================
   5. RIGHT COLUMN: LAND TABLE PANEL
   ========================================================================== */
.land-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.head-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.total-badge {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.land-entry-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.land-inputs-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 6px;
}

.land-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.land-field label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #475569;
}

.land-field input {
  width: 100%;
  padding: 5px 6px;
  font-size: 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  text-align: center;
  font-weight: 600;
}

.land-field input:focus {
  outline: none;
  border-color: #15803d;
}

.btn-add-registry {
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-add-registry:hover {
  background: #15803d;
}

.registry-table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}

.registry-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  text-align: center;
}

.registry-list-table thead {
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}

.registry-list-table th {
  padding: 5px 4px;
  font-weight: 700;
  color: #475569;
  font-size: 0.69rem;
}

.registry-list-table td {
  padding: 5px 4px;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 500;
}

.registry-list-table tbody tr:hover {
  background: #f8fafc;
}

.btn-del-parcel {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 1px 4px;
  border-radius: 3px;
}

.btn-del-parcel:hover {
  background: #fee2e2;
}

/* ==========================================================================
   6. HIGH FIDELITY PRINT ENGINE (A4, A5, 4x6, PVC Smart Card)
   ========================================================================== */
@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .app-topbar,
  .entry-panel,
  .land-panel,
  .print-guide-notice {
    display: none !important;
  }

  .studio-layout {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .cards-viewport {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .cards-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12mm !important;
    margin: 0 auto !important;
    page-break-inside: avoid !important;
  }

  /* Exact ISO CR80 Dimensions in Print (85.6mm x 53.98mm) */
  .agri-card {
    width: 85.6mm !important;
    height: 53.98mm !important;
    max-width: 85.6mm !important;
    max-height: 53.98mm !important;
    border: 0.5pt solid #999999 !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
  }

  /* Top Header Bar in Print */
  .card-header-bar {
    height: 9.2mm !important;
    min-height: 9.2mm !important;
    padding: 0.8mm 2mm 0.4mm 2mm !important;
    border-bottom: 1.5pt solid #d97706 !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    overflow: visible !important;
  }

  .card-header-divider {
    height: 1.5pt !important;
    min-height: 1.5pt !important;
    background-color: #d97706 !important;
    border-top: 1.5pt solid #d97706 !important;
    flex-shrink: 0 !important;
    display: block !important;
  }

  .agristack-logo-wrap {
    width: 22mm !important;
    height: 7mm !important;
    flex-shrink: 0 !important;
  }

  .agristack-official-img {
    height: 6.2mm !important;
    max-width: 22mm !important;
  }

  .card-emblem-wrap {
    width: 7mm !important;
    height: 7.5mm !important;
    flex-shrink: 0 !important;
  }

  .national-emblem-img {
    height: 7.2mm !important;
    width: auto !important;
  }

  .card-gov-titles {
    flex: 1 !important;
    line-height: normal !important;
    padding: 0 1mm !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .gov-hi-title {
    font-size: 7.5pt !important;
    line-height: 1.35 !important;
    color: #ea580c !important;
    font-family: 'Noto Sans Devanagari', sans-serif !important;
    padding-top: 0.4mm !important;
    display: inline-block !important;
    overflow: visible !important;
  }

  .gov-en-title {
    font-size: 5.2pt !important;
    line-height: 1.15 !important;
    color: #15803d !important;
  }

  /* Front Card Body in Print */
  .card-front-body {
    flex: 1 !important;
    padding: 0.8mm 2mm !important;
    gap: 1.5mm !important;
    min-height: 0 !important;
    display: flex !important;
    align-items: center !important;
  }

  .card-vertical-left {
    writing-mode: vertical-rl !important;
    -webkit-writing-mode: vertical-rl !important;
    transform: rotate(180deg) !important;
    -webkit-transform: rotate(180deg) !important;
    font-size: 4.5pt !important;
    color: #334155 !important;
    flex-shrink: 0 !important;
    display: block !important;
  }

  .card-photo-box {
    width: 17mm !important;
    height: 22mm !important;
    flex-shrink: 0 !important;
    border: 0.5pt solid #64748b !important;
    border-radius: 2pt !important;
  }

  .card-details-grid {
    flex: 1 !important;
    min-width: 0 !important;
    padding: 0 1mm !important;
    gap: 0.8pt !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }

  .c-row {
    display: grid !important;
    grid-template-columns: 10mm 1fr !important;
    line-height: 1.15 !important;
  }

  .c-row.name-row {
    line-height: 1.35 !important;
    overflow: visible !important;
  }

  .name-row .c-val {
    line-height: 1.35 !important;
    overflow: visible !important;
    padding-top: 0.4mm !important;
  }

  .c-lbl {
    font-size: 5pt !important;
    color: #475569 !important;
  }

  .c-val {
    font-size: 5.4pt !important;
    color: #0f172a !important;
    word-break: break-word !important;
  }

  .val-hindi-name {
    font-size: 6.2pt !important;
    color: #047857 !important;
    line-height: 1.35 !important;
    display: inline-block !important;
    padding-top: 0.4mm !important;
    overflow: visible !important;
    font-family: 'Noto Sans Devanagari', 'Noto Sans Tamil', 'Noto Sans Telugu', 'Noto Sans Kannada', 'Noto Sans Gujarati', 'Noto Sans Gurmukhi', 'Noto Sans Bengali', 'Noto Sans Malayalam', 'Noto Sans Oriya', 'Nirmala UI', sans-serif !important;
  }

  .card-qr-box {
    width: 15.5mm !important;
    height: 15.5mm !important;
    padding: 0.5mm !important;
    flex-shrink: 0 !important;
    border: 0.5pt solid #cbd5e1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #frontQrContainer {
    width: 14.5mm !important;
    height: 14.5mm !important;
  }

  #frontQrContainer img,
  #frontQrContainer canvas {
    width: 14.5mm !important;
    height: 14.5mm !important;
  }

  /* Front Bottom Banners */
  .card-farmer-id-banner {
    height: 4.6mm !important;
    min-height: 4.6mm !important;
    padding: 0 2mm !important;
    font-size: 5.8pt !important;
    background: #14532d !important;
    color: #ffffff !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .card-farmer-id-banner b {
    font-size: 6.2pt !important;
    color: #fef08a !important;
  }

  .card-bottom-state-bar {
    height: 4.2mm !important;
    min-height: 4.2mm !important;
    padding: 0 2mm !important;
    font-size: 5.2pt !important;
    background: #f0fdf4 !important;
    color: #166534 !important;
    border-top: 0.5pt solid #bbf7d0 !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Back Card Print Specifics */
  .card-back .card-header-bar {
    height: 9mm !important;
    min-height: 9mm !important;
    padding: 0.8mm 2mm 0.4mm 2mm !important;
    overflow: visible !important;
  }

  .card-back .agristack-logo-wrap {
    width: 17mm !important;
  }

  .card-back .agristack-official-img {
    height: 5mm !important;
    max-width: 17mm !important;
  }

  .card-back .card-emblem-wrap {
    width: 6.5mm !important;
  }

  .card-back .state-seal-img {
    height: 6.5mm !important;
    width: auto !important;
    max-width: 7mm !important;
    object-fit: contain !important;
  }

  .card-back .ministry-hi {
    font-size: 6pt !important;
    white-space: nowrap !important;
    line-height: 1.35 !important;
    padding-top: 0.5mm !important;
    display: inline-block !important;
    overflow: visible !important;
    font-family: 'Noto Sans Devanagari', sans-serif !important;
  }

  .card-back .ministry-en {
    font-size: 4.4pt !important;
    white-space: nowrap !important;
    line-height: 1.15 !important;
  }

  .card-back-body {
    flex: 1 !important;
    padding: 0.8mm 2mm !important;
    gap: 1.5mm !important;
    min-height: 0 !important;
  }

  .card-address-block {
    font-size: 4.8pt !important;
    line-height: 1.15 !important;
    padding: 0.6mm 1.5mm !important;
    max-height: 8mm !important;
    flex-shrink: 0 !important;
  }

  .card-table-wrap {
    flex: 1 !important;
    min-height: 0 !important;
    border: 0.5pt solid #14532d !important;
  }

  .card-land-table th {
    padding: 0.6mm 1mm !important;
    font-size: 4.8pt !important;
    background: #15803d !important;
    color: #ffffff !important;
  }

  .card-land-table td {
    padding: 0.5mm 1mm !important;
    font-size: 4.8pt !important;
  }

  .card-land-table .compact-row td,
  .card-land-table .summary-row td {
    padding: 0.3mm 0.8mm !important;
    font-size: 4.2pt !important;
  }

  .card-back-footer-bar {
    height: 4.8mm !important;
    min-height: 4.8mm !important;
    padding: 0 2mm !important;
    border-top: 1pt solid #d97706 !important;
    flex-shrink: 0 !important;
    margin-top: auto !important;
    font-size: 4.4pt !important;
    background: #f8fafc !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  /* 4x6 / 4R Photo Paper Mode */
  body[data-paper="4x6"] .cards-container {
    gap: 8mm !important;
    padding-top: 10mm !important;
  }

  /* PVC Single Card Mode */
  body[data-paper="pvc"] .cards-container {
    gap: 0 !important;
  }

  body[data-paper="pvc"] .agri-card {
    margin-bottom: 0 !important;
    page-break-after: always !important;
  }
}

/* Page rules per paper size */
@page {
  margin: 10mm;
}
