* {
  box-sizing: border-box;
}

html {
  direction: rtl;
  background: #eef4f1;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ar);
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(169, 207, 57, 0.12), transparent 32rem),
    linear-gradient(180deg, #f8fbf9 0%, #edf4f0 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.site-shell {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
  padding-block: 24px 40px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-block-end: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand__logo {
  width: 72px;
  height: 54px;
  object-fit: contain;
}

.brand__text strong {
  display: block;
  font-size: 1.08rem;
  color: var(--asia-green);
}

.brand__text span {
  color: var(--muted);
  font-size: 0.9rem;
}

.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(0, 112, 72, 0.96), rgba(47, 124, 72, 0.93));
  color: white;
  border-radius: 28px;
  padding: clamp(24px, 5vw, 52px);
  box-shadow: var(--shadow-lg);
  margin-block-end: 26px;
}

.hero::after {
  content: "";
  position: absolute;
  inline-size: 270px;
  block-size: 270px;
  border-radius: 50%;
  inset-inline-start: -70px;
  inset-block-end: -120px;
  background: rgba(169, 207, 57, 0.2);
}

.hero h1 {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 4vw, 3rem);
}

.hero p {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0;
  color: rgba(255,255,255,0.86);
  line-height: 1.9;
}

.library-tools {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(4, minmax(150px, 1fr)) auto;
  gap: 12px;
  margin-block-end: 22px;
  align-items: stretch;
}

.search-box,
.filter-select {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 112, 72, 0.12);
  border-radius: 15px;
  box-shadow: var(--shadow-sm);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-inline: 16px;
}

.search-box input,
.filter-select {
  width: 100%;
  min-height: 52px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search-box input {
  min-width: 0;
}

.filter-select {
  padding-inline: 14px;
}

.filter-reset {
  min-height: 52px;
  white-space: nowrap;
}

.library-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-block-end: 14px;
  color: var(--muted);
}

.library-summary strong {
  color: var(--asia-green);
}

.forms-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.form-card[hidden] {
  display: none !important;
}

.form-card {
  display: flex;
  flex-direction: column;
  min-height: 238px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 112, 72, 0.12);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  padding: 18px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.form-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(11, 54, 39, 0.12);
  border-color: rgba(0, 112, 72, 0.26);
}

.form-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-block-end: 18px;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-strong);
  color: var(--asia-green);
  border: 1px solid rgba(0,112,72,.17);
  border-radius: 999px;
  min-height: 32px;
  padding-inline: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}

.status-chip {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .78rem;
  background: #edf8f1;
  color: #247044;
}

.form-card h2 {
  margin: 0 0 8px;
  font-size: 1.12rem;
  line-height: 1.6;
}

.form-card__taxonomy {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-block-end: 10px;
}

.taxonomy-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding-inline: 10px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--asia-green);
  border: 1px solid rgba(0, 112, 72, 0.12);
  font-size: .75rem;
  font-weight: 700;
}

.taxonomy-chip--type {
  background: #fff9e8;
  color: #806212;
  border-color: rgba(214, 166, 44, .25);
}

.form-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
  font-size: .9rem;
}

.form-card__actions {
  margin-block-start: auto;
  padding-block-start: 18px;
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  padding-inline: 15px;
  cursor: pointer;
  transition: .18s ease;
}

.btn--primary {
  background: var(--asia-green);
  color: white;
}

.btn--primary:hover {
  background: #005f3d;
}

.btn--soft {
  color: var(--asia-green);
  background: var(--surface-strong);
}

.btn--ghost {
  color: var(--ink);
  background: white;
  border: 1px solid var(--border);
}

.empty-state {
  display: none;
  text-align: center;
  padding: 48px 20px;
  background: white;
  border-radius: 18px;
  color: var(--muted);
}

.document-page {
  padding-block: 20px 46px;
}

.document-toolbar {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-block-end: 16px;
}

.document-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.document-wrap {
  width: min(210mm, calc(100% - 24px));
  margin-inline: auto;
}

.document-wrap--landscape {
  width: min(297mm, calc(100% - 24px));
}

.company-form {
  width: 210mm;
  min-height: 297mm;
  max-width: 100%;
  margin-inline: auto;
  background: var(--paper);
  color: #17231f;
  box-shadow: var(--shadow-lg);
  padding: 10mm 9mm 8mm;
  border-radius: 2mm;
}

.company-form--landscape {
  width: 297mm;
  min-height: 210mm;
}

.form-header {
  margin-block-end: 4mm;
}

.form-header__identity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48mm;
  gap: 8mm;
  align-items: center;
}

