:root {
  --ink: #17202a;
  --muted: #64748b;
  --line: #d7dee8;
  --panel: #ffffff;
  --page: #f3f7f4;
  --green: #096936;
  --green-dark: #064d28;
  --green-soft: #eef8f1;
  --green-line: #b9ddc6;
  --maroon: #6c211c;
  --sand: #ece8e0;
  --red: #b42318;
  --blue: #255b85;
  --blue-soft: #eef6fb;
  --action-primary-bg: #096936;
  --action-primary-fg: #ffffff;
  --action-primary-border: #096936;
  --action-primary-hover: #064d28;
  --action-view-bg: #255b85;
  --action-view-fg: #ffffff;
  --action-view-border: #255b85;
  --action-view-hover: #1b476b;
  --action-download-bg: var(--action-view-bg);
  --action-download-fg: var(--action-view-fg);
  --action-download-border: var(--action-view-border);
  --action-download-hover: var(--action-view-hover);
  --action-danger-bg: #b42318;
  --action-danger-fg: #ffffff;
  --action-danger-border: #b42318;
  --action-danger-hover: #8f1b13;
  --action-intervention-bg: #5145a8;
  --action-intervention-fg: #ffffff;
  --action-intervention-border: #5145a8;
  --action-intervention-hover: #40368a;
  --action-secondary-bg: #f8fafc;
  --action-secondary-fg: #334155;
  --action-secondary-border: #cbd5e1;
  --action-secondary-hover: #eef2f6;
  --state-success-bg: #eef8f1;
  --state-success-fg: #064d28;
  --state-success-border: #b9ddc6;
  --state-info-bg: #eef6fb;
  --state-info-fg: #1b476b;
  --state-info-border: #b7d5e8;
  --state-warning-bg: #fffbeb;
  --state-warning-fg: #854d0e;
  --state-warning-border: #f4d58d;
  --state-danger-bg: #fff1f0;
  --state-danger-fg: #8f1b13;
  --state-danger-border: #efb5ae;
  --state-neutral-bg: #f8fafc;
  --state-neutral-fg: #475569;
  --state-neutral-border: #cbd5e1;
  --interaction-focus: #0b63ce;
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.055);
  --shadow-hover: 0 14px 34px rgba(15, 23, 42, 0.085);
  --paper-border: #111827;
  --radius: 8px;
  --font-ar: Tajawal, Tahoma, Arial, sans-serif;
  --font-ar-bold: Tajawal, Tahoma, Arial, sans-serif;
  --table-th-font-size: 12.5px;
  --table-td-font-size: 13px;
  --table-cell-line-height: 1.55;
}

.error-shell {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(0, 91, 53, 0.08), rgba(245, 248, 250, 0.96)),
    #f5f8fa;
  color: var(--ink);
}

.error-dialog-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.error-dialog {
  width: min(640px, 100%);
  text-align: center;
  padding: 34px;
  border-right: 6px solid var(--green);
}

.error-dialog .error-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #b45309;
  font-size: 28px;
  font-weight: 900;
}

.error-dialog h1 {
  margin: 12px 0 8px;
  color: var(--green-dark);
}

.error-dialog p {
  margin: 0 auto 20px;
  max-width: 520px;
  color: var(--muted);
  line-height: 1.9;
}

.error-dialog .actions {
  justify-content: center;
}

.request-type-picker {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.origin-choice-panel {
  width: min(1080px, 100%);
  min-height: calc(100vh - 380px);
  margin: 0 auto;
  display: grid;
  align-items: center;
}

.activity-choice-panel {
  width: min(1180px, 100%);
  min-height: calc(100vh - 380px);
  margin: 0 auto;
  display: grid;
  align-items: center;
}

.request-type-card {
  display: grid;
  gap: 6px;
  min-height: 132px;
}

.origin-picker {
  grid-template-columns: repeat(2, minmax(340px, 1fr));
  gap: 22px;
  padding: 0;
}

.activity-picker {
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 18px;
  padding: 0;
}

.registration-origin-card,
.registration-activity-card {
  position: relative;
  min-height: 228px;
  align-content: start;
  padding: 28px;
  overflow: hidden;
  border-top: 5px solid var(--green);
  background:
    radial-gradient(circle at 0% 100%, rgba(9, 105, 54, 0.08), transparent 34%),
    #fff;
  box-shadow: var(--shadow-soft);
}

.registration-origin-card::after,
.registration-activity-card::after {
  content: "";
  position: absolute;
  inset-inline-start: -46px;
  bottom: -58px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(9, 105, 54, 0.07);
  pointer-events: none;
}

.registration-origin-card .origin-badge,
.registration-activity-card .origin-badge {
  width: fit-content;
  padding: 9px 16px;
  border: 1px solid var(--green-line);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 17px;
  font-weight: 800;
}

.registration-origin-card strong,
.registration-activity-card strong {
  margin-top: 18px;
  color: var(--green-dark);
  font-size: 30px;
  line-height: 1.45;
}

.registration-origin-card small,
.registration-activity-card small {
  max-width: 420px;
  line-height: 1.75;
  color: var(--muted);
}

.registration-origin-card:hover,
.registration-activity-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.registration-activity-card {
  min-height: 214px;
}

.registration-activity-card strong {
  font-size: 25px;
}

@media (max-width: 760px) {
  .origin-choice-panel,
  .activity-choice-panel {
    min-height: 0;
  }

  .origin-picker,
  .activity-picker {
    grid-template-columns: 1fr;
  }

  .registration-origin-card {
    min-height: 190px;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .activity-picker {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

.table-filters-panel {
  padding-block: 16px;
}

.filters-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 260px)) auto auto;
  align-items: end;
  gap: 12px;
}

.filters-row .field {
  margin: 0;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: 8px;
}

.inline-form input,
.inline-form select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  font-family: var(--font-ar);
}

@media (max-width: 820px) {
  .filters-row {
    grid-template-columns: 1fr;
  }

  .inline-form {
    display: grid;
    margin: 8px 0 0;
  }
}

@font-face {
  font-family: Tajawal;
  src: url("/static/assets/fonts/tajawal/Tajawal-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Tajawal;
  src: url("/static/assets/fonts/tajawal/Tajawal-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: Tajawal;
  src: url("/static/assets/fonts/tajawal/Tajawal-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: Tajawal;
  src: url("/static/assets/fonts/tajawal/Tajawal-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 92% 0%, rgba(9, 105, 54, 0.08), transparent 280px),
    linear-gradient(180deg, rgba(238, 248, 241, 0.88), rgba(245, 247, 251, 0.98) 280px),
    var(--page);
  color: var(--ink);
  font-family: var(--font-ar);
  line-height: 1.6;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--green-line);
  box-shadow: 0 8px 24px rgba(4, 88, 44, 0.055);
  backdrop-filter: blur(10px);
}

.portal-body .topbar {
  min-height: 56px;
  padding: 7px 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 8px 2px 2px;
  transition: background 120ms ease, color 120ms ease;
}

.account-chip:hover {
  color: var(--green-dark);
  background: var(--green-soft);
}

.topbar-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  background: var(--green);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 5px 14px rgba(4, 88, 44, 0.16);
  font-weight: 800;
}

.logout-link {
  display: inline-grid;
  place-items: center;
  color: var(--red);
  border-right: 1px solid var(--line);
  padding-right: 10px;
  min-height: 34px;
  font-weight: 800;
}

.logout-form {
  margin: 0;
}

.action-primary,
.action-view,
.action-download,
.action-danger,
.action-intervention,
.action-secondary {
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
}

.action-primary { background: var(--action-primary-bg); color: var(--action-primary-fg); border-color: var(--action-primary-border); }
.action-view { background: var(--action-view-bg); color: var(--action-view-fg); border-color: var(--action-view-border); }
.action-download { background: var(--action-download-bg); color: var(--action-download-fg); border-color: var(--action-download-border); }
.action-danger { background: var(--action-danger-bg); color: var(--action-danger-fg); border-color: var(--action-danger-border); }
.action-intervention { background: var(--action-intervention-bg); color: var(--action-intervention-fg); border-color: var(--action-intervention-border); }
.action-secondary { background: var(--action-secondary-bg); color: var(--action-secondary-fg); border-color: var(--action-secondary-border); }

.action-primary:hover { background: var(--action-primary-hover); }
.action-view:hover { background: var(--action-view-hover); }
.action-download:hover { background: var(--action-download-hover); }
.action-danger:hover { background: var(--action-danger-hover); }
.action-intervention:hover { background: var(--action-intervention-hover); }
.action-secondary:hover { background: var(--action-secondary-hover); }

.action-primary:focus-visible,
.action-view:focus-visible,
.action-download:focus-visible,
.action-danger:focus-visible,
.action-intervention:focus-visible,
.action-secondary:focus-visible {
  outline: 3px solid var(--interaction-focus);
  outline-offset: 2px;
}

.action-primary:disabled,
.action-view:disabled,
.action-download:disabled,
.action-danger:disabled,
.action-intervention:disabled,
.action-secondary:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

@media (forced-colors: active) {
  .action-primary,
  .action-view,
  .action-download,
  .action-danger,
  .action-intervention,
  .action-secondary {
    border: 1px solid ButtonText;
    forced-color-adjust: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .action-primary,
  .action-view,
  .action-download,
  .action-danger,
  .action-intervention,
  .action-secondary {
    scroll-behavior: auto;
    transition: none;
  }
}

.compact-identifier {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

button.logout-link {
  background: transparent;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  cursor: pointer;
  font: inherit;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  align-items: start;
  min-height: calc(100vh - 56px);
}

.auth-body .layout {
  display: block;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 18px 14px;
  background: #fff;
  border-left: 1px solid var(--green-line);
  box-shadow: -8px 0 24px rgba(4, 88, 44, 0.035);
}

.sidebar::-webkit-scrollbar,
.portal-shell::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-thumb,
.portal-shell::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.sidebar-title {
  display: grid;
  gap: 2px;
  padding: 4px 10px 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-title strong {
  font-size: 18px;
  font-weight: 800;
  font-family: var(--font-ar-bold);
}

.sidebar-title span {
  color: var(--muted);
  font-size: 12px;
}

.sidebar nav {
  display: grid;
  gap: 2px;
}

.sidebar nav {
  margin-top: 12px;
}

.nav-group {
  display: grid;
  gap: 0;
  border-bottom: 1px solid #edf2f7;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
}

.nav-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  font-family: var(--font-ar-bold);
  cursor: pointer;
  list-style: none;
  border: 0;
  border-radius: 6px;
  background: transparent;
  transition: background 120ms ease, color 120ms ease;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group summary::before {
  content: "▸";
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  color: var(--green-dark);
  background: transparent;
  font-size: 12px;
  line-height: 1;
  transform: rotate(180deg);
  transition: transform 140ms ease;
}

.nav-group summary:hover {
  color: var(--green-dark);
  background: #f8fcfa;
}

.nav-group[open] summary {
  color: var(--green-dark);
  background: transparent;
  box-shadow: none;
}

.nav-group[open] summary::before {
  transform: rotate(270deg);
}

.nav-group-label {
  flex: 1 1 auto;
  min-width: 0;
}

.nav-group-links {
  display: grid;
  gap: 4px;
  padding: 2px 8px 8px;
  border-right: 0;
  margin-right: 8px;
}

.sidebar a {
  color: var(--ink);
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
  font-family: var(--font-ar-bold);
  line-height: 1.35;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.sidebar a:hover,
.sidebar a.is-active {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: var(--green-line);
  border-right-color: var(--green);
}

.sidebar a.is-active {
  box-shadow: inset -3px 0 0 var(--green);
}

.portal-shell {
  width: min(1360px, calc(100% - 36px));
  height: calc(100vh - 56px);
  margin: 0 auto;
  padding: 20px 0 40px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.public-body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(238, 248, 241, 0.86), rgba(245, 247, 251, 0.98) 260px),
    var(--page);
}

.public-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.registration-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.registration-title h1 {
  margin: 0 0 4px;
  color: var(--green-dark);
  font-size: 30px;
  line-height: 1.25;
}

.registration-title p {
  margin: 0;
  color: var(--muted);
}

.customer-registration-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.customer-registration-form .auth-form-head {
  text-align: right;
}

.customer-registration-form .auth-form-head span {
  font-size: 24px;
}

.customer-registration-form .auth-form-head strong {
  margin: 0;
}

.registration-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.auth-shell {
  width: min(1420px, calc(100% - 42px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 14px 0;
}

.auth-body {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(2, 38, 39, 0.98), rgba(4, 69, 47, 0.88)),
    linear-gradient(135deg, #063d3c 0%, #042f2e 42%, #0a5737 100%);
}

.auth-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(118deg, transparent 0 53%, rgba(255, 255, 255, 0.04) 53.2% 53.7%, transparent 54%),
    linear-gradient(70deg, transparent 0 63%, rgba(255, 255, 255, 0.03) 63.2% 64%, transparent 64.2%),
    linear-gradient(160deg, transparent 0 35%, rgba(255, 255, 255, 0.024) 35.2% 60%, transparent 60.2%);
  opacity: 0.9;
}

.auth-body::after {
  content: "";
  position: fixed;
  right: 22%;
  bottom: -15vh;
  width: 48vw;
  height: 72vh;
  pointer-events: none;
  background:
    linear-gradient(82deg, rgba(214, 224, 196, 0.14), rgba(214, 224, 196, 0.03) 58%, transparent 59%),
    repeating-linear-gradient(100deg, transparent 0 27px, rgba(255, 255, 255, 0.055) 28px 30px);
  transform: skewX(-18deg);
  opacity: 0.55;
}

.auth {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: calc(100vh - 28px);
  display: grid;
  grid-template-columns: minmax(430px, 500px) minmax(0, 1fr);
  gap: clamp(54px, 7vw, 128px);
  align-items: center;
}

.register-auth {
  grid-template-columns: minmax(680px, 820px) minmax(320px, 1fr);
}

.registration-page {
  grid-template-columns: 1fr;
  align-content: start;
  justify-items: center;
  gap: 18px;
  width: min(1180px, 100%);
  min-height: auto;
  margin: 0 auto;
  padding: 22px 0 44px;
}

.registration-page .auth-identity {
  min-height: auto;
  width: min(980px, 100%);
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.registration-page .auth-brand-lockup {
  margin: 0;
}

.registration-page .auth-logo {
  width: 74px;
  height: 74px;
}

.registration-page h1 {
  font-size: clamp(30px, 3vw, 42px);
}

.registration-page p {
  max-width: 820px;
  font-size: 17px;
}

.registration-page .auth-meta {
  justify-content: center;
  margin-top: 0;
}

.choice-auth {
  grid-template-columns: 1fr;
  align-content: center;
  justify-items: center;
  gap: 34px;
  width: min(1120px, 100%);
  margin: 0 auto;
}

.login-auth {
  grid-template-columns: minmax(430px, 500px) minmax(0, 1fr);
}

.login-auth.customer-login-auth > .auth-form.panel:only-child {
  grid-column: 1 / -1;
  justify-self: center;
}

.success-auth {
  width: min(760px, 100%);
  min-height: calc(100vh - 28px);
  margin: 0 auto;
  grid-template-columns: 1fr;
  align-content: center;
  justify-items: center;
}

.success-auth .success-panel {
  position: relative;
  width: min(100%, 620px);
  min-height: auto;
  justify-items: center;
  align-content: center;
  gap: 24px;
  padding: 54px 50px 48px;
  text-align: center;
}

.success-auth .success-panel::before {
  content: "✓";
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 2px;
  color: #fff;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 14px 30px rgba(9, 105, 54, 0.22);
  font-family: var(--font-ar-bold);
  font-size: 30px;
  font-weight: 900;
}

.success-auth .auth-form-head span {
  font-size: clamp(30px, 3vw, 42px);
}

.success-auth .auth-form-head strong,
.success-auth .muted {
  max-width: 460px;
  margin-inline: auto;
  line-height: 1.8;
}

.success-auth .link-button {
  width: min(100%, 420px);
}

.auth-identity {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 22px;
  min-height: 620px;
  color: #fff;
  text-align: right;
}

.choice-auth .auth-identity {
  justify-items: center;
  gap: 16px;
  min-height: auto;
  width: min(920px, 100%);
  text-align: center;
}

.choice-auth .auth-brand-lockup {
  justify-content: center;
  margin-bottom: 2px;
}

.choice-auth .auth-logo {
  width: 104px;
  height: 104px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.choice-auth h1 {
  max-width: none;
  font-size: clamp(34px, 4vw, 54px);
}

.choice-auth p {
  max-width: 820px;
  font-size: clamp(17px, 1.5vw, 22px);
}

.choice-auth .auth-meta {
  justify-content: center;
  margin-top: 2px;
}

.auth-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.auth-logo {
  width: 104px;
  height: 104px;
  object-fit: contain;
  display: block;
  opacity: 0.96;
}

.auth-brand-lockup span {
  color: rgba(255, 255, 255, 0.92);
  font-size: 18px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.auth h1 {
  max-width: 820px;
  margin: 0;
  color: #fff;
  font-size: clamp(28px, 3.1vw, 40px);
  line-height: 1.18;
  text-wrap: balance;
}

.auth p {
  max-width: 760px;
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(17px, 1.7vw, 24px);
  line-height: 1.7;
}

.auth-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 10px;
}

.auth-meta span {
  min-height: 34px;
  padding: 6px 13px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-ar-bold);
}

.login-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  width: min(100%, 820px);
}

.login-choice-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 330px;
  padding: 30px 32px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.24);
  overflow: hidden;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.login-choice-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: var(--green);
}

.login-choice-card::after {
  content: "";
  position: absolute;
  left: -42px;
  bottom: -58px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(9, 105, 54, 0.08);
}

.login-choice-card .choice-kicker::before {
  display: block;
  width: 54px;
  height: 54px;
  margin-bottom: 18px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid var(--green-line);
  border-radius: 14px;
  box-shadow: inset 0 -10px 18px rgba(9, 105, 54, 0.05);
  text-align: center;
  line-height: 54px;
  font-size: 15px;
  font-weight: 800;
}

.customer-choice .choice-kicker::before {
  content: "عميل";
}

.staff-choice .choice-kicker::before {
  content: "فريق";
  color: var(--maroon);
  background: #fbf1ef;
  border-color: rgba(108, 33, 28, 0.22);
  box-shadow: inset 0 -10px 18px rgba(108, 33, 28, 0.05);
}

.login-choice-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 34px 84px rgba(0, 0, 0, 0.32);
}

.choice-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-ar-bold);
}

.login-choice-card strong {
  color: var(--green-dark);
  font-size: 28px;
  line-height: 1.25;
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.login-choice-card p {
  color: #334155;
  font-size: 16px;
  line-height: 1.75;
}

.login-choice-card em {
  align-self: end;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  margin-top: auto;
  padding: 10px 16px;
  color: #fff;
  background: var(--green);
  border-radius: 6px;
  font-style: normal;
  font-weight: 800;
  font-family: var(--font-ar-bold);
}

.staff-choice::before,
.staff-choice em {
  background: var(--maroon);
}

.staff-choice::after {
  background: rgba(108, 33, 28, 0.08);
}

.staff-choice strong {
  color: var(--maroon);
}

.choice-links {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.84);
  font-weight: 800;
}

.choice-links span {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.28);
}

