/* myForms — shared styles. Government/official KSA-flavored aesthetic. */

:root {
  /* Palette — defaults; tweakable */
  --c-primary: #0E5C3A;        /* deep teal-green, off from #006C35 */
  --c-primary-dark: #084529;
  --c-primary-tint: #E8F2EC;
  --c-accent: #B89456;         /* warm gold for seals/accents */
  --c-accent-soft: #F4ECDC;

  --c-ink: #0F1B14;
  --c-ink-2: #2A3A30;
  --c-muted: #5C6B62;
  --c-muted-2: #8A968E;
  --c-line: #DCE1DD;
  --c-line-soft: #ECEFEC;
  --c-bg: #F6F5F0;             /* sand */
  --c-bg-2: #FBFAF6;
  --c-card: #FFFFFF;

  --c-success: #1F7A4D;
  --c-warning: #B07C18;
  --c-danger: #B33A2A;
  --c-info: #21558A;

  /* Type */
  --f-head: "Inter", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --f-body: "Inter", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  --f-ar: "IBM Plex Sans Arabic", "Noto Sans Arabic", system-ui, sans-serif;

  /* Density */
  --pad: 16px;
  --pad-sm: 10px;
  --pad-lg: 24px;
  --row-h: 44px;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 20, 0.06), 0 1px 1px rgba(15, 27, 20, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 27, 20, 0.08), 0 1px 2px rgba(15, 27, 20, 0.05);
}

[data-density="compact"] {
  --pad: 12px;
  --pad-sm: 6px;
  --pad-lg: 18px;
  --row-h: 36px;
}

[data-headfont="serif"] {
  --f-head: "Source Serif 4", "Amiri", Georgia, serif;
}

/* ==== RTL adjustments ==== */
html[dir="rtl"] body {
  font-family: var(--f-ar);
}

html[dir="rtl"] {
  --f-head: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif;
}

html[dir="rtl"][data-headfont="serif"] {
  --f-head: "Amiri", "Source Serif 4", Georgia, serif;
}

/* .right uses logical end so it auto-flips */
html[dir="rtl"] .crumbs .sep {
  transform: scaleX(-1);
  display: inline-block;
}

html[dir="rtl"] .admin-side a.active {
  box-shadow: inset -2px 0 0 var(--c-accent);
}

html[dir="rtl"] .admin-side .footer .av {
  order: 2;
}

html[dir="rtl"] .stat .accent {
  left: auto;
  right: 0;
}

html[dir="rtl"] .md-list .item.active {
  border-left: 0;
  border-right: 3px solid var(--c-primary);
  padding-left: 16px;
  padding-right: 13px;
}

html[dir="rtl"] .public-form .head::before {
  background: linear-gradient(270deg, var(--c-primary) 0%, var(--c-accent) 60%, var(--c-primary) 100%);
}

html[dir="rtl"] .step:first-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

html[dir="rtl"] .step:last-child {
  border-radius: var(--radius) 0 0 var(--radius);
  border-right: 1px solid var(--c-line);
  border-left: 0;
}

html[dir="rtl"] .step {
  border-right: 0;
  border-left: 1px solid var(--c-line);
}

html[dir="rtl"] .step:last-child {
  border-left: 0;
}

html[dir="rtl"] .tbl-toolbar .search svg {
  left: auto;
  right: 10px;
}

html[dir="rtl"] .tbl-toolbar .search input {
  padding: 7px 32px 7px 10px;
}

html[dir="rtl"] .pager .pages {
  flex-direction: row-reverse;
}

html[dir="rtl"] .builder .builder-field .handle {
  left: auto;
  right: -2px;
}

html[dir="rtl"] .settings-nav a.on {
  /* same */
}

html[dir="rtl"] .success-card .stamp {
  right: auto;
  left: -40px;
  transform: rotate(12deg);
}

html[dir="rtl"] .toggle.on .track::after {
  left: 2px;
  right: 18px;
}

html[dir="rtl"] .toggle .track::after {
  left: auto;
  right: 2px;
}

html[dir="rtl"] .toggle.on .track::after {
  right: 18px;
}

/* Mirror chevrons for nav-style icons */
html[dir="rtl"] .chev-mirror svg {
  transform: scaleX(-1);
}

/* Numerals — keep latin in mono. Excludes td so we don't break table-cell
   layout (which would shrink the row's border-bottom to text width). */
