/*
  The ONLY custom stylesheet of the product (DEVELOPMENT_PLAN.md §6.1 rule 3).
  Everything else comes from the Balady design system (CDN css + balady-ds/app.js). Rules here are consolidated from the inline <style>
  blocks of balady-service-template (slide-wizard.html, requests.html). Colors are the ones already
  used by the template — do not add new ones.
*/

/* ── Header (design system inner-header-login + mainHeader) ──
   Selected state of the current menu item (DGA criterion 16.3 / 29.3): the design system draws a bar under hovered and
   open items; the current section keeps it, in the primary green. External links carry the external-link icon (14.3). */
.mainHeader .menu-item-first.is-active > a { color: #1b8354; font-weight: 600; }
.mainHeader .menu-item-first.is-active > a::before { display: block; background-color: #1b8354; }
.luc-ext { font-size: .75em; margin-inline-start: .25rem; }
.header-profile .dropdown-menu form .dropdown-item, .user-login-sso .dropdown-menu form .dropdown-item { width: 100%; text-align: right; background: none; border: 0; }

/* ── Page top ───────────────────────────────────────────── */
.page-top-fixed > .container { position: relative; }
.page-top-fixed .page-title-content { display: flex; flex-direction: column; align-items: flex-start; }
.page-top-fixed .title-heading, .page-top-fixed .title-heading h1, .title-heading h1 { color: #161616 !important; }
.page-top-fixed .title-heading h1 { font-size: 1.75rem; line-height: 1.4; margin-top: .25rem; }
.page-top-fixed .page-options-btns { justify-content: flex-start; margin: .75rem 0 .25rem; }
.service-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: .75rem 0 0; padding: 0; list-style: none; color: #384250; font-size: .875rem; }
.service-meta strong { color: #161616; font-weight: 600; }
.sheet { padding: 2rem 0 4rem; }

/* ── Forms ──────────────────────────────────────────────── */
label.req > span:not(.select2):before { content: "*"; color: #b42318; margin-inline-end: .35rem; }
.inputRequiredError { border-color: #b42318 !important; }

/* ── Wizard ─────────────────────────────────────────────── */
.form-steps-cont-new .step-anchor { gap: 0; }
.form-steps-cont-new .step-anchor > li { width: auto; flex: 1 1 0; }
.form-steps-cont-new .step-anchor .nav-item a { cursor: pointer; }
.step-top { position: absolute; top: 1.25rem; left: 12px; display: flex; gap: 0; z-index: 2; }
.step-top button { height: 40px; min-width: 92px; padding: 0 16px; margin: 0; border-radius: 0; font-weight: 500; cursor: pointer; }
.step-top .btn-next { background: #1b8354; border: 1px solid #1b8354; color: #fff; border-start-start-radius: 4px; border-end-start-radius: 4px; }
.step-top .btn-next:hover { background: #166a45; border-color: #166a45; }
.step-top .btn-prev { background: #fff; border: 1px solid #d2d6db; color: #161616; margin-inline-start: -1px; border-start-end-radius: 4px; border-end-end-radius: 4px; }
.step-top .btn-prev:hover { background: #f3f4f6; }
.step-top button:disabled { background: #eff0f0; border-color: #d2d6db; color: #9aa4b2; cursor: default; }
.review-table th { width: 34%; color: #384250; font-weight: 500; }
.success-panel { text-align: center; padding: 2rem 1rem 1rem; }
.success-panel h2 { color: #166a45; font-size: 1.5rem; }
.request-number { display: inline-block; margin-top: 1rem; padding: .75rem 1.5rem; background: #f3fcf6; border: 1px solid #b8eacb; border-radius: .5rem; font-size: 1.25rem; font-weight: 700; color: #14573a; }

/* ── Tables (طلباتي / السلال) ─────────────────────────────── */
.requests { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; }
.requests table { width: 100%; margin: 0; }
.requests th { background: #f9fafb; color: #384250; font-weight: 600; border-top: 0; }
.requests td, .requests th { padding: 14px 16px; vertical-align: middle; }
.requests td.num { font-variant-numeric: tabular-nums; }
.requests .empty { padding: 2.5rem 1rem; text-align: center; color: #384250; }

/* ── Status pills ───────────────────────────────────────── */
.status { display: inline-block; background: #f3f4f6; color: #384250; border-radius: 999px; padding: 4px 10px; font-size: 13px; }
.status.review { background: #eef4ff; color: #1849a9; }
.status.wait { background: #fffaeb; color: #b54708; }
.status.done { background: #ecfdf3; color: #166a45; }
.status.reject { background: #fef3f2; color: #b42318; }

.row-action { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid #d2d6db; border-radius: 8px; background: #fff; color: #161616; }
.row-action:hover { background: #f3f4f6; color: #161616; }
.row-action svg { width: 20px; height: 20px; }

/* ── Map (study workspace) ──────────────────────────────── */
.luc-map { width: 100%; height: 520px; border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; }
.luc-map-note { color: #384250; font-size: .875rem; margin-top: .5rem; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .requests { overflow-x: auto; }
  .luc-map { height: 380px; }
}

/* ── Settings module (M9, UC110–UC122) ─────────────────────
   Left-to-right fields (codes, equations, HTML), JSON audit values, template preview,
   and the inline filter/toolbar forms above settings tables. Template colors only. */
.ltr { direction: ltr; text-align: left; unicode-bidi: plaintext; }
.settings-filter { min-width: 260px; }
.settings-toolbar { gap: 1rem; }
.luc-pre { white-space: pre-wrap; word-break: break-word; direction: ltr; text-align: left; max-height: 240px; overflow: auto; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: .5rem; margin: .25rem 0 .5rem; font-size: 12px; }
.luc-code { font-family: Consolas, "Courier New", monospace; font-size: 13px; }
.luc-preview { width: 100%; height: 420px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; }
/* ── Amanah back office (M2/M3: baskets, request view, letter request, referrals) ── */
.luc-tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid #e5e7eb; padding: 0; list-style: none; }
.luc-tabs .nav-link { display: inline-flex; align-items: center; gap: .4rem; padding: .65rem 1rem; color: #384250; background: none; border: 0; border-bottom: 3px solid transparent; font-weight: 500; cursor: pointer; }
.luc-tabs .nav-link:hover { color: #161616; }
.luc-tabs .nav-link.active { color: #166a45; border-bottom-color: #1b8354; font-weight: 600; }
.luc-tabs .nav-link:focus-visible { outline: 2px solid #1b8354; outline-offset: 2px; }
.luc-tab-count { display: inline-block; min-width: 1.6rem; padding: 0 .4rem; border-radius: 999px; background: #f3f4f6; color: #384250; font-size: .8rem; text-align: center; font-variant-numeric: tabular-nums; }
.luc-tabs .nav-link.active .luc-tab-count { background: #ecfdf3; color: #166a45; }
.luc-filter .form-group { margin-bottom: .5rem; }
.luc-pager { display: flex; align-items: center; gap: .75rem; }
.luc-me { color: #166a45; font-weight: 600; }
.luc-summary-head { gap: .5rem; }
.luc-dl dt { color: #384250; font-weight: 500; }
.luc-dl dd { color: #161616; }
.luc-actions-row { gap: .75rem; }
.luc-actions-row form { margin: 0; }
.luc-action-list { display: grid; gap: .75rem; }
.luc-action { border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; }
.luc-action > summary { padding: .85rem 1rem; font-weight: 600; color: #161616; cursor: pointer; }
.luc-action > summary:focus-visible { outline: 2px solid #1b8354; outline-offset: 2px; }
.luc-action[open] > summary { border-bottom: 1px solid #e5e7eb; }
.luc-action > form { padding: 1rem; }
.luc-action-danger > summary { color: #b42318; }
.luc-row-flag td, .luc-row-flag th { background: #fffaeb; }
.luc-ltr-cell { text-align: right; unicode-bidi: plaintext; }
.luc-related-filter { max-width: 360px; }
.luc-req-mark:before { content: "*"; color: #b42318; margin-inline-end: .35rem; }
.luc-steps { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; padding: 0; margin: 0; list-style: none; color: #384250; }
.luc-steps li { display: inline-flex; align-items: center; gap: .5rem; }
.luc-steps li span { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid #d2d6db; background: #fff; font-weight: 600; }
.luc-steps li.active { color: #161616; font-weight: 600; }
.luc-steps li.active span { background: #1b8354; border-color: #1b8354; color: #fff; }
.luc-steps li.done span { background: #ecfdf3; border-color: #b8eacb; color: #166a45; }
.luc-home-card { display: flex; flex-direction: column; gap: .25rem; height: 100%; padding: 1.25rem; border: 1px solid #e5e7eb; border-radius: 12px; color: #161616; text-decoration: none; }
.luc-home-card:hover, .luc-home-card:focus-visible { border-color: #1b8354; color: #161616; text-decoration: none; }
.luc-home-count { font-size: 2rem; font-weight: 700; color: #166a45; font-variant-numeric: tabular-nums; }
.luc-home-label { font-size: 1.1rem; font-weight: 600; }
.luc-home-hint { color: #384250; font-size: .875rem; }
/* ── M1 Intake (beneficiary wizard & request tracking) ─────
   From slide-wizard.html: capacity radios. Template colors only. */
.page-title-content > .form-steps-cont-new.luc-wizard-steps { align-self: stretch; width: 100%; margin-top: 1rem; }
.form-steps-cont-new .step-anchor .nav-item a[aria-disabled="true"] { cursor: default; }
.luc-map.luc-map-sm { height: 360px; }
.luc-muted { color: #384250; }
.luc-text-warn { color: #b54708 !important; }
.luc-alert-action { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.luc-status-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.luc-timeline { list-style: none; margin: 0; padding: 0; border-inline-start: 2px solid #e5e7eb; }
.luc-timeline li { position: relative; padding: 0 1.25rem .9rem; }
.luc-timeline li::before { content: ""; position: absolute; inset-inline-start: -7px; top: .45rem; width: 12px; height: 12px; border-radius: 50%; background: #1b8354; }
.requests td input[type=radio] { width: 18px; height: 18px; accent-color: #1b8354; }
@media (max-width: 767.98px) {
  .step-top { position: static; margin-top: .75rem; }
  .luc-map.luc-map-sm { height: 300px; }
}
/* ── Coordination & entity portal (M4/M5: UC054–UC066) ── */
.luc-coord-options { display: grid; gap: .75rem; }
.luc-coord-option { border: 1px solid #e5e7eb; border-radius: 12px; padding: 1rem; margin: 0; background: #fff; }
.luc-coord-option[disabled] { background: #f9fafb; }
.luc-coord-option-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; width: auto; font-size: 1rem; font-weight: 600; margin-bottom: .5rem; }
.luc-coord-option-head .custom-control { margin: 0; }

/* ── Study module (M6, UC067–UC086): map legend, layer toggles, phase-2 report ── */
.luc-study-layers { margin-top: .75rem; }
.luc-study-layer-list { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.luc-study-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; padding: 0; margin: .75rem 0 0; list-style: none; color: #384250; font-size: .875rem; }
.luc-study-legend li { display: inline-flex; align-items: center; }
.luc-swatch { display: inline-block; width: 14px; height: 14px; margin-left: .4rem; border-radius: 3px; border: 2px solid var(--luc-swatch, #1b8354); background: transparent; vertical-align: middle; }
.luc-swatch-district { border-color: #14573a; }
.luc-swatch-site { border-color: #b42318; background: #b42318; }
.luc-swatch-ref { border-color: #1b8354; background: rgba(27, 131, 84, .15); border-radius: 50%; }
.luc-swatch-custom { border: 2px dashed #b54708; background: rgba(247, 144, 9, .12); border-radius: 50%; }
.luc-study-report { white-space: pre-line; color: #161616; }
/* ── M8 Execution (UC103–UC109: partial-amendment decision, path review, outputs) ─────
   Template colors only. */
.luc-exec-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.luc-exec-clauses { min-height: 10rem; line-height: 1.8; }
.luc-doc-preview { border: 1px solid #d2d6db; border-radius: 8px; padding: 1rem 1.25rem; background: #fff; line-height: 1.8; }
.luc-doc-preview h1 { font-size: 1.25rem; color: #14573a; }
.luc-doc-preview h2 { font-size: 1.05rem; color: #14573a; margin-top: 1rem; }
.luc-doc-preview table { width: 100%; border-collapse: collapse; margin-bottom: .75rem; }
.luc-doc-preview th, .luc-doc-preview td { border: 1px solid #d2d6db; padding: .4rem .6rem; text-align: right; }
.luc-doc-preview th { background: #f3f4f6; font-weight: 600; }

/* ── Ministry stage (M7, UC087–UC102) ───────────────────────────── */
.luc-ministry-text { white-space: pre-line; word-break: break-word; }
.luc-ministry-flag { margin-inline-start: .5rem; }
.luc-check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.luc-check-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.luc-doc-editor { font-family: Consolas, "Courier New", monospace; font-size: .875rem; direction: ltr; text-align: left; min-height: 14rem; }
.luc-doc-view { white-space: pre-wrap; word-break: break-word; direction: ltr; text-align: left; max-height: 320px; overflow: auto; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: .75rem; margin: 1rem; font-size: .8125rem; }
.luc-action-box { border: 1px solid #e5e7eb; border-radius: 12px; padding: 1rem; background: #fff; }

/* ── Radio groups with a group label (WCAG 1.3.1) ───────────── */
.luc-radio-group { border: 0; padding: 0; margin: 0 0 .75rem; min-width: 0; }
.luc-radio-legend { font-size: 1rem; font-weight: 600; color: #161616; margin-bottom: .5rem; width: auto; }

/* Demo environment banner (DemoEnvironment): always visible, never mistaken for production. */
.luc-demo-banner { background: #fff6e8; color: #6a3d00; border-bottom: 1px solid #f1c27d; padding: 6px 16px; text-align: center; font-size: .875rem; font-weight: 600; }

/* Radios and checkboxes follow the design system's custom-control pattern (app.min.css styles only that pattern; it also
   gives every bare <input> a text field's height). Outside .choose-service-type the radio circle sits at the inline end
   (right in RTL) without room for it, so reserve the space; a bare radio/checkbox keeps its natural size. */
.custom-radio .custom-control-label { padding-right: 2rem; line-height: 1.75rem; }
.choose-service-type .custom-radio .custom-control-label { padding-right: 2.5rem; }
input[type=radio]:not(.custom-control-input), input[type=checkbox]:not(.custom-control-input) { height: auto; width: auto; padding: 0; line-height: normal; }

/* Phones: app.js pins .page-top-fixed (sticky) while scrolling. The design system's bar is compact (breadcrumb + buttons);
   ours also carries the page title, service details and the stepper, which would cover half a phone screen. On phones
   the title block therefore stays in the page flow; tablets and desktops keep the design system's pinned bar. */
@media (max-width: 767.98px) {
  .page-top-fixed.nav-fixed { position: static !important; padding-top: 8px !important; box-shadow: none; }
}