.form-header__text {
  text-align: start;
}

.company-name {
  color: var(--asia-green);
  font-size: 18pt;
  font-weight: 900;
  line-height: 1.5;
}

.department-name {
  color: var(--asia-green-2);
  font-size: 11pt;
  font-weight: 700;
  margin-block-start: 1mm;
}

.form-logo-wrap {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.form-logo {
  display: block;
  width: 42mm;
  max-height: 29mm;
  object-fit: contain;
}

.form-title {
  margin: 4mm 0 2.5mm;
  text-align: center;
  color: var(--asia-green);
  font-size: 21pt;
  line-height: 1.5;
  font-weight: 900;
}

.title-rule {
  position: relative;
  height: 2mm;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-block-end: 2.5mm;
}

.title-rule::before {
  content: "";
  width: 72%;
  border-block-start: .45mm solid var(--asia-gold);
}

.title-rule span {
  position: absolute;
  width: 3.2mm;
  height: 3.2mm;
  border: .45mm solid var(--asia-gold);
  background: white;
  transform: rotate(45deg);
}

.form-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5mm;
  font-size: 8.8pt;
}

.form-code-badge {
  display: inline-flex;
  align-items: center;
  gap: 2.5mm;
  border: .35mm solid var(--asia-green);
  border-radius: 2mm;
  padding: 1.4mm 4mm;
  color: var(--asia-green);
  background: #fbfdfc;
}

.form-document-meta {
  display: flex;
  align-items: center;
  gap: 4mm;
  color: #53645c;
}

.form-sections {
  display: grid;
  gap: 4mm;
}

.form-section {
  position: relative;
  border: .36mm solid var(--asia-green);
  border-radius: 2mm;
  padding: 5.3mm 4mm 3.2mm;
  break-inside: avoid;
}

.form-section--plain {
  border: 0;
  padding-inline: 0;
}

.section-title {
  position: absolute;
  inset-block-start: -4mm;
  inset-inline-start: 0;
  min-width: 48mm;
  background: linear-gradient(90deg, var(--asia-green), #1b7a54);
  color: white;
  border-radius: 2mm 2mm 0 0;
  padding: 1.2mm 4mm 1.4mm;
  text-align: center;
  font-size: 9.2pt;
  font-weight: 800;
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1.3mm 3mm;
  align-items: stretch;
}

.field-cell {
  grid-column: span var(--span, 12);
  min-width: 0;
}

.paper-field {
  width: 100%;
  color: #1a2521;
}

.paper-field--line {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: end;
  gap: 2mm;
  min-height: 7mm;
  min-width: 0;
}

.paper-field__label {
  font-size: 8.7pt;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.45;
  min-width: 0;
}

.paper-field__line {
  min-width: 0;
  min-height: 5.6mm;
  border-block-end: .28mm dotted #8a9792;
  display: flex;
  align-items: flex-end;
  gap: 1.5mm;
  padding-block-end: .5mm;
}

.paper-field__value {
  min-width: 0;
  min-height: 4mm;
  flex: 1;
  text-align: center;
  font-size: 8.5pt;
}

.date-placeholder,
.time-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .8mm;
  width: min(100%, 33mm);
  max-width: 100%;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
  vertical-align: bottom;
}

.time-placeholder {
  width: min(100%, 20mm);
}

.date-placeholder i,
.time-placeholder i {
  display: block;
  flex: 1 1 0;
  min-width: 3.5mm;
  height: 3.2mm;
  border-block-end: .28mm solid #50645b;
}

.date-placeholder__year {
  flex-grow: 1.45 !important;
}

.date-placeholder b,
.time-placeholder b {
  flex: 0 0 auto;
  font-size: 7.8pt;
  line-height: 1;
  font-weight: 500;
  color: #50645b;
}

.paper-field__suffix {
  color: #45574f;
  white-space: nowrap;
  font-size: 8pt;
}

/*
 * Narrow printed fields:
 * 3-column cells are common for dates, employee numbers and short values.
 * Stack the label above the writing line so the value area never collapses
 * or wraps vertically when printing.
 */
.field-cell--span-1 .paper-field--line,
.field-cell--span-2 .paper-field--line,
.field-cell--span-3 .paper-field--line {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: .6mm;
}

.field-cell--span-1 .paper-field__label,
.field-cell--span-2 .paper-field__label,
.field-cell--span-3 .paper-field__label {
  white-space: normal;
  min-height: 4.5mm;
}