html[dir="rtl"] :not(td).num,
html[dir="rtl"] [class*="font-mono"] {
  direction: ltr;
  unicode-bidi: embed;
  display: inline-block;
}

html[dir="rtl"] td.num {
  direction: ltr;
  unicode-bidi: embed;
  text-align: right;
}

/* Login hero side stays on left visually but layout flips */
html[dir="rtl"] .login-page {
  grid-template-columns: 1fr 1fr;
}

/* dl labels */
html[dir="rtl"] .dl {
  direction: rtl;
}

html[dir="rtl"] .dl dd {
  text-align: right;
}

html[dir="rtl"] .govbar .left {
  flex-direction: row-reverse;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--f-body);
  color: var(--c-ink);
  background: var(--c-bg);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  zoom: 1;
}

/* ==== Government top bar (bilingual) ==== */
.govbar {
  background: #0B1F14;
  color: #DDE6E0;
  font-size: 11px;
  border-bottom: 2px solid var(--c-accent);
}

.govbar .inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 6px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.govbar .left {
  display: flex;
  align-items: center;
  gap: 14px;
  letter-spacing: 0.02em;
}

.govbar .left .ar {
  font-family: var(--f-ar);
  font-size: 12px;
}

.govbar .left .sep {
  opacity: 0.4;
}

.govbar .right {
  display: flex;
  gap: 14px;
  align-items: center;
  opacity: 0.85;
}

.govbar a,
.govbar button {
  color: inherit;
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.govbar .lang {
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 3px;
  font-family: var(--f-ar);
}

/* ==== Site header ==== */
.siteheader {
  background: var(--c-card);
  border-bottom: 1px solid var(--c-line);
}

.siteheader .inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.crest {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  position: relative;
  line-height: 0;
}

.crest svg,
.crest img {
  display: block;
  height: 52px;
  width: auto;
}

.crest.crest-xl svg,
.crest.crest-xl img {
  height: 96px;
}

.siteheader .inner {
  padding: 24px 24px;
}

.brand h1 {
  margin: 0;
  font-family: var(--f-head);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--c-ink);
}

.brand .sub {
  font-size: 12px;
  color: var(--c-muted);
  margin-top: 2px;
}

.brand .sub-ar {
  font-family: var(--f-ar);
  font-size: 13px;
  color: var(--c-ink-2);
}

.siteheader .spacer {
  flex: 1;
}

.siteheader .meta {
  font-size: 12px;
  color: var(--c-muted);
  display: flex;
  gap: 18px;
  align-items: center;
  text-align: right;
}

.siteheader .meta .pill {
  background: var(--c-primary-tint);
  color: var(--c-primary-dark);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.02em;
}

/* ==== Generic ==== */
h1,
h2,
h3,
h4 {
  font-family: var(--f-head);
  color: var(--c-ink);
  margin: 0;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 22px;
  font-weight: 600;
}

h3 {
  font-size: 16px;
  font-weight: 600;
}

h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-muted);
}

a {
  color: var(--c-info);
}

.card {
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--c-line);
  background: var(--c-card);
  color: var(--c-ink);
  font: 500 13px var(--f-body);
  cursor: pointer;
  transition: 0.15s;
}

.btn:hover {
  border-color: var(--c-ink-2);
}

.btn-primary {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: white;
}

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

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover {
  background: var(--c-line-soft);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 10px 12px;
  font: 14px var(--f-body);
  color: var(--c-ink);
  background: var(--c-card);
  transition: 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(14, 92, 58, 0.12);
}

input[type="radio"]:focus,
input[type="radio"]:focus-visible,
input[type="checkbox"]:focus,
input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: none;
}

label.field {
  display: block;
  margin-bottom: 18px;
}

