:root {
  --kp-green-900: #063d2b;
  --kp-green-800: #075336;
  --kp-green-700: #0b6b45;
  --kp-green-600: #108b56;
  --kp-green-100: #e6f3eb;
  --kp-gold: #c79a2d;
  --ink: #18231f;
  --muted: #64736d;
  --line: #d9e5de;
  --surface: #ffffff;
  --page: #f2f6f3;
}

@font-face {
  font-family: "Noto Nastaliq Urdu";
  src: url("../fonts/NotoNastaliqUrdu-VariableFont_wght.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

html {
  font-size: 14px;
  min-height: 100%;
  position: relative;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  background:
    linear-gradient(180deg, rgba(6, 61, 43, 0.06), rgba(6, 61, 43, 0) 280px),
    var(--page);
  color: var(--ink);
  margin-bottom: 72px;
}

a {
  color: var(--kp-green-700);
}

.btn {
  border-radius: 6px;
  font-weight: 600;
}

.btn-primary {
  --bs-btn-bg: var(--kp-green-700);
  --bs-btn-border-color: var(--kp-green-700);
  --bs-btn-hover-bg: var(--kp-green-800);
  --bs-btn-hover-border-color: var(--kp-green-800);
  --bs-btn-active-bg: var(--kp-green-900);
  --bs-btn-active-border-color: var(--kp-green-900);
}

.btn-outline-primary {
  --bs-btn-color: var(--kp-green-700);
  --bs-btn-border-color: var(--kp-green-700);
  --bs-btn-hover-bg: var(--kp-green-700);
  --bs-btn-hover-border-color: var(--kp-green-700);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--kp-green-600);
  box-shadow: 0 0 0 0.18rem rgba(16, 139, 86, 0.2);
}

.form-check-input:checked {
  background-color: var(--kp-green-700);
  border-color: var(--kp-green-700);
}

.gov-topbar {
  background: var(--kp-green-900);
  color: #d9efe4;
  font-size: 0.9rem;
}

.gov-topbar-inner {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-height: 36px;
}

.official-navbar {
  background: linear-gradient(90deg, var(--kp-green-800), var(--kp-green-700));
  border-bottom: 4px solid var(--kp-gold);
  box-shadow: 0 8px 24px rgba(6, 61, 43, 0.18);
}

.official-navbar .nav-link,
.official-navbar .navbar-brand {
  color: #fff;
}

.official-navbar .nav-link {
  border-radius: 6px;
  font-weight: 600;
  padding-inline: 12px;
}

.official-navbar .nav-link:hover,
.official-navbar .nav-link:focus {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 12px;
}

.brand-emblem {
  align-items: center;
  background: #fff;
  border: 2px solid rgba(199, 154, 45, 0.7);
  border-radius: 50%;
  color: var(--kp-green-800);
  display: inline-flex;
  font-size: 0.95rem;
  font-weight: 800;
  height: 46px;
  justify-content: center;
  letter-spacing: 0;
  width: 46px;
}

.brand-emblem img {
  display: block;
  height: 34px;
  object-fit: contain;
  width: 34px;
}

.brand-title,
.brand-subtitle {
  display: block;
  line-height: 1.15;
}

.brand-title {
  font-size: 1.08rem;
  font-weight: 800;
}

.brand-subtitle {
  color: #d7eee2;
  font-size: 0.78rem;
  font-weight: 500;
  margin-top: 2px;
}

.auth-panel,
.instruction-band,
.dashboard-header {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(6, 61, 43, 0.08);
  padding: 24px;
}

.auth-panel h1,
.dashboard-header h1,
.instruction-band h2 {
  color: var(--kp-green-900);
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 18px;
}

.auth-panel.compact {
  max-width: 520px;
}

.service-hero {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(6, 61, 43, 0.98), rgba(13, 111, 70, 0.96)),
    var(--kp-green-800);
  border-bottom: 4px solid var(--kp-gold);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(6, 61, 43, 0.22);
  color: #fff;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 30px;
}

.home-hero {
  min-height: 252px;
  padding: 21px;
}

.home-hero .hero-logo {
  height: clamp(68px, 9vw, 105px);
  padding: 7px;
  width: clamp(68px, 9vw, 105px);
}

.home-hero h1 {
  font-size: clamp(1.4rem, 2.8vw, 2.24rem);
}

.home-hero p {
  max-width: 520px;
}

.home-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  margin: -6px 0 24px;
}

.dashboard-hero {
  align-items: center;
}

.dashboard-hero .hero-copy {
  flex: 1 1 auto;
}

.dashboard-hero h1 {
  font-size: clamp(0.98rem, 1.96vw, 1.57rem);
  line-height: 1.18;
  max-width: 760px;
}