.field-cell--span-1 .paper-field__hint,
.field-cell--span-2 .paper-field__hint,
.field-cell--span-3 .paper-field__hint {
  grid-column: 1;
}

.field-cell--type-date .paper-field__value,
.field-cell--type-time .paper-field__value {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.field-cell--type-date .paper-field__line,
.field-cell--type-time .paper-field__line {
  border-block-end: 0;
  padding-block-end: 0;
}


.paper-field__hint {
  grid-column: 2;
  color: #8b9893;
  font-size: 7pt;
}

.paper-field--boxed .paper-field__label,
.paper-field--textarea .paper-field__label,
.paper-field--choices .paper-field__label {
  margin-block-end: 1.2mm;
}

.paper-field__box {
  min-height: 8mm;
  border: .3mm solid var(--border);
  border-radius: 1.5mm;
  padding: 1.5mm 2mm;
  display: flex;
  align-items: center;
}

.textarea-box {
  min-height: var(--field-height, 18mm);
  border: .3mm solid var(--border);
  border-radius: 1.5mm;
  padding: 2mm;
  white-space: pre-wrap;
}

.choice-list {
  display: flex;
  gap: 3mm;
  flex-wrap: wrap;
}

.choice-list--vertical {
  flex-direction: column;
  align-items: flex-start;
}

.choice-item {
  display: inline-flex;
  align-items: center;
  gap: 1.5mm;
  font-size: 8.5pt;
}

.choice-box {
  width: 3.5mm;
  height: 3.5mm;
  border: .35mm solid var(--asia-green);
  border-radius: .6mm;
  background: white;
}

.table-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 1.5mm;
}

.paper-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 8.3pt;
}

.paper-table th,
.paper-table td {
  border: .3mm solid #6d9a85;
  padding: 1.2mm 1.8mm;
  text-align: center;
  vertical-align: middle;
}

.paper-table th {
  background: #eef5f1;
  color: var(--asia-green);
  font-weight: 800;
}

.paper-table td {
  min-height: 7mm;
  height: 7mm;
}

.signature-card,
.approval-card {
  border: .28mm solid var(--border);
  border-radius: 1.3mm;
  min-height: 27mm;
  background: white;
}

.signature-card__title,
.approval-card__title {
  text-align: center;
  color: var(--asia-green);
  background: var(--surface);
  padding: 1.3mm;
  font-size: 8.4pt;
  font-weight: 800;
  border-block-end: .28mm solid var(--border);
}

.signature-space {
  height: 13mm;
}

.signature-line {
  width: 65%;
  border-block-end: .28mm dotted #7d8b85;
  margin-inline: auto;
}

.approval-card__body {
  padding: 2mm;
  display: grid;
  gap: 2mm;
}

.approval-row {
  display: grid;
  grid-template-columns: 12mm minmax(0, 1fr);
  align-items: end;
  gap: 1.5mm;
  font-size: 7.8pt;
}

.approval-row i {
  display: block;
  height: 4.5mm;
  border-block-end: .28mm dotted #7d8b85;
}

.static-paragraph {
  margin: 0;
  line-height: 1.9;
  font-size: 8.5pt;
}

.static-note {
  border-inline-start: 1.2mm solid var(--asia-lime);
  background: var(--surface);
  padding: 2mm 3mm;
  font-size: 8.2pt;
}

.paper-spacer {
  height: var(--spacer-height, 8mm);
}

.form-footer {
  margin-block-start: 4mm;
  color: #496058;
  font-size: 7.8pt;
}

.footer-rule {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 2.5mm;
}

.footer-rule::before {
  content: "";
  width: 100%;
  border-block-start: .45mm solid var(--asia-green);
}

.footer-rule span {
  position: absolute;
  width: 2.8mm;
  height: 2.8mm;
  border: .4mm solid var(--asia-green);
  background: var(--asia-gold);
  transform: rotate(45deg);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  gap: 5mm;
  align-items: center;
  margin-block-start: 1.5mm;
}

.footer-note {
  color: var(--asia-green);
  font-weight: 800;
}

@media (max-width: 1100px) {
  .library-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-box {
    grid-column: 1 / -1;
  }

  .filter-reset {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .forms-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .library-tools {
    grid-template-columns: 1fr;
  }

  .search-box {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  .site-shell {
    width: min(100% - 20px, 1180px);
  }

  .forms-grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    align-items: flex-start;
  }

  .brand__logo {
    width: 58px;
    height: 46px;
  }

  .document-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-wrap {
    overflow-x: auto;
    padding-block-end: 8px;
  }

  .company-form {
    transform-origin: top right;
  }
}