label.field .lbl {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

label.field .lbl .name {
  font-weight: 500;
  font-size: 13px;
  color: var(--c-ink-2);
}

label.field .lbl .name .ar {
  font-family: var(--f-ar);
  color: var(--c-muted);
  margin-right: 6px;
  font-size: 12px;
}

label.field .lbl .req {
  color: var(--c-danger);
  margin-left: 4px;
}

label.field .lbl .opt {
  color: var(--c-muted);
  font-size: 11px;
}

label.field .hint {
  font-size: 12px;
  color: var(--c-muted);
  margin-top: 5px;
}

.divider {
  height: 1px;
  background: var(--c-line);
  margin: 24px 0;
}

/* ==== Status pills ==== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill.success {
  background: #E5F1EC;
  color: var(--c-success);
}

.pill.warning {
  background: #F8EFD9;
  color: var(--c-warning);
}

.pill.danger {
  background: #F6E1DC;
  color: var(--c-danger);
}

.pill.info {
  background: #DDEAF6;
  color: var(--c-info);
}

.pill.neutral {
  background: var(--c-line-soft);
  color: var(--c-muted);
}

.pill.flat::before {
  display: none;
}

/* ==== Crest SVG container styling ==== */
.crest .ring {
  stroke: var(--c-accent);
}

.crest .fill {
  fill: var(--c-primary);
}

/* ==== Admin layout ==== */
.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100%;
  background: var(--c-bg);
}

.admin-side {
  background: #0B1F14;
  color: #C8D5CC;
  padding: 20px 14px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-side .brand-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 14px;
}

.admin-side .brand-mini .crest svg,
.admin-side .brand-mini .crest img {
  height: 32px;
  width: auto;
}

.admin-side .brand-mini .crest.crest-side svg,
.admin-side .brand-mini .crest.crest-side img {
  height: auto;
  width: 100%;
  max-width: 180px;
}

.admin-side .brand-mini {
  align-items: center;
  gap: 8px;
}

.admin-side .brand-mini .brand-text {
  font-family: var(--f-head);
  font-size: 14px;
  color: white;
  font-weight: 600;
}

.admin-side .brand-mini .brand-text .ar {
  font-family: var(--f-ar);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  display: block;
  font-weight: 400;
}

.admin-side .nav-section {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  padding: 18px 10px 8px;
}

.admin-side a {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 14px;
  border-radius: 5px;
  color: #C8D5CC;
  text-decoration: none;
  font-size: 17px;
}

.admin-side a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.admin-side a.active {
  background: rgba(184, 148, 86, 0.14);
  color: white;
  box-shadow: inset 2px 0 0 var(--c-accent);
}

.admin-side a .ic {
  width: 21px;
  height: 21px;
  opacity: 0.7;
}

.admin-side a.active .ic {
  opacity: 1;
}

.admin-side .side-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.admin-side .side-logout {
  margin: 0;
  padding: 0 0 6px;
}

.admin-side .logout-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 14px;
  border: 0;
  background: transparent;
  color: #C8D5CC;
  font: inherit;
  font-size: 17px;
  border-radius: 5px;
  cursor: pointer;
  text-align: start;
}

.admin-side .logout-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.admin-side .logout-link .ic {
  width: 21px;
  height: 21px;
  opacity: 0.7;
}

.admin-side .footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 0 -14px;
  padding-inline-start: 24px;
  padding-inline-end: 24px;
}

.admin-side .footer .av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--c-accent);
  color: #0B1F14;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex-shrink: 0;
}

.admin-side .footer .who {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.admin-side .footer .who .name {
  color: white;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-side .footer .who .role {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-side a.footer-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: 5px;
  transition: background 150ms;
}

.admin-side a.footer-link:hover {
  background: rgba(255, 255, 255, 0.05);
}

.admin-side a.footer-link.active {
  background: rgba(255, 255, 255, 0.06);
}

.admin-side a.footer-link .chev {
  color: rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.admin-main {
  padding: 24px 32px 48px;
  overflow: auto;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.admin-topbar .crumbs {
  font-size: 12px;
  color: var(--c-muted);
}

.admin-topbar .crumbs .sep {
  margin: 0 6px;
  opacity: 0.5;
}

.admin-topbar .actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-topbar h2 {
  margin-top: 4px;
}

/* ==== Tables ==== */
.tbl {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-card);
  font-size: 17px;
}

.tbl thead th {
  text-align: start;
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-muted);
  padding: 13px 18px;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-bg-2);
  white-space: nowrap;
}

.tbl tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--c-line-soft);
  vertical-align: middle;
  text-align: start;
}

.tbl th.right,
.tbl td.right {
  text-align: end;
}

/* LTR text inside RTL cells (emails, phones, refs): keep direction LTR but stay aligned with column */
.tbl .ltr {
  unicode-bidi: plaintext;
  direction: ltr;
}

html[dir="rtl"] .tbl .ltr {
  text-align: start;
}

.tbl tbody tr:hover {
  background: var(--c-bg-2);
  cursor: pointer;
}

