@font-face {
  font-family: "Frutiger LT Arabic 45 Light";
  src: url("./assets/Fonts/alfont_com_AlFont_com_FrutigerLTArabic-45Light-1.ttf")
    format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ece8fa;
  --card: #ffffff;
  --primary: #2d3f83;
  --primary-dark: #223267;
  --muted: #858585;
  --line: #e8e8e8;
  --success: #32c96d;
  --shadow: 0 10px 24px rgba(62, 71, 124, 0.08);
  --radius: 26px;
  --text: #1f1f1f;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: var(--text);
  overflow-x: hidden;
}

button,
input,
select,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-shell,
.permit-page-shell,
.scan-page {
  min-height: 100vh;
  width: 100%;
  padding: 24px;
  display: grid;
  place-items: center;
}

.auth-panel,
.scan-panel {
  width: min(100%, 560px);
  padding: 28px;
}

.dashboard-shell {
  min-height: 100vh;
  width: 100%;
  padding: 24px;
  display: grid;
  gap: 20px;
}

.dashboard-topbar,
.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.dashboard-topbar {
  padding: 20px 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.3fr) minmax(300px, 0.7fr);
  gap: 20px;
  align-items: start;
}

.form-panel,
.permits-panel,
.preview-panel {
  padding: 24px;
}

.public-preview-panel {
  width: min(100%, 1040px);
}

.panel-heading {
  margin-bottom: 22px;
}

.panel-heading h1,
.panel-heading h2 {
  margin: 0 0 10px;
}

.panel-heading h1 {
  font-size: 2rem;
}

.panel-heading h2 {
  font-size: 1.5rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.95rem;
}