.auth-form.panel,
.auth-card {
  display: grid;
  align-content: start;
  gap: 22px;
  width: min(100%, 500px);
  min-height: min(520px, calc(100vh - 28px));
  margin: 0;
  padding: 50px 46px;
  background: #fff;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
}

.register-form {
  width: min(100%, 1120px);
  min-height: auto;
  padding: 30px;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.24);
}

.registration-head {
  margin-bottom: 2px;
}

.registration-head span {
  font-size: 30px;
}

.registration-head strong {
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.7;
}

.auth-form-head {
  display: grid;
  gap: 2px;
  margin: 0 0 4px;
  text-align: center;
}

.auth-form-head span {
  color: var(--ink);
  font-size: 34px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
  line-height: 1.25;
}

.auth-form-head strong {
  color: var(--muted);
  font-size: 13px;
  font-family: var(--font-ar);
  font-weight: 400;
}

.staff-login-auth .auth-form.panel {
  box-shadow: 0 28px 70px rgba(60, 14, 12, 0.3);
}

.staff-login-auth .auth-form-head span {
  color: var(--maroon);
}

.staff-login-auth .auth-form button {
  background: var(--maroon);
}

.staff-login-auth .auth-form button:hover {
  background: #531814;
}

.auth-back-link {
  display: inline-flex;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-copyright {
  position: fixed;
  right: min(9vw, 150px);
  bottom: 18px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  z-index: 2;
}

.hero,
.panel {
  margin-bottom: 14px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f7fbf8 72%, rgba(238, 246, 251, 0.68) 100%);
  border-right: 5px solid var(--green);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.hero-actions .link-button {
  min-height: 38px;
  padding: 8px 14px;
}

.hero h1,
.panel h1,
.panel h2 {
  margin: 0 0 10px;
  color: var(--green-dark);
  line-height: 1.35;
}

.wide {
  max-width: none;
}

.muted {
  color: var(--muted);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading > * {
  min-width: 0;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 20px;
}

.detail-list > div {
  min-width: 0;
  padding: 12px;
  background: var(--surface-soft, #f7faf8);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-list dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 700;
}

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

.form-grid > label,
.form-grid > .form-actions {
  min-width: 0;
}

.form-grid > label:has(textarea),
.form-grid > .form-actions {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 4px 9px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid var(--green-line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.artifact-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.artifact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.artifact-row > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.artifact-row strong,
.artifact-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.artifact-row > div > span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  .section-heading,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-list,
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .artifact-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 4px;
  padding: 4px 10px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid var(--green-line);
  border-radius: 999px;
  font-family: var(--font-ar-bold);
  font-size: 12px;
  line-height: 1.4;
}

.stack {
  display: grid;
  gap: 14px;
}

.grid {
  display: grid;
  gap: 12px;
}

.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 5px;
  font-weight: 800;
  font-family: var(--font-ar-bold);
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  font: inherit;
  background: #fff;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(9, 105, 54, 0.12);
  background: #fff;
}

.auth-form input,
.auth-form select,
.auth-form textarea {
  min-height: 48px;
  background: #fbfdff;
}

.auth-form .field span {
  display: block;
  width: 100%;
  color: var(--ink);
  font-size: 14px;
  font-family: var(--font-ar-bold);
  direction: rtl;
  text-align: right;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 9px 15px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-family: var(--font-ar-bold);
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

button:hover,
.link-button:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(4, 88, 44, 0.14);
}

.auth-form button,
.auth-form .link-button {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
}

.secondary {
  background: var(--green-soft);
  color: var(--green-dark);
  border: 1px solid var(--green-line);
}

.danger {
  background: var(--red);
}

.success-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  color: var(--green-dark);
  background: #f4fbf7;
  border: 1px solid var(--green-line);
  border-right: 5px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.success-banner-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 36px;
  padding: 4px 10px;
  color: #fff;
  background: var(--green);
  border-radius: 999px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.success-banner strong {
  display: block;
  margin-bottom: 3px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.success-banner p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.confirm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(3px);
}

.confirm-modal-backdrop[hidden] {
  display: none;
}

.confirm-modal {
  width: min(520px, 100%);
  display: grid;
  gap: 12px;
  padding: 24px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--green-line);
  border-right: 6px solid var(--green);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.confirm-modal-kicker {
  width: fit-content;
  padding: 4px 10px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid var(--green-line);
  border-radius: 999px;
  font-family: var(--font-ar-bold);
  font-size: 12px;
}

.confirm-modal h2 {
  margin: 0;
  color: var(--green-dark);
  font-size: 26px;
}

.confirm-modal p {
  margin: 0;
  color: #42526b;
  line-height: 1.9;
}

.confirm-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 8px;
}

.confirm-modal-actions button {
  min-width: 132px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric {
  display: grid;
  gap: 2px;
  min-height: 92px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-right: 5px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

a.metric {
  color: inherit;
  text-decoration: none;
}

.metric.is-link {
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.metric.is-link:hover {
  transform: translateY(-1px);
  border-color: var(--green-line);
  background: #f8fffb;
  box-shadow: 0 12px 24px rgba(4, 88, 44, 0.1);
}

.metric span,
.metric small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  color: var(--green-dark);
  font-size: 22px;
  line-height: 1.2;
}

.finance-action-panel {
  padding-bottom: 18px;
}

.finance-action-list {
  display: grid;
  gap: 10px;
}

.finance-action-row {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) minmax(220px, 1.4fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 66px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-right: 5px solid var(--green);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
}

.finance-action-row:hover {
  border-color: var(--green-line);
  background: #f8fffb;
}

.finance-action-row strong {
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
  font-size: 18px;
}

.finance-action-row small {
  color: var(--muted);
  font-weight: 800;
}

.finance-action-row em {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-style: normal;
  font-family: var(--font-ar-bold);
  font-size: 18px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}

th,
td {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  padding: 10px 11px;
  text-align: right;
  vertical-align: top;
}

tr:last-child td {
  border-bottom: 0;
}

th:last-child,
td:last-child {
  border-left: 0;
}

thead th {
  color: var(--muted);
  background: #f4f7f9;
  font-size: 12px;
  font-weight: 800;
}

tbody tr:nth-child(even) td {
  background: #fbfdff;
}

tbody tr:hover td {
  background: #f7fbf8;
}

.badge,
.status {
  display: inline-block;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid var(--green-line);
  border-radius: 999px;
  padding: 4px 9px;
  font-weight: 800;
  font-family: var(--font-ar-bold);
}

.records-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.record-card {
  display: grid;
  gap: 6px;
  min-height: 88px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-right: 4px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.record-card span {
  color: var(--muted);
  font-size: 13px;
}

.record-card:hover {
  transform: translateY(-2px);
  border-color: var(--green-line);
  box-shadow: var(--shadow-hover);
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.account-grid .wide {
  grid-column: 1 / -1;
}

.account-role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-password-form {
  align-items: end;
}

.account-password-form button {
  min-height: 44px;
}

.account-security-grid {
  grid-template-columns: 1fr;
}

.customer-home-summary,
.client-data-section {
  display: grid;
  gap: 14px;
}

.client-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.client-info-card {
  display: grid;
  gap: 6px;
  min-height: 84px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-right: 4px solid var(--green);
  border-radius: var(--radius);
  transition: border-color 120ms ease, background 120ms ease;
}

.client-info-card:hover {
  border-color: var(--green-line);
  background: #fbfefc;
}

.client-info-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.client-info-card strong {
  color: #17202a;
  font-size: 17px;
  line-height: 1.45;
  word-break: break-word;
}

.unit-cycle-block {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.unit-cycle-block:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.unit-cycle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.unit-cycle-head h3,
.unit-cycle-head p {
  margin: 0;
}

.unit-cycle-head h3 {
  color: var(--green-dark);
  font-size: 21px;
}

.unit-cycle-head p {
  color: var(--muted);
  font-weight: 800;
}

.stage-track {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stage span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: #e2e8f0;
  border-radius: 999px;
  font-weight: 800;
}

.stage strong {
  font-size: 13px;
  line-height: 1.35;
}

.stage.done {
  background: var(--green-soft);
  border-color: var(--green-line);
}

.stage.done span,
.stage.active span {
  color: #fff;
  background: var(--green);
}

.stage.active {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 420px;
}

.inline-form input {
  min-width: 150px;
}

.review-actions-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 620px;
}

.review-actions-form input {
  min-width: 180px;
}

.review-actions-form .link-button,
.review-actions-form button {
  min-height: 38px;
  padding: 8px 12px;
  white-space: nowrap;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.registration-list-table {
  min-width: 920px;
  table-layout: fixed;
}

.registration-list-table th,
.registration-list-table td {
  padding: 15px 12px;
  vertical-align: middle;
  text-align: center;
  line-height: 1.7;
}

.registration-list-table th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 13px;
}

.registration-list-table tbody tr:hover td {
  background: #fbfefc;
}

.registration-list-table th:nth-child(2),
.registration-list-table td:nth-child(2),
.registration-list-table th:nth-child(3),
.registration-list-table td:nth-child(3),
.registration-list-table th:nth-child(8),
.registration-list-table td:nth-child(8) {
  text-align: right;
}

.registration-primary-cell {
  font-weight: 800;
}

.registration-primary-cell strong {
  color: var(--ink);
  font-size: 15px;
}

.notes-cell {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.registration-status-badge {
  display: inline-flex;
  width: auto;
  min-width: 112px;
  max-width: 145px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 8px;
  white-space: normal;
  line-height: 1.45;
  font-size: 14px;
}

.registration-status-badge.is-attention {
  color: #075985;
  background: #f0f9ff;
  border-color: #bae6fd;
}

.registration-status-badge.is-done {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: var(--green-line);
}

.registration-status-badge.is-warning {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fed7aa;
}

.registration-status-badge.is-danger {
  color: var(--red);
  background: #fff1f2;
  border-color: #fecdd3;
}

.registration-actions-cell {
  text-align: center;
}

.customers-list-table {
  min-width: 1180px;
  table-layout: fixed;
  border: 1px solid #d2dce8;
}

.customers-list-table th {
  color: #64748b;
  background: #f3f6f8;
  border-color: #d2dce8;
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
}

.customers-list-table th small {
  color: #64748b;
  font-size: 11px;
}

.customers-list-table td {
  border-color: #d8e1eb;
  text-align: center;
  vertical-align: middle;
  line-height: 1.6;
  padding: 16px 12px;
  background: #fff;
}

.customers-list-table td strong {
  color: var(--ink);
  font-family: var(--font-ar-bold);
  font-size: 16px;
}

.customers-list-table .status {
  display: inline-flex;
  max-width: 100%;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 8px;
  line-height: 1.45;
  white-space: normal;
}

.customers-list-table tbody tr:hover td {
  background: #f8fffb;
}

.customers-list-table th:first-child,
.customers-list-table td:first-child {
  width: 52px;
  text-align: center;
}

.customer-units-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.customer-units-table th,
.customer-units-table td {
  padding: 12px 8px;
  font-size: var(--table-td-font-size);
  line-height: var(--table-cell-line-height);
  overflow-wrap: normal;
  word-break: keep-all;
}

.customer-units-table th:first-child,
.customer-units-table td:first-child {
  width: 78px;
}

.customer-units-table th:nth-child(2),
.customer-units-table td:nth-child(2) {
  width: 110px;
}

.customer-units-table th:nth-child(5),
.customer-units-table td:nth-child(5),
.customer-units-table th:nth-child(6),
.customer-units-table td:nth-child(6) {
  width: 92px;
}

.customer-units-table th:nth-child(9),
.customer-units-table td:nth-child(9),
.customer-units-table th:nth-child(10),
.customer-units-table td:nth-child(10) {
  width: 108px;
}

.customer-units-table .status {
  max-width: 100%;
  padding: 5px 8px;
  font-size: 13px;
}

.customer-units-table .table-action {
  min-width: 0;
  font-size: 13px;
  line-height: 1.45;
}

.customer-directory-panel {
  overflow-x: auto;
}

.customers-list-table {
  width: 100%;
  table-layout: fixed;
  min-width: 1120px;
}

.customers-list-table th,
.customers-list-table td {
  padding: 11px 8px;
  font-size: var(--table-td-font-size);
  line-height: var(--table-cell-line-height);
  overflow-wrap: normal;
  word-break: keep-all;
}

.customers-list-table th {
  word-break: keep-all;
  overflow-wrap: normal;
  white-space: normal;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
}

.pagination-bar .is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.customers-list-table th:nth-child(1),
.customers-list-table td:nth-child(1) {
  width: 42px;
}

.customers-list-table th:nth-child(2),
.customers-list-table td:nth-child(2),
.customers-list-table th:nth-child(3),
.customers-list-table td:nth-child(3),
.customers-list-table th:nth-child(4),
.customers-list-table td:nth-child(4) {
  width: 10.5%;
}

.customers-list-table th:last-child,
.customers-list-table td:last-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 104px;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
}

.customers-list-table th:last-child {
  z-index: 3;
  background: #f8fafc;
}

.customer-index-cell {
  color: var(--muted);
  font-family: var(--font-ar-bold);
}

.customer-main-cell,
.customer-activity-cell,
.customer-last-file,
.customer-action-cell {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.customer-main-cell strong,
.customer-last-file strong,
.customer-action-cell strong {
  color: var(--ink);
  font-family: var(--font-ar-bold);
  font-size: 16px;
}

.customer-main-cell span,
.customer-last-file span,
.customer-action-cell span,
.customer-activity-cell small,
.customer-last-file small {
  color: var(--muted);
  font-size: 13px;
}

.customer-main-cell > span {
  direction: ltr;
  text-align: right;
}

.customer-code-chips,
.customer-alerts,
.customer-source-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.customer-code-chips span,
.customer-source {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  color: var(--green-dark);
  background: #f6fbf8;
  border: 1px solid var(--green-line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.customer-code-chips span.is-muted {
  color: var(--muted);
  background: #f8fafc;
  border-color: var(--line);
}

.customer-count-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  gap: 6px;
}

.customer-count-grid span {
  display: inline-flex;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.customer-count-grid strong {
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
}

.customer-source {
  margin-top: 6px;
}

.customer-source.source-historical {
  color: #075985;
  background: #f0f9ff;
  border-color: #bae6fd;
}

.customer-source.source-mixed {
  color: #6d4c00;
  background: #fff8e1;
  border-color: #f3d27a;
}

.customer-source.source-no_files {
  color: #475569;
  background: #f8fafc;
  border-color: #cbd5e1;
}

.customer-filter-panel .section-headline.compact,
.customer-directory-panel .section-headline.compact {
  margin-bottom: 14px;
}

.customer-filter-bar {
  grid-template-columns: minmax(240px, 1.7fr) repeat(3, minmax(118px, 0.8fr)) minmax(96px, 0.5fr) 48px;
  margin-bottom: 10px;
  min-width: 0;
}

.customer-filter-bar button,
.customer-filter-bar .filter-clear {
  min-width: 0;
  width: 100%;
  white-space: nowrap;
}

.customer-filter-footer {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.small-text {
  margin-top: 6px;
  font-size: 12px;
}

@media (max-width: 1200px) {
  .customer-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customer-filter-bar .search-field,
  .customer-filter-bar button,
  .customer-filter-bar .filter-clear {
    grid-column: auto;
  }

  .customer-filter-footer {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .customer-filter-panel {
    overflow: visible;
  }

  .customer-filter-bar,
  .filter-bar.customer-filter-bar {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .customer-filter-bar .field,
  .customer-filter-bar .search-field,
  .customer-filter-bar button,
  .customer-filter-bar .filter-clear {
    width: 100%;
    min-width: 0;
    grid-column: auto;
  }

  .customer-filter-bar .filter-clear {
    min-height: 46px;
  }

  .customer-directory-panel {
    overflow-x: visible;
  }

  .customers-list-table,
  .customers-list-table thead,
  .customers-list-table tbody,
  .customers-list-table tr,
  .customers-list-table th,
  .customers-list-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .customers-list-table {
    border: 0;
    min-width: 0;
  }

  .customers-list-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .customers-list-table tr {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .customers-list-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 0;
    border: 0;
    text-align: left;
  }

  .customers-list-table td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    color: var(--muted);
    font-family: var(--font-ar-bold);
    text-align: right;
  }

  .customers-list-table td:nth-child(1),
  .customers-list-table td:nth-child(5),
  .customers-list-table td:nth-child(8),
  .customers-list-table td:nth-child(9),
  .customers-list-table td:nth-child(12) {
    display: none;
  }

  .customers-list-table td:last-child {
    display: block;
    position: static;
    width: 100%;
    box-shadow: none;
    background: transparent;
  }

  .customers-list-table td:last-child::before {
    display: none;
  }

  .customers-list-table td:last-child .table-action {
    display: flex;
    justify-content: center;
    width: 100%;
    min-height: 44px;
  }
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) repeat(3, minmax(150px, 0.7fr)) auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-tabs a {
  padding: 8px 13px;
  color: var(--green-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.filter-tabs a.is-active {
  background: var(--green-soft);
  border-color: var(--green-line);
}

.quick-views {
  margin-bottom: 10px;
}

.status.status-alert {
  display: inline-flex;
  margin: 2px;
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.status.status-done {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

.customer-files-preview td {
  padding-top: 0;
  background: #f8fafc;
}

.mini-file-row {
  display: inline-grid;
  grid-template-columns: auto auto auto auto;
  gap: 8px;
  align-items: center;
  margin: 4px 6px;
  padding: 7px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.mini-file-row span {
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
}

.mini-file-row small {
  color: var(--muted);
}

.mini-file-row a {
  color: var(--green);
  font-family: var(--font-ar-bold);
}

.table-action {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: auto;
  min-height: 0;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--green);
  box-shadow: none;
  font-size: 14px;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a.table-action:hover,
button.table-action:hover {
  background: var(--green-soft);
  color: var(--green-dark);
  box-shadow: none;
}

.inline-action-form {
  display: grid;
  margin: 0;
}

.inline-action-form button {
  width: auto;
}

.notes-cell {
  min-width: 170px;
  color: var(--muted);
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: normal;
}

.review-decision-form {
  display: grid;
  gap: 14px;
}

.inspection-report-review-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(244, 250, 246, 0.76), rgba(255, 255, 255, 0));
}

.inspection-report-review-form .decision-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.inspection-report-review-form .decision-actions button {
  min-height: 42px;
}

.inspection-report-review-form .decision-actions button.secondary {
  background: #fff;
}

.review-final-state {
  display: grid;
  gap: 10px;
  border-color: var(--green-line);
  background: #f8fbf9;
}

.review-final-state strong {
  width: fit-content;
  padding: 6px 12px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid var(--green-line);
  border-radius: 999px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.review-final-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.review-final-state .link-button {
  width: fit-content;
}

.rejected-final-state {
  border-color: rgba(177, 31, 22, 0.25);
  background: #fff8f7;
}

.rejected-final-state strong {
  color: var(--maroon);
  background: #fff1ef;
  border-color: rgba(177, 31, 22, 0.28);
}

.review-section-card {
  display: grid;
  gap: 12px;
}

.review-section-card h2 {
  margin: 0;
  padding-bottom: 10px;
  color: var(--green-dark);
  border-bottom: 1px solid var(--line);
}

.review-section-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.review-section-table th,
.review-section-table td {
  min-height: 42px;
  padding: 10px 12px;
  vertical-align: middle;
  border: 1px solid var(--line);
  text-align: right;
}

.review-section-table th {
  width: 22%;
  color: var(--green-dark);
  background: var(--green-soft);
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.review-section-table td {
  color: #17202a;
  background: #fff;
  word-break: keep-all;
  overflow-wrap: normal;
}

.review-declaration {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: #17202a;
  background: #f8fbf9;
  border: 1px solid var(--green-line);
  border-radius: 8px;
  line-height: 1.8;
}

.review-declaration p {
  margin: 0;
}

.compact-form {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.timeline {
  display: grid;
  gap: 12px;
}

.message {
  width: min(760px, 100%);
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.message.from-staff {
  margin-right: auto;
  background: #f8fbff;
  border-right: 4px solid var(--blue);
}

.message.from-customer {
  margin-left: auto;
  border-right: 4px solid var(--green);
}

.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.client-file-section {
  display: grid;
  gap: 16px;
}

.current-action-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  border-right: 6px solid var(--green);
  background: linear-gradient(135deg, #ffffff 0%, #f8fbf9 100%);
}

.current-action-panel h2 {
  margin: 4px 0 6px;
  color: var(--green-dark);
}

.current-action-panel p {
  margin: 0;
  color: #42526b;
  line-height: 1.8;
}

.operational-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 0;
}

.operational-mini-grid div {
  min-width: 0;
  padding: 10px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.operational-mini-grid dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-en);
}

.operational-mini-grid dd {
  margin: 0;
  color: #152238;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.current-action-panel.is-client {
  border-right-color: var(--blue);
  background: #f8fbff;
}

.current-action-panel.is-closed {
  border-right-color: #64748b;
  background: #f8fafc;
}

.current-action-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.current-action-side span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 6px 12px;
  color: var(--green-dark);
  background: #fff;
  border: 1px solid var(--green-line);
  border-radius: 999px;
  font-family: var(--font-ar-bold);
}

.file-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.file-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  color: #17202a;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-ar-bold);
  font-size: 14px;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.file-tabs a.is-active {
  color: var(--green-dark);
  background: #edf8f1;
  border-color: var(--green-line);
  box-shadow: inset 0 -2px 0 var(--green);
}

.client-file-section h3 {
  margin: 4px 0 -4px;
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
  font-size: 20px;
}

.section-headline {
  display: grid;
  gap: 4px;
}

.section-headline h2 {
  margin: 0;
}

.section-headline p {
  margin: 0;
}

.customer-360-snapshot {
  border-right: 6px solid var(--green);
}

.highlight-card {
  background: linear-gradient(135deg, #ffffff 0%, #edf8f1 100%);
  border-color: var(--green-line);
}

.document-vault table {
  margin-top: 2px;
}

.workflow-section {
  overflow: visible;
}

.workflow-track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.journey-step {
  min-height: 88px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  align-content: center;
  gap: 6px;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.journey-step span {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  color: var(--green-dark);
  background: #edf8f1;
  border: 1px solid var(--green-line);
  border-radius: 50%;
  font-family: var(--font-ar-bold);
}

.journey-step strong {
  font-family: var(--font-ar-bold);
  color: #17202a;
  line-height: 1.4;
}

.journey-step.is-done {
  background: #f1f8f4;
  border-color: var(--green-line);
}

.journey-step.is-current {
  background: #fff;
  border-color: var(--green);
  box-shadow: inset 4px 0 0 var(--green), var(--shadow-soft);
}

.sub-panel {
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.record-card em {
  justify-self: start;
  min-width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
  color: #fff;
  background: var(--green);
  border-radius: 999px;
  font-family: var(--font-ar-bold);
  font-style: normal;
}

.client-file-timeline {
  display: grid;
  gap: 10px;
}

.client-file-event {
  display: grid;
  gap: 5px;
  padding: 13px 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-right: 4px solid var(--green);
  border-radius: var(--radius);
}

.client-file-event span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.client-file-event strong {
  color: #17202a;
  font-family: var(--font-ar-bold);
  font-size: 17px;
}

.client-file-event p {
  margin: 0;
  color: var(--muted);
}

.task-due {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}

.operational-details {
  margin-top: 14px;
}

.operational-details summary {
  width: fit-content;
  cursor: pointer;
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
  font-weight: 800;
  padding: 6px 10px;
  border: 1px solid var(--green-line);
  border-radius: 999px;
  background: var(--green-soft);
}

.operational-details .operational-mini-grid {
  margin-top: 10px;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.task-card {
  display: grid;
  gap: 9px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-right: 4px solid #94a3b8;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.task-card.is-open {
  border-right-color: var(--green);
}

.task-card.is-done {
  background: #f8fafc;
  opacity: 0.82;
}

.task-card h3 {
  margin: 0;
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
  font-size: 18px;
}

.task-card p {
  margin: 0;
  color: #42526b;
  line-height: 1.7;
}

.task-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.task-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-card dd {
  margin: 0;
  color: #17202a;
  font-family: var(--font-ar-bold);
}

.task-priority {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.work-center-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.work-center-card {
  display: grid;
  gap: 5px;
  min-height: 112px;
  padding: 14px;
  color: #17202a;
  background: #fff;
  border: 1px solid var(--line);
  border-right: 5px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.work-center-card:hover {
  transform: translateY(-2px);
  border-color: var(--green-line);
  box-shadow: var(--shadow-hover);
}

.work-center-card span,
.work-center-card small {
  color: var(--muted);
  font-weight: 800;
}

.work-center-card strong {
  color: var(--green-dark);
  font-size: 30px;
  line-height: 1;
}

.work-center-card.is-alert {
  border-right-color: #c2410c;
  background: linear-gradient(135deg, #fff 0%, #fff7ed 100%);
}

.work-center-card.is-alert strong {
  color: #9a3412;
}

.message h3 {
  margin: 8px 0;
}

.message p {
  margin: 0;
  white-space: pre-wrap;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 92px;
  padding: 18px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.print-body {
  min-height: 100vh;
  background: #eef5f0;
  direction: ltr;
  overflow: auto;
}

.print-preview-shell {
  width: fit-content;
  min-width: 210mm;
  margin: 0 auto;
  padding: 24px;
}

.print-body .print-toolbar,
.print-body .print-sheet {
  direction: rtl;
}

.print-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 210mm;
  margin: 0 auto 16px;
}

.print-hint {
  color: var(--muted);
  font-size: 13px;
}

.print-sheet {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 5mm;
  overflow: visible;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.12);
}

.original-form {
  position: relative;
  max-width: none;
  color: #111827;
  font-size: 9px;
  line-height: 1.28;
}

.original-head {
  display: grid;
  grid-template-columns: 31mm 1fr 31mm;
  gap: 4mm;
  align-items: end;
  min-height: 20mm;
  padding-bottom: 2mm;
}

.logo-mark {
  text-align: center;
}

.logo-mark img {
  display: block;
  width: 24mm;
  max-height: 18mm;
  margin: 0 auto;
  object-fit: contain;
}

.form-title {
  text-align: center;
}

.form-title h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.18;
}

.form-title p {
  margin: 0;
  color: #1f2937;
  font-weight: 700;
}

.form-title small {
  color: var(--muted);
}

.form-date {
  display: grid;
  gap: 5px;
  text-align: center;
}

.form-date span,
.form-date small {
  display: block;
  min-height: 6mm;
  padding: 1.2mm 1.5mm;
  border: 1px solid var(--paper-border);
}

.original-section {
  margin-top: 1.4mm;
}

.original-section h2 {
  margin: 0;
  padding: 1mm 2mm;
  color: #fff;
  background: var(--green);
  border: 1px solid var(--paper-border);
  border-bottom: 0;
  font-size: 10px;
  text-align: center;
}

.original-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border: 1px solid var(--paper-border);
  background: #fff;
}

.original-table th,
.original-table td {
  min-height: 7.5mm;
  padding: 1mm 1.3mm;
  vertical-align: middle;
  text-align: center;
  border: 1px solid var(--paper-border);
}

.original-table th {
  width: 18%;
  background: #eef7f1;
}

.original-table span,
.original-table small,
.original-table strong {
  display: block;
}

.original-table small {
  color: #4b5563;
  font-size: 7.4px;
}

.original-table strong {
  min-height: 3mm;
  margin-top: 1px;
  font-size: 9px;
  word-break: keep-all;
  overflow-wrap: normal;
}

.signature-row td {
  width: 50%;
  height: 22mm;
}

.inline-signature {
  text-align: center;
}

.inline-signature img,
.inline-signature .blank-sign {
  display: block;
  width: 33mm;
  height: 8.5mm;
  margin: 1mm auto;
  object-fit: contain;
  background: #ffffff;
  border-bottom: 1px solid var(--paper-border);
  filter: saturate(1.18) contrast(1.08);
}

.inline-signature .blank-sign {
  border: 1px dashed #94a3b8;
}

.inline-signature span,
.inline-signature small,
.inline-signature strong {
  display: block;
}

.inline-signature strong {
  margin-top: 0.5mm;
}

.input-form,
.paper-form {
  display: grid;
  gap: 16px;
}

.input-form {
  padding: 0;
  background: transparent;
  border: 0;
}

.paper-form {
  padding: 18px;
  background: #f8fbf9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.paper-form-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 12px 16px;
  color: var(--green-dark);
  background: #fff;
  border: 1px solid var(--green-line);
  border-right: 5px solid var(--green);
  border-radius: 6px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
  font-size: 18px;
}

.form-section {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.025);
}

.form-section legend {
  float: none;
  width: auto;
  margin: 0;
  padding: 0 2px 8px;
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
  font-weight: 800;
  font-size: 17px;
  line-height: 1.5;
}

.category-fields[hidden] {
  display: none;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 11px;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.input-form .field,
.paper-form .field {
  align-content: start;
  gap: 7px;
}

.input-form .field span,
.paper-form .field span {
  min-height: 24px;
  color: #17202a;
  font-size: 14px;
  line-height: 1.45;
}

.input-form input,
.input-form select,
.input-form textarea,
.paper-form input,
.paper-form select,
.paper-form textarea {
  min-height: 46px;
  background: #fff;
}

.input-form textarea,
.paper-form textarea {
  min-height: 92px;
}

.check-field input {
  width: auto;
  min-height: 0;
}

.file-field {
  display: grid;
  gap: 8px;
  min-height: 92px;
  padding: 12px;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.file-field span {
  color: #17202a;
  font-family: var(--font-ar-bold);
  font-weight: 800;
  line-height: 1.45;
}

.edit-file-field small {
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.remove-doc {
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.file-field input[type="file"] {
  min-height: 44px;
  padding: 9px;
  background: #fff;
  border: 1px dashed var(--green-line);
}

.documents-grid {
  align-items: stretch;
}

.documents-table {
  width: 100%;
  border-collapse: collapse;
}

.documents-table th,
.documents-table td {
  padding: 10px;
  border: 1px solid var(--line);
  text-align: right;
}

.documents-table th {
  width: 34%;
  color: var(--green-dark);
  background: var(--green-soft);
}

.doc-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.doc-status.attached {
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid var(--green-line);
}

.doc-status.missing {
  color: var(--maroon);
  background: #fbf1ef;
  border: 1px solid rgba(108, 33, 28, 0.22);
}

.doc-download {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-inline-start: 8px;
  padding: 3px 10px;
  color: #fff;
  background: var(--green);
  border-radius: 6px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.original-section .documents-table th,
.original-section .documents-table td {
  padding: 1.3mm;
  border-color: var(--paper-border);
}

.declaration {
  align-items: flex-start;
  line-height: 1.8;
}

.signature-box {
  width: 100%;
  min-height: 180px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(0deg, transparent 0 38px, rgba(9, 105, 54, 0.08) 39px 40px);
  border: 1px solid var(--line);
  border-radius: 6px;
}

#signature-pad {
  display: block;
  width: 100%;
  height: 180px;
  cursor: crosshair;
  touch-action: none;
}

.signature-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.official-registration-form {
  display: grid;
  gap: 18px;
}

.registration-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.registration-flow button {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  line-height: 1.35;
}

.registration-flow .is-current {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: var(--green-line);
}

.registration-flow button:hover {
  color: var(--green-dark);
  border-color: var(--green-line);
}

.registration-review-step {
  display: grid;
  gap: 14px;
}

.registration-step {
  scroll-margin-top: 86px;
}

.registration-step.is-current-step {
  border-color: var(--green-line);
  box-shadow: inset -4px 0 0 var(--green);
}

.category-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.category-card {
  display: grid;
  gap: 7px;
  min-height: 126px;
  padding: 14px;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.category-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.category-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.category-card strong {
  color: #111827;
  font-family: var(--font-ar-bold);
  font-size: 17px;
  line-height: 1.4;
}

.category-card small {
  color: var(--muted);
  line-height: 1.45;
}

.category-card.is-active {
  border-color: var(--green);
  box-shadow: inset 4px 0 0 var(--green), 0 10px 24px rgba(9, 105, 54, 0.08);
}

.official-input-form {
  gap: 18px;
}

.official-form-definition {
  display: grid;
  gap: 14px;
}

.official-form-definition[hidden] {
  display: none;
}

.official-form-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--green-line);
  border-right: 5px solid var(--green);
  border-radius: 8px;
}

.official-form-banner h2 {
  margin: 4px 0 2px;
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
  font-size: 24px;
  line-height: 1.25;
}

.official-form-banner p,
.official-form-banner span {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.official-form-banner img {
  width: 82px;
  max-height: 70px;
  object-fit: contain;
}

.official-intro {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  color: #17202a;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.8;
}

.official-intro p {
  margin: 0;
}

.official-section {
  box-shadow: none;
}

.official-grid .form-field-wide,
.official-grid .official-check {
  grid-column: span 2;
}

.official-check {
  justify-content: flex-start;
}

.official-request-text {
  padding: 2mm 3mm;
  border: 1px solid var(--paper-border);
}

.official-request-text p {
  margin: 1mm 0;
  line-height: 1.7;
  text-align: justify;
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  html,
  body.print-body {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    background: #fff;
  }

  .print-preview-shell {
    width: 210mm;
    min-width: 0;
    padding: 0;
  }

  .print-toolbar {
    display: none;
  }

  .print-sheet {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    border: 0;
    box-shadow: none;
    border-radius: 0;
  }

  .auth-body {
    background: #fff;
  }

  .auth-identity,
  .auth-copyright,
  .signature-actions,
  .auth-form button {
    display: none;
  }

  .register-auth,
  .auth-shell {
    display: block;
    width: 100%;
  }

  .auth-form.panel {
    width: 100%;
    box-shadow: none;
    border: 0;
    padding: 0;
  }
}

@media (max-width: 900px) {
  .workflow-track {
    grid-template-columns: 1fr;
  }

  .current-action-panel {
    grid-template-columns: 1fr;
  }

  .current-action-side {
    justify-items: stretch;
  }

  .hero {
    display: grid;
  }

  .hero-actions {
    justify-content: stretch;
  }

  .hero-actions .status,
  .hero-actions .link-button {
    flex: 1 1 120px;
    justify-content: center;
  }

  .auth-body {
    overflow-y: auto;
  }

  .auth-shell {
    width: min(100% - 28px, 720px);
    min-height: auto;
    padding: 24px 0;
  }

  .auth,
  .register-auth {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .registration-page {
    width: min(100% - 24px, 720px);
    padding: 18px 0 32px;
  }

  .public-shell {
    width: min(100% - 24px, 720px);
  }

  .registration-title {
    display: grid;
  }

  .register-form {
    padding: 22px 16px;
  }

  .customer-registration-form {
    padding: 16px;
  }

  .registration-flow,
  .category-picker {
    grid-template-columns: 1fr;
  }

  .official-form-banner {
    display: grid;
    justify-items: center;
    text-align: center;
  }

  .official-grid .form-field-wide,
  .official-grid .official-check {
    grid-column: auto;
  }

  .input-form,
  .paper-form {
    padding: 12px;
  }

  .paper-form-head {
    display: grid;
    justify-items: center;
    text-align: center;
  }

  .choice-auth,
  .login-auth {
    grid-template-columns: 1fr;
  }

  .login-choice-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .login-choice-card {
    min-height: 260px;
    padding: 24px;
  }

  .login-choice-card strong {
    font-size: 25px;
  }

  .auth-identity {
    min-height: auto;
    gap: 12px;
  }

  .auth-logo {
    width: 72px;
    height: 72px;
  }

  .auth h1 {
    font-size: 28px;
  }

  .auth p {
    font-size: 16px;
  }

  .auth-form.panel,
  .auth-card {
    width: 100%;
    min-height: auto;
    padding: 28px 22px;
    border-radius: 14px;
  }

  .auth-form-head span {
    font-size: 26px;
  }

  .auth-copyright {
    position: static;
    margin-top: 8px;
  }

  .layout {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .sidebar {
    order: 2;
    position: static;
    height: auto;
    width: min(100% - 24px, 1280px);
    margin: 12px auto 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .sidebar-title {
    display: none;
  }

  .sidebar nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    overflow: visible;
    margin-top: 0;
  }

  .nav-group {
    min-width: 0;
    border: 0;
  }

  .portal-shell {
    order: 1;
    width: min(100% - 24px, 1280px);
  }

  .metrics,
  .three,
  .account-grid,
  .client-info-grid,
  .operational-mini-grid,
  .records-grid,
  .stage-track {
    grid-template-columns: 1fr;
  }

  .unit-cycle-head {
    align-items: stretch;
    flex-direction: column;
  }

  .finance-action-row {
    grid-template-columns: 1fr;
    justify-items: start;
  }

}

:focus-visible {
  outline: 3px solid #255b85;
  outline-offset: 3px;
}

.current-action-panel h2,
.client-file-hero h1,
.inspector-field-card h3 {
  overflow-wrap: anywhere;
}

.inspector-field-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--green-line);
  border-right: 5px solid var(--green);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, var(--green-soft));
}

.inspector-field-card h3,
.inspector-field-card p {
  margin: 0;
}

.inspector-field-card p {
  color: var(--muted);
  line-height: 1.8;
}

.inspector-field-meta {
  display: grid;
  gap: 4px;
  min-width: 150px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.inspector-field-meta span {
  color: var(--muted);
  font-size: 13px;
}

.inspector-field-meta strong {
  color: var(--green-dark);
}

.table-scroll-hint {
  display: none;
}

@media (max-width: 720px) {
  .topbar {
    gap: 10px;
    padding-inline: 12px;
  }

  .brand span,
  .user-chip strong {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .actions,
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .actions > *,
  .hero-actions > * {
    width: 100%;
  }

  .link-button,
  button {
    min-height: 44px;
  }

  .inspector-field-card {
    grid-template-columns: 1fr;
  }

  .inspector-field-meta {
    width: 100%;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .client-file-section table,
  .work-center-grid + .panel table {
    white-space: normal;
  }

  .client-file-section table thead,
  .work-center-grid + .panel table thead {
    display: none;
  }

  .client-file-section table tbody,
  .client-file-section table tr,
  .client-file-section table td,
  .work-center-grid + .panel table tbody,
  .work-center-grid + .panel table tr,
  .work-center-grid + .panel table td {
    display: block;
    width: 100%;
  }

  .client-file-section table tr,
  .work-center-grid + .panel table tr {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
  }

  .client-file-section table td,
  .work-center-grid + .panel table td {
    border: 0;
    padding: 8px 0;
    white-space: normal;
  }

  .current-action-side {
    width: 100%;
  }
}

/* Platform Operations Console */
.ops-command-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
  padding: 26px;
  border: 1px solid var(--line);
  border-right: 7px solid var(--green);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(8, 92, 53, 0.08), rgba(255, 255, 255, 0) 48%),
    #fff;
  box-shadow: var(--shadow-soft);
}

.ops-command-hero.warn {
  border-right-color: #d97706;
  background:
    linear-gradient(135deg, rgba(217, 119, 6, 0.1), rgba(255, 255, 255, 0) 48%),
    #fff;
}

.ops-command-hero.danger {
  border-right-color: var(--red);
  background:
    linear-gradient(135deg, rgba(190, 18, 60, 0.1), rgba(255, 255, 255, 0) 48%),
    #fff;
}

.ops-command-copy {
  display: grid;
  align-content: center;
  gap: 10px;
}

.ops-command-copy h1 {
  margin: 0;
  color: var(--green-dark);
  font-size: 38px;
  line-height: 1.35;
}

.ops-command-copy p {
  max-width: 920px;
  margin: 0;
  color: var(--muted);
  line-height: 1.9;
}

.ops-anchor-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ops-anchor-row a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--green-line);
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 800;
  text-decoration: none;
}

.ops-decision-card {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
}

.ops-decision-card span,
.ops-decision-card small {
  color: var(--muted);
}

.ops-decision-card strong {
  color: var(--red);
  font-size: 30px;
  line-height: 1.35;
}

.ops-command-hero.warn .ops-decision-card strong {
  color: #9a3412;
}

.ops-command-hero.ok .ops-decision-card strong {
  color: var(--green-dark);
}

.ops-grid.command {
  grid-template-columns: 1fr;
}

.ops-action-center {
  border-right: 5px solid var(--red);
}

.ops-risk-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ops-risk-card {
  display: grid;
  gap: 8px;
  min-height: 178px;
  padding: 16px;
  border: 1px solid var(--line);
  border-right: 5px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.ops-risk-card.critical {
  border-right-color: var(--red);
  background: #fff7f8;
}

.ops-risk-card.high {
  border-right-color: #d97706;
  background: #fffbeb;
}

.ops-risk-card.medium {
  border-right-color: #2563eb;
  background: #eff6ff;
}

.ops-risk-card.success {
  border-right-color: var(--green);
  background: var(--green-soft);
}

.ops-risk-card span {
  width: fit-content;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  background: #64748b;
  font-weight: 900;
  font-size: 12px;
}

.ops-risk-card.critical span {
  background: var(--red);
}

.ops-risk-card.high span {
  background: #d97706;
}

.ops-risk-card.medium span {
  background: #2563eb;
}

.ops-risk-card.success span {
  background: var(--green);
}

.ops-risk-card h3,
.ops-risk-card p,
.ops-risk-card strong,
.ops-risk-card small {
  margin: 0;
}

.ops-risk-card h3 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.6;
}

.ops-risk-card p,
.ops-risk-card small {
  color: var(--muted);
  line-height: 1.8;
}

.ops-risk-card strong {
  color: var(--ink);
  line-height: 1.8;
}

.ops-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--green-line);
  border-right: 6px solid var(--green);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.ops-hero h1 {
  margin: 6px 0 8px;
  color: var(--green-dark);
  font-size: 34px;
}

.ops-hero p {
  max-width: 860px;
  margin: 0;
  color: var(--muted);
  line-height: 1.9;
}

.ops-readiness {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--green-soft);
}

.ops-readiness.warn {
  background: #fff7ed;
  border-color: #fed7aa;
}

.ops-readiness span,
.ops-readiness small,
.ops-kpi span,
.ops-kpi small {
  color: var(--muted);
}

.ops-readiness strong {
  color: var(--green-dark);
  font-size: 30px;
}

.ops-readiness.warn strong {
  color: #9a3412;
}

.ops-status-strip,
.ops-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.ops-status-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ops-status-ar > div {
  min-height: 96px;
}

.ops-status-strip > div,
.ops-kpi,
.ops-node {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.ops-status-strip > div {
  display: grid;
  gap: 8px;
}

.ops-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ops-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ops-panel {
  margin: 0;
}

.ops-panel.critical {
  border-right: 5px solid var(--red);
}

.ops-kpi {
  display: grid;
  gap: 4px;
}

.ops-kpi strong {
  color: var(--green-dark);
  font-size: 24px;
}

.ops-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
}

.ops-badge.success {
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid var(--green-line);
}

.ops-badge.danger {
  color: var(--red);
  background: #fff1f2;
  border: 1px solid #fecdd3;
}

.ops-map {
  display: grid;
  gap: 10px;
}

.ops-node {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  box-shadow: none;
}

.ops-node.ok {
  border-right: 4px solid var(--green);
}

.ops-node.bad {
  border-right: 4px solid var(--red);
  background: #fffafa;
}

.ops-node span {
  color: var(--muted);
}

.ops-node strong,
.mono-cell {
  overflow-wrap: anywhere;
}

.ops-log {
  max-height: 260px;
  overflow: auto;
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
  font-family: Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f172a;
  color: #e2e8f0;
}

.ops-runbook {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.ops-runbook li {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.ops-runbook span {
  color: var(--muted);
  line-height: 1.7;
}

.admin-control-hero {
  background: linear-gradient(135deg, #ffffff 0%, #f1f8f4 100%);
  border: 1px solid var(--line);
  border-right: 6px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: center;
  margin-bottom: 18px;
}

.admin-control-hero h1 {
  margin: 8px 0 10px;
  color: var(--green-dark);
  font-size: clamp(30px, 3vw, 44px);
}

.admin-control-hero p {
  color: var(--muted);
  max-width: 820px;
  line-height: 1.9;
  margin: 0;
}

.admin-control-decision {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  display: grid;
  gap: 8px;
  box-shadow: 0 10px 26px rgba(7, 54, 34, .08);
}

.admin-control-decision span,
.admin-control-decision small {
  color: var(--muted);
  font-weight: 800;
}

.admin-control-decision strong {
  color: #8a2f00;
  font-size: 26px;
  line-height: 1.4;
}

.admin-control-hero.ok .admin-control-decision strong {
  color: var(--green);
}

.admin-control-hero.warn .admin-control-decision strong {
  color: #8a4b00;
}

.admin-control-nav {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.admin-control-nav a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  background: #fff;
  text-align: center;
  min-height: 52px;
  display: grid;
  place-items: center;
}

.admin-control-nav a.is-active {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: var(--green-line);
  box-shadow: inset -4px 0 0 var(--green);
}

.admin-control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.admin-control-card {
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 20px;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(7, 54, 34, .07);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.admin-control-card::before {
  content: "";
  position: absolute;
  inset-inline-end: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--green);
}

.admin-control-card.warn::before {
  background: #c95a10;
}

.admin-control-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(7, 54, 34, .12);
}

.admin-control-card span {
  width: fit-content;
  border: 1px solid var(--green-line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 13px;
  font-weight: 900;
}

.admin-control-card.warn span {
  color: #8a2f00;
  border-color: #f1be8f;
  background: #fff7ed;
}

.admin-control-card strong {
  color: var(--green-dark);
  font-size: 22px;
}

.admin-control-card p {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

.admin-control-card em {
  margin-top: auto;
  color: var(--green);
  font-style: normal;
  font-weight: 900;
}


.platform-console {
  display: grid;
  direction: ltr;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.platform-console-sidebar,
.platform-console-main {
  direction: rtl;
}

.platform-console-sidebar {
  position: sticky;
  top: 92px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 16px;
  display: grid;
  gap: 14px;
}

.platform-console-brand {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  display: grid;
  gap: 6px;
}

.platform-console-brand span,
.platform-console-brand small,
.platform-environment-card span,
.platform-environment-card small {
  color: var(--muted);
  font-weight: 800;
}

.platform-console-brand strong {
  color: var(--green-dark);
  font-size: 24px;
}

.platform-nav-search {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

.platform-nav-search input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  min-width: 0;
}

.platform-nav-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.platform-nav-group summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--muted);
  font-weight: 900;
  background: #f8fafc;
}

.platform-nav-group summary::-webkit-details-marker {
  display: none;
}

.platform-nav-group div {
  display: grid;
  gap: 4px;
  padding: 8px;
}

.platform-nav-group a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.platform-nav-group a:hover,
.platform-nav-group a.is-active {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: var(--green-line);
  box-shadow: inset -4px 0 0 var(--green);
}

.platform-console-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.platform-console-topbar,
.platform-command-hero {
  background: linear-gradient(135deg, #ffffff 0%, #f1f8f4 100%);
  border: 1px solid var(--line);
  border-right: 6px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: center;
}

.platform-console-topbar h1,
.platform-command-hero h2 {
  margin: 8px 0 8px;
  color: var(--green-dark);
  font-size: clamp(28px, 3vw, 42px);
}

.platform-console-topbar p,
.platform-command-hero p {
  color: var(--muted);
  margin: 0;
  line-height: 1.8;
}

.platform-environment-card,
.platform-decision-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 10px 26px rgba(7, 54, 34, .08);
  display: grid;
  gap: 8px;
}

.platform-environment-card strong,
.platform-decision-card strong {
  color: var(--green-dark);
  font-size: 22px;
  line-height: 1.4;
}

.platform-command-hero.warn .platform-decision-card strong,
.platform-environment-card.warn strong {
  color: #8a4b00;
}

.platform-command-hero.danger .platform-decision-card strong,
.platform-environment-card.danger strong {
  color: #8a1f11;
}

.platform-status-wall {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.platform-status-card {
  background: #fff;
  border: 1px solid var(--line);
  border-right: 5px solid var(--green);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 8px 22px rgba(7, 54, 34, .06);
  display: grid;
  gap: 8px;
  min-height: 126px;
}

.platform-status-card.warn {
  border-right-color: #c95a10;
}

.platform-status-card.danger {
  border-right-color: #b42318;
}

.platform-status-card span,
.platform-status-card small {
  color: var(--muted);
  font-weight: 800;
}

.platform-status-card strong {
  color: var(--green-dark);
  font-size: 24px;
}

.platform-action-grid,
.platform-release-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.platform-action-tile {
  min-height: 176px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 18px;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 8px 22px rgba(7, 54, 34, .06);
}

.platform-action-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(7, 54, 34, .12);
}

.platform-action-tile span,
.platform-release-card span {
  width: fit-content;
  border: 1px solid var(--green-line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 13px;
  font-weight: 900;
}

.platform-action-tile.warn span,
.platform-release-card.warn span {
  color: #8a4b00;
  border-color: #f1be8f;
  background: #fff7ed;
}

.platform-action-tile strong,
.platform-release-card strong {
  color: var(--green-dark);
  font-size: 22px;
}

.platform-action-tile p,
.platform-release-card small {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

.platform-action-tile em {
  margin-top: auto;
  color: var(--green);
  font-style: normal;
  font-weight: 900;
}

.platform-home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.platform-panel {
  min-width: 0;
}

.platform-risk-list {
  display: grid;
  gap: 10px;
}

.platform-risk-item {
  border: 1px solid var(--line);
  border-right: 5px solid #c95a10;
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  background: #fff;
}

.platform-risk-item.critical {
  border-right-color: #b42318;
}

.platform-risk-item.success {
  border-right-color: var(--green);
}

.platform-risk-item > span {
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 900;
  color: #8a4b00;
  background: #fff7ed;
  border: 1px solid #f1be8f;
}

.platform-risk-item.critical > span {
  color: #8a1f11;
  background: #fff1f1;
  border-color: #fecaca;
}

.platform-risk-item.success > span {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: var(--green-line);
}

.platform-risk-item strong {
  color: var(--ink);
  display: block;
  margin-bottom: 4px;
}

.platform-risk-item p,
.platform-risk-item small,
.platform-risk-item em {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  font-style: normal;
}

.platform-release-card {
  border: 1px solid var(--line);
  border-right: 5px solid var(--green);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.platform-release-card.warn {
  border-right-color: #c95a10;
}

.platform-release-card.danger {
  border-right-color: #b42318;
}

.platform-table {
  width: 100%;
}

.muted-card {
  background: #f8fafc;
  color: var(--muted);
}

.muted-card::before {
  background: #94a3b8;
}

.muted-card strong {
  color: #334155;
}

.muted-card em {
  color: #64748b;
}

.admin-workspace-shell,
.admin-workspace-hero {
  background: linear-gradient(135deg, #ffffff 0%, #f3faf6 100%);
  border: 1px solid var(--line);
  border-right: 6px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: center;
  gap: 22px;
  padding: 28px;
  margin-bottom: 18px;
}

.admin-workspace-shell h1,
.admin-workspace-hero h1 {
  color: var(--green-dark);
  margin: 8px 0 10px;
  font-size: clamp(30px, 3vw, 44px);
}

.admin-workspace-shell p,
.admin-workspace-hero p {
  color: var(--muted);
  line-height: 1.9;
  margin: 0;
  max-width: 880px;
}

.admin-workspace-summary,
.admin-workspace-command {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 26px rgba(7, 54, 34, .08);
  padding: 18px;
  display: grid;
  gap: 6px;
}

.admin-workspace-summary span,
.admin-workspace-summary small,
.admin-workspace-command span,
.admin-workspace-command small {
  color: var(--muted);
  font-weight: 800;
}

.admin-workspace-summary strong,
.admin-workspace-command strong {
  color: var(--green-dark);
  font-size: 22px;
}

.admin-workspace-command.warn strong {
  color: #8a4b00;
}

.admin-workspace-command.ok strong {
  color: var(--green);
}

.admin-workspace-tab-panel {
  padding: 14px;
}

.admin-workspace-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.admin-workspace-tabs a {
  border-radius: 8px;
  min-height: 52px;
  text-align: center;
  display: grid;
  place-items: center;
}

.admin-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
  gap: 16px;
}

.admin-dashboard-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: center;
}

.admin-command-panel {
  min-height: 100%;
}

.admin-attention-list,
.admin-risk-grid,
.admin-management-actions {
  display: grid;
  gap: 12px;
}

.admin-attention-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-right: 5px solid #c95a10;
  border-radius: var(--radius);
  background: #fffaf5;
  padding: 14px;
}

.admin-attention-item.calm {
  border-right-color: var(--green);
  background: #f6fbf8;
}

.admin-attention-item strong {
  color: var(--ink);
  display: block;
  margin-bottom: 4px;
}

.admin-attention-item span {
  color: var(--muted);
  line-height: 1.7;
}

.admin-risk-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-risk-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f6fbf8;
  padding: 16px;
  display: grid;
  gap: 6px;
}

.admin-risk-item.warn {
  background: #fff7ed;
  border-color: #f1be8f;
}

.admin-risk-item span,
.admin-risk-item small {
  color: var(--muted);
  font-weight: 800;
}

.admin-risk-item strong {
  color: var(--green-dark);
  font-size: 30px;
}

.admin-risk-item.warn strong {
  color: #9a3412;
}

.admin-management-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.business-admin-control {
  display: grid;
  direction: rtl;
  grid-template-columns: minmax(0, 1fr) 282px;
  gap: 18px;
  align-items: start;
}

.business-control-sidebar {
  direction: rtl;
  grid-column: 2;
  position: sticky;
  top: 76px;
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 96px);
  padding: 14px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-right: 4px solid var(--green);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.business-control-brand {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.business-control-brand span,
.business-control-brand small,
.business-nav-search span,
.business-command-status span,
.business-command-status small,
.business-control-clock span,
.business-control-clock small,
.business-action-tile span,
.business-action-tile p,
.business-action-tile em {
  color: var(--muted);
  font-size: 12px;
}

.business-control-brand strong {
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
  font-size: 20px;
  line-height: 1.3;
}

.business-nav-search {
  display: grid;
  gap: 6px;
}

.business-nav-search input {
  min-height: 40px;
  border-radius: 8px;
}

.business-admin-nav-group {
  border-bottom: 1px solid #edf2f7;
  padding-bottom: 8px;
}

.business-admin-nav-group summary {
  cursor: pointer;
  list-style: none;
  min-height: 36px;
  padding: 7px 9px;
  color: var(--muted);
  border-radius: 8px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.business-admin-nav-group summary::-webkit-details-marker {
  display: none;
}

.business-admin-nav-group div {
  display: grid;
  gap: 6px;
  padding: 4px 8px 0 0;
}

.business-admin-nav-group a {
  display: block;
  padding: 9px 10px;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
  line-height: 1.35;
}

.business-admin-nav-group a:hover,
.business-admin-nav-group a.is-active {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: var(--green-line);
  box-shadow: inset -3px 0 0 var(--green);
}

.business-control-main {
  direction: rtl;
  grid-column: 1;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.business-control-topbar,
.business-command-hero,
.business-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.34fr);
  gap: 18px;
  align-items: center;
  padding: 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f7fbf8 74%, rgba(236, 248, 241, 0.82) 100%);
  border: 1px solid var(--green-line);
  border-right: 5px solid var(--green);
  border-radius: var(--radius);
  box-shadow: 0 14px 32px rgba(4, 88, 44, 0.075);
}

.business-command-hero {
  padding: 20px;
}

.business-control-topbar h1,
.business-command-hero h2,
.business-section-head h2 {
  margin: 4px 0;
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.25;
}

.business-control-topbar p,
.business-command-hero p,
.business-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.business-control-clock,
.business-command-status {
  display: grid;
  gap: 5px;
  min-height: 110px;
  align-content: center;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.business-command-status.warn {
  border-right: 4px solid #d97706;
}

.business-command-status.ok {
  border-right: 4px solid var(--green);
}

.business-control-clock strong,
.business-command-status strong {
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
  font-size: 22px;
}

.business-decision-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.business-decision-item {
  display: grid;
  gap: 5px;
  min-height: 104px;
  padding: 14px 16px;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-right: 4px solid var(--green);
  border-radius: var(--radius);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.045);
}

.business-decision-item.warn {
  border-right-color: #d97706;
  background: #fffaf3;
}

.business-decision-item:hover {
  border-color: var(--green-line);
  box-shadow: 0 12px 24px rgba(4, 88, 44, 0.09);
}

.business-decision-item span,
.business-decision-item small {
  color: var(--muted);
  font-size: 12px;
}

.business-decision-item strong {
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
  font-size: 26px;
  line-height: 1.1;
}

.business-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.business-action-tile {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 170px;
  padding: 14px;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-right: 4px solid var(--green);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.business-action-tile.warn {
  border-right-color: #d97706;
  background: #fffaf3;
}

.business-action-tile:hover {
  border-color: var(--green-line);
  box-shadow: 0 14px 28px rgba(4, 88, 44, 0.1);
}

.business-action-tile strong {
  color: var(--ink);
  font-family: var(--font-ar-bold);
  font-size: 18px;
}

.business-command-bar .business-action-tile {
  min-height: 142px;
}

.business-action-tile select,
.business-action-tile button {
  width: 100%;
}

.business-action-tile em {
  display: inline-grid;
  place-items: center;
  width: fit-content;
  min-height: 34px;
  margin-top: auto;
  padding: 6px 12px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid var(--green-line);
  border-radius: 8px;
  font-family: var(--font-ar-bold);
  font-style: normal;
  font-weight: 800;
}

.business-dashboard-grid,
.business-users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.72fr);
  gap: 16px;
  align-items: start;
}

.business-command-panel {
  min-height: 100%;
}

.business-user-jump {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}

.business-user-jump select {
  min-width: 220px;
}

.business-account-toolbar {
  display: grid;
  grid-template-columns: minmax(250px, 0.42fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
}

.business-account-toolbar > div {
  display: grid;
  gap: 4px;
}

.business-account-toolbar > div strong {
  color: var(--ink);
  font-family: var(--font-ar-bold);
}

.business-account-toolbar .business-user-jump {
  width: 100%;
}

.business-account-toolbar .business-user-jump select {
  flex: 1;
  min-width: 0;
}

.business-directory-panel,
.business-user-control-panel {
  min-width: 0;
}

.business-user-control-panel {
  display: grid;
  gap: 14px;
}

@media (max-width: 980px) {
  .ops-command-hero,
  .ops-risk-grid,
  .ops-hero,
  .admin-control-hero,
  .admin-control-grid,
  .admin-control-nav,
  .admin-workspace-shell,
  .admin-workspace-hero,
  .admin-workspace-tabs,
  .admin-workspace-grid,
  .admin-management-actions,
  .admin-dashboard-intro,
  .platform-console,
  .platform-console-topbar,
  .platform-command-hero,
  .platform-status-wall,
  .platform-action-grid,
  .platform-home-grid,
  .platform-release-grid,
  .business-admin-control,
  .business-dashboard-grid,
  .business-decision-strip,
  .business-users-layout,
  .business-control-topbar,
  .business-command-hero,
  .business-section-head,
  .ops-grid.two,
  .ops-grid.four,
  .ops-status-strip {
    grid-template-columns: 1fr;
  }

  .business-control-sidebar {
    grid-column: 1;
    position: static;
    max-height: none;
    order: 2;
  }

  .business-control-main {
    grid-column: 1;
    order: 1;
  }

  .business-user-jump {
    display: grid;
    grid-template-columns: 1fr;
  }

  .business-user-jump select {
    min-width: 0;
    width: 100%;
  }

  .business-account-toolbar {
    grid-template-columns: 1fr;
  }

  .admin-attention-item,
  .admin-risk-grid {
    grid-template-columns: 1fr;
  }

  .ops-node {
    grid-template-columns: 1fr;
  }
}


.filter-clear {
  min-width: 42px;
  width: 42px;
  padding-inline: 0;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
}

.filter-clear:hover {
  color: var(--red);
  border-color: #fecdd3;
  background: #fff1f2;
}


.chat-hero {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  padding: 20px 22px;
  border: 1px solid var(--green-line);
  border-right: 6px solid var(--green);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff 0%, #f4fbf7 100%);
  box-shadow: var(--shadow-soft);
}

.chat-hero h1 {
  margin: 4px 0 6px;
  color: var(--green-dark);
  font-size: 30px;
}

.chat-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  min-height: 650px;
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-height: 760px;
  overflow: auto;
}

.chat-sidebar-head {
  display: grid;
  gap: 3px;
  padding: 6px 2px;
}

.chat-sidebar-head strong {
  color: var(--green-dark);
  font-size: 17px;
}

.chat-sidebar-head span {
  color: var(--muted);
  font-size: 13px;
}

.chat-thread-card,
.chat-start-card {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.chat-thread-card:hover,
.chat-start-card:hover,
.chat-thread-card.is-active {
  border-color: var(--green-line);
  background: var(--green-soft);
  transform: translateY(-1px);
}

.chat-thread-card div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.chat-thread-card strong,
.chat-start-card strong {
  color: var(--green-dark);
  font-size: 16px;
}

.chat-thread-card span,
.chat-start-card span,
.chat-thread-card small,
.chat-start-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.chat-thread-card p {
  margin: 0;
  font-weight: 800;
}

.chat-thread-card em {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: inline-flex;
  min-width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-style: normal;
  font-weight: 900;
  font-size: 12px;
}

.chat-window {
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto;
  gap: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.chat-window-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.chat-window-head span {
  color: var(--green);
  font-weight: 900;
  font-size: 13px;
}

.chat-window-head h2 {
  margin: 3px 0;
  color: var(--green-dark);
  font-size: 24px;
}

.chat-window-head p {
  margin: 0;
  color: var(--muted);
}

.chat-message-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  overflow: auto;
  background: #f8fafc;
}

.chat-bubble {
  display: grid;
  gap: 6px;
  width: min(74%, 660px);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.chat-bubble.is-me {
  align-self: flex-end;
  border-color: var(--green-line);
  background: #eefbf4;
}

.chat-bubble.is-other {
  align-self: flex-start;
}

.chat-bubble-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.chat-bubble-meta strong {
  color: var(--ink);
}

.chat-bubble p {
  margin: 0;
  line-height: 1.9;
  white-space: pre-wrap;
}

.chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-attachment {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  color: var(--green-dark);
  text-decoration: none;
  border: 1px solid var(--green-line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
}

.chat-composer {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.chat-composer textarea {
  min-height: 72px;
  resize: vertical;
}

.chat-composer-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.chat-file-control {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--green-line);
  border-radius: 8px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 900;
  cursor: pointer;
}

.chat-file-control input {
  display: none;
}

.chat-composer small,
.chat-composer.is-disabled span {
  color: var(--muted);
}

.chat-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 260px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.chat-empty strong {
  color: var(--green-dark);
  font-size: 22px;
}

.chat-entry-panel {
  display: grid;
  gap: 14px;
}

.chat-audit-timeline {
  display: grid;
  gap: 10px;
}

.chat-audit-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-right: 4px solid var(--green);
  border-radius: 8px;
  background: #fff;
}

.chat-audit-item span,
.chat-audit-item small {
  color: var(--muted);
}

.chat-audit-item strong {
  color: var(--green-dark);
}

.chat-audit-item p {
  margin: 0;
  line-height: 1.8;
}

@media (max-width: 980px) {
  .chat-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .chat-sidebar {
    max-height: none;
  }

  .chat-window {
    min-height: 620px;
  }

  .chat-bubble {
    width: 92%;
  }

  .chat-window-head,
  .chat-composer-tools {
    align-items: stretch;
    flex-direction: column;
  }
}


/* Responsive guardrails for admin/management portal pages */
.portal-body,
.portal-body .layout,
.portal-body .portal-shell,
.portal-body .sidebar,
.portal-body .hero,
.portal-body .panel {
  min-width: 0;
}

@media (max-width: 720px) {
  html,
  body.portal-body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .portal-body .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    padding-inline: 8px;
    min-width: 0;
  }

  .portal-body .layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .portal-body .portal-shell {
    order: 1;
  }

  .portal-body .sidebar {
    order: 2;
  }

  .portal-body .brand,
  .portal-body .user-chip,
  .portal-body .account-chip {
    min-width: 0;
  }

  .portal-body .brand {
    flex: 0 0 auto;
  }

  .portal-body .brand span {
    display: none;
  }

  .portal-body .user-chip {
    flex: 1 1 auto;
    gap: 4px;
    justify-content: center;
    overflow: hidden;
  }

  .portal-body .account-chip {
    gap: 5px;
    padding-inline: 4px;
    overflow: hidden;
  }

  .portal-body .account-chip strong {
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .portal-body .topbar-avatar {
    width: 30px;
    height: 30px;
  }

  .portal-body .logout-link {
    flex: 0 0 auto;
    min-height: 32px;
    padding-right: 6px;
    padding-left: 6px;
    font-size: 13px;
  }

  .portal-body .sidebar {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    margin-inline: auto;
    box-sizing: border-box;
    padding: 10px;
    overflow: visible;
  }

  .portal-body .sidebar nav {
    display: grid;
    grid-template-columns: 1fr;
    max-width: 100%;
    overflow: visible;
    padding-bottom: 0;
  }

  .portal-body .nav-group {
    min-width: 0;
    width: 100%;
  }

  .portal-body .sidebar a {
    display: block;
    padding: 8px 9px;
    font-size: 13px;
  }

  .portal-body .portal-shell {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    margin-inline: auto;
    box-sizing: border-box;
    height: auto;
    overflow: visible;
    padding-top: 12px;
  }

  .portal-body .hero,
  .portal-body .panel {
    max-width: 100%;
    overflow-x: hidden;
    padding: 14px;
  }

  .portal-body .hero h1,
  .portal-body .panel h1,
  .portal-body .panel h2 {
    overflow-wrap: anywhere;
    font-size: clamp(24px, 8vw, 34px);
  }

  .portal-body .metrics {
    grid-template-columns: 1fr;
  }

  .portal-body table {
    max-width: 100%;
  }

  .portal-body .business-admin-table {
    display: block;
    overflow: visible;
    border: 0;
    background: transparent;
    white-space: normal;
  }

  .portal-body .business-admin-table thead {
    display: none;
  }

  .portal-body .business-admin-table tbody,
  .portal-body .business-admin-table tr,
  .portal-body .business-admin-table td {
    display: block;
    width: 100%;
  }

  .portal-body .business-admin-table tr {
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-right: 4px solid var(--green);
    border-radius: var(--radius);
    background: #fff;
  }

  .portal-body .business-admin-table tr.selected-row {
    background: #f7fbf8;
  }

  .portal-body .business-admin-table td {
    display: grid;
    grid-template-columns: minmax(94px, 36%) minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    border: 0;
    border-bottom: 1px solid #edf2f7;
    padding: 8px 0;
    white-space: normal;
  }

  .portal-body .business-admin-table td:last-child {
    border-bottom: 0;
  }

  .portal-body .business-admin-table td::before {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .portal-body .business-users-table td:nth-child(1)::before { content: "المستخدم"; }
  .portal-body .business-users-table td:nth-child(2)::before { content: "الإدارة/الوظيفة"; }
  .portal-body .business-users-table td:nth-child(3)::before { content: "الأدوار"; }
  .portal-body .business-users-table td:nth-child(4)::before { content: "الحالة"; }
  .portal-body .business-users-table td:nth-child(5)::before { content: "إدارة"; }

  .portal-body .business-customer-accounts-table td:nth-child(1)::before { content: "العميل"; }
  .portal-body .business-customer-accounts-table td:nth-child(2)::before { content: "اسم المستخدم"; }
  .portal-body .business-customer-accounts-table td:nth-child(3)::before { content: "الارتباط التشغيلي"; }
  .portal-body .business-customer-accounts-table td:nth-child(4)::before { content: "حالة الحساب"; }
  .portal-body .business-customer-accounts-table td:nth-child(5)::before { content: "كلمة المرور"; }
  .portal-body .business-customer-accounts-table td:nth-child(6)::before { content: "إدارة"; }

  .portal-body .business-user-roles-table td:nth-child(1)::before { content: "الدور"; }
  .portal-body .business-user-roles-table td:nth-child(2)::before { content: "المدة"; }
  .portal-body .business-user-roles-table td:nth-child(3)::before { content: "الحالة"; }
  .portal-body .business-user-roles-table td:nth-child(4)::before { content: "منحه"; }
  .portal-body .business-user-roles-table td:nth-child(5)::before { content: "السبب"; }
  .portal-body .business-user-roles-table td:nth-child(6)::before { content: "إجراء"; }

  .portal-body .business-roles-table td:nth-child(1)::before { content: "الدور"; }
  .portal-body .business-roles-table td:nth-child(2)::before { content: "النطاق"; }
  .portal-body .business-roles-table td:nth-child(3)::before { content: "الصلاحيات"; }

  .portal-body .business-role-history-table td:nth-child(1)::before { content: "المستخدم"; }
  .portal-body .business-role-history-table td:nth-child(2)::before { content: "الدور"; }
  .portal-body .business-role-history-table td:nth-child(3)::before { content: "المدة"; }
  .portal-body .business-role-history-table td:nth-child(4)::before { content: "الحالة"; }
  .portal-body .business-role-history-table td:nth-child(5)::before { content: "منحه"; }
  .portal-body .business-role-history-table td:nth-child(6)::before { content: "التاريخ"; }

  .portal-body .business-admin-table .status-row {
    justify-content: flex-start;
  }

  .portal-body .business-admin-table .table-action,
  .portal-body .business-admin-table button {
    width: 100%;
  }

  .portal-body .admin-workspace-shell,
  .portal-body .admin-workspace-hero,
  .portal-body .admin-dashboard-intro,
  .portal-body .admin-workspace-tab-panel,
  .portal-body .admin-workspace-grid,
  .portal-body .admin-management-actions {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .portal-body .admin-workspace-shell *,
  .portal-body .admin-workspace-hero *,
  .portal-body .admin-dashboard-intro *,
  .portal-body .admin-workspace-tab-panel *,
  .portal-body .admin-workspace-grid * {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .portal-body .admin-workspace-shell,
  .portal-body .admin-workspace-hero {
    padding: 18px 14px;
    text-align: center;
    justify-items: center;
  }

  .portal-body .admin-workspace-shell h1,
  .portal-body .admin-workspace-hero h1 {
    font-size: clamp(26px, 9vw, 32px);
    overflow-wrap: anywhere;
  }

  .portal-body .admin-workspace-shell p,
  .portal-body .admin-workspace-hero p,
  .portal-body .admin-dashboard-intro p {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-align: center;
    font-size: 14px;
    line-height: 1.8;
  }

  .portal-body .admin-workspace-tabs {
    grid-template-columns: 1fr;
  }

  .portal-body .admin-workspace-summary,
  .portal-body .admin-workspace-command,
  .portal-body .admin-control-card,
  .portal-body .admin-attention-item,
  .portal-body .admin-risk-item {
    max-width: 100%;
    min-width: 0;
  }

  .portal-body .admin-attention-item,
  .portal-body .admin-risk-grid {
    grid-template-columns: 1fr;
  }
}

/* Management reports and SLA governance */
.report-navigation-panel,
.report-filter-panel {
  display: grid;
  gap: 14px;
}

.report-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

.report-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  color: var(--green-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-ar-bold);
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.report-tab:hover {
  background: #f8fffb;
  border-color: var(--green-line);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(4, 88, 44, 0.1);
}

.report-tab.active {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 12px 24px rgba(4, 88, 44, 0.16);
}

.report-card-link {
  color: inherit;
  text-decoration: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.report-card-link:hover {
  border-color: var(--green-line);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(4, 88, 44, 0.12);
}

.report-filter-panel .filter-bar {
  margin-bottom: 0;
}

.management-report-table {
  border-color: var(--line);
  table-layout: auto;
}

.management-report-table th {
  color: var(--muted);
  background: #f8fafc;
  border-color: var(--line);
  font-size: 13px;
  text-align: right;
}

.management-report-table td {
  border-color: #e5edf4;
  vertical-align: middle;
  line-height: 1.65;
}

.management-report-table tbody tr:hover td {
  background: #f8fffb;
}

.report-main-cell,
.report-meta-stack {
  display: grid;
  gap: 3px;
}

.report-main-cell strong,
.report-meta-stack strong {
  color: var(--ink);
  font-family: var(--font-ar-bold);
  font-size: 16px;
}

.report-main-cell span {
  color: var(--muted);
  font-size: 13px;
  direction: ltr;
  text-align: right;
}

.report-meta-stack span {
  color: var(--muted);
  font-size: 13px;
  direction: rtl;
  text-align: right;
}

.report-summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.report-summary-chips span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 9px;
  color: var(--green-dark);
  background: #f6fbf8;
  border: 1px solid var(--green-line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.report-summary-chips strong {
  color: var(--ink);
  font-family: var(--font-ar-bold);
}

.report-filter-panel ~ .panel.wide table,
.sla-table-panel table {
  min-width: 1040px;
}

.report-filter-panel ~ .panel.wide,
.sla-table-panel,
.sla-calendar-panel .sub-panel {
  overflow-x: auto;
}

.workweek-selector {
  display: grid;
  grid-template-columns: repeat(7, minmax(88px, 1fr));
  gap: 10px;
}

.workday-toggle {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.workday-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.workday-toggle span {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-family: var(--font-ar-bold);
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.workday-toggle input:checked + span {
  border-color: #79b99a;
  background: #e9f6ee;
  color: var(--green-dark);
  box-shadow: inset 0 -3px 0 var(--green);
}

.workday-toggle input:focus-visible + span {
  outline: 3px solid rgba(18, 117, 70, 0.22);
  outline-offset: 2px;
}

.holiday-editor {
  display: grid;
  gap: 10px;
}

.holiday-entry-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.72fr) minmax(260px, 1.4fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.holiday-entry-row.is-new {
  background: #f7fbf8;
  border-style: dashed;
}

.holiday-entry-row label {
  margin: 0;
}

.holiday-entry-row label > span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
}

.holiday-entry-row input[type="date"],
.holiday-entry-row input[name^="holiday_name_"] {
  width: 100%;
  min-width: 0;
}

.holiday-entry-action {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.holiday-remove {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 8px 10px;
  color: var(--red);
  cursor: pointer;
}

.holiday-remove input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--red);
}

.flow-scenario-count {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.flow-boundary {
  display: grid;
  gap: 3px;
  padding: 6px 0;
}

.flow-boundary + .flow-boundary {
  border-top: 1px solid var(--line);
}

.flow-boundary > span:first-child {
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-ar-bold);
}

.sla-policy-form {
  display: grid;
  grid-template-columns: minmax(74px, 88px) minmax(120px, 1fr) auto;
  gap: 7px;
  align-items: end;
  min-width: 0;
  margin: 0;
}

.sla-policy-form label {
  margin: 0;
}

.sla-policy-form label span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.sla-policy-form input {
  min-width: 0;
}

.sla-policy-form button {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .report-tabs,
  .report-filter-panel .filter-bar,
  .sla-policy-form,
  .holiday-entry-row {
    grid-template-columns: 1fr;
  }

  .workweek-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* Platform admin control panel rebuild */
.platform-admin-page {
  display: grid;
  gap: 18px;
}

.platform-admin-hero,
.platform-admin-header {
  background: linear-gradient(135deg, #ffffff 0%, #f5fbf8 100%);
  border: 1px solid var(--line);
  border-right: 6px solid var(--brand);
  border-radius: 8px;
  padding: 26px;
  box-shadow: var(--shadow-soft);
}

.platform-admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: center;
}

.platform-admin-hero h1,
.platform-admin-header h1 {
  margin: 6px 0 10px;
  color: var(--brand-strong);
}

.platform-admin-hero p,
.platform-admin-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.platform-decision-card,
.platform-metric-card,
.platform-risk-item,
.platform-setting-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.platform-decision-card {
  border-right: 5px solid var(--warning);
}

.platform-admin-hero.danger .platform-decision-card,
.platform-metric-card.danger,
.platform-risk-item.danger {
  border-right-color: var(--danger);
}

.platform-metric-card.ok,
.platform-risk-item.ok {
  border-right-color: var(--brand);
}

.platform-metric-card.warn,
.platform-risk-item.warn {
  border-right-color: var(--warning);
}

.platform-decision-card span,
.platform-metric-card span,
.platform-risk-item span {
  display: block;
  color: var(--muted);
  font-weight: 800;
  font-size: .9rem;
}

.platform-decision-card strong,
.platform-metric-card strong,
.platform-risk-item strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 1.15rem;
}

.platform-decision-card small,
.platform-metric-card small,
.platform-risk-item small,
.platform-setting-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
}

.platform-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.platform-admin-grid {
  display: grid;
  gap: 16px;
}

.platform-admin-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.platform-admin-grid .full {
  grid-column: 1 / -1;
}

.platform-risk-list,
.platform-setting-grid {
  display: grid;
  gap: 12px;
}

.platform-setting-card {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1.2fr) auto;
  gap: 12px;
  align-items: end;
}

.platform-setting-card strong {
  color: var(--brand-strong);
}

.platform-setting-card label {
  display: block;
}

.platform-setting-card input,
.platform-setting-card select,
.platform-setting-card textarea {
  width: 100%;
  min-height: 46px;
}

.platform-setting-card textarea {
  resize: vertical;
}

.platform-table small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

@media (max-width: 1100px) {
  .platform-admin-hero,
  .platform-admin-grid.two,
  .platform-metric-grid {
    grid-template-columns: 1fr;
  }

  .platform-setting-card {
    grid-template-columns: 1fr;
  }
}

/* Dedicated employee account and management conversation workspaces */
.staff-account-back {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.compact-admin-header {
  display: block;
  padding: 16px 22px;
  margin-bottom: 12px;
}

.compact-admin-header h1 {
  margin: 6px 0 4px;
  font-size: clamp(24px, 2.5vw, 34px);
}

.compact-admin-header p {
  max-width: 860px;
  margin: 0;
}

.staff-header-role-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.staff-account-editor,
.staff-account-editor + .panel {
  max-width: none;
}

.employee-account-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.employee-account-summary > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
  overflow: hidden;
}

.employee-account-summary span {
  color: var(--muted);
  font-family: var(--font-ar-bold);
  white-space: nowrap;
}

.employee-account-summary strong {
  min-width: 0;
  white-space: nowrap;
}

.staff-profile-form {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.staff-password-form {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.staff-profile-form > .grid.two,
.staff-password-form > .grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.staff-profile-form .form-actions,
.staff-password-form .form-actions {
  display: flex;
  justify-content: flex-start;
}

.readonly-field {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.readonly-field span {
  color: var(--muted);
  font-family: var(--font-ar-bold);
}

.readonly-field strong {
  margin-top: 4px;
  color: var(--green-dark);
}

.staff-roles-form {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.staff-roles-form h3 {
  margin: 0 0 14px;
  color: var(--green-dark);
}

.role-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.role-check-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 8px;
  min-height: 48px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
  cursor: pointer;
}

.role-check-card input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--green);
}

.role-check-card span {
  color: var(--green-dark);
  font-family: var(--font-ar-bold);
}

.role-check-card small {
  grid-column: 2;
  color: var(--muted);
  line-height: 1.7;
}

.permission-group-block {
  margin-top: 16px;
}

.permission-group-block h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-family: var(--font-ar-bold);
}

.staff-roles-form .form-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 14px;
}

.account-security-grid {
  margin-top: 14px;
}

.account-security-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
  margin-top: 16px;
}

.account-actions-only {
  background: #fff;
}

.account-actions-panel {
  padding-inline-start: 18px;
  border-inline-start: 1px solid var(--line);
}

.account-state-list {
  display: grid;
  gap: 10px;
}

.account-state-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.account-state-list span {
  color: var(--muted);
  font-family: var(--font-ar-bold);
}

.account-action-row {
  justify-content: flex-start;
  gap: 8px;
}

.account-action-row .inline-form {
  margin: 0;
}

.customer-account-actions-grid.single-actions .account-actions-only {
  display: block;
  padding: 0;
}

.customer-account-actions-grid.single-actions .account-actions-only h3 {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  text-align: right;
}

.customer-account-actions-grid.single-actions .account-action-row {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 8px !important;
  row-gap: 8px !important;
  margin: 0 12px;
  justify-content: stretch;
}

.customer-account-actions-grid.single-actions .account-action-row .inline-form {
  display: block !important;
  margin: 0 !important;
  min-width: 0;
  width: 100%;
}

.customer-account-actions-grid.single-actions .account-action-row button,
.customer-account-actions-grid.single-actions .account-action-row .notice {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  white-space: nowrap;
  line-height: 1.5;
  border-radius: 8px;
}

.customer-account-actions-grid.single-actions .account-actions-only .muted {
  margin: 12px 0 0;
  text-align: center;
}

.customer-account-actions-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
  gap: 14px;
}

.customer-profile-grid .form-save-slot {
  display: flex;
  align-items: end;
  justify-content: stretch;
}

.customer-profile-grid .form-save-slot button {
  width: 100%;
  min-height: 46px;
}

.customer-account-actions-grid.single-actions {
  grid-template-columns: 1fr;
}

.customer-account-actions-grid > form,
.customer-account-actions-grid > .sub-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 760px) {
  .employee-account-summary {
    grid-template-columns: 1fr;
  }

  .customer-account-actions-grid {
    grid-template-columns: 1fr;
  }

  .customer-account-actions-grid.single-actions .account-action-row {
    display: grid;
    grid-template-columns: 1fr;
    margin-inline: 0;
    justify-content: stretch;
  }

  .account-security-panel {
    grid-template-columns: 1fr;
  }

  .account-actions-panel {
    padding-inline-start: 0;
    border-inline-start: 0;
    border-top: 1px solid var(--line);
    padding-top: 14px;
  }
}

.advanced-options {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.advanced-options summary {
  padding: 12px 14px;
  color: var(--green-dark);
  cursor: pointer;
  font-family: var(--font-ar-bold);
  font-weight: 800;
}

.advanced-options[open] summary {
  border-bottom: 1px solid var(--line);
}

.advanced-options > .grid {
  padding: 14px;
}

.business-directory-panel .business-users-table {
  min-width: 820px;
}

.business-directory-panel .business-customer-accounts-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

.business-customer-accounts-table th,
.business-customer-accounts-table td {
  white-space: normal;
  overflow-wrap: normal;
  word-break: keep-all;
}

.business-customer-accounts-table .account-username {
  display: inline-block;
  max-width: 100%;
  direction: ltr;
  unicode-bidi: plaintext;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.management-chat-filters {
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  max-width: none;
  margin-bottom: 4px;
}

.management-chat-layout {
  min-height: 680px;
}

.management-chat-case time {
  color: var(--muted);
  font-size: 12px;
}

.management-chat-window {
  grid-template-rows: auto minmax(420px, 1fr);
}

.management-chat-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 18px;
  overflow: auto;
  background: #f7faf8;
}

.management-chat-message {
  width: min(78%, 720px);
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(22, 48, 37, .05);
}

.management-chat-message.from-customer {
  align-self: flex-start;
  border-right: 4px solid #2674b8;
}

.management-chat-message.from-staff {
  align-self: flex-end;
  border-right: 4px solid var(--green);
}

.management-chat-message header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.management-chat-message header div {
  display: grid;
  gap: 2px;
}

.management-chat-message header strong {
  color: var(--green-dark);
}

.management-chat-message header span,
.management-chat-message header time,
.management-chat-message footer {
  color: var(--muted);
  font-size: 12px;
}

.management-chat-message p {
  margin: 0;
  line-height: 1.8;
  white-space: pre-wrap;
}

.management-chat-message footer {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .compact-admin-header {
    padding: 14px 14px;
  }

  .compact-admin-header h1 {
    font-size: 24px;
  }

  .management-chat-filters {
    grid-template-columns: 1fr;
  }

  .management-chat-message {
    width: 94%;
  }

  .staff-account-editor .grid.three,
  .staff-account-editor .grid.two,
  .account-security-grid {
    grid-template-columns: 1fr;
  }

  .business-directory-panel .business-users-table {
    min-width: 0;
    width: 100%;
  }

  .business-directory-panel .business-customer-accounts-table {
    min-width: 0;
    width: 100%;
  }
}


/* Executive oversight workspace */
.oversight-hero {
  align-items: center;
  min-height: 150px;
}
.oversight-summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}
.oversight-summary-strip article,
.oversight-decision-card {
  background: #fff;
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--green);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}
.oversight-summary-strip article.is-alert {
  border-inline-start-color: #b45309;
  background: #fffaf2;
}
.oversight-summary-strip span,
.oversight-decision-card span {
  color: var(--muted);
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}
.oversight-summary-strip strong,
.oversight-decision-card strong {
  display: block;
  color: var(--green-dark);
  font-size: 30px;
  line-height: 1;
}
.oversight-summary-strip small,
.oversight-decision-card small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
}
.oversight-priority-table th,
.oversight-priority-table td {
  vertical-align: middle;
}
.oversight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .85fr);
  gap: 16px;
  margin-top: 16px;
}
.oversight-decision-grid {
  display: grid;
  gap: 12px;
}
.oversight-decision-card a {
  color: var(--green-dark);
  display: inline-block;
  font-weight: 800;
  margin-top: 10px;
}
@media (max-width: 1000px) {
  .oversight-summary-strip,
  .oversight-grid {
    grid-template-columns: 1fr;
  }
}


.finance-report-filter-panel {
  padding: 16px 18px 14px;
}

.finance-report-filter-panel .finance-report-filter-bar,
.finance-report-filter-panel .finance-quotes-filter-bar,
.finance-report-filter-panel .finance-claims-filter-bar,
.finance-report-filter-panel .finance-payments-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  justify-content: flex-start;
  margin-bottom: 4px;
}

.finance-report-filter-panel .field {
  flex: 0 1 180px;
  min-width: 155px;
}

.finance-report-filter-panel .field:has(input[type="date"]) {
  flex-basis: 190px;
}

.finance-report-filter-panel .search-field {
  flex: 1 1 360px;
  min-width: 280px;
}

.finance-report-filter-panel .field span {
  font-size: 13px;
  margin-bottom: 5px;
}

.finance-report-filter-panel .filter-clear {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  min-height: 48px;
  align-self: flex-end;
}

.finance-report-filter-panel .small-text {
  margin: 6px 0 0;
  text-align: start;
}

@media (max-width: 720px) {
  .finance-report-filter-panel .finance-report-filter-bar,
  .finance-report-filter-panel .finance-quotes-filter-bar,
  .finance-report-filter-panel .finance-claims-filter-bar,
  .finance-report-filter-panel .finance-payments-filter-bar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .finance-report-filter-panel .field,
  .finance-report-filter-panel .search-field,
  .finance-report-filter-panel .filter-clear {
    width: 100%;
    min-width: 0;
  }
}

.report-section-note {
  margin: 0 0 14px;
  text-align: right;
}

.finance-report-filter-panel .compact-date-field {
  flex: 0 1 170px;
  min-width: 150px;
}

.unit-profile-hero p {
  margin-bottom: 0;
}

.unit-current-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.unit-current-grid article {
  min-height: 96px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  border-inline-start: 4px solid var(--green);
  background: #f8fbf9;
}

.unit-current-grid span,
.unit-current-grid small {
  display: block;
  color: var(--muted);
}

.unit-current-grid strong {
  display: block;
  margin: 8px 0 6px;
  color: var(--green-dark);
  font-size: 18px;
}

.unit-current-section > .link-button {
  margin-top: 12px;
}

.sla-workday-section,
.sla-holiday-section,
.sla-duration-section {
  margin-block: 16px;
}

.sla-workday-section .workweek-selector {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  gap: 8px;
}

.sla-duration-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-block: 16px;
}

.sla-task-group {
  border-block: 1px solid var(--border-color, #d7ddd9);
  padding-block: 8px;
}

.sla-task-group summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-weight: 700;
  padding: 10px 4px;
}

.sla-task-group td input[type="number"] {
  width: 110px;
  min-width: 0;
}

.sla-change-summary {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--warning-border, #d7a928);
  background: var(--warning-soft, #fff8df);
}

.sla-change-summary li {
  margin-block: 6px;
}

@media (max-width: 1024px) {
  .sla-workday-section .workweek-selector {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .sla-workday-section .workweek-selector,
  .sla-duration-filters {
    grid-template-columns: 1fr;
  }

  .sla-task-group summary {
    align-items: flex-start;
    flex-direction: column;
  }
}

.customer-filter-panel,
.customer-filter-bar .field,
.customer-filter-bar .search-field,
.customer-filter-bar input,
.customer-filter-bar select {
  min-width: 0;
  max-width: 100%;
}

.cycle-readonly-section {
  overflow: visible;
}

.cycle-readonly-section .cycle-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cycle-detail-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-gutter: stable;
  margin: 10px 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.cycle-detail-table-wrap .cycle-detail-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  margin: 0;
}

.cycle-detail-table-wrap .cycle-detail-table th,
.cycle-detail-table-wrap .cycle-detail-table td {
  min-width: 138px;
  max-width: 260px;
  padding: 11px 12px;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

.cycle-detail-table-wrap .cycle-detail-table th:first-child,
.cycle-detail-table-wrap .cycle-detail-table td:first-child {
  min-width: 170px;
}

.cycle-detail-table-wrap .cycle-detail-table th:last-child,
.cycle-detail-table-wrap .cycle-detail-table td:last-child {
  min-width: 120px;
}

.cycle-detail-table-wrap .cycle-detail-table td:nth-child(2),
.cycle-detail-table-wrap .cycle-detail-table td:nth-child(3),
.cycle-detail-table-wrap .cycle-detail-table td:nth-child(4) {
  white-space: nowrap;
}

.cycle-detail-table-wrap .cycle-events-table th,
.cycle-detail-table-wrap .cycle-events-table td {
  min-width: 150px;
}

.cycle-detail-table-wrap .cycle-events-table th:last-child,
.cycle-detail-table-wrap .cycle-events-table td:last-child {
  min-width: 320px;
  max-width: 420px;
  white-space: normal;
  overflow-wrap: normal;
  word-break: keep-all;
}

.unit-cycle-cards {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.unit-cycle-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  border-inline-start: 4px solid var(--green);
  background: #fff;
}

.unit-cycle-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.unit-cycle-card-head span,
.unit-cycle-card-grid span {
  display: block;
  color: var(--muted);
  font-family: var(--font-ar-bold);
}

.unit-cycle-card-head strong {
  display: block;
  margin-top: 4px;
  color: var(--green-dark);
  font-size: 20px;
}

.unit-cycle-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.unit-cycle-card-grid > div {
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.unit-cycle-card-grid strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
}

.unit-cycle-card > .link-button {
  margin-top: 12px;
}

.unit-visit-history-table {
  direction: rtl;
  width: max-content;
  min-width: 1162px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.unit-visit-scroll {
  direction: ltr;
  position: relative;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-gutter: stable;
}

.unit-visit-scroll::before {
  content: "اسحب الجدول أفقياً لعرض باقي الأعمدة عند ضيق المساحة";
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.unified-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.unified-table-scroll > .unified-record-table {
  display: table;
  width: 100%;
  min-width: 680px;
  overflow: visible;
  white-space: normal;
}

.unified-table-scroll > .inspection-period-table {
  min-width: 820px;
}

.journey-progress-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.journey-progress-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 11px 12px;
  border-inline-start: 4px solid #cbd5e1;
  background: #f8fafc;
}

.journey-progress-list li.done {
  border-inline-start-color: #2f855a;
}

.journey-progress-list li.current {
  border-inline-start-color: #2563eb;
  background: #eff6ff;
}

.journey-progress-list li strong {
  white-space: nowrap;
  font-size: 12px;
}

@media (max-width: 720px) {
  .unified-table-scroll::before {
    content: "مرر الجدول أفقيا لعرض بقية الأعمدة";
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 12px;
    text-align: right;
  }

  .journey-progress-list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.unit-visit-scroll::after {
  content: "";
  display: block;
  height: 1px;
}

.unit-visit-history-table th:nth-last-child(1),
.unit-visit-history-table td:nth-last-child(1) {
  position: sticky;
  left: 0;
  right: auto;
  width: 142px;
  min-width: 142px;
  z-index: 4;
  background: #fff;
}

.unit-visit-history-table th:nth-last-child(2),
.unit-visit-history-table td:nth-last-child(2) {
  position: sticky;
  left: 142px;
  right: auto;
  width: 150px;
  min-width: 150px;
  z-index: 3;
  background: #fff;
  box-shadow: -8px 0 14px rgba(15, 23, 42, 0.08);
}

.unit-visit-history-table th,
.unit-visit-history-table td {
  direction: rtl;
  padding: 11px 8px;
  font-size: var(--table-td-font-size);
  line-height: var(--table-cell-line-height);
  vertical-align: middle;
  overflow-wrap: normal;
  word-break: keep-all;
}

.unit-visit-history-table th:nth-child(1),
.unit-visit-history-table td:nth-child(1) {
  width: 210px;
}

.unit-visit-history-table th:nth-child(2),
.unit-visit-history-table td:nth-child(2) {
  width: 120px;
}

.unit-visit-history-table th:nth-child(3),
.unit-visit-history-table td:nth-child(3) {
  width: 132px;
}

.unit-visit-history-table th:nth-child(4),
.unit-visit-history-table td:nth-child(4) {
  width: 118px;
}

.unit-visit-history-table th:nth-child(5),
.unit-visit-history-table td:nth-child(5) {
  width: 138px;
}

.unit-visit-history-table th:nth-child(6),
.unit-visit-history-table td:nth-child(6) {
  width: 126px;
}

.unit-visit-history-table th:nth-child(7),
.unit-visit-history-table td:nth-child(7) {
  width: 126px;
}

.unit-visit-history-table th:nth-child(8),
.unit-visit-history-table td:nth-child(8) {
  width: 150px;
}

.unit-visit-history-table th:nth-child(9),
.unit-visit-history-table td:nth-child(9) {
  width: 142px;
}

.unit-visit-history-table tr.unit-cycle-group-start td {
  border-top-width: 2px;
}

.unit-period-cell,
.unit-payment-cell {
  background: #f8fffb !important;
}

.unit-period-cell strong,
.unit-payment-cell strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-ar-bold);
}

.unit-period-cell small,
.unit-payment-cell small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.visit-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid #d2dce8;
  border-radius: 8px;
  background: #fff;
}

.visit-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #b7e3c8;
  border-radius: 8px;
  color: var(--green);
  background: #f4fff8;
  font-family: var(--font-ar-bold);
  text-decoration: none;
}

.visit-tabs a:hover {
  background: #eaf8ef;
}

.visit-tab-panel {
  scroll-margin-top: 90px;
}

@media (max-width: 900px) {
  .unit-current-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cycle-readonly-section .cycle-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .unit-cycle-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .cycle-readonly-section .cycle-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .unit-current-grid {
    grid-template-columns: 1fr;
  }

  .cycle-readonly-section .cycle-summary-grid {
    grid-template-columns: 1fr;
  }

  .unit-cycle-card-grid {
    grid-template-columns: 1fr;
  }
}

/* Unified table typography: keep table text readable without character-level breaking. */
.portal-body table th,
.portal-body table td,
.management-report-table th,
.management-report-table td,
.customers-list-table th,
.customers-list-table td,
.customer-units-table th,
.customer-units-table td,
.business-admin-table th,
.business-admin-table td,
.business-customer-accounts-table th,
.business-customer-accounts-table td,
.registration-list-table th,
.registration-list-table td,
.unit-visit-history-table th,
.unit-visit-history-table td,
.platform-table th,
.platform-table td {
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: manual;
}

.portal-body table th,
.management-report-table th,
.customers-list-table th,
.customer-units-table th,
.business-admin-table th,
.business-customer-accounts-table th,
.registration-list-table th,
.unit-visit-history-table th,
.platform-table th {
  font-size: var(--table-th-font-size);
  line-height: 1.45;
  white-space: normal;
}

.portal-body table td,
.management-report-table td,
.customers-list-table td,
.customer-units-table td,
.business-admin-table td,
.business-customer-accounts-table td,
.registration-list-table td,
.unit-visit-history-table td,
.platform-table td {
  font-size: var(--table-td-font-size);
  line-height: var(--table-cell-line-height);
}

.customers-list-table td:first-child,
.customers-list-table td:nth-child(2),
.customers-list-table td:nth-child(8),
.customers-list-table td:nth-child(9),
.customers-list-table td:nth-child(10),
.customers-list-table td:nth-child(12),
.customers-list-table td:last-child,
.customer-units-table td:first-child,
.customer-units-table td:nth-child(2),
.customer-units-table td:nth-child(5),
.customer-units-table td:nth-child(6),
.customer-units-table td:nth-child(9),
.customer-units-table td:nth-child(10),
.management-report-table .status,
.management-report-table .badge,
.customers-list-table .status,
.customer-units-table .status,
.unit-visit-history-table .status,
.unit-visit-history-table td:nth-child(2),
.unit-visit-history-table td:nth-child(7),
.unit-visit-history-table td:nth-child(8),
.unit-visit-history-table td:nth-child(9),
.table-action,
.link-button,
button {
  white-space: nowrap;
}

.customer-main-cell strong,
.customer-activity-cell strong,
.customer-last-file strong,
.report-main-cell strong,
.report-meta-stack strong,
.business-customer-accounts-table strong,
.unit-visit-history-table strong {
  overflow-wrap: normal;
  word-break: keep-all;
}

/* Batch correction: readable data tables without clipping or nested scroll. */
.customer-directory-panel {
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-gutter: stable;
}

.customers-list-table {
  min-width: 1520px;
  table-layout: fixed;
}

.customers-list-table th,
.customers-list-table td {
  padding: 10px 8px;
  font-size: var(--table-td-font-size);
  line-height: 1.5;
}

.customers-list-table td strong,
.customer-main-cell strong,
.customer-last-file strong,
.customer-action-cell strong {
  font-size: 13.5px;
  line-height: 1.45;
}

.customers-list-table th:nth-child(1),
.customers-list-table td:nth-child(1) { width: 48px; }
.customers-list-table th:nth-child(2),
.customers-list-table td:nth-child(2) { width: 132px; }
.customers-list-table th:nth-child(3),
.customers-list-table td:nth-child(3) { width: 154px; }
.customers-list-table th:nth-child(4),
.customers-list-table td:nth-child(4) { width: 140px; }
.customers-list-table th:nth-child(5),
.customers-list-table td:nth-child(5) { width: 96px; }
.customers-list-table th:nth-child(6),
.customers-list-table td:nth-child(6) { width: 118px; }
.customers-list-table th:nth-child(7),
.customers-list-table td:nth-child(7) { width: 124px; }
.customers-list-table th:nth-child(8),
.customers-list-table td:nth-child(8) { width: 146px; }
.customers-list-table th:nth-child(9),
.customers-list-table td:nth-child(9) { width: 118px; }
.customers-list-table th:nth-child(10),
.customers-list-table td:nth-child(10) { width: 112px; }
.customers-list-table th:nth-child(11),
.customers-list-table td:nth-child(11) { width: 154px; }
.customers-list-table th:nth-child(12),
.customers-list-table td:nth-child(12) { width: 108px; }
.customers-list-table th:last-child,
.customers-list-table td:last-child {
  width: 124px;
  min-width: 124px;
}

.customers-list-table .status {
  max-width: 138px;
  white-space: normal;
  overflow-wrap: normal;
  word-break: keep-all;
  line-height: 1.4;
}

.customers-list-table td:last-child .table-action {
  min-width: 96px;
}

.report-filter-panel ~ .panel.wide,
.sla-table-panel,
.sla-calendar-panel .sub-panel {
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-gutter: stable;
}

.report-filter-panel ~ .panel.wide table,
.management-report-table,
.sla-table-panel table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.management-report-table th,
.management-report-table td {
  min-width: 92px;
  max-width: 230px;
  padding: 10px 9px;
  font-size: var(--table-td-font-size);
  line-height: 1.5;
}

.management-report-table td strong,
.report-main-cell strong,
.report-meta-stack strong {
  font-size: 13.5px;
  line-height: 1.45;
}

.management-report-table th:first-child,
.management-report-table td:first-child {
  min-width: 48px;
  max-width: 64px;
  white-space: nowrap;
}

.management-report-table th:nth-child(2),
.management-report-table td:nth-child(2) {
  min-width: 142px;
  white-space: nowrap;
}

.management-report-table th:last-child,
.management-report-table td:last-child {
  min-width: 110px;
  white-space: nowrap;
}

.management-report-table th:nth-child(6),
.management-report-table td:nth-child(6),
.management-report-table th:nth-child(7),
.management-report-table td:nth-child(7),
.management-report-table th:nth-child(8),
.management-report-table td:nth-child(8),
.management-report-table th:nth-child(10),
.management-report-table td:nth-child(10),
.management-report-table th:nth-child(11),
.management-report-table td:nth-child(11),
.management-report-table th:nth-child(12),
.management-report-table td:nth-child(12) {
  min-width: 112px;
}

.management-report-table .status,
.management-report-table .badge,
.management-report-table .table-action,
.management-report-table td:nth-child(2) strong {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .customer-directory-panel {
    overflow-x: visible;
  }

  .customers-list-table,
  .customers-list-table thead,
  .customers-list-table tbody,
  .customers-list-table tr,
  .customers-list-table th,
  .customers-list-table td {
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
    table-layout: auto;
  }

  .customers-list-table tr {
    box-sizing: border-box;
    overflow: hidden;
  }

  .customers-list-table td {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr);
    align-items: start;
    justify-content: stretch;
    gap: 10px;
    white-space: normal !important;
    overflow-wrap: normal;
    word-break: keep-all;
  }

  .customers-list-table td::before {
    min-width: 0;
    flex: none;
  }

  .customers-list-table td > *,
  .customer-main-cell,
  .customer-activity-cell,
  .customer-last-file,
  .customer-action-cell,
  .customer-main-cell strong,
  .customer-main-cell span,
  .customer-last-file strong,
  .customer-last-file span,
  .customer-action-cell strong,
  .customer-action-cell span {
    min-width: 0;
    max-width: 100%;
    white-space: normal !important;
    overflow-wrap: normal;
    word-break: keep-all;
  }

  .customers-list-table td:nth-child(2),
  .customers-list-table td:nth-child(10),
  .customers-list-table td:nth-child(12) {
    white-space: nowrap !important;
  }

  .customers-list-table td:last-child {
    display: block;
    position: static;
    min-width: 0 !important;
    width: 100% !important;
    box-shadow: none;
  }

  .customers-list-table td:last-child .table-action {
    width: 100%;
    min-width: 0;
  }

  .report-filter-panel ~ .panel.wide {
    overflow-x: auto;
    overflow-y: visible;
  }

  .report-filter-panel ~ .panel.wide table,
  .management-report-table {
    width: max-content;
    min-width: 1120px;
    table-layout: auto;
  }

  .management-report-table th,
  .management-report-table td {
    white-space: normal;
  }

  .management-report-table th:nth-child(2),
  .management-report-table td:nth-child(2),
  .management-report-table th:nth-child(6),
  .management-report-table td:nth-child(6),
  .management-report-table th:nth-child(7),
  .management-report-table td:nth-child(7),
  .management-report-table th:nth-child(8),
  .management-report-table td:nth-child(8),
  .management-report-table th:nth-child(10),
  .management-report-table td:nth-child(10),
  .management-report-table th:nth-child(11),
  .management-report-table td:nth-child(11),
  .management-report-table th:nth-child(12),
  .management-report-table td:nth-child(12),
  .management-report-table th:last-child,
  .management-report-table td:last-child {
    white-space: nowrap;
  }
}

/* Batch correction follow-up: keep report scrolling on the outer panel only. */
.customers-list-table:not(.unit-visit-history-table) th:last-child,
.customers-list-table:not(.unit-visit-history-table) td:last-child {
  width: 142px;
  min-width: 142px;
}

@media (max-width: 720px) {
  .unit-visit-scroll {
    direction: ltr;
    overflow-x: auto;
    overflow-y: visible;
  }

  .unit-visit-history-table {
    display: table !important;
    direction: rtl;
    width: max-content !important;
    min-width: 1162px !important;
    table-layout: fixed !important;
    border-collapse: separate;
    border-spacing: 0;
  }

  .unit-visit-history-table thead {
    position: static !important;
    display: table-header-group !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
  }

  .unit-visit-history-table tbody {
    display: table-row-group !important;
  }

  .unit-visit-history-table tr {
    display: table-row !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
  }

  .unit-visit-history-table th,
  .unit-visit-history-table td {
    display: table-cell !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 11px 8px !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: normal !important;
  }

  .unit-visit-history-table td::before {
    display: none !important;
    content: none !important;
  }

  .unit-visit-history-table th:nth-last-child(1),
  .unit-visit-history-table td:nth-last-child(1) {
    position: sticky !important;
    left: 0 !important;
    right: auto !important;
    width: 142px !important;
    min-width: 142px !important;
    max-width: 142px !important;
    z-index: 4;
    background: #fff;
  }

  .unit-visit-history-table th:nth-last-child(2),
  .unit-visit-history-table td:nth-last-child(2) {
    position: sticky !important;
    left: 142px !important;
    right: auto !important;
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    z-index: 3;
    background: #fff;
  }
}

.customers-list-table:not(.unit-visit-history-table) td:last-child .table-action {
  min-width: 116px;
  padding-inline: 10px;
}

.report-filter-panel ~ .panel.wide table,
.management-report-table,
.sla-table-panel table {
  display: table;
  width: max-content !important;
  min-width: max-content !important;
  overflow: visible !important;
}

@media (max-width: 720px) {
  .report-filter-panel ~ .panel.wide table,
  .management-report-table,
  .sla-table-panel table {
    width: max-content !important;
    min-width: max-content !important;
    overflow: visible !important;
  }
}

/* Batch correction follow-up 2: snap customer table scrolling to column boundaries. */
@media (min-width: 721px) {
  .customer-directory-panel:not(.approved-client-section) {
    direction: ltr;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 152px;
    scroll-padding-right: 0;
    overscroll-behavior-x: contain;
  }

  .customers-list-table:not(.unit-visit-history-table) th,
  .customers-list-table:not(.unit-visit-history-table) td {
    direction: rtl;
    scroll-snap-align: start;
    scroll-snap-stop: normal;
  }

  .customers-list-table:not(.unit-visit-history-table) th:last-child,
  .customers-list-table:not(.unit-visit-history-table) td:last-child {
    position: sticky;
    left: 0;
    right: auto;
    z-index: 4;
    width: 152px;
    min-width: 152px;
    max-width: 152px;
    scroll-snap-align: end;
    background: #fff;
    box-shadow: 1px 0 0 var(--line), 8px 0 18px rgba(15, 23, 42, 0.08);
  }

  .customers-list-table:not(.unit-visit-history-table) th:last-child {
    z-index: 5;
    background: #f8fafc;
  }

  .customers-list-table:not(.unit-visit-history-table) td:last-child .table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 124px;
    min-width: 124px;
    max-width: 124px;
    padding-inline: 8px;
  }
}

/* Cycle details must own their horizontal scroll and keep headers readable. */
@media (min-width: 1200px) {
  .customer-directory-panel:not(.approved-client-section) {
    overflow-x: visible;
    scrollbar-gutter: auto;
    scroll-snap-type: none;
  }

  .customers-list-table:not(.unit-visit-history-table) {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
  }

  .customers-list-table:not(.unit-visit-history-table) th,
  .customers-list-table:not(.unit-visit-history-table) td {
    padding: 9px 6px;
    font-size: 12.4px;
  }

  .customers-list-table:not(.unit-visit-history-table) th:first-child,
  .customers-list-table:not(.unit-visit-history-table) td:first-child { width: 34px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(2),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(2) { width: 82px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(3),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(3) { width: 108px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(4),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(4) { width: 100px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(5),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(5) { width: 66px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(6),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(6) { width: 84px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(7),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(7) { width: 58px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(8),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(8) { width: 98px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(9),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(9) { width: 78px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(10),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(10) { width: 84px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(11),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(11) { width: 102px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(12),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(12) { width: 72px; }
  .customers-list-table:not(.unit-visit-history-table) th:last-child,
  .customers-list-table:not(.unit-visit-history-table) td:last-child {
    position: static;
    width: 84px;
    min-width: 84px;
    max-width: none;
    box-shadow: none;
  }

  .customers-list-table:not(.unit-visit-history-table) td:last-child .table-action {
    width: auto;
    min-width: 70px;
    max-width: 100%;
    padding-inline: 6px;
  }
}

/* RC guard: keep the approved desktop customer list as a full table.
   Do not compress columns into clipped cells; the panel owns horizontal scroll. */
@media (min-width: 1200px) {
  .customer-directory-panel:not(.approved-client-section) {
    direction: ltr;
    overflow-x: auto;
    scrollbar-gutter: stable;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 152px;
  }

  .customers-list-table:not(.unit-visit-history-table) {
    direction: rtl;
    width: max-content !important;
    min-width: 1540px !important;
    table-layout: fixed;
  }

  .customers-list-table:not(.unit-visit-history-table) th:first-child,
  .customers-list-table:not(.unit-visit-history-table) td:first-child { width: 48px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(2),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(2) { width: 132px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(3),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(3) { width: 154px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(4),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(4) { width: 140px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(5),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(5) { width: 96px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(6),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(6) { width: 118px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(7),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(7) { width: 124px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(8),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(8) { width: 146px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(9),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(9) { width: 118px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(10),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(10) { width: 112px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(11),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(11) { width: 154px; }
  .customers-list-table:not(.unit-visit-history-table) th:nth-child(12),
  .customers-list-table:not(.unit-visit-history-table) td:nth-child(12) { width: 118px; }
  .customers-list-table:not(.unit-visit-history-table) th:last-child,
  .customers-list-table:not(.unit-visit-history-table) td:last-child {
    position: sticky;
    left: 0;
    right: auto;
    z-index: 4;
    width: 152px;
    min-width: 152px;
    max-width: 152px;
    background: #fff;
    box-shadow: 1px 0 0 var(--line), 8px 0 18px rgba(15, 23, 42, 0.08);
  }

  .customers-list-table:not(.unit-visit-history-table) th:last-child {
    z-index: 5;
    background: #f8fafc;
  }

  .customers-list-table:not(.unit-visit-history-table) td:last-child .table-action {
    width: 124px;
    min-width: 124px;
    max-width: 124px;
    padding-inline: 8px;
  }
}

@media (min-width: 721px) {
  .customer-directory-panel.approved-client-section {
    direction: ltr;
    overflow-x: auto;
    scrollbar-gutter: stable;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 152px;
  }

  .customer-directory-panel.approved-client-section .customers-list-table:not(.unit-visit-history-table) {
    direction: rtl;
    border-collapse: separate;
    border-spacing: 0;
    width: max-content !important;
    min-width: 1540px !important;
    table-layout: fixed;
  }

  .customer-directory-panel.approved-client-section .customers-list-table:not(.unit-visit-history-table) th,
  .customer-directory-panel.approved-client-section .customers-list-table:not(.unit-visit-history-table) td {
    direction: rtl;
  }

  .customer-directory-panel.approved-client-section .customers-list-table:not(.unit-visit-history-table) th:last-child,
  .customer-directory-panel.approved-client-section .customers-list-table:not(.unit-visit-history-table) td:last-child {
    position: sticky;
    left: 0;
    right: auto;
    z-index: 4;
    width: 152px;
    min-width: 152px;
    max-width: 152px;
    background: #fff;
    box-shadow: 1px 0 0 var(--line), 8px 0 18px rgba(15, 23, 42, 0.08);
  }

  .customer-directory-panel.approved-client-section .customers-list-table:not(.unit-visit-history-table) th:last-child {
    z-index: 5;
    background: #f8fafc;
  }

  .customer-directory-panel.approved-client-section .customers-list-table:not(.unit-visit-history-table) td:last-child .table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 124px;
    min-width: 124px;
    max-width: 124px;
    padding-inline: 8px;
  }
}

/* Final RC responsive guardrails: keep approved structures, expose scroll instead of clipping. */
@media (max-width: 720px) {
  .portal-body .admin-control-grid,
  .portal-body .admin-risk-grid,
  .portal-body .oversight-summary-strip,
  .portal-body .business-decision-strip,
  .portal-body .platform-risk-grid,
  .portal-body .ops-risk-grid {
    grid-template-columns: 1fr !important;
  }

  .portal-body .admin-control-card,
  .portal-body .admin-control-card *,
  .portal-body .ops-risk-card,
  .portal-body .ops-risk-card *,
  .portal-body .platform-risk-item,
  .portal-body .platform-risk-item *,
  .portal-body .oversight-summary-strip article,
  .portal-body .oversight-summary-strip article * {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: normal;
    word-break: keep-all;
    line-height: 1.55;
  }

  .portal-body .admin-control-card strong,
  .portal-body .ops-risk-card strong,
  .portal-body .platform-risk-item strong,
  .portal-body .oversight-summary-strip strong {
    font-size: clamp(20px, 6vw, 28px);
    white-space: normal;
  }

  .portal-body .visit-tab-panel,
  .portal-body .work-center-grid + .panel,
  .portal-body .panel:has(.management-report-table),
  .portal-body .panel:has(.review-section-table) {
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
  }

  .portal-body .visit-tab-panel::before,
  .portal-body .work-center-grid + .panel::before,
  .portal-body .panel:has(.management-report-table)::before {
    content: "مرر أفقيًا لعرض بقية الجدول";
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 8px;
    text-align: right;
  }

  .portal-body .visit-tab-panel table,
  .portal-body .work-center-grid + .panel table,
  .portal-body .panel:has(.review-section-table) table {
    display: table;
    width: max-content;
    min-width: max-content;
    max-width: none;
    overflow: visible;
    white-space: normal;
  }
}

/* Shared operational table and filter contracts. */
.portal-body .panel:has(> .table-scroll-contract),
.portal-body .approved-client-section:has(> .table-scroll-contract),
.portal-body .visit-tab-panel:has(> .table-scroll-contract) {
  overflow: visible !important;
}

.table-scroll-contract {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: visible !important;
  scrollbar-gutter: stable;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  outline: 0;
}

.table-scroll-contract:focus-visible {
  outline: 3px solid rgba(15, 111, 82, 0.28);
  outline-offset: 3px;
}

.table-scroll-contract > .table-scroll-hint {
  position: sticky;
  right: 0;
  z-index: 8;
  display: none;
  width: fit-content;
  margin: 0 0 8px auto;
  padding: 4px 8px;
  border: 1px solid #d5ded9;
  border-radius: 4px;
  color: var(--muted);
  background: #f8faf9;
  font-size: 12px;
  line-height: 1.4;
}

.table-scroll-contract.can-scroll > .table-scroll-hint {
  display: block;
}

.table-scroll-contract.can-scroll {
  box-shadow: inset 14px 0 14px -16px rgba(20, 51, 42, 0.85),
              inset -14px 0 14px -16px rgba(20, 51, 42, 0.85);
}

.table-scroll-contract > table {
  display: table !important;
  overflow: visible !important;
  max-width: none;
  margin: 0;
}

.table-scroll-contract > table > thead {
  display: table-header-group !important;
}

.table-scroll-contract > table > tbody {
  display: table-row-group !important;
}

.table-scroll-contract > table tr {
  display: table-row !important;
}

.table-scroll-contract > table th,
.table-scroll-contract > table td {
  display: table-cell !important;
  min-width: 104px;
  max-width: 260px;
  overflow-wrap: normal;
  word-break: keep-all;
  white-space: normal;
  vertical-align: middle;
}

.table-scroll-contract > table th {
  white-space: nowrap;
}

.table-scroll-contract > table.has-sticky-action {
  border-collapse: separate;
  border-spacing: 0;
}

.table-scroll-contract > table.has-sticky-action th:last-child,
.table-scroll-contract > table.has-sticky-action td:last-child {
  position: sticky !important;
  left: 0 !important;
  right: auto !important;
  z-index: 6;
  min-width: 142px !important;
  width: 142px !important;
  max-width: 142px !important;
  background: #fff;
  box-shadow: 1px 0 0 var(--line), 8px 0 16px rgba(15, 23, 42, 0.09);
}

.table-scroll-contract > table.has-sticky-action th:last-child {
  z-index: 7;
  background: #f8fafc;
}

.table-scroll-contract > table .sticky-action-cell {
  position: sticky !important;
  left: var(--sticky-action-left, 0) !important;
  right: auto !important;
  z-index: 6;
  width: var(--sticky-action-width, 142px) !important;
  min-width: var(--sticky-action-width, 142px) !important;
  max-width: var(--sticky-action-width, 142px) !important;
  background: #fff;
  box-shadow: 1px 0 0 var(--line), 8px 0 16px rgba(15, 23, 42, 0.09);
}

.table-scroll-contract > table thead .sticky-action-cell {
  z-index: 7;
  background: #f8fafc;
}

.table-scroll-contract > table.has-sticky-action td:last-child .table-action,
.table-scroll-contract > table.has-sticky-action td:last-child .link-button {
  width: 116px;
  min-width: 116px;
  max-width: 116px;
  justify-content: center;
  white-space: nowrap;
}

.responsive-filter-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 12px !important;
  align-items: end;
  min-width: 0 !important;
}

.responsive-filter-grid > *,
.responsive-filter-grid .field,
.responsive-filter-grid input,
.responsive-filter-grid select,
.responsive-filter-grid button,
.responsive-filter-grid .link-button {
  min-width: 0 !important;
  max-width: 100%;
}

@media (max-width: 1100px) {
  .responsive-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 720px) {
  .responsive-filter-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .table-scroll-contract > table,
  .table-scroll-contract > .customers-list-table,
  .table-scroll-contract > .management-report-table {
    display: table !important;
    width: max-content !important;
    min-width: 100% !important;
    max-width: none !important;
    table-layout: auto !important;
  }

  .table-scroll-contract > table thead,
  .table-scroll-contract > table tbody,
  .table-scroll-contract > table tr,
  .table-scroll-contract > table th,
  .table-scroll-contract > table td {
    position: static;
    width: auto !important;
    max-width: 260px !important;
    transform: none !important;
  }

  .table-scroll-contract > table.has-sticky-action th:last-child,
  .table-scroll-contract > table.has-sticky-action td:last-child {
    position: sticky !important;
    left: 0 !important;
    min-width: 132px !important;
    width: 132px !important;
    max-width: 132px !important;
  }

  .platform-admin-page,
  .platform-admin-page * {
    min-width: 0;
  }

  .platform-admin-page .platform-decision-card strong,
  .platform-admin-page .platform-metric-card strong,
  .platform-admin-page .platform-risk-item strong,
  .platform-admin-page .platform-setting-card strong {
    max-width: 100%;
    overflow-wrap: normal;
    word-break: keep-all;
    white-space: normal;
    font-size: 1rem;
    line-height: 1.55;
  }

  .platform-admin-page .platform-admin-hero,
  .platform-admin-page .platform-admin-header,
  .platform-admin-page .platform-decision-card,
  .platform-admin-page .platform-metric-card,
  .platform-admin-page .platform-risk-item,
  .platform-admin-page .platform-setting-card {
    padding: 14px;
    overflow: hidden;
  }

  .platform-admin-page .platform-risk-item {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 6px;
  }

  .platform-admin-page .platform-risk-item > span {
    width: max-content;
    max-width: 100%;
    justify-self: start;
    white-space: nowrap;
  }

  .platform-admin-page .platform-risk-item > strong,
  .platform-admin-page .platform-risk-item > small {
    width: 100%;
    min-width: 0;
    margin-top: 0;
    overflow-wrap: normal;
    word-break: keep-all;
    white-space: normal;
  }
}

.inspection-stage-nav {
  display: grid;
  grid-template-columns: repeat(8, minmax(126px, 1fr));
  gap: 8px;
  margin: 10px 0 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 4px 4px 9px;
  scroll-padding-inline: 8px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.inspection-stage-nav a {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.inspection-stage-nav a.is-current,
.inspection-stage-nav a.is-blocked {
  border-width: 2px;
  border-color: var(--green);
  background: var(--green-soft);
}

.inspection-stage-nav a.is-blocked {
  border-color: #a36312;
  background: #fff7e8;
}

.inspection-stage-nav a.is-upcoming {
  background: #f7f8f8;
  color: var(--muted);
}

.inspection-stage-nav a.is-upcoming > span {
  background: #78827e;
}

.inspection-stage-nav a.is-completed > span::after {
  content: "✓";
}

.inspection-stage-nav a.is-completed > span {
  font-size: 0;
}

.inspection-stage-nav a.is-completed > span::after {
  font-size: 14px;
}

.inspection-stage-nav a > span,
.inspection-stage .stage-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.inspection-stage-nav strong,
.inspection-stage-nav small {
  min-width: 0;
  overflow-wrap: normal;
}

.inspection-stage-nav small {
  grid-column: 2;
  color: var(--muted);
}

.inspection-stage-stack {
  display: grid;
  gap: 9px;
}

.inspection-stage {
  scroll-margin-top: 18px;
  padding: 0;
  overflow: clip;
  transition: border-color 160ms ease, opacity 160ms ease;
}

.inspection-stage.is-current {
  border-color: var(--green);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--green) 24%, transparent);
}

.inspection-stage.is-blocked {
  border-color: #b8781f;
  box-shadow: inset 4px 0 #b8781f;
}

.inspection-stage.is-upcoming {
  opacity: .72;
  background: #f8f9f8;
}

.inspection-stage-disclosure {
  min-width: 0;
}

.inspection-stage-disclosure > summary {
  list-style: none;
}

.inspection-stage-disclosure > summary::-webkit-details-marker {
  display: none;
}

.inspection-stage-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  margin: 0;
  padding: 11px 14px;
  cursor: pointer;
  user-select: none;
}

.inspection-stage-head:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--green) 35%, transparent);
  outline-offset: -3px;
}

.inspection-stage-head .stage-title {
  display: grid;
  grid-template-columns: minmax(0, auto) auto;
  align-items: center;
  gap: 3px 10px;
  min-width: 0;
}

.inspection-stage-head .stage-title small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.inspection-stage-head h2 {
  margin: 0;
  font-size: 18px;
}

.stage-toggle {
  margin-inline-start: auto;
  color: var(--green);
  font-size: 13px;
  white-space: nowrap;
}

.inspection-stage-disclosure[open] .stage-toggle {
  font-size: 0;
}

.inspection-stage-disclosure[open] .stage-toggle::after {
  content: "إخفاء التفاصيل";
  font-size: 13px;
}

.inspection-stage-content {
  min-width: 0;
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}

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

.stage-detail-grid > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--green-soft);
}

.stage-detail-grid span,
.stage-detail-grid strong {
  display: block;
}

.stage-detail-grid span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
}

.stage-action-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cycle-artifact-list {
  display: grid;
  gap: 12px;
}

.cycle-artifact {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.cycle-artifact-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cycle-artifact-head h3 {
  margin: 3px 0 0;
  font-size: 16px;
}

.cycle-artifact-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.cycle-artifact-meta > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--green-soft);
}

.cycle-artifact-meta span,
.cycle-artifact-meta strong {
  display: block;
  overflow-wrap: normal;
  word-break: keep-all;
}

.cycle-artifact-meta span {
  color: var(--muted);
  font-size: 12px;
}

.cycle-artifact-meta strong {
  margin-top: 4px;
  font-size: 14px;
}

.artifact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.finance-transaction-flow {
  position: relative;
  display: grid;
  gap: 9px;
  padding-inline-start: 42px;
}

.finance-transaction-flow::before {
  content: "";
  position: absolute;
  inset-block: 18px;
  inset-inline-start: 16px;
  width: 2px;
  background: var(--line);
}

.finance-flow-step {
  position: relative;
  min-width: 0;
}

.finance-flow-index {
  position: absolute;
  z-index: 1;
  inset-inline-start: -42px;
  inset-block-start: 14px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.finance-flow-step .cycle-artifact {
  padding: 12px;
}

.delivery-package-checklist {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.delivery-package-checklist li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.package-check {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
}

.delivery-package-checklist strong,
.delivery-package-checklist small {
  display: block;
  min-width: 0;
}

.delivery-package-checklist small {
  margin-top: 2px;
  color: var(--muted);
}

.delivery-status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.delivery-status-strip > span {
  padding: 9px;
  border: 1px solid var(--line);
  background: var(--green-soft);
  font-size: 13px;
}

.inspection-cycle-page .inspection-cycle-hero {
  min-height: 0;
  padding-block: 11px;
}

.inspection-cycle-page .inspection-cycle-hero h1 {
  margin-block: 3px;
  font-size: clamp(24px, 2.3vw, 34px);
}

.inspection-cycle-page > .metrics {
  margin-block: 10px;
}

.inspection-cycle-page > .metrics article {
  min-height: 0;
  padding-block: 8px;
}

.stage-nav-hint {
  display: none;
  margin: 0 4px 8px;
  color: var(--muted);
  font-size: 12px;
}

.chronology-notice {
  margin-block: 8px;
}

@media (max-width: 1280px) {
  .inspection-stage-nav {
    grid-template-columns: repeat(8, minmax(142px, 142px));
    mask-image: linear-gradient(to left, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
  }

  .stage-nav-hint {
    display: block;
  }
}

@media (max-width: 720px) {
  .inspection-stage-nav {
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(8, minmax(142px, 142px));
    gap: 7px;
  }

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

  .cycle-artifact-meta {
    grid-template-columns: 1fr;
  }

  .cycle-artifact-head {
    align-items: stretch;
    flex-direction: column;
  }

  .inspection-stage {
    padding-inline: 0;
  }

  .inspection-cycle-page .inspection-stage-head {
    min-height: 54px;
    padding: 9px 10px;
  }

  .inspection-cycle-page .inspection-stage-head h2 {
    font-size: 17px;
    line-height: 1.35;
  }

  .inspection-cycle-page .inspection-stage-head .stage-title {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .inspection-stage-head .status {
    justify-self: start;
  }

  .inspection-stage-head .stage-title small {
    display: none;
  }

  .inspection-cycle-page .stage-toggle {
    max-width: 70px;
    font-size: 12px;
    white-space: normal;
    text-align: left;
  }

  .inspection-stage-content {
    padding: 0 10px 10px;
  }

  .cycle-artifact {
    width: 100%;
    max-width: 100%;
    padding: 11px;
  }

  .cycle-artifact-head h3 {
    font-size: 15px;
  }

  .finance-transaction-flow {
    padding-inline-start: 34px;
  }

  .finance-flow-index {
    inset-inline-start: -34px;
    width: 27px;
    height: 27px;
  }

  .delivery-package-checklist li {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .delivery-package-checklist .link-button {
    grid-column: 2;
    justify-self: start;
  }

  .delivery-status-strip {
    grid-template-columns: 1fr;
  }

  .inspection-cycle-page .inspection-cycle-hero {
    padding: 10px;
  }

  .inspection-cycle-page .inspection-cycle-hero h1 {
    font-size: 23px;
  }

  .inspection-cycle-page > .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .inspection-cycle-page > .metrics article {
    padding: 9px;
  }

  .inspection-cycle-page > .metrics strong {
    font-size: 17px;
    line-height: 1.45;
  }

  .inspection-cycle-page .cycle-artifact,
  .inspection-cycle-page .cycle-artifact * {
    min-width: 0;
    overflow-wrap: normal;
    word-break: keep-all;
  }

  .portal-body .account-chip strong {
    display: block;
    max-width: 105px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