.tbl tbody tr.selected {
  background: var(--c-primary-tint);
}

.tbl .num {
  font-family: var(--f-mono);
  font-size: 16px;
  color: var(--c-muted);
}

.tbl .name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tbl .av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-primary-tint);
  color: var(--c-primary-dark);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 11px;
  flex-shrink: 0;
}

.tbl .av.gold {
  background: var(--c-accent-soft);
  color: var(--c-accent);
}

.tbl .files-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--c-muted);
}

/* Stat cards */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat {
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}

.stat .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-muted);
}

.stat .val {
  font-family: var(--f-head);
  font-size: 34px;
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: -0.02em;
}

html[dir="rtl"] .stat .val,
html[dir="rtl"] .stat .label,
html[dir="rtl"] .stat .delta {
  text-align: right;
  direction: rtl;
}
html[dir="rtl"] .stat .val { unicode-bidi: isolate; }

.stat .delta {
  font-size: 13px;
  margin-top: 4px;
  color: var(--c-success);
}

.stat .delta.down {
  color: var(--c-danger);
}

.stat .accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--c-primary);
}

.stat .accent.gold {
  background: var(--c-accent);
}

.stat .accent.info {
  background: var(--c-info);
}

.stat .accent.warn {
  background: var(--c-warning);
}

/* Toolbar above tables */
.tbl-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--c-line);
  border-bottom: 0;
  background: var(--c-card);
  border-radius: var(--radius) var(--radius) 0 0;
}

.tbl-toolbar .search {
  flex: 1;
  max-width: 420px;
  position: relative;
}

.tbl-toolbar .search input {
  padding: 10px 12px 10px 38px;
  font-size: 17px;
  background: var(--c-bg-2);
}

.tbl-toolbar .search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-muted);
}

.tbl-wrap {
  border: 1px solid var(--c-line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

/* Pagination */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--c-muted);
  background: var(--c-bg-2);
  border-top: 1px solid var(--c-line);
}

.pager .pages {
  display: flex;
  gap: 4px;
}

.pager .pages button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--c-line);
  background: var(--c-card);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.pager .pages button.on {
  background: var(--c-primary);
  color: white;
  border-color: var(--c-primary);
}

/* Section header */
.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 4px 0 14px;
}

/* Definition list */
.dl {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px 20px;
  font-size: 13px;
}

.dl dt {
  color: var(--c-muted);
  font-size: 12px;
}

.dl dd {
  margin: 0;
  color: var(--c-ink);
}

/* Sectioned variant: clear visual grouping between fields, useful when one
   field has many values (e.g. multiple uploaded files). */
.dl-sections {
  gap: 0;
}
.dl-sections dt,
.dl-sections dd {
  padding: 16px 0;
  border-top: 1px solid var(--c-line-soft);
  align-self: stretch;
}
.dl-sections > dt:first-of-type,
.dl-sections > dt:first-of-type + dd {
  border-top: 0;
  padding-top: 4px;
}
.dl-sections dt {
  position: sticky;
  top: 12px;
  align-self: start;
  font-weight: 500;
}

/* File row */
.filerow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  background: var(--c-card);
}

.filerow+.filerow {
  margin-top: 8px;
}

.filerow .ic {
  width: 36px;
  height: 44px;
  border-radius: 4px;
  background: var(--c-primary-tint);
  display: grid;
  place-items: center;
  color: var(--c-primary-dark);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.filerow .ic.pdf {
  background: #FDECE7;
  color: #B33A2A;
}

.filerow .ic.img {
  background: #E5EFF8;
  color: var(--c-info);
}

.filerow .meta {
  flex: 1;
  min-width: 0;
}

.filerow .meta .nm {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink);
}

.filerow .meta .sz {
  font-size: 11px;
  color: var(--c-muted);
  margin-top: 2px;
}

.filerow .acts {
  display: flex;
  gap: 4px;
}

/* Public form */
.public-page {
  background: var(--c-bg);
  min-height: 100%;
}

.public-form {
  max-width: 720px;
  margin: 32px auto 64px;
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.public-form .head {
  padding: 28px 36px;
  border-bottom: 1px solid var(--c-line);
  background: linear-gradient(180deg, var(--c-bg-2) 0%, var(--c-card) 100%);
  position: relative;
}

.public-form .head::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--c-primary) 0%, var(--c-accent) 60%, var(--c-primary) 100%);
}