.dashboard-hero p {
  font-size: 0.9rem;
  max-width: 640px;
}

.dashboard-hero .btn {
  min-width: 160px;
}

.hero-logo {
  background: rgba(255, 255, 255, 0.95);
  border: 3px solid rgba(199, 154, 45, 0.72);
  border-radius: 50%;
  flex: 0 0 auto;
  height: clamp(96px, 13vw, 150px);
  object-fit: contain;
  padding: 10px;
  width: clamp(96px, 13vw, 150px);
}

.service-hero h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 800;
  letter-spacing: 0;
  margin: 4px 0 8px;
}

.service-hero p {
  color: #d9efe4;
  margin: 0;
  max-width: 680px;
}

.eyebrow {
  color: var(--kp-gold);
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-span {
  grid-column: 1 / -1;
}

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

.dashboard-header h1 {
  margin-bottom: 6px;
}

.dashboard-header p {
  color: var(--muted);
  margin: 0;
}

.status-pill {
  background: var(--kp-green-100);
  border: 1px solid #b8dac7;
  border-radius: 999px;
  color: var(--kp-green-800);
  font-weight: 700;
  padding: 7px 12px;
}

.instruction-band {
  border-left: 5px solid var(--kp-green-700);
}

.instruction-title-row,
.instruction-row {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.instruction-title-row {
  align-items: baseline;
  margin-bottom: 14px;
}

.instruction-title-row h2 {
  margin-bottom: 0;
}

.instruction-pairs {
  display: grid;
  gap: 10px;
}

.instruction-row {
  border-top: 1px solid var(--line);
  color: var(--ink);
  line-height: 1.55;
  padding-top: 10px;
}

.instruction-row div {
  align-items: flex-start;
  display: flex;
  gap: 10px;
}

.instruction-row div[dir="rtl"] {
  justify-content: flex-start;
  text-align: right;
}

.instruction-row span {
  align-items: center;
  background: var(--kp-green-100);
  border: 1px solid #b8dac7;
  border-radius: 50%;
  color: var(--kp-green-900);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  line-height: 1;
  margin-top: 1px;
  width: 26px;
}

.table {
  --bs-table-hover-bg: var(--kp-green-100);
  background: #fff;
  border-color: var(--line);
}

.table thead th {
  background: var(--kp-green-100);
  color: var(--kp-green-900);
  font-weight: 800;
}

.section-title-row {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-title-row h1 {
  margin-bottom: 0;
}

.process-steps {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 4px 0 22px;
}

.step {
  align-items: center;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  font-weight: 700;
  gap: 10px;
  padding: 10px 12px;
}

.step b {
  align-items: center;
  background: #dfe9e3;
  border-radius: 50%;
  color: var(--kp-green-900);
  display: inline-flex;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.step.active {
  background: var(--kp-green-100);
  border-color: #b8dac7;
  color: var(--kp-green-900);
}

.step.active b {
  background: var(--kp-green-700);
  color: #fff;
}

.payment-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.payment-summary div {
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.payment-summary span,
.payment-summary strong {
  display: block;
}

.payment-summary span {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 4px;
}

.payment-summary strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.support-thread {
  display: grid;
  gap: 12px;
}

.support-message {
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.support-message.staff-reply {
  background: var(--kp-green-100);
  border-color: #b8dac7;
}

.support-message-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.support-message-meta strong {
  color: var(--ink);
}

.support-message p {
  margin-bottom: 0;
  white-space: pre-wrap;
}

.support-admin-form {
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 100%;
  padding: 14px;
}

[lang="ur"],
[dir="rtl"],
.urdu-input,
.name-language-field.urdu-input {
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Nafees Nastaleeq", "Segoe UI", Tahoma, sans-serif;
  line-height: 2;
}

.official-footer {
  background: #fff;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.report-toolbar {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.report-page-container {
  max-width: none;
  overflow-x: auto;
  padding-left: 18px;
  padding-right: 18px;
}

.fard-print-body {
  background: #fff;
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Nafees Nastaleeq", "Segoe UI", Tahoma, sans-serif;
  margin: 0;
}

.fard-report-sheet {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(0, 64, 45, 0.08);
  color: #111;
  margin: 0 auto;
  aspect-ratio: 297 / 210;
  max-width: 1320px;
  min-height: 935px;
  padding: 22px 26px;
  width: min(100%, 1320px);
}

.fard-report-header {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: 180px 1fr 220px;
  margin-bottom: 16px;
}

.fard-report-header h2 {
  color: #111;
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: center;
}

.fard-report-meta {
  display: grid;
  font-size: 0.9rem;
  gap: 3px;
  text-align: right;
}

.fard-report-qr {
  align-items: center;
  display: grid;
  font-size: 0.82rem;
  gap: 5px;
  justify-items: center;
  text-align: center;
}

.fard-report-qr img {
  height: 76px;
  image-rendering: crisp-edges;
  object-fit: contain;
  width: 76px;
}

.fard-report-title {
  min-width: 0;
}

.fard-report-center-meta {
  display: flex;
  flex-wrap: wrap;
  font-size: 0.9rem;
  gap: 12px 26px;
  justify-content: center;
}

.fard-report-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

.fard-report-table-wrap h4,
.fard-khata-section h3,
.fard-khatooni-section h4 {
  color: var(--kp-green-dark);
  margin: 16px 0 8px;
}

.fard-report-table {
  border-collapse: collapse;
  min-width: 720px;
  width: 100%;
}

.fard-report-table th,
.fard-report-table td {
  border: 1px solid #b8c7bf;
  padding: 8px 10px;
  text-align: right;
  vertical-align: top;
  white-space: pre-wrap;
}

.fard-report-table th {
  background: var(--kp-green-100);
  color: var(--kp-green-dark);
  font-weight: 800;
}

.fard-rdl-grid {
  border-collapse: collapse;
  direction: ltr;
  font-size: 0.86rem;
  margin-top: 10px;
  table-layout: fixed;
  width: 100%;
}

.fard-rdl-grid th,
.fard-rdl-grid td {
  border: 1px solid #111;
  direction: rtl;
  padding: 4px;
  text-align: center;
  vertical-align: top;
  white-space: pre-wrap;
  word-break: normal;
}

.fard-rdl-grid th {
  background: #f8fbf9;
  color: #111;
  font-weight: 800;
  line-height: 1.8;
  min-height: 64px;
}

.fard-rdl-column-numbers th {
  font-size: 0.82rem;
  line-height: 1.2;
  padding: 2px 4px;
}

.fard-rdl-grid th:nth-child(1),
.fard-rdl-grid th:nth-child(2),
.fard-rdl-grid td:nth-child(1),
.fard-rdl-grid td:nth-child(2) {
  font-size: 0.72rem;
}

.fard-rdl-center {
  font-size: 0.82rem;
  font-weight: 800;
  vertical-align: middle !important;
}

.fard-rdl-main-row > td {
  min-height: 220px;
  height: 220px;
}

.fard-mini-table {
  border-collapse: collapse;
  direction: rtl;
  font-size: 0.76rem;
  line-height: 1.9;
  width: 100%;
}

.fard-mini-table td {
  border: 0;
  border-bottom: 0;
  padding: 2px 3px;
  text-align: center;
  vertical-align: top;
}

.fard-mini-table tr:last-child td {
  border-bottom: 0;
}

.fard-subreport {
  border-bottom: 1px solid #111;
  margin-bottom: 6px;
  padding-bottom: 6px;
}

.fard-subreport:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.fard-rdl-muted {
  color: #555;
  display: inline-block;
  font-weight: 700;
  padding: 6px;
}

.fard-outside-summary {
  border: 1px solid #111;
  border-top: 0;
  margin-bottom: 12px;
}

.fard-summary-table {
  border-collapse: collapse;
  direction: rtl;
  font-size: 0.84rem;
  line-height: 1.9;
  width: 100%;
}

.fard-summary-table td {
  border-left: 1px solid #111;
  min-height: 44px;
  padding: 8px 12px;
  text-align: center;
  vertical-align: middle;
  width: 50%;
}

.fard-summary-table td:first-child {
  border-left: 0;
}

.fard-report-footer {
  border-top: 1px solid #111;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  margin-top: 22px;
  padding-top: 10px;
}

.fard-khata-section {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 10px;
}

.fard-khatooni-section {
  margin-top: 16px;
}

@media print {
  .no-print,
  body > header,
  .site-header,
  .gov-topbar,
  .official-navbar,
  .official-footer {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .container,
  .container-fluid,
  main {
    max-width: none;
    padding: 0;
    width: auto;
  }

  .fard-report-sheet {
    aspect-ratio: auto;
    border: 0;
    box-shadow: none;
    max-width: none;
    min-height: auto;
    padding: 0;
    width: 100%;
  }

  @page {
    size: A4 landscape;
    margin: 9mm;
  }
}

@media (max-width: 720px) {
  .gov-topbar-inner,
  .dashboard-header,
  .section-title-row,
  .service-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid,
  .instruction-row,
  .instruction-title-row,
  .payment-summary,
  .process-steps {
    grid-template-columns: 1fr;
  }

  .brand-subtitle {
    display: none;
  }

  .hero-logo {
    order: -1;
  }

  .fard-report-sheet {
    overflow-x: auto;
  }

  .fard-report-header {
    grid-template-columns: 1fr;
  }

  .fard-rdl-grid {
    min-width: 1120px;
  }
}