.subtext {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.permit-form,
.manual-box {
  display: grid;
  gap: 18px;
}

.save-note {
  padding: 14px 16px;
  border-radius: 16px;
  background: #eef2ff;
  color: var(--primary);
  line-height: 1.7;
  font-weight: 700;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field-full {
  grid-column: 1 / -1;
}

.field span {
  color: #444444;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #d5d9e6;
  border-radius: 14px;
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field select:focus {
  border-color: #8c98c8;
  box-shadow: 0 0 0 4px rgba(45, 63, 131, 0.1);
}

.actions,
.preview-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

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

.btn-secondary {
  background: #edf0ff;
  color: var(--primary);
  font-weight: 700;
}

.full-width {
  width: 100%;
}

.compact-heading {
  margin-bottom: 14px;
}

.permits-list {
  display: grid;
  gap: 12px;
  max-height: 720px;
  overflow: auto;
}

.permit-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #dde2f4;
  border-radius: 16px;
  background: #fbfbfe;
  transition: border-color 0.2s ease, transform 0.16s ease, background 0.2s ease;
}

.permit-item:hover {
  transform: translateY(-1px);
  border-color: #b8c2e8;
}

.permit-item.active {
  background: #eef2ff;
  border-color: #8c98c8;
}

.permit-open-button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  padding: 8px 10px;
  text-align: right;
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.permit-open-button:hover {
  background: rgba(45, 63, 131, 0.04);
}

.permit-item-name {
  font-weight: 800;
}

.permit-item-meta {
  color: var(--muted);
  font-size: 0.93rem;
}

.permit-delete-button {
  border: 0;
  border-radius: 12px;
  background: #ffe5e5;
  color: #b32a2a;
  padding: 10px 12px;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 700;
}

.permit-delete-button:hover {
  background: #ffd7d7;
}

.permit-item-actions {
  display: grid;
  gap: 8px;
  justify-items: stretch;
}

.permit-rental-button {
  border-radius: 12px;
  background: #edf0ff;
  color: var(--primary);
  padding: 10px 12px;
  white-space: nowrap;
  font-weight: 700;
  text-align: center;
}

.permit-rental-button:hover {
  background: #e4e9ff;
}

.empty-state {
  padding: 18px;
  border-radius: 16px;
  background: #fbfbfe;
  color: var(--muted);
  line-height: 1.8;
}

.mobile-preview-wrap {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.single-preview {
  padding: 24px 0;
}

.mobile-preview {
  width: 100%;
  max-width: 390px;
  background: #e9e4f8;
  padding: 22px 14px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.permit-header {
  background: #f9f9fb;
  border-radius: 0 0 22px 22px;
  padding: 26px 18px;
  text-align: center;
  margin-bottom: 16px;
}

.permit-subtitle {
  margin: 0;
  font-size: 1.03rem;
  font-weight: 700;
  font-family: Arial, sans-serif;
  line-height: 1.45;
}

.info-card {
  padding: 18px 22px;
  margin-bottom: 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.info-card h2 {
  margin: 0 0 18px;
  font-size: 1.1rem;
  font-weight: 800;
  color: #222;
}

.detail-row {
  border-top: 1px solid var(--line);
  padding: 18px 0;
  display: grid;
  gap: 10px;
}

.detail-row:first-of-type {
  border-top-width: 3px;
  border-top-color: #d7d7d7;
}

.label {
  color: #8f8f8f;
  font-size: 0.95rem;
}

.value {
  font-size: 1rem;
  line-height: 1.7;
  word-break: break-word;
}

.permit-phone-link {
  color: #1f66d1;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.permit-phone-link:hover {
  color: #0f56bf;
}

.permit-phone-link.is-disabled {
  color: inherit;
  text-decoration: none;
  pointer-events: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  border-radius: 999px;
  padding: 6px 12px;
  color: #fff;
  background: var(--success);
  font-weight: 800;
  font-size: 0.84rem;
}

.status-expired {
  background: #db4b4b;
}

.status-pending {
  background: #e4a72f;
}

.copy-link-card {
  width: 100%;
  border: 0;
  border-radius: 22px;
  padding: 20px 24px;
  margin: 4px 0 18px;
  background: #334685;
  color: #fff;
  display: block;
  position: relative;
  text-align: center;
  font-size: 1.28rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1.2;
  box-shadow: 0 10px 18px rgba(45, 63, 131, 0.14);
  transition: background 0.18s ease, transform 0.16s ease, box-shadow 0.18s ease;
}

.copy-link-text {
  display: inline-block;
  letter-spacing: 0;
}

.copy-link-label-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.copy-link-icon::before {
  content: "🔗";
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
}

.copy-link-success-text {
  display: none;
}

.copy-link-card.is-copied {
  background: #20a25e;
  box-shadow: 0 10px 18px rgba(32, 162, 94, 0.2);
}

.copy-link-card.is-copied .copy-link-label-wrap {
  display: none;
}

.copy-link-card.is-copied .copy-link-success-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.copy-link-card.is-copied .copy-link-success-text::before {
  content: "✓";
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
}

.permit-footer {
  background: #f8f8f8;
  padding: 34px 24px 28px;
  text-align: center;
  margin-top: 10px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.footer-brand-large {
  margin-bottom: 18px;
}

.brand-logo-image {
  width: 136px;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.footer-links {
  display: grid;
  gap: 12px;
  color: #777;
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 18px;
}

.footer-language {
  font-size: 1rem;
  color: #222;
  margin-bottom: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  direction: ltr;
  font-weight: 600;
}

.globe-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.08rem;
}

.footer-partners {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: center;
  direction: ltr;
  justify-items: center;
}

.partner-logo {
  width: 100%;
  min-height: 124px;
  border-radius: 0;
  display: grid;
  place-items: center;
  padding: 0;
  font-weight: 800;
  overflow: visible;
  background: transparent;
}

.partner-ministry,
.partner-takamol {
  background: transparent;
}

.partner-image {
  display: block;
  max-width: 100%;
  height: auto;
}

.partner-image-ministry {
  width: 92%;
  transform: none;
}

.partner-image-takamol {
  width: 74%;
  transform: none;
}

.footer-host-chip {
  width: fit-content;
  margin: 24px auto 0;
  padding: 12px 28px;
  border-radius: 999px;
  background: rgba(78, 74, 97, 0.72);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(59, 56, 74, 0.18);
}

.paper-stage {
  overflow-x: auto;
  padding: 8px 4px 4px;
}

.rental-paper-page .dashboard-grid {
  grid-template-columns: minmax(320px, 420px) minmax(640px, 1fr);
}

.rental-preview-panel {
  background: #f3f3f3;
}

.permit-paper {
  width: 794px;
  min-height: 1123px;
  margin: 0 auto;
  padding: 36px 36px 30px;
  background: #ffffff;
  color: #303030;
  border: 1px solid #d8d8d8;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  font-family: "Frutiger LT Arabic 45 Light", "Frutiger LT Arabic", Arial, sans-serif;
  font-weight: 300;
}

.rental-sheet {
  width: min(8.27in, 100%);
  height: 11.69in;
  min-height: 11.69in;
  padding: 0.38in 0.60in 0.24in 0.79in;
  background: #ffffff;
  border: 1px solid #d8d8d8;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
  color: #000000;
  font-size: 9pt;
  box-sizing: border-box;
  overflow: hidden;
}

.rental-sheet-header {
  width: 6.86in;
  max-width: 100%;
  grid-template-columns: 90px 1fr 214px;
  gap: 12px;
  padding: 2px 16px 3px 24px;
  height: 0.87in;
  min-height: 0.87in;
  border: 0.72px solid #cecfd5;
  margin-right: 0;
  margin-left: auto;
}

.rental-sheet-main-title {
  margin: 0;
  line-height: 1;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 700;
  color: #000000;
}

.rental-sheet .paper-title-block {
  width: 1.37in;
  height: 0.24in;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  position: relative;
  left: -12px;
}

.rental-sheet .paper-logos {
  gap: 10px;
  padding-right: 10px;
}

.rental-sheet-intro {
  margin-top: 6px;
  width: 6.85in;
  max-width: 100%;
  font-size: 9pt;
  line-height: 1.2;
  font-weight: 400;
  color: #000000;
  margin-right: 0;
  margin-left: auto;
  text-align: right;
  font-stretch: 100%;
}

.rental-intro-lines {
  display: block;
  width: 6.67in;
  max-width: 100%;
  margin: 0;
  margin-right: 0;
  margin-left: auto;
  font-size: 9pt;
  line-height: 1.2;
  font-weight: 400;
  text-align: right;
  color: #000000;
}

.rental-intro-line {
  display: block;
  margin: 0;
  font-size: 9pt;
  line-height: 1.2;
  font-weight: 400;
  white-space: nowrap;
}

.rental-sheet-declarations {
  width: 6.88in;
  max-width: 100%;
  margin-top: 10px;
  margin-right: 0;
  margin-left: auto;
  color: #000000;
  position: relative;
  top: -18px;
}

.rental-sheet-declarations h2 {
  font-size: 9pt;
  margin: 0 0 10px;
  color: #000000;
  line-height: 1.2;
  text-align: right;
}

.rental-declaration-intro {
  margin: 0 0 8px;
  text-align: right;
  font-size: 9pt;
  line-height: 1.2;
  font-weight: 700;
  color: #000000;
  font-stretch: 100%;
}

.rental-sheet-declarations ul {
  margin: 0;
  padding-right: 0;
  padding-left: 0;
  font-size: 9pt;
  line-height: 1.2;
  font-weight: 400;
  color: #000000;
  list-style: none;
  text-align: right;
  font-stretch: 100%;
}

.rental-sheet-declarations li {
  position: relative;
  margin: 0;
  padding-right: 0;
  font-size: 9pt;
  line-height: 1.2;
  font-weight: 400;
}

.rental-sheet-declarations li::before {
  content: "\2022";
  position: absolute;
  right: -12px;
  top: 0;
  color: #000000;
}

.rental-sheet-declarations li + li {
  margin-top: 4px;
}

.rental-sheet-footer {
  width: 6.88in;
  max-width: 100%;
  margin-top: 220px;
  margin-right: 0;
  margin-left: auto;
  font-size: 9pt;
  line-height: 1.2;
  font-weight: 400;
  color: #000000;
  text-align: center;
  position: relative;
  top: -34px;
}

.rental-sheet-footer p {
  margin: 0;
  font-size: 9pt;
  line-height: 1.2;
  font-weight: 400;
}

.rental-sheet-footer p + p {
  margin-top: 2px;
}

.rental-sheet-link {
  direction: ltr;
  unicode-bidi: bidi-override;
  font-size: 9pt;
  font-weight: 400;
}

.paper-header {
  direction: ltr;
  display: grid;
  grid-template-columns: 112px 1fr 176px;
  align-items: center;
  gap: 16px;
  border: 1px solid #cfcfcf;
  padding: 14px 18px;
}

.paper-qr-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 0.63in;
  justify-self: start;
  gap: 1px;
  margin-top: -5px;
}

.paper-qr {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  font-size: 0.9rem;
  color: #707070;
  overflow: hidden;
}

.paper-qr img,
.paper-qr canvas {
  width: 88px !important;
  height: 88px !important;
  display: block;
}

.rental-sheet .paper-qr {
  width: 0.60in;
  height: 0.60in;
  margin-top: -2px;
}

.rental-sheet .paper-qr img,
.rental-sheet .paper-qr canvas {
  width: 0.60in !important;
  height: 0.60in !important;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.rental-sheet .paper-serial {
  width: 0.63in;
  height: 0.09in;
  text-align: center;
  font-size: 9pt;
  color: #000000;
  line-height: 1;
  margin-top: -1px;
}

.paper-serial {
  font-size: 15px;
  color: #555555;
  direction: ltr;
}

.paper-title-block {
  text-align: center;
  direction: rtl;
}

.paper-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: #2b2b2b;
}

.paper-logos {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.paper-logo-ajeer {
  width: 70px;
  height: auto;
  display: block;
}

.paper-logo-ministry {
  width: 82px;
  height: auto;
  display: block;
}

.rental-sheet .paper-logo-ajeer,
.rental-sheet .paper-logo-ministry {
  height: 0.41in;
  width: auto;
  object-fit: contain;
}

.rental-sheet .paper-logo-ajeer {
  width: 0.52in;
  height: auto;
  margin-left: 0;
  transform: scale(1.08);
  transform-origin: center center;
  position: relative;
  left: -14px;
}

.paper-intro {
  margin-top: 56px;
  text-align: center;
  line-height: 1.9;
  font-size: 15px;
  color: #555555;
}

.paper-intro p {
  margin: 0;
}

.paper-note {
  margin-top: 10px !important;
  font-weight: 700;
  color: #2d3f83;
}

.paper-table-wrap {
  margin-top: 38px;
}

.rental-sheet .paper-table-wrap {
  margin-top: 20px;
  width: 6.88in;
  max-width: 100%;
  margin-right: 0;
  margin-left: auto;
}

.permit-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  direction: rtl;
}

.permit-col-label {
  width: 25%;
}

.permit-col-value {
  width: 25%;
}

.permit-table th,
.permit-table td {
  border: 1px solid #cfd2d4;
  padding: 6px 8px;
  font-size: 13px;
  text-align: center;
  vertical-align: middle;
  line-height: 1.25;
  color: #4a4a4a;
}

.permit-table tr:not(.section-row) > th {
  background: #ffffff;
  font-weight: 300;
  color: #555555;
}

.permit-table .section-row th {
  background: #dde1e2;
  color: #2f2f2f;
  font-weight: 500;
  font-size: 14px;
  padding: 7px 8px;
}

.rental-reference-table {
  background: #ffffff;
  border: 0.57px solid #cecfd5;
}

.rental-col-label {
  width: 25%;
}

.rental-col-value {
  width: 25%;
}

.rental-reference-table th,
.rental-reference-table td {
  border: 0.57px solid #cecfd5;
  font-size: 12px;
  padding: 5px 7px;
  color: #000000;
  text-align: right;
}

.rental-reference-table .section-row th {
  background: #ecf0f1;
  color: #000000;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 7px;
}

.rental-sheet .rental-reference-table th,
.rental-sheet .rental-reference-table td {
  font-size: 9pt;
  height: 0.26in;
  padding: 0 7px;
  color: #000000;
  line-height: 1.2;
  vertical-align: middle;
}

.rental-sheet .rental-reference-table tr.rental-tall-row > th,
.rental-sheet .rental-reference-table tr.rental-tall-row > td {
  height: 0.41in;
  vertical-align: top;
  padding-top: 4px;
  padding-bottom: 0;
}

.rental-sheet .rental-reference-table tr.rental-wide-row > th {
  height: 0.26in;
  background: #ecf0f1;
  font-weight: 400;
  vertical-align: middle;
}

.rental-sheet .rental-reference-table tr.rental-wide-row > td {
  height: 0.26in;
  text-align: right;
  vertical-align: middle;
  padding-right: 10px;
  padding-left: 0;
}

.rental-sheet .rental-reference-table tr:not(.section-row) > th:nth-child(1),
.rental-sheet .rental-reference-table tr:not(.section-row) > th:nth-child(3) {
  font-weight: 400;
  color: #000000;
  background: #ecf0f1;
}

.rental-sheet .rental-reference-table .section-row th {
  font-size: 9pt;
  height: 0.34in;
  padding: 0 5px;
  background: #ecf0f1;
  color: #000000;
  line-height: 1.2;
  text-align: center;
}

.paper-declarations {
  margin-top: 28px;
}

.paper-declarations h2 {
  margin: 0 0 14px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}

.paper-declarations ul {
  margin: 0;
  padding-right: 24px;
  line-height: 1.9;
  font-size: 15px;
  color: #3f3f3f;
}

.paper-declarations li + li {
  margin-top: 4px;
}

.paper-footer {
  margin-top: auto;
  padding-top: 36px;
  text-align: center;
  line-height: 1.9;
  font-size: 15px;
  color: #454545;
}

.paper-footer p {
  margin: 0;
}

.paper-footer p + p {
  margin-top: 4px;
}

#permitWebsiteLink {
  color: #333333;
  text-decoration: none;
  direction: ltr;
  unicode-bidi: bidi-override;
}

.reader-box {
  overflow: hidden;
  border-radius: 20px;
  background: #f7f7fb;
  margin-bottom: 20px;
}

.save-note-error {
  background: #ffe8e8;
  color: #a32424;
}

.save-note-success {
  background: #e8f7ea;
  color: #1f7a39;
}

.pdf-analyzer-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
  gap: 20px;
  align-items: start;
}

.pdf-upload-panel,
.pdf-report-panel,
.pdf-template-panel,
.pdf-overlay-panel,
.pdf-preview-panel {
  padding: 24px;
}

.pdf-dropzone {
  border: 2px dashed #c8d0ea;
  border-radius: 20px;
  background: #f8faff;
  min-height: 188px;
  padding: 24px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.16s ease;
}

.pdf-dropzone:hover,
.pdf-dropzone-active {
  border-color: #8d99c8;
  background: #f1f5ff;
}

.pdf-dropzone-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #1f2d5f;
}

.pdf-dropzone-subtitle {
  color: var(--muted);
  line-height: 1.7;
}

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

.pdf-visual-box {
  margin: 18px 0;
  padding: 18px;
  border-radius: 20px;
  background: #f7f9ff;
  border: 1px solid #dce4fb;
  display: grid;
  gap: 14px;
}

.pdf-visual-box h3 {
  margin: 0 0 6px;
  color: #203169;
  font-size: 1.08rem;
}

.pdf-visual-box p {
  margin: 0;
  color: #5c678d;
  line-height: 1.7;
}

.pdf-stat-card {
  background: #f8faff;
  border: 1px solid #e1e6f6;
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.pdf-stat-label {
  color: var(--muted);
  font-size: 0.95rem;
}

.pdf-stat-value {
  font-size: 1.15rem;
  color: var(--primary);
}

.pdf-report-block + .pdf-report-block {
  margin-top: 18px;
}

.pdf-report-block h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef2ff;
  color: #2b3f86;
  font-weight: 700;
  font-size: 0.92rem;
}

.tag-chip.muted {
  background: #f1f3f7;
  color: #7b8295;
}

.pdf-report-list {
  margin: 0;
  padding-right: 18px;
  display: grid;
  gap: 8px;
  line-height: 1.7;
}

.pdf-sample-text {
  margin: 0;
  padding: 16px;
  border-radius: 16px;
  background: #f7f8fc;
  border: 1px solid #e2e6f3;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.8;
  font-family: Arial, sans-serif;
}

.pdf-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.pdf-page-card {
  background: #f8f9fe;
  border: 1px solid #e1e5f3;
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.pdf-page-stage {
  position: relative;
  width: 100%;
  cursor: crosshair;
}

.pdf-page-title {
  font-weight: 800;
  color: #243467;
}

.pdf-page-card canvas {
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(30, 39, 83, 0.08);
}

.pdf-page-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pdf-overlay-marker {
  position: absolute;
  border: 0;
  background: transparent;
  padding: 2px 4px;
  line-height: 1.2;
  transform: translateX(var(--overlay-anchor)) translateY(-50%);
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.pdf-overlay-marker.active {
  outline: 2px dashed #2d3f83;
  outline-offset: 2px;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 6px;
}

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

.overlay-items-list {
  display: grid;
  gap: 10px;
}

.overlay-item-chip {
  width: 100%;
  border: 1px solid #d7ddf3;
  background: #f8faff;
  border-radius: 16px;
  padding: 12px 14px;
  text-align: right;
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.overlay-item-chip span {
  color: #6c7390;
  font-size: 0.92rem;
}

.overlay-item-chip strong {
  color: #1f2d5f;
  font-size: 0.98rem;
}

.overlay-item-chip.active {
  border-color: #6277c7;
  background: #eef2ff;
}

.template-grid {
  grid-template-columns: minmax(320px, 0.86fr) minmax(420px, 1.14fr);
}

.pdf-template-preview-panel {
  padding: 24px;
}

.template-paper-stage {
  border-radius: 24px;
  background: #f7f8fc;
  padding: 20px;
  overflow: auto;
}

.template-paper {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(27, 39, 90, 0.08);
  overflow: hidden;
}

.template-paper-bg {
  display: block;
  width: 100%;
  height: 100%;
}

.template-overlay-layer,
.template-qr-layer {
  position: absolute;
  inset: 0;
}

.template-mask {
  position: absolute;
  background: #ffffff;
  border-radius: 2px;
  box-sizing: border-box;
}

.template-text {
  position: absolute;
  direction: rtl;
  line-height: 1.1;
  font-weight: 400;
  white-space: pre-wrap;
  word-break: break-word;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1px 3px;
  overflow: hidden;
  box-sizing: border-box;
  font-family: "Frutiger LT Arabic 45 Light", Arial, sans-serif;
  inset: auto;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.template-text.multiline {
  line-height: 1.18;
}

.template-qr-layer {
  pointer-events: none;
}

.template-qr-box {
  position: absolute;
  left: 4.2%;
  top: 6.7%;
  width: 10.8%;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  display: grid;
  place-items: center;
}

.template-paper,
.template-paper * {
  image-rendering: auto;
}

.template-qr-box canvas,
.template-qr-box img {
  width: 100%;
  height: 100%;
}

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

  .pdf-analyzer-grid {
    grid-template-columns: 1fr;
  }

  .template-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .auth-shell,
  .permit-page-shell,
  .scan-page,
  .dashboard-shell {
    padding: 12px;
  }

  .auth-panel,
  .scan-panel,
  .dashboard-topbar,
  .form-panel,
  .permits-panel,
  .preview-panel {
    padding: 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .overlay-form-grid {
    grid-template-columns: 1fr;
  }

  .field-full {
    grid-column: auto;
  }

  .actions .btn,
  .preview-toolbar .btn {
    width: 100%;
  }

  .permit-paper {
    padding: 24px 18px 20px;
  }

  .paper-header {
    grid-template-columns: 94px 1fr 130px;
    gap: 10px;
    padding: 12px;
  }

  .paper-title {
    font-size: 16px;
  }

  .paper-logo-ajeer {
    width: 54px;
  }

  .paper-logo-ministry {
    width: 64px;
  }

  .paper-intro,
  .permit-table th,
  .permit-table td,
  .paper-declarations ul,
  .paper-footer {
    font-size: 13px;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .dashboard-topbar,
  .form-panel,
  .permits-panel,
  .preview-heading {
    display: none !important;
  }

  .dashboard-shell,
  .permit-page-shell {
    padding: 0;
  }

  .preview-panel,
  .public-preview-panel {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
  }

  .paper-stage {
    padding: 0;
    overflow: visible;
  }

  .permit-paper {
    margin: 0;
    box-shadow: none;
    border: 0;
  }
}