.public-form .head .title-ar {
  font-family: var(--f-ar);
  font-size: 18px;
  color: var(--c-ink-2);
  font-weight: 600;
}

.public-form .head h1 {
  margin: 4px 0 8px;
  font-family: var(--f-head);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.public-form .head .desc {
  color: var(--c-muted);
  font-size: 13px;
}

.public-form .head .meta-row {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  font-size: 11px;
  color: var(--c-muted);
  border-top: 1px dashed var(--c-line);
  padding-top: 12px;
}

.public-form .head .meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.public-form .body {
  padding: 28px 36px;
}

.public-form .footer-actions {
  padding: 18px 36px;
  border-top: 1px solid var(--c-line);
  background: var(--c-bg-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.upload {
  border: 1.5px dashed var(--c-line);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  background: var(--c-bg-2);
  cursor: pointer;
  transition: 0.15s;
}

.upload:hover {
  border-color: var(--c-primary);
  background: var(--c-primary-tint);
}

.upload .big {
  font-weight: 500;
  color: var(--c-ink-2);
  font-size: 13px;
}

.upload .small {
  font-size: 11px;
  color: var(--c-muted);
  margin-top: 4px;
}

.uploaded-list {
  margin-top: 12px;
}

/* Address grid */
.addr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.addr-grid .span2 {
  grid-column: 1 / 3;
}

.steps {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
}

.step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--c-line);
  border-right: 0;
  background: var(--c-card);
  font-size: 12px;
  color: var(--c-muted);
}

.step:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.step:last-child {
  border-right: 1px solid var(--c-line);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.step .n {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c-line-soft);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 11px;
  color: var(--c-muted);
}

.step.done {
  color: var(--c-primary-dark);
  background: var(--c-primary-tint);
}

.step.done .n {
  background: var(--c-primary);
  color: white;
}

.step.active .n {
  background: var(--c-accent);
  color: white;
}

.step.active {
  color: var(--c-ink);
  border-color: var(--c-accent);
  position: relative;
}

/* OTP */
.otp-input {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 18px 0;
}

.otp-input input {
  width: 48px;
  height: 56px;
  text-align: center;
  font: 600 22px var(--f-mono);
}

/* Misc */
.kbd {
  font-family: var(--f-mono);
  font-size: 11px;
  background: var(--c-line-soft);
  border: 1px solid var(--c-line);
  border-radius: 4px;
  padding: 1px 6px;
}

/* Builder */
.builder {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  gap: 16px;
}

.builder .palette,
.builder .props {
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 14px;
  align-self: start;
}

.builder .palette h4 {
  margin-bottom: 10px;
}

.builder .field-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
  border: 1px solid var(--c-line);
  border-radius: 4px;
  background: var(--c-bg-2);
  font-size: 12px;
  cursor: grab;
}

.builder .field-tile .ic {
  width: 16px;
  height: 16px;
  color: var(--c-muted);
}

.builder .canvas-form {
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 22px 28px;
  min-height: 600px;
}

.builder .builder-field {
  border: 1px solid transparent;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 6px;
  position: relative;
}

.builder .builder-field:hover {
  border-color: var(--c-line);
  background: var(--c-bg-2);
}

.builder .builder-field.selected {
  border-color: var(--c-primary);
  background: var(--c-primary-tint);
}

.builder .builder-field .handle {
  position: absolute;
  left: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  background: var(--c-line);
  border-radius: 2px;
}

.builder .builder-field.selected .handle {
  background: var(--c-primary);
}

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
}

.settings-nav a {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--c-ink-2);
  text-decoration: none;
  border-radius: 5px;
}

.settings-nav a.on {
  background: var(--c-primary-tint);
  color: var(--c-primary-dark);
  font-weight: 500;
}

.settings-section {
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
}

.settings-section h3 {
  margin-bottom: 4px;
}

.settings-section .desc {
  color: var(--c-muted);
  font-size: 12px;
  margin-bottom: 16px;
}

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

.muted {
  color: var(--c-muted);
}

.right {
  text-align: end;
}

/* Toggle */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle .track {
  width: 36px;
  height: 20px;
  background: var(--c-line);
  border-radius: 999px;
  position: relative;
  transition: 0.15s;
}

.toggle .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: 0.15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle.on .track {
  background: var(--c-primary);
}

.toggle.on .track::after {
  left: 18px;
}

/* Compact tweaks */
[data-density="compact"] .tbl tbody td {
  padding: 7px 12px;
}

[data-density="compact"] .tbl thead th {
  padding: 7px 12px;
}

[data-density="compact"] .stat {
  padding: 12px 14px;
}

[data-density="compact"] .stat .val {
  font-size: 26px;
}

[data-density="compact"] .public-form .body {
  padding: 22px 30px;
}

[data-density="compact"] .public-form .head {
  padding: 22px 30px;
}

[data-density="compact"] label.field {
  margin-bottom: 14px;
}

/* Login page */
.login-page {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--c-bg);
}

.login-page .hero {
  background: #0B1F14;
  color: white;
  padding: 48px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.login-page .hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 80% 10%, rgba(184, 148, 86, 0.12) 0, transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(14, 92, 58, 0.4) 0, transparent 50%);
  pointer-events: none;
}

.login-page .hero h1 {
  font-family: var(--f-head);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  color: white;
  letter-spacing: -0.02em;
  margin-top: 56px;
  position: relative;
  max-width: 360px;
}

.login-page .hero .ar {
  font-family: var(--f-ar);
  font-size: 22px;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 16px;
  position: relative;
  max-width: 360px;
}

.login-page .hero .tagline {
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  line-height: 1.6;
  position: relative;
  max-width: 360px;
}

.login-page .hero .seal-bg {
  position: absolute;
  right: -80px;
  bottom: -80px;
  width: 360px;
  opacity: 0.06;
}

.login-page .form-side {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
}

.login-page .form-side .form-inner {
  max-width: 360px;
  width: 100%;
  margin: 0 auto;
}

/* Success */
.success-card {
  max-width: 580px;
  margin: 64px auto;
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  padding: 56px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.success-card .stamp {
  position: absolute;
  right: -40px;
  top: 18px;
  width: 180px;
  height: 180px;
  border: 3px double var(--c-success);
  border-radius: 50%;
  display: grid;
  place-items: center;
  transform: rotate(-12deg);
  opacity: 0.16;
  font-family: var(--f-head);
  font-weight: 700;
  color: var(--c-success);
  font-size: 18px;
  letter-spacing: 0.1em;
  pointer-events: none;
}

.success-card .check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--c-primary-tint);
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
}

.success-card h1 {
  font-size: 28px;
  font-weight: 600;
}

.success-card .ar {
  font-family: var(--f-ar);
  font-size: 17px;
  color: var(--c-muted);
  margin-top: 6px;
}

.success-card .ref {
  margin-top: 22px;
  padding: 14px 18px;
  background: var(--c-bg-2);
  border: 1px dashed var(--c-line);
  border-radius: var(--radius);
  font-family: var(--f-mono);
  font-size: 14px;
  color: var(--c-ink);
  display: inline-block;
}

.success-card .ref small {
  display: block;
  font-family: var(--f-body);
  font-size: 11px;
  color: var(--c-muted);
  margin-bottom: 4px;
}

/* Master-detail */
.md-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 640px;
}

.md-list {
  background: var(--c-card);
  border-right: 1px solid var(--c-line);
  overflow: hidden;
}

.md-list .item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-line-soft);
  cursor: pointer;
}

.md-list .item:hover {
  background: var(--c-bg-2);
}

.md-list .item.active {
  background: var(--c-primary-tint);
  border-left: 3px solid var(--c-primary);
  padding-left: 13px;
}

.md-list .item .top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--c-muted);
  margin-bottom: 4px;
}

.md-list .item .nm {
  font-weight: 500;
  color: var(--c-ink);
}

.md-list .item .preview {
  font-size: 12px;
  color: var(--c-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.md-detail {
  background: var(--c-bg-2);
  padding: 24px 28px;
  overflow: auto;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--c-line);
  margin-bottom: 16px;
}

.tabs .tab {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--c-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
}

.tabs .tab.on {
  color: var(--c-primary-dark);
  border-bottom-color: var(--c-primary);
  font-weight: 500;
}

/* Filter chip */
.fchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--c-bg-2);
  border: 1px solid var(--c-line);
  font-size: 16px;
  color: var(--c-ink-2);
  cursor: pointer;
}

.fchip svg {
  color: var(--c-muted);
}

.fchip.active {
  background: var(--c-primary-tint);
  border-color: var(--c-primary);
  color: var(--c-primary-dark);
}